diff --git a/core/lib/Thelia/Model/Base/Category.php b/core/lib/Thelia/Model/Base/Category.php index 6c7ac3c3e..810283e44 100755 --- a/core/lib/Thelia/Model/Base/Category.php +++ b/core/lib/Thelia/Model/Base/Category.php @@ -41,6 +41,8 @@ use Thelia\Model\Product as ChildProduct; use Thelia\Model\ProductCategory as ChildProductCategory; use Thelia\Model\ProductCategoryQuery as ChildProductCategoryQuery; use Thelia\Model\ProductQuery as ChildProductQuery; +use Thelia\Model\Rewriting as ChildRewriting; +use Thelia\Model\RewritingQuery as ChildRewritingQuery; use Thelia\Model\Map\CategoryTableMap; use Thelia\Model\Map\CategoryVersionTableMap; @@ -151,6 +153,12 @@ abstract class Category implements ActiveRecordInterface protected $collAttributeCategories; protected $collAttributeCategoriesPartial; + /** + * @var ObjectCollection|ChildRewriting[] Collection to store aggregation of ChildRewriting objects. + */ + protected $collRewritings; + protected $collRewritingsPartial; + /** * @var ObjectCollection|ChildCategoryImage[] Collection to store aggregation of ChildCategoryImage objects. */ @@ -262,6 +270,12 @@ abstract class Category implements ActiveRecordInterface */ protected $attributeCategoriesScheduledForDeletion = null; + /** + * An array of objects scheduled for deletion. + * @var ObjectCollection + */ + protected $rewritingsScheduledForDeletion = null; + /** * An array of objects scheduled for deletion. * @var ObjectCollection @@ -474,6 +488,7 @@ abstract class Category implements ActiveRecordInterface if (!$this->hasVirtualColumn($name)) { throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); } + return $this->virtualColumns[$name]; } @@ -1024,6 +1039,8 @@ abstract class Category implements ActiveRecordInterface $this->collAttributeCategories = null; + $this->collRewritings = null; + $this->collCategoryImages = null; $this->collCategoryDocuments = null; @@ -1314,6 +1331,23 @@ abstract class Category implements ActiveRecordInterface } } + if ($this->rewritingsScheduledForDeletion !== null) { + if (!$this->rewritingsScheduledForDeletion->isEmpty()) { + \Thelia\Model\RewritingQuery::create() + ->filterByPrimaryKeys($this->rewritingsScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->rewritingsScheduledForDeletion = null; + } + } + + if ($this->collRewritings !== null) { + foreach ($this->collRewritings as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + if ($this->categoryImagesScheduledForDeletion !== null) { if (!$this->categoryImagesScheduledForDeletion->isEmpty()) { \Thelia\Model\CategoryImageQuery::create() @@ -1634,6 +1668,9 @@ abstract class Category implements ActiveRecordInterface if (null !== $this->collAttributeCategories) { $result['AttributeCategories'] = $this->collAttributeCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } + if (null !== $this->collRewritings) { + $result['Rewritings'] = $this->collRewritings->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } if (null !== $this->collCategoryImages) { $result['CategoryImages'] = $this->collCategoryImages->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } @@ -1858,6 +1895,12 @@ abstract class Category implements ActiveRecordInterface } } + foreach ($this->getRewritings() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addRewriting($relObj->copy($deepCopy)); + } + } + foreach ($this->getCategoryImages() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCategoryImage($relObj->copy($deepCopy)); @@ -1938,6 +1981,9 @@ abstract class Category implements ActiveRecordInterface if ('AttributeCategory' == $relationName) { return $this->initAttributeCategories(); } + if ('Rewriting' == $relationName) { + return $this->initRewritings(); + } if ('CategoryImage' == $relationName) { return $this->initCategoryImages(); } @@ -2687,6 +2733,299 @@ abstract class Category implements ActiveRecordInterface return $this->getAttributeCategories($query, $con); } + /** + * Clears out the collRewritings 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 addRewritings() + */ + public function clearRewritings() + { + $this->collRewritings = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Reset is the collRewritings collection loaded partially. + */ + public function resetPartialRewritings($v = true) + { + $this->collRewritingsPartial = $v; + } + + /** + * Initializes the collRewritings collection. + * + * By default this just sets the collRewritings collection to an empty array (like clearcollRewritings()); + * 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 initRewritings($overrideExisting = true) + { + if (null !== $this->collRewritings && !$overrideExisting) { + return; + } + $this->collRewritings = new ObjectCollection(); + $this->collRewritings->setModel('\Thelia\Model\Rewriting'); + } + + /** + * Gets an array of ChildRewriting 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 ChildCategory 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|ChildRewriting[] List of ChildRewriting objects + * @throws PropelException + */ + public function getRewritings($criteria = null, ConnectionInterface $con = null) + { + $partial = $this->collRewritingsPartial && !$this->isNew(); + if (null === $this->collRewritings || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collRewritings) { + // return empty collection + $this->initRewritings(); + } else { + $collRewritings = ChildRewritingQuery::create(null, $criteria) + ->filterByCategory($this) + ->find($con); + + if (null !== $criteria) { + if (false !== $this->collRewritingsPartial && count($collRewritings)) { + $this->initRewritings(false); + + foreach ($collRewritings as $obj) { + if (false == $this->collRewritings->contains($obj)) { + $this->collRewritings->append($obj); + } + } + + $this->collRewritingsPartial = true; + } + + $collRewritings->getInternalIterator()->rewind(); + + return $collRewritings; + } + + if ($partial && $this->collRewritings) { + foreach ($this->collRewritings as $obj) { + if ($obj->isNew()) { + $collRewritings[] = $obj; + } + } + } + + $this->collRewritings = $collRewritings; + $this->collRewritingsPartial = false; + } + } + + return $this->collRewritings; + } + + /** + * Sets a collection of Rewriting 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 $rewritings A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return ChildCategory The current object (for fluent API support) + */ + public function setRewritings(Collection $rewritings, ConnectionInterface $con = null) + { + $rewritingsToDelete = $this->getRewritings(new Criteria(), $con)->diff($rewritings); + + + $this->rewritingsScheduledForDeletion = $rewritingsToDelete; + + foreach ($rewritingsToDelete as $rewritingRemoved) { + $rewritingRemoved->setCategory(null); + } + + $this->collRewritings = null; + foreach ($rewritings as $rewriting) { + $this->addRewriting($rewriting); + } + + $this->collRewritings = $rewritings; + $this->collRewritingsPartial = false; + + return $this; + } + + /** + * Returns the number of related Rewriting objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param ConnectionInterface $con + * @return int Count of related Rewriting objects. + * @throws PropelException + */ + public function countRewritings(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + { + $partial = $this->collRewritingsPartial && !$this->isNew(); + if (null === $this->collRewritings || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collRewritings) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getRewritings()); + } + + $query = ChildRewritingQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByCategory($this) + ->count($con); + } + + return count($this->collRewritings); + } + + /** + * Method called to associate a ChildRewriting object to this object + * through the ChildRewriting foreign key attribute. + * + * @param ChildRewriting $l ChildRewriting + * @return \Thelia\Model\Category The current object (for fluent API support) + */ + public function addRewriting(ChildRewriting $l) + { + if ($this->collRewritings === null) { + $this->initRewritings(); + $this->collRewritingsPartial = true; + } + + if (!in_array($l, $this->collRewritings->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddRewriting($l); + } + + return $this; + } + + /** + * @param Rewriting $rewriting The rewriting object to add. + */ + protected function doAddRewriting($rewriting) + { + $this->collRewritings[]= $rewriting; + $rewriting->setCategory($this); + } + + /** + * @param Rewriting $rewriting The rewriting object to remove. + * @return ChildCategory The current object (for fluent API support) + */ + public function removeRewriting($rewriting) + { + if ($this->getRewritings()->contains($rewriting)) { + $this->collRewritings->remove($this->collRewritings->search($rewriting)); + if (null === $this->rewritingsScheduledForDeletion) { + $this->rewritingsScheduledForDeletion = clone $this->collRewritings; + $this->rewritingsScheduledForDeletion->clear(); + } + $this->rewritingsScheduledForDeletion[]= $rewriting; + $rewriting->setCategory(null); + } + + return $this; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this Category is new, it will return + * an empty collection; or if this Category has previously + * been saved, it will retrieve related Rewritings from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in Category. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return Collection|ChildRewriting[] List of ChildRewriting objects + */ + public function getRewritingsJoinProduct($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) + { + $query = ChildRewritingQuery::create(null, $criteria); + $query->joinWith('Product', $joinBehavior); + + return $this->getRewritings($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this Category is new, it will return + * an empty collection; or if this Category has previously + * been saved, it will retrieve related Rewritings from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in Category. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return Collection|ChildRewriting[] List of ChildRewriting objects + */ + public function getRewritingsJoinFolder($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) + { + $query = ChildRewritingQuery::create(null, $criteria); + $query->joinWith('Folder', $joinBehavior); + + return $this->getRewritings($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this Category is new, it will return + * an empty collection; or if this Category has previously + * been saved, it will retrieve related Rewritings from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in Category. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return Collection|ChildRewriting[] List of ChildRewriting objects + */ + public function getRewritingsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) + { + $query = ChildRewritingQuery::create(null, $criteria); + $query->joinWith('Content', $joinBehavior); + + return $this->getRewritings($query, $con); + } + /** * Clears out the collCategoryImages collection * @@ -4410,6 +4749,11 @@ abstract class Category implements ActiveRecordInterface $o->clearAllReferences($deep); } } + if ($this->collRewritings) { + foreach ($this->collRewritings as $o) { + $o->clearAllReferences($deep); + } + } if ($this->collCategoryImages) { foreach ($this->collCategoryImages as $o) { $o->clearAllReferences($deep); @@ -4468,6 +4812,10 @@ abstract class Category implements ActiveRecordInterface $this->collAttributeCategories->clearIterator(); } $this->collAttributeCategories = null; + if ($this->collRewritings instanceof Collection) { + $this->collRewritings->clearIterator(); + } + $this->collRewritings = null; if ($this->collCategoryImages instanceof Collection) { $this->collCategoryImages->clearIterator(); } diff --git a/core/lib/Thelia/Model/Base/CategoryQuery.php b/core/lib/Thelia/Model/Base/CategoryQuery.php index 1fe81871b..4c823a223 100755 --- a/core/lib/Thelia/Model/Base/CategoryQuery.php +++ b/core/lib/Thelia/Model/Base/CategoryQuery.php @@ -58,6 +58,10 @@ use Thelia\Model\Map\CategoryTableMap; * @method ChildCategoryQuery rightJoinAttributeCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCategory relation * @method ChildCategoryQuery innerJoinAttributeCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCategory relation * + * @method ChildCategoryQuery leftJoinRewriting($relationAlias = null) Adds a LEFT JOIN clause to the query using the Rewriting relation + * @method ChildCategoryQuery rightJoinRewriting($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rewriting relation + * @method ChildCategoryQuery innerJoinRewriting($relationAlias = null) Adds a INNER JOIN clause to the query using the Rewriting relation + * * @method ChildCategoryQuery leftJoinCategoryImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryImage relation * @method ChildCategoryQuery rightJoinCategoryImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryImage relation * @method ChildCategoryQuery innerJoinCategoryImage($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryImage relation @@ -866,6 +870,79 @@ abstract class CategoryQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'AttributeCategory', '\Thelia\Model\AttributeCategoryQuery'); } + /** + * Filter the query by a related \Thelia\Model\Rewriting object + * + * @param \Thelia\Model\Rewriting|ObjectCollection $rewriting the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCategoryQuery The current query, for fluid interface + */ + public function filterByRewriting($rewriting, $comparison = null) + { + if ($rewriting instanceof \Thelia\Model\Rewriting) { + return $this + ->addUsingAlias(CategoryTableMap::ID, $rewriting->getCategoryId(), $comparison); + } elseif ($rewriting instanceof ObjectCollection) { + return $this + ->useRewritingQuery() + ->filterByPrimaryKeys($rewriting->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByRewriting() only accepts arguments of type \Thelia\Model\Rewriting or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the Rewriting relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildCategoryQuery The current query, for fluid interface + */ + public function joinRewriting($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Rewriting'); + + // 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, 'Rewriting'); + } + + return $this; + } + + /** + * Use the Rewriting relation Rewriting 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\RewritingQuery A secondary query class using the current class as primary query + */ + public function useRewritingQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinRewriting($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Rewriting', '\Thelia\Model\RewritingQuery'); + } + /** * Filter the query by a related \Thelia\Model\CategoryImage object * diff --git a/core/lib/Thelia/Model/Base/Content.php b/core/lib/Thelia/Model/Base/Content.php index 0078502f6..e46d82ac4 100755 --- a/core/lib/Thelia/Model/Base/Content.php +++ b/core/lib/Thelia/Model/Base/Content.php @@ -35,6 +35,8 @@ use Thelia\Model\Folder as ChildFolder; use Thelia\Model\FolderQuery as ChildFolderQuery; use Thelia\Model\ProductAssociatedContent as ChildProductAssociatedContent; use Thelia\Model\ProductAssociatedContentQuery as ChildProductAssociatedContentQuery; +use Thelia\Model\Rewriting as ChildRewriting; +use Thelia\Model\RewritingQuery as ChildRewritingQuery; use Thelia\Model\Map\ContentTableMap; use Thelia\Model\Map\ContentVersionTableMap; @@ -121,6 +123,12 @@ abstract class Content implements ActiveRecordInterface */ protected $version_created_by; + /** + * @var ObjectCollection|ChildRewriting[] Collection to store aggregation of ChildRewriting objects. + */ + protected $collRewritings; + protected $collRewritingsPartial; + /** * @var ObjectCollection|ChildContentFolder[] Collection to store aggregation of ChildContentFolder objects. */ @@ -204,6 +212,12 @@ abstract class Content implements ActiveRecordInterface */ protected $foldersScheduledForDeletion = null; + /** + * An array of objects scheduled for deletion. + * @var ObjectCollection + */ + protected $rewritingsScheduledForDeletion = null; + /** * An array of objects scheduled for deletion. * @var ObjectCollection @@ -938,6 +952,8 @@ abstract class Content implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? + $this->collRewritings = null; + $this->collContentFolders = null; $this->collContentImages = null; @@ -1125,6 +1141,23 @@ abstract class Content implements ActiveRecordInterface } } + if ($this->rewritingsScheduledForDeletion !== null) { + if (!$this->rewritingsScheduledForDeletion->isEmpty()) { + \Thelia\Model\RewritingQuery::create() + ->filterByPrimaryKeys($this->rewritingsScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->rewritingsScheduledForDeletion = null; + } + } + + if ($this->collRewritings !== null) { + foreach ($this->collRewritings as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + if ($this->contentFoldersScheduledForDeletion !== null) { if (!$this->contentFoldersScheduledForDeletion->isEmpty()) { \Thelia\Model\ContentFolderQuery::create() @@ -1460,6 +1493,9 @@ abstract class Content implements ActiveRecordInterface } if ($includeForeignObjects) { + if (null !== $this->collRewritings) { + $result['Rewritings'] = $this->collRewritings->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } if (null !== $this->collContentFolders) { $result['ContentFolders'] = $this->collContentFolders->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } @@ -1666,6 +1702,12 @@ abstract class Content implements ActiveRecordInterface // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); + foreach ($this->getRewritings() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addRewriting($relObj->copy($deepCopy)); + } + } + foreach ($this->getContentFolders() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addContentFolder($relObj->copy($deepCopy)); @@ -1749,6 +1791,9 @@ abstract class Content implements ActiveRecordInterface */ public function initRelation($relationName) { + if ('Rewriting' == $relationName) { + return $this->initRewritings(); + } if ('ContentFolder' == $relationName) { return $this->initContentFolders(); } @@ -1772,6 +1817,299 @@ abstract class Content implements ActiveRecordInterface } } + /** + * Clears out the collRewritings 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 addRewritings() + */ + public function clearRewritings() + { + $this->collRewritings = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Reset is the collRewritings collection loaded partially. + */ + public function resetPartialRewritings($v = true) + { + $this->collRewritingsPartial = $v; + } + + /** + * Initializes the collRewritings collection. + * + * By default this just sets the collRewritings collection to an empty array (like clearcollRewritings()); + * 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 initRewritings($overrideExisting = true) + { + if (null !== $this->collRewritings && !$overrideExisting) { + return; + } + $this->collRewritings = new ObjectCollection(); + $this->collRewritings->setModel('\Thelia\Model\Rewriting'); + } + + /** + * Gets an array of ChildRewriting 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 ChildContent 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|ChildRewriting[] List of ChildRewriting objects + * @throws PropelException + */ + public function getRewritings($criteria = null, ConnectionInterface $con = null) + { + $partial = $this->collRewritingsPartial && !$this->isNew(); + if (null === $this->collRewritings || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collRewritings) { + // return empty collection + $this->initRewritings(); + } else { + $collRewritings = ChildRewritingQuery::create(null, $criteria) + ->filterByContent($this) + ->find($con); + + if (null !== $criteria) { + if (false !== $this->collRewritingsPartial && count($collRewritings)) { + $this->initRewritings(false); + + foreach ($collRewritings as $obj) { + if (false == $this->collRewritings->contains($obj)) { + $this->collRewritings->append($obj); + } + } + + $this->collRewritingsPartial = true; + } + + $collRewritings->getInternalIterator()->rewind(); + + return $collRewritings; + } + + if ($partial && $this->collRewritings) { + foreach ($this->collRewritings as $obj) { + if ($obj->isNew()) { + $collRewritings[] = $obj; + } + } + } + + $this->collRewritings = $collRewritings; + $this->collRewritingsPartial = false; + } + } + + return $this->collRewritings; + } + + /** + * Sets a collection of Rewriting 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 $rewritings A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return ChildContent The current object (for fluent API support) + */ + public function setRewritings(Collection $rewritings, ConnectionInterface $con = null) + { + $rewritingsToDelete = $this->getRewritings(new Criteria(), $con)->diff($rewritings); + + + $this->rewritingsScheduledForDeletion = $rewritingsToDelete; + + foreach ($rewritingsToDelete as $rewritingRemoved) { + $rewritingRemoved->setContent(null); + } + + $this->collRewritings = null; + foreach ($rewritings as $rewriting) { + $this->addRewriting($rewriting); + } + + $this->collRewritings = $rewritings; + $this->collRewritingsPartial = false; + + return $this; + } + + /** + * Returns the number of related Rewriting objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param ConnectionInterface $con + * @return int Count of related Rewriting objects. + * @throws PropelException + */ + public function countRewritings(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + { + $partial = $this->collRewritingsPartial && !$this->isNew(); + if (null === $this->collRewritings || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collRewritings) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getRewritings()); + } + + $query = ChildRewritingQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByContent($this) + ->count($con); + } + + return count($this->collRewritings); + } + + /** + * Method called to associate a ChildRewriting object to this object + * through the ChildRewriting foreign key attribute. + * + * @param ChildRewriting $l ChildRewriting + * @return \Thelia\Model\Content The current object (for fluent API support) + */ + public function addRewriting(ChildRewriting $l) + { + if ($this->collRewritings === null) { + $this->initRewritings(); + $this->collRewritingsPartial = true; + } + + if (!in_array($l, $this->collRewritings->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddRewriting($l); + } + + return $this; + } + + /** + * @param Rewriting $rewriting The rewriting object to add. + */ + protected function doAddRewriting($rewriting) + { + $this->collRewritings[]= $rewriting; + $rewriting->setContent($this); + } + + /** + * @param Rewriting $rewriting The rewriting object to remove. + * @return ChildContent The current object (for fluent API support) + */ + public function removeRewriting($rewriting) + { + if ($this->getRewritings()->contains($rewriting)) { + $this->collRewritings->remove($this->collRewritings->search($rewriting)); + if (null === $this->rewritingsScheduledForDeletion) { + $this->rewritingsScheduledForDeletion = clone $this->collRewritings; + $this->rewritingsScheduledForDeletion->clear(); + } + $this->rewritingsScheduledForDeletion[]= $rewriting; + $rewriting->setContent(null); + } + + return $this; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this Content is new, it will return + * an empty collection; or if this Content has previously + * been saved, it will retrieve related Rewritings from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in Content. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return Collection|ChildRewriting[] List of ChildRewriting objects + */ + public function getRewritingsJoinProduct($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) + { + $query = ChildRewritingQuery::create(null, $criteria); + $query->joinWith('Product', $joinBehavior); + + return $this->getRewritings($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this Content is new, it will return + * an empty collection; or if this Content has previously + * been saved, it will retrieve related Rewritings from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in Content. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return Collection|ChildRewriting[] List of ChildRewriting objects + */ + public function getRewritingsJoinCategory($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) + { + $query = ChildRewritingQuery::create(null, $criteria); + $query->joinWith('Category', $joinBehavior); + + return $this->getRewritings($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this Content is new, it will return + * an empty collection; or if this Content has previously + * been saved, it will retrieve related Rewritings from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in Content. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return Collection|ChildRewriting[] List of ChildRewriting objects + */ + public function getRewritingsJoinFolder($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) + { + $query = ChildRewritingQuery::create(null, $criteria); + $query->joinWith('Folder', $joinBehavior); + + return $this->getRewritings($query, $con); + } + /** * Clears out the collContentFolders collection * @@ -3602,6 +3940,11 @@ abstract class Content implements ActiveRecordInterface public function clearAllReferences($deep = false) { if ($deep) { + if ($this->collRewritings) { + foreach ($this->collRewritings as $o) { + $o->clearAllReferences($deep); + } + } if ($this->collContentFolders) { foreach ($this->collContentFolders as $o) { $o->clearAllReferences($deep); @@ -3648,6 +3991,10 @@ abstract class Content implements ActiveRecordInterface $this->currentLocale = 'en_EN'; $this->currentTranslations = null; + if ($this->collRewritings instanceof Collection) { + $this->collRewritings->clearIterator(); + } + $this->collRewritings = null; if ($this->collContentFolders instanceof Collection) { $this->collContentFolders->clearIterator(); } diff --git a/core/lib/Thelia/Model/Base/ContentQuery.php b/core/lib/Thelia/Model/Base/ContentQuery.php index 11275cdc6..d4749ce46 100755 --- a/core/lib/Thelia/Model/Base/ContentQuery.php +++ b/core/lib/Thelia/Model/Base/ContentQuery.php @@ -44,6 +44,10 @@ use Thelia\Model\Map\ContentTableMap; * @method ChildContentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildContentQuery innerJoin($relation) Adds a INNER JOIN clause to the query * + * @method ChildContentQuery leftJoinRewriting($relationAlias = null) Adds a LEFT JOIN clause to the query using the Rewriting relation + * @method ChildContentQuery rightJoinRewriting($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rewriting relation + * @method ChildContentQuery innerJoinRewriting($relationAlias = null) Adds a INNER JOIN clause to the query using the Rewriting relation + * * @method ChildContentQuery leftJoinContentFolder($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentFolder relation * @method ChildContentQuery rightJoinContentFolder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentFolder relation * @method ChildContentQuery innerJoinContentFolder($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentFolder relation @@ -598,6 +602,79 @@ abstract class ContentQuery extends ModelCriteria return $this->addUsingAlias(ContentTableMap::VERSION_CREATED_BY, $versionCreatedBy, $comparison); } + /** + * Filter the query by a related \Thelia\Model\Rewriting object + * + * @param \Thelia\Model\Rewriting|ObjectCollection $rewriting the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildContentQuery The current query, for fluid interface + */ + public function filterByRewriting($rewriting, $comparison = null) + { + if ($rewriting instanceof \Thelia\Model\Rewriting) { + return $this + ->addUsingAlias(ContentTableMap::ID, $rewriting->getContentId(), $comparison); + } elseif ($rewriting instanceof ObjectCollection) { + return $this + ->useRewritingQuery() + ->filterByPrimaryKeys($rewriting->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByRewriting() only accepts arguments of type \Thelia\Model\Rewriting or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the Rewriting relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildContentQuery The current query, for fluid interface + */ + public function joinRewriting($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Rewriting'); + + // 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, 'Rewriting'); + } + + return $this; + } + + /** + * Use the Rewriting relation Rewriting 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\RewritingQuery A secondary query class using the current class as primary query + */ + public function useRewritingQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinRewriting($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Rewriting', '\Thelia\Model\RewritingQuery'); + } + /** * Filter the query by a related \Thelia\Model\ContentFolder object * diff --git a/core/lib/Thelia/Model/Base/Coupon.php b/core/lib/Thelia/Model/Base/Coupon.php index 1d1bfe1e2..484215534 100755 --- a/core/lib/Thelia/Model/Base/Coupon.php +++ b/core/lib/Thelia/Model/Base/Coupon.php @@ -20,8 +20,6 @@ use Propel\Runtime\Util\PropelDateTime; use Thelia\Model\Coupon as ChildCoupon; use Thelia\Model\CouponI18n as ChildCouponI18n; use Thelia\Model\CouponI18nQuery as ChildCouponI18nQuery; -use Thelia\Model\CouponOrder as ChildCouponOrder; -use Thelia\Model\CouponOrderQuery as ChildCouponOrderQuery; use Thelia\Model\CouponQuery as ChildCouponQuery; use Thelia\Model\CouponVersion as ChildCouponVersion; use Thelia\Model\CouponVersionQuery as ChildCouponVersionQuery; @@ -80,24 +78,6 @@ abstract class Coupon implements ActiveRecordInterface */ protected $type; - /** - * The value for the title field. - * @var string - */ - protected $title; - - /** - * The value for the short_description field. - * @var string - */ - protected $short_description; - - /** - * The value for the description field. - * @var string - */ - protected $description; - /** * The value for the amount field. * @var double @@ -171,12 +151,6 @@ abstract class Coupon implements ActiveRecordInterface */ protected $version; - /** - * @var ObjectCollection|ChildCouponOrder[] Collection to store aggregation of ChildCouponOrder objects. - */ - protected $collCouponOrders; - protected $collCouponOrdersPartial; - /** * @var ObjectCollection|ChildCouponI18n[] Collection to store aggregation of ChildCouponI18n objects. */ @@ -219,12 +193,6 @@ abstract class Coupon implements ActiveRecordInterface */ protected $enforceVersion = false; - /** - * An array of objects scheduled for deletion. - * @var ObjectCollection - */ - protected $couponOrdersScheduledForDeletion = null; - /** * An array of objects scheduled for deletion. * @var ObjectCollection @@ -537,39 +505,6 @@ abstract class Coupon implements ActiveRecordInterface return $this->type; } - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - - return $this->title; - } - - /** - * Get the [short_description] column value. - * - * @return string - */ - public function getShortDescription() - { - - return $this->short_description; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - - return $this->description; - } - /** * Get the [amount] column value. * @@ -792,69 +727,6 @@ abstract class Coupon implements ActiveRecordInterface return $this; } // setType() - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return \Thelia\Model\Coupon 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[] = CouponTableMap::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [short_description] column. - * - * @param string $v new value - * @return \Thelia\Model\Coupon The current object (for fluent API support) - */ - public function setShortDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->short_description !== $v) { - $this->short_description = $v; - $this->modifiedColumns[] = CouponTableMap::SHORT_DESCRIPTION; - } - - - return $this; - } // setShortDescription() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return \Thelia\Model\Coupon 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[] = CouponTableMap::DESCRIPTION; - } - - - return $this; - } // setDescription() - /** * Set the value of [amount] column. * @@ -1165,58 +1037,49 @@ abstract class Coupon implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponTableMap::translateFieldName('Type', TableMap::TYPE_PHPNAME, $indexType)]; $this->type = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; - $this->title = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponTableMap::translateFieldName('ShortDescription', TableMap::TYPE_PHPNAME, $indexType)]; - $this->short_description = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; - $this->description = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)]; $this->amount = (null !== $col) ? (double) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CouponTableMap::translateFieldName('IsUsed', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponTableMap::translateFieldName('IsUsed', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_used = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CouponTableMap::translateFieldName('IsEnabled', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponTableMap::translateFieldName('IsEnabled', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_enabled = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CouponTableMap::translateFieldName('ExpirationDate', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponTableMap::translateFieldName('ExpirationDate', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->expiration_date = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CouponTableMap::translateFieldName('SerializedRules', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CouponTableMap::translateFieldName('SerializedRules', TableMap::TYPE_PHPNAME, $indexType)]; $this->serialized_rules = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponTableMap::translateFieldName('IsCumulative', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CouponTableMap::translateFieldName('IsCumulative', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_cumulative = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponTableMap::translateFieldName('IsRemovingPostage', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CouponTableMap::translateFieldName('IsRemovingPostage', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_removing_postage = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponTableMap::translateFieldName('MaxUsage', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CouponTableMap::translateFieldName('MaxUsage', TableMap::TYPE_PHPNAME, $indexType)]; $this->max_usage = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponTableMap::translateFieldName('IsAvailableOnSpecialOffers', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponTableMap::translateFieldName('IsAvailableOnSpecialOffers', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_available_on_special_offers = (null !== $col) ? (boolean) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CouponTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponTableMap::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 ? 16 + $startcol : CouponTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : CouponTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; $this->version = (null !== $col) ? (int) $col : null; $this->resetModified(); @@ -1226,7 +1089,7 @@ abstract class Coupon implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 18; // 18 = CouponTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 15; // 15 = CouponTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\Coupon object", 0, $e); @@ -1287,8 +1150,6 @@ abstract class Coupon implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? - $this->collCouponOrders = null; - $this->collCouponI18ns = null; $this->collCouponVersions = null; @@ -1435,23 +1296,6 @@ abstract class Coupon implements ActiveRecordInterface $this->resetModified(); } - if ($this->couponOrdersScheduledForDeletion !== null) { - if (!$this->couponOrdersScheduledForDeletion->isEmpty()) { - \Thelia\Model\CouponOrderQuery::create() - ->filterByPrimaryKeys($this->couponOrdersScheduledForDeletion->getPrimaryKeys(false)) - ->delete($con); - $this->couponOrdersScheduledForDeletion = null; - } - } - - if ($this->collCouponOrders !== null) { - foreach ($this->collCouponOrders as $referrerFK) { - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { - $affectedRows += $referrerFK->save($con); - } - } - } - if ($this->couponI18nsScheduledForDeletion !== null) { if (!$this->couponI18nsScheduledForDeletion->isEmpty()) { \Thelia\Model\CouponI18nQuery::create() @@ -1521,15 +1365,6 @@ abstract class Coupon implements ActiveRecordInterface if ($this->isColumnModified(CouponTableMap::TYPE)) { $modifiedColumns[':p' . $index++] = 'TYPE'; } - if ($this->isColumnModified(CouponTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; - } - if ($this->isColumnModified(CouponTableMap::SHORT_DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'SHORT_DESCRIPTION'; - } - if ($this->isColumnModified(CouponTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; - } if ($this->isColumnModified(CouponTableMap::AMOUNT)) { $modifiedColumns[':p' . $index++] = 'AMOUNT'; } @@ -1586,15 +1421,6 @@ abstract class Coupon implements ActiveRecordInterface case 'TYPE': $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR); break; - case 'TITLE': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case 'SHORT_DESCRIPTION': - $stmt->bindValue($identifier, $this->short_description, PDO::PARAM_STR); - break; - case 'DESCRIPTION': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; case 'AMOUNT': $stmt->bindValue($identifier, $this->amount, PDO::PARAM_STR); break; @@ -1703,48 +1529,39 @@ abstract class Coupon implements ActiveRecordInterface return $this->getType(); break; case 3: - return $this->getTitle(); - break; - case 4: - return $this->getShortDescription(); - break; - case 5: - return $this->getDescription(); - break; - case 6: return $this->getAmount(); break; - case 7: + case 4: return $this->getIsUsed(); break; - case 8: + case 5: return $this->getIsEnabled(); break; - case 9: + case 6: return $this->getExpirationDate(); break; - case 10: + case 7: return $this->getSerializedRules(); break; - case 11: + case 8: return $this->getIsCumulative(); break; - case 12: + case 9: return $this->getIsRemovingPostage(); break; - case 13: + case 10: return $this->getMaxUsage(); break; - case 14: + case 11: return $this->getIsAvailableOnSpecialOffers(); break; - case 15: + case 12: return $this->getCreatedAt(); break; - case 16: + case 13: return $this->getUpdatedAt(); break; - case 17: + case 14: return $this->getVersion(); break; default: @@ -1779,21 +1596,18 @@ abstract class Coupon implements ActiveRecordInterface $keys[0] => $this->getId(), $keys[1] => $this->getCode(), $keys[2] => $this->getType(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getShortDescription(), - $keys[5] => $this->getDescription(), - $keys[6] => $this->getAmount(), - $keys[7] => $this->getIsUsed(), - $keys[8] => $this->getIsEnabled(), - $keys[9] => $this->getExpirationDate(), - $keys[10] => $this->getSerializedRules(), - $keys[11] => $this->getIsCumulative(), - $keys[12] => $this->getIsRemovingPostage(), - $keys[13] => $this->getMaxUsage(), - $keys[14] => $this->getIsAvailableOnSpecialOffers(), - $keys[15] => $this->getCreatedAt(), - $keys[16] => $this->getUpdatedAt(), - $keys[17] => $this->getVersion(), + $keys[3] => $this->getAmount(), + $keys[4] => $this->getIsUsed(), + $keys[5] => $this->getIsEnabled(), + $keys[6] => $this->getExpirationDate(), + $keys[7] => $this->getSerializedRules(), + $keys[8] => $this->getIsCumulative(), + $keys[9] => $this->getIsRemovingPostage(), + $keys[10] => $this->getMaxUsage(), + $keys[11] => $this->getIsAvailableOnSpecialOffers(), + $keys[12] => $this->getCreatedAt(), + $keys[13] => $this->getUpdatedAt(), + $keys[14] => $this->getVersion(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1802,9 +1616,6 @@ abstract class Coupon implements ActiveRecordInterface } if ($includeForeignObjects) { - if (null !== $this->collCouponOrders) { - $result['CouponOrders'] = $this->collCouponOrders->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); - } if (null !== $this->collCouponI18ns) { $result['CouponI18ns'] = $this->collCouponI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } @@ -1855,48 +1666,39 @@ abstract class Coupon implements ActiveRecordInterface $this->setType($value); break; case 3: - $this->setTitle($value); - break; - case 4: - $this->setShortDescription($value); - break; - case 5: - $this->setDescription($value); - break; - case 6: $this->setAmount($value); break; - case 7: + case 4: $this->setIsUsed($value); break; - case 8: + case 5: $this->setIsEnabled($value); break; - case 9: + case 6: $this->setExpirationDate($value); break; - case 10: + case 7: $this->setSerializedRules($value); break; - case 11: + case 8: $this->setIsCumulative($value); break; - case 12: + case 9: $this->setIsRemovingPostage($value); break; - case 13: + case 10: $this->setMaxUsage($value); break; - case 14: + case 11: $this->setIsAvailableOnSpecialOffers($value); break; - case 15: + case 12: $this->setCreatedAt($value); break; - case 16: + case 13: $this->setUpdatedAt($value); break; - case 17: + case 14: $this->setVersion($value); break; } // switch() @@ -1926,21 +1728,18 @@ abstract class Coupon implements ActiveRecordInterface if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setShortDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setDescription($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setAmount($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setIsUsed($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setIsEnabled($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setExpirationDate($arr[$keys[9]]); - if (array_key_exists($keys[10], $arr)) $this->setSerializedRules($arr[$keys[10]]); - if (array_key_exists($keys[11], $arr)) $this->setIsCumulative($arr[$keys[11]]); - if (array_key_exists($keys[12], $arr)) $this->setIsRemovingPostage($arr[$keys[12]]); - if (array_key_exists($keys[13], $arr)) $this->setMaxUsage($arr[$keys[13]]); - if (array_key_exists($keys[14], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[14]]); - if (array_key_exists($keys[15], $arr)) $this->setCreatedAt($arr[$keys[15]]); - if (array_key_exists($keys[16], $arr)) $this->setUpdatedAt($arr[$keys[16]]); - if (array_key_exists($keys[17], $arr)) $this->setVersion($arr[$keys[17]]); + if (array_key_exists($keys[3], $arr)) $this->setAmount($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setIsUsed($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setIsEnabled($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setExpirationDate($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setSerializedRules($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setIsCumulative($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setIsRemovingPostage($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setMaxUsage($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setVersion($arr[$keys[14]]); } /** @@ -1955,9 +1754,6 @@ abstract class Coupon implements ActiveRecordInterface if ($this->isColumnModified(CouponTableMap::ID)) $criteria->add(CouponTableMap::ID, $this->id); if ($this->isColumnModified(CouponTableMap::CODE)) $criteria->add(CouponTableMap::CODE, $this->code); if ($this->isColumnModified(CouponTableMap::TYPE)) $criteria->add(CouponTableMap::TYPE, $this->type); - if ($this->isColumnModified(CouponTableMap::TITLE)) $criteria->add(CouponTableMap::TITLE, $this->title); - if ($this->isColumnModified(CouponTableMap::SHORT_DESCRIPTION)) $criteria->add(CouponTableMap::SHORT_DESCRIPTION, $this->short_description); - if ($this->isColumnModified(CouponTableMap::DESCRIPTION)) $criteria->add(CouponTableMap::DESCRIPTION, $this->description); if ($this->isColumnModified(CouponTableMap::AMOUNT)) $criteria->add(CouponTableMap::AMOUNT, $this->amount); if ($this->isColumnModified(CouponTableMap::IS_USED)) $criteria->add(CouponTableMap::IS_USED, $this->is_used); if ($this->isColumnModified(CouponTableMap::IS_ENABLED)) $criteria->add(CouponTableMap::IS_ENABLED, $this->is_enabled); @@ -2035,9 +1831,6 @@ abstract class Coupon implements ActiveRecordInterface { $copyObj->setCode($this->getCode()); $copyObj->setType($this->getType()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setShortDescription($this->getShortDescription()); - $copyObj->setDescription($this->getDescription()); $copyObj->setAmount($this->getAmount()); $copyObj->setIsUsed($this->getIsUsed()); $copyObj->setIsEnabled($this->getIsEnabled()); @@ -2056,12 +1849,6 @@ abstract class Coupon implements ActiveRecordInterface // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); - foreach ($this->getCouponOrders() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addCouponOrder($relObj->copy($deepCopy)); - } - } - foreach ($this->getCouponI18ns() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCouponI18n($relObj->copy($deepCopy)); @@ -2115,9 +1902,6 @@ abstract class Coupon implements ActiveRecordInterface */ public function initRelation($relationName) { - if ('CouponOrder' == $relationName) { - return $this->initCouponOrders(); - } if ('CouponI18n' == $relationName) { return $this->initCouponI18ns(); } @@ -2126,249 +1910,6 @@ abstract class Coupon implements ActiveRecordInterface } } - /** - * Clears out the collCouponOrders 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 addCouponOrders() - */ - public function clearCouponOrders() - { - $this->collCouponOrders = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Reset is the collCouponOrders collection loaded partially. - */ - public function resetPartialCouponOrders($v = true) - { - $this->collCouponOrdersPartial = $v; - } - - /** - * Initializes the collCouponOrders collection. - * - * By default this just sets the collCouponOrders collection to an empty array (like clearcollCouponOrders()); - * 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 initCouponOrders($overrideExisting = true) - { - if (null !== $this->collCouponOrders && !$overrideExisting) { - return; - } - $this->collCouponOrders = new ObjectCollection(); - $this->collCouponOrders->setModel('\Thelia\Model\CouponOrder'); - } - - /** - * Gets an array of ChildCouponOrder 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 ChildCoupon 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|ChildCouponOrder[] List of ChildCouponOrder objects - * @throws PropelException - */ - public function getCouponOrders($criteria = null, ConnectionInterface $con = null) - { - $partial = $this->collCouponOrdersPartial && !$this->isNew(); - if (null === $this->collCouponOrders || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collCouponOrders) { - // return empty collection - $this->initCouponOrders(); - } else { - $collCouponOrders = ChildCouponOrderQuery::create(null, $criteria) - ->filterByCoupon($this) - ->find($con); - - if (null !== $criteria) { - if (false !== $this->collCouponOrdersPartial && count($collCouponOrders)) { - $this->initCouponOrders(false); - - foreach ($collCouponOrders as $obj) { - if (false == $this->collCouponOrders->contains($obj)) { - $this->collCouponOrders->append($obj); - } - } - - $this->collCouponOrdersPartial = true; - } - - $collCouponOrders->getInternalIterator()->rewind(); - - return $collCouponOrders; - } - - if ($partial && $this->collCouponOrders) { - foreach ($this->collCouponOrders as $obj) { - if ($obj->isNew()) { - $collCouponOrders[] = $obj; - } - } - } - - $this->collCouponOrders = $collCouponOrders; - $this->collCouponOrdersPartial = false; - } - } - - return $this->collCouponOrders; - } - - /** - * Sets a collection of CouponOrder 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 $couponOrders A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return ChildCoupon The current object (for fluent API support) - */ - public function setCouponOrders(Collection $couponOrders, ConnectionInterface $con = null) - { - $couponOrdersToDelete = $this->getCouponOrders(new Criteria(), $con)->diff($couponOrders); - - - $this->couponOrdersScheduledForDeletion = $couponOrdersToDelete; - - foreach ($couponOrdersToDelete as $couponOrderRemoved) { - $couponOrderRemoved->setCoupon(null); - } - - $this->collCouponOrders = null; - foreach ($couponOrders as $couponOrder) { - $this->addCouponOrder($couponOrder); - } - - $this->collCouponOrders = $couponOrders; - $this->collCouponOrdersPartial = false; - - return $this; - } - - /** - * Returns the number of related CouponOrder objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related CouponOrder objects. - * @throws PropelException - */ - public function countCouponOrders(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) - { - $partial = $this->collCouponOrdersPartial && !$this->isNew(); - if (null === $this->collCouponOrders || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collCouponOrders) { - return 0; - } - - if ($partial && !$criteria) { - return count($this->getCouponOrders()); - } - - $query = ChildCouponOrderQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByCoupon($this) - ->count($con); - } - - return count($this->collCouponOrders); - } - - /** - * Method called to associate a ChildCouponOrder object to this object - * through the ChildCouponOrder foreign key attribute. - * - * @param ChildCouponOrder $l ChildCouponOrder - * @return \Thelia\Model\Coupon The current object (for fluent API support) - */ - public function addCouponOrder(ChildCouponOrder $l) - { - if ($this->collCouponOrders === null) { - $this->initCouponOrders(); - $this->collCouponOrdersPartial = true; - } - - if (!in_array($l, $this->collCouponOrders->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddCouponOrder($l); - } - - return $this; - } - - /** - * @param CouponOrder $couponOrder The couponOrder object to add. - */ - protected function doAddCouponOrder($couponOrder) - { - $this->collCouponOrders[]= $couponOrder; - $couponOrder->setCoupon($this); - } - - /** - * @param CouponOrder $couponOrder The couponOrder object to remove. - * @return ChildCoupon The current object (for fluent API support) - */ - public function removeCouponOrder($couponOrder) - { - if ($this->getCouponOrders()->contains($couponOrder)) { - $this->collCouponOrders->remove($this->collCouponOrders->search($couponOrder)); - if (null === $this->couponOrdersScheduledForDeletion) { - $this->couponOrdersScheduledForDeletion = clone $this->collCouponOrders; - $this->couponOrdersScheduledForDeletion->clear(); - } - $this->couponOrdersScheduledForDeletion[]= clone $couponOrder; - $couponOrder->setCoupon(null); - } - - return $this; - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Coupon is new, it will return - * an empty collection; or if this Coupon has previously - * been saved, it will retrieve related CouponOrders from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Coupon. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildCouponOrder[] List of ChildCouponOrder objects - */ - public function getCouponOrdersJoinOrder($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildCouponOrderQuery::create(null, $criteria); - $query->joinWith('Order', $joinBehavior); - - return $this->getCouponOrders($query, $con); - } - /** * Clears out the collCouponI18ns collection * @@ -2823,9 +2364,6 @@ abstract class Coupon implements ActiveRecordInterface $this->id = null; $this->code = null; $this->type = null; - $this->title = null; - $this->short_description = null; - $this->description = null; $this->amount = null; $this->is_used = null; $this->is_enabled = null; @@ -2858,11 +2396,6 @@ abstract class Coupon implements ActiveRecordInterface public function clearAllReferences($deep = false) { if ($deep) { - if ($this->collCouponOrders) { - foreach ($this->collCouponOrders as $o) { - $o->clearAllReferences($deep); - } - } if ($this->collCouponI18ns) { foreach ($this->collCouponI18ns as $o) { $o->clearAllReferences($deep); @@ -2879,10 +2412,6 @@ abstract class Coupon implements ActiveRecordInterface $this->currentLocale = 'en_EN'; $this->currentTranslations = null; - if ($this->collCouponOrders instanceof Collection) { - $this->collCouponOrders->clearIterator(); - } - $this->collCouponOrders = null; if ($this->collCouponI18ns instanceof Collection) { $this->collCouponI18ns->clearIterator(); } @@ -3016,6 +2545,78 @@ abstract class Coupon implements ActiveRecordInterface 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\CouponI18n The current object (for fluent API support) + */ + public function setTitle($v) + { $this->getCurrentTranslation()->setTitle($v); + + return $this; + } + + + /** + * Get the [short_description] column value. + * + * @return string + */ + public function getShortDescription() + { + return $this->getCurrentTranslation()->getShortDescription(); + } + + + /** + * Set the value of [short_description] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponI18n The current object (for fluent API support) + */ + public function setShortDescription($v) + { $this->getCurrentTranslation()->setShortDescription($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\CouponI18n The current object (for fluent API support) + */ + public function setDescription($v) + { $this->getCurrentTranslation()->setDescription($v); + + return $this; + } + // versionable behavior /** @@ -3067,9 +2668,6 @@ abstract class Coupon implements ActiveRecordInterface $version->setId($this->getId()); $version->setCode($this->getCode()); $version->setType($this->getType()); - $version->setTitle($this->getTitle()); - $version->setShortDescription($this->getShortDescription()); - $version->setDescription($this->getDescription()); $version->setAmount($this->getAmount()); $version->setIsUsed($this->getIsUsed()); $version->setIsEnabled($this->getIsEnabled()); @@ -3122,9 +2720,6 @@ abstract class Coupon implements ActiveRecordInterface $this->setId($version->getId()); $this->setCode($version->getCode()); $this->setType($version->getType()); - $this->setTitle($version->getTitle()); - $this->setShortDescription($version->getShortDescription()); - $this->setDescription($version->getDescription()); $this->setAmount($version->getAmount()); $this->setIsUsed($version->getIsUsed()); $this->setIsEnabled($version->getIsEnabled()); diff --git a/core/lib/Thelia/Model/Base/CouponI18n.php b/core/lib/Thelia/Model/Base/CouponI18n.php index bc7cc8cdc..328d04af8 100644 --- a/core/lib/Thelia/Model/Base/CouponI18n.php +++ b/core/lib/Thelia/Model/Base/CouponI18n.php @@ -66,6 +66,24 @@ abstract class CouponI18n implements ActiveRecordInterface */ protected $locale; + /** + * The value for the title field. + * @var string + */ + protected $title; + + /** + * The value for the short_description field. + * @var string + */ + protected $short_description; + + /** + * The value for the description field. + * @var string + */ + protected $description; + /** * @var Coupon */ @@ -368,6 +386,39 @@ abstract class CouponI18n implements ActiveRecordInterface return $this->locale; } + /** + * Get the [title] column value. + * + * @return string + */ + public function getTitle() + { + + return $this->title; + } + + /** + * Get the [short_description] column value. + * + * @return string + */ + public function getShortDescription() + { + + return $this->short_description; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + + return $this->description; + } + /** * Set the value of [id] column. * @@ -414,6 +465,69 @@ abstract class CouponI18n implements ActiveRecordInterface return $this; } // setLocale() + /** + * Set the value of [title] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponI18n 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[] = CouponI18nTableMap::TITLE; + } + + + return $this; + } // setTitle() + + /** + * Set the value of [short_description] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponI18n The current object (for fluent API support) + */ + public function setShortDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->short_description !== $v) { + $this->short_description = $v; + $this->modifiedColumns[] = CouponI18nTableMap::SHORT_DESCRIPTION; + } + + + return $this; + } // setShortDescription() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponI18n 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[] = CouponI18nTableMap::DESCRIPTION; + } + + + return $this; + } // setDescription() + /** * Indicates whether the columns in this object are only set to default values. * @@ -460,6 +574,15 @@ abstract class CouponI18n implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : CouponI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]; $this->locale = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; + $this->title = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponI18nTableMap::translateFieldName('ShortDescription', TableMap::TYPE_PHPNAME, $indexType)]; + $this->short_description = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponI18nTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; + $this->description = (null !== $col) ? (string) $col : null; $this->resetModified(); $this->setNew(false); @@ -468,7 +591,7 @@ abstract class CouponI18n implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 2; // 2 = CouponI18nTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 5; // 5 = CouponI18nTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\CouponI18n object", 0, $e); @@ -695,6 +818,15 @@ abstract class CouponI18n implements ActiveRecordInterface if ($this->isColumnModified(CouponI18nTableMap::LOCALE)) { $modifiedColumns[':p' . $index++] = 'LOCALE'; } + if ($this->isColumnModified(CouponI18nTableMap::TITLE)) { + $modifiedColumns[':p' . $index++] = 'TITLE'; + } + if ($this->isColumnModified(CouponI18nTableMap::SHORT_DESCRIPTION)) { + $modifiedColumns[':p' . $index++] = 'SHORT_DESCRIPTION'; + } + if ($this->isColumnModified(CouponI18nTableMap::DESCRIPTION)) { + $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + } $sql = sprintf( 'INSERT INTO coupon_i18n (%s) VALUES (%s)', @@ -712,6 +844,15 @@ abstract class CouponI18n implements ActiveRecordInterface case 'LOCALE': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; + case 'TITLE': + $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); + break; + case 'SHORT_DESCRIPTION': + $stmt->bindValue($identifier, $this->short_description, PDO::PARAM_STR); + break; + case 'DESCRIPTION': + $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + break; } } $stmt->execute(); @@ -773,6 +914,15 @@ abstract class CouponI18n implements ActiveRecordInterface case 1: return $this->getLocale(); break; + case 2: + return $this->getTitle(); + break; + case 3: + return $this->getShortDescription(); + break; + case 4: + return $this->getDescription(); + break; default: return null; break; @@ -804,6 +954,9 @@ abstract class CouponI18n implements ActiveRecordInterface $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getLocale(), + $keys[2] => $this->getTitle(), + $keys[3] => $this->getShortDescription(), + $keys[4] => $this->getDescription(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -855,6 +1008,15 @@ abstract class CouponI18n implements ActiveRecordInterface case 1: $this->setLocale($value); break; + case 2: + $this->setTitle($value); + break; + case 3: + $this->setShortDescription($value); + break; + case 4: + $this->setDescription($value); + break; } // switch() } @@ -881,6 +1043,9 @@ abstract class CouponI18n implements ActiveRecordInterface 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->setShortDescription($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); } /** @@ -894,6 +1059,9 @@ abstract class CouponI18n implements ActiveRecordInterface if ($this->isColumnModified(CouponI18nTableMap::ID)) $criteria->add(CouponI18nTableMap::ID, $this->id); if ($this->isColumnModified(CouponI18nTableMap::LOCALE)) $criteria->add(CouponI18nTableMap::LOCALE, $this->locale); + if ($this->isColumnModified(CouponI18nTableMap::TITLE)) $criteria->add(CouponI18nTableMap::TITLE, $this->title); + if ($this->isColumnModified(CouponI18nTableMap::SHORT_DESCRIPTION)) $criteria->add(CouponI18nTableMap::SHORT_DESCRIPTION, $this->short_description); + if ($this->isColumnModified(CouponI18nTableMap::DESCRIPTION)) $criteria->add(CouponI18nTableMap::DESCRIPTION, $this->description); return $criteria; } @@ -966,6 +1134,9 @@ abstract class CouponI18n implements ActiveRecordInterface { $copyObj->setId($this->getId()); $copyObj->setLocale($this->getLocale()); + $copyObj->setTitle($this->getTitle()); + $copyObj->setShortDescription($this->getShortDescription()); + $copyObj->setDescription($this->getDescription()); if ($makeNew) { $copyObj->setNew(true); } @@ -1051,6 +1222,9 @@ abstract class CouponI18n implements ActiveRecordInterface { $this->id = null; $this->locale = null; + $this->title = null; + $this->short_description = null; + $this->description = null; $this->alreadyInSave = false; $this->clearAllReferences(); $this->applyDefaultValues(); diff --git a/core/lib/Thelia/Model/Base/CouponI18nQuery.php b/core/lib/Thelia/Model/Base/CouponI18nQuery.php index 9468f787f..5dfbdbcdc 100644 --- a/core/lib/Thelia/Model/Base/CouponI18nQuery.php +++ b/core/lib/Thelia/Model/Base/CouponI18nQuery.php @@ -23,9 +23,15 @@ use Thelia\Model\Map\CouponI18nTableMap; * * @method ChildCouponI18nQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildCouponI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column + * @method ChildCouponI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column + * @method ChildCouponI18nQuery orderByShortDescription($order = Criteria::ASC) Order by the short_description column + * @method ChildCouponI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column * * @method ChildCouponI18nQuery groupById() Group by the id column * @method ChildCouponI18nQuery groupByLocale() Group by the locale column + * @method ChildCouponI18nQuery groupByTitle() Group by the title column + * @method ChildCouponI18nQuery groupByShortDescription() Group by the short_description column + * @method ChildCouponI18nQuery groupByDescription() Group by the description column * * @method ChildCouponI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildCouponI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query @@ -40,9 +46,15 @@ use Thelia\Model\Map\CouponI18nTableMap; * * @method ChildCouponI18n findOneById(int $id) Return the first ChildCouponI18n filtered by the id column * @method ChildCouponI18n findOneByLocale(string $locale) Return the first ChildCouponI18n filtered by the locale column + * @method ChildCouponI18n findOneByTitle(string $title) Return the first ChildCouponI18n filtered by the title column + * @method ChildCouponI18n findOneByShortDescription(string $short_description) Return the first ChildCouponI18n filtered by the short_description column + * @method ChildCouponI18n findOneByDescription(string $description) Return the first ChildCouponI18n filtered by the description column * * @method array findById(int $id) Return ChildCouponI18n objects filtered by the id column * @method array findByLocale(string $locale) Return ChildCouponI18n objects filtered by the locale column + * @method array findByTitle(string $title) Return ChildCouponI18n objects filtered by the title column + * @method array findByShortDescription(string $short_description) Return ChildCouponI18n objects filtered by the short_description column + * @method array findByDescription(string $description) Return ChildCouponI18n objects filtered by the description column * */ abstract class CouponI18nQuery extends ModelCriteria @@ -131,7 +143,7 @@ abstract class CouponI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE FROM coupon_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT ID, LOCALE, TITLE, SHORT_DESCRIPTION, DESCRIPTION FROM coupon_i18n WHERE ID = :p0 AND LOCALE = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); @@ -304,6 +316,93 @@ abstract class CouponI18nQuery extends ModelCriteria return $this->addUsingAlias(CouponI18nTableMap::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 ChildCouponI18nQuery 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(CouponI18nTableMap::TITLE, $title, $comparison); + } + + /** + * Filter the query on the short_description column + * + * Example usage: + * + * $query->filterByShortDescription('fooValue'); // WHERE short_description = 'fooValue' + * $query->filterByShortDescription('%fooValue%'); // WHERE short_description LIKE '%fooValue%' + * + * + * @param string $shortDescription 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 ChildCouponI18nQuery The current query, for fluid interface + */ + public function filterByShortDescription($shortDescription = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($shortDescription)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $shortDescription)) { + $shortDescription = str_replace('*', '%', $shortDescription); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(CouponI18nTableMap::SHORT_DESCRIPTION, $shortDescription, $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 ChildCouponI18nQuery 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(CouponI18nTableMap::DESCRIPTION, $description, $comparison); + } + /** * Filter the query by a related \Thelia\Model\Coupon object * diff --git a/core/lib/Thelia/Model/Base/CouponOrder.php b/core/lib/Thelia/Model/Base/CouponOrder.php index 7d3c413b6..0b1300855 100755 --- a/core/lib/Thelia/Model/Base/CouponOrder.php +++ b/core/lib/Thelia/Model/Base/CouponOrder.php @@ -16,10 +16,8 @@ use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Util\PropelDateTime; -use Thelia\Model\Coupon as ChildCoupon; use Thelia\Model\CouponOrder as ChildCouponOrder; use Thelia\Model\CouponOrderQuery as ChildCouponOrderQuery; -use Thelia\Model\CouponQuery as ChildCouponQuery; use Thelia\Model\Order as ChildOrder; use Thelia\Model\OrderQuery as ChildOrderQuery; use Thelia\Model\Map\CouponOrderTableMap; @@ -70,12 +68,6 @@ abstract class CouponOrder implements ActiveRecordInterface */ protected $order_id; - /** - * The value for the code field. - * @var string - */ - protected $code; - /** * The value for the value field. * @var double @@ -99,11 +91,6 @@ abstract class CouponOrder implements ActiveRecordInterface */ protected $aOrder; - /** - * @var Coupon - */ - protected $aCoupon; - /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -388,17 +375,6 @@ abstract class CouponOrder implements ActiveRecordInterface return $this->order_id; } - /** - * Get the [code] column value. - * - * @return string - */ - public function getCode() - { - - return $this->code; - } - /** * Get the [value] column value. * @@ -496,31 +472,6 @@ abstract class CouponOrder implements ActiveRecordInterface return $this; } // setOrderId() - /** - * Set the value of [code] column. - * - * @param string $v new value - * @return \Thelia\Model\CouponOrder The current object (for fluent API support) - */ - public function setCode($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->code !== $v) { - $this->code = $v; - $this->modifiedColumns[] = CouponOrderTableMap::CODE; - } - - if ($this->aCoupon !== null && $this->aCoupon->getCode() !== $v) { - $this->aCoupon = null; - } - - - return $this; - } // setCode() - /** * Set the value of [value] column. * @@ -627,19 +578,16 @@ abstract class CouponOrder implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : CouponOrderTableMap::translateFieldName('OrderId', TableMap::TYPE_PHPNAME, $indexType)]; $this->order_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponOrderTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)]; - $this->code = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponOrderTableMap::translateFieldName('Value', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponOrderTableMap::translateFieldName('Value', TableMap::TYPE_PHPNAME, $indexType)]; $this->value = (null !== $col) ? (double) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponOrderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponOrderTableMap::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 : CouponOrderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponOrderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -652,7 +600,7 @@ abstract class CouponOrder implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 6; // 6 = CouponOrderTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 5; // 5 = CouponOrderTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\CouponOrder object", 0, $e); @@ -677,9 +625,6 @@ abstract class CouponOrder implements ActiveRecordInterface if ($this->aOrder !== null && $this->order_id !== $this->aOrder->getId()) { $this->aOrder = null; } - if ($this->aCoupon !== null && $this->code !== $this->aCoupon->getCode()) { - $this->aCoupon = null; - } } // ensureConsistency /** @@ -720,7 +665,6 @@ abstract class CouponOrder implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? $this->aOrder = null; - $this->aCoupon = null; } // if (deep) } @@ -855,13 +799,6 @@ abstract class CouponOrder implements ActiveRecordInterface $this->setOrder($this->aOrder); } - if ($this->aCoupon !== null) { - if ($this->aCoupon->isModified() || $this->aCoupon->isNew()) { - $affectedRows += $this->aCoupon->save($con); - } - $this->setCoupon($this->aCoupon); - } - if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { @@ -905,9 +842,6 @@ abstract class CouponOrder implements ActiveRecordInterface if ($this->isColumnModified(CouponOrderTableMap::ORDER_ID)) { $modifiedColumns[':p' . $index++] = 'ORDER_ID'; } - if ($this->isColumnModified(CouponOrderTableMap::CODE)) { - $modifiedColumns[':p' . $index++] = 'CODE'; - } if ($this->isColumnModified(CouponOrderTableMap::VALUE)) { $modifiedColumns[':p' . $index++] = 'VALUE'; } @@ -934,9 +868,6 @@ abstract class CouponOrder implements ActiveRecordInterface case 'ORDER_ID': $stmt->bindValue($identifier, $this->order_id, PDO::PARAM_INT); break; - case 'CODE': - $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); - break; case 'VALUE': $stmt->bindValue($identifier, $this->value, PDO::PARAM_STR); break; @@ -1015,15 +946,12 @@ abstract class CouponOrder implements ActiveRecordInterface return $this->getOrderId(); break; case 2: - return $this->getCode(); - break; - case 3: return $this->getValue(); break; - case 4: + case 3: return $this->getCreatedAt(); break; - case 5: + case 4: return $this->getUpdatedAt(); break; default: @@ -1057,10 +985,9 @@ abstract class CouponOrder implements ActiveRecordInterface $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getOrderId(), - $keys[2] => $this->getCode(), - $keys[3] => $this->getValue(), - $keys[4] => $this->getCreatedAt(), - $keys[5] => $this->getUpdatedAt(), + $keys[2] => $this->getValue(), + $keys[3] => $this->getCreatedAt(), + $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1072,9 +999,6 @@ abstract class CouponOrder implements ActiveRecordInterface if (null !== $this->aOrder) { $result['Order'] = $this->aOrder->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } - if (null !== $this->aCoupon) { - $result['Coupon'] = $this->aCoupon->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } } return $result; @@ -1116,15 +1040,12 @@ abstract class CouponOrder implements ActiveRecordInterface $this->setOrderId($value); break; case 2: - $this->setCode($value); - break; - case 3: $this->setValue($value); break; - case 4: + case 3: $this->setCreatedAt($value); break; - case 5: + case 4: $this->setUpdatedAt($value); break; } // switch() @@ -1153,10 +1074,9 @@ abstract class CouponOrder implements ActiveRecordInterface if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setOrderId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setCode($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setValue($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[2], $arr)) $this->setValue($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]]); } /** @@ -1170,7 +1090,6 @@ abstract class CouponOrder implements ActiveRecordInterface if ($this->isColumnModified(CouponOrderTableMap::ID)) $criteria->add(CouponOrderTableMap::ID, $this->id); if ($this->isColumnModified(CouponOrderTableMap::ORDER_ID)) $criteria->add(CouponOrderTableMap::ORDER_ID, $this->order_id); - if ($this->isColumnModified(CouponOrderTableMap::CODE)) $criteria->add(CouponOrderTableMap::CODE, $this->code); if ($this->isColumnModified(CouponOrderTableMap::VALUE)) $criteria->add(CouponOrderTableMap::VALUE, $this->value); if ($this->isColumnModified(CouponOrderTableMap::CREATED_AT)) $criteria->add(CouponOrderTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(CouponOrderTableMap::UPDATED_AT)) $criteria->add(CouponOrderTableMap::UPDATED_AT, $this->updated_at); @@ -1238,7 +1157,6 @@ abstract class CouponOrder implements ActiveRecordInterface public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setOrderId($this->getOrderId()); - $copyObj->setCode($this->getCode()); $copyObj->setValue($this->getValue()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); @@ -1321,59 +1239,6 @@ abstract class CouponOrder implements ActiveRecordInterface return $this->aOrder; } - /** - * Declares an association between this object and a ChildCoupon object. - * - * @param ChildCoupon $v - * @return \Thelia\Model\CouponOrder The current object (for fluent API support) - * @throws PropelException - */ - public function setCoupon(ChildCoupon $v = null) - { - if ($v === null) { - $this->setCode(NULL); - } else { - $this->setCode($v->getCode()); - } - - $this->aCoupon = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the ChildCoupon object, it will not be re-added. - if ($v !== null) { - $v->addCouponOrder($this); - } - - - return $this; - } - - - /** - * Get the associated ChildCoupon object - * - * @param ConnectionInterface $con Optional Connection object. - * @return ChildCoupon The associated ChildCoupon object. - * @throws PropelException - */ - public function getCoupon(ConnectionInterface $con = null) - { - if ($this->aCoupon === null && (($this->code !== "" && $this->code !== null))) { - $this->aCoupon = ChildCouponQuery::create() - ->filterByCouponOrder($this) // here - ->findOne($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->aCoupon->addCouponOrders($this); - */ - } - - return $this->aCoupon; - } - /** * Clears the current object and sets all attributes to their default values */ @@ -1381,7 +1246,6 @@ abstract class CouponOrder implements ActiveRecordInterface { $this->id = null; $this->order_id = null; - $this->code = null; $this->value = null; $this->created_at = null; $this->updated_at = null; @@ -1407,7 +1271,6 @@ abstract class CouponOrder implements ActiveRecordInterface } // if ($deep) $this->aOrder = null; - $this->aCoupon = null; } /** diff --git a/core/lib/Thelia/Model/Base/CouponOrderQuery.php b/core/lib/Thelia/Model/Base/CouponOrderQuery.php index e3a95ea1a..255d69504 100755 --- a/core/lib/Thelia/Model/Base/CouponOrderQuery.php +++ b/core/lib/Thelia/Model/Base/CouponOrderQuery.php @@ -23,14 +23,12 @@ use Thelia\Model\Map\CouponOrderTableMap; * * @method ChildCouponOrderQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildCouponOrderQuery orderByOrderId($order = Criteria::ASC) Order by the order_id column - * @method ChildCouponOrderQuery orderByCode($order = Criteria::ASC) Order by the code column * @method ChildCouponOrderQuery orderByValue($order = Criteria::ASC) Order by the value column * @method ChildCouponOrderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildCouponOrderQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * * @method ChildCouponOrderQuery groupById() Group by the id column * @method ChildCouponOrderQuery groupByOrderId() Group by the order_id column - * @method ChildCouponOrderQuery groupByCode() Group by the code column * @method ChildCouponOrderQuery groupByValue() Group by the value column * @method ChildCouponOrderQuery groupByCreatedAt() Group by the created_at column * @method ChildCouponOrderQuery groupByUpdatedAt() Group by the updated_at column @@ -43,23 +41,17 @@ use Thelia\Model\Map\CouponOrderTableMap; * @method ChildCouponOrderQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation * @method ChildCouponOrderQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation * - * @method ChildCouponOrderQuery leftJoinCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the Coupon relation - * @method ChildCouponOrderQuery rightJoinCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Coupon relation - * @method ChildCouponOrderQuery innerJoinCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the Coupon relation - * * @method ChildCouponOrder findOne(ConnectionInterface $con = null) Return the first ChildCouponOrder matching the query * @method ChildCouponOrder findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCouponOrder matching the query, or a new ChildCouponOrder object populated from the query conditions when no match is found * * @method ChildCouponOrder findOneById(int $id) Return the first ChildCouponOrder filtered by the id column * @method ChildCouponOrder findOneByOrderId(int $order_id) Return the first ChildCouponOrder filtered by the order_id column - * @method ChildCouponOrder findOneByCode(string $code) Return the first ChildCouponOrder filtered by the code column * @method ChildCouponOrder findOneByValue(double $value) Return the first ChildCouponOrder filtered by the value column * @method ChildCouponOrder findOneByCreatedAt(string $created_at) Return the first ChildCouponOrder filtered by the created_at column * @method ChildCouponOrder findOneByUpdatedAt(string $updated_at) Return the first ChildCouponOrder filtered by the updated_at column * * @method array findById(int $id) Return ChildCouponOrder objects filtered by the id column * @method array findByOrderId(int $order_id) Return ChildCouponOrder objects filtered by the order_id column - * @method array findByCode(string $code) Return ChildCouponOrder objects filtered by the code column * @method array findByValue(double $value) Return ChildCouponOrder objects filtered by the value column * @method array findByCreatedAt(string $created_at) Return ChildCouponOrder objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildCouponOrder objects filtered by the updated_at column @@ -151,7 +143,7 @@ abstract class CouponOrderQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, ORDER_ID, CODE, VALUE, CREATED_AT, UPDATED_AT FROM coupon_order WHERE ID = :p0'; + $sql = 'SELECT ID, ORDER_ID, VALUE, CREATED_AT, UPDATED_AT FROM coupon_order WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -324,35 +316,6 @@ abstract class CouponOrderQuery extends ModelCriteria return $this->addUsingAlias(CouponOrderTableMap::ORDER_ID, $orderId, $comparison); } - /** - * Filter the query on the code column - * - * Example usage: - * - * $query->filterByCode('fooValue'); // WHERE code = 'fooValue' - * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%' - * - * - * @param string $code The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function filterByCode($code = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($code)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $code)) { - $code = str_replace('*', '%', $code); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CouponOrderTableMap::CODE, $code, $comparison); - } - /** * Filter the query on the value column * @@ -555,81 +518,6 @@ abstract class CouponOrderQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'Order', '\Thelia\Model\OrderQuery'); } - /** - * Filter the query by a related \Thelia\Model\Coupon object - * - * @param \Thelia\Model\Coupon|ObjectCollection $coupon The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function filterByCoupon($coupon, $comparison = null) - { - if ($coupon instanceof \Thelia\Model\Coupon) { - return $this - ->addUsingAlias(CouponOrderTableMap::CODE, $coupon->getCode(), $comparison); - } elseif ($coupon instanceof ObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(CouponOrderTableMap::CODE, $coupon->toKeyValue('PrimaryKey', 'Code'), $comparison); - } else { - throw new PropelException('filterByCoupon() only accepts arguments of type \Thelia\Model\Coupon or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the Coupon relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function joinCoupon($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Coupon'); - - // 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, 'Coupon'); - } - - return $this; - } - - /** - * Use the Coupon relation Coupon 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\CouponQuery A secondary query class using the current class as primary query - */ - public function useCouponQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinCoupon($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Coupon', '\Thelia\Model\CouponQuery'); - } - /** * Exclude object from result * diff --git a/core/lib/Thelia/Model/Base/CouponQuery.php b/core/lib/Thelia/Model/Base/CouponQuery.php index c7ae0eabd..f4062e158 100755 --- a/core/lib/Thelia/Model/Base/CouponQuery.php +++ b/core/lib/Thelia/Model/Base/CouponQuery.php @@ -25,9 +25,6 @@ use Thelia\Model\Map\CouponTableMap; * @method ChildCouponQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildCouponQuery orderByCode($order = Criteria::ASC) Order by the code column * @method ChildCouponQuery orderByType($order = Criteria::ASC) Order by the type column - * @method ChildCouponQuery orderByTitle($order = Criteria::ASC) Order by the title column - * @method ChildCouponQuery orderByShortDescription($order = Criteria::ASC) Order by the short_description column - * @method ChildCouponQuery orderByDescription($order = Criteria::ASC) Order by the description column * @method ChildCouponQuery orderByAmount($order = Criteria::ASC) Order by the amount column * @method ChildCouponQuery orderByIsUsed($order = Criteria::ASC) Order by the is_used column * @method ChildCouponQuery orderByIsEnabled($order = Criteria::ASC) Order by the is_enabled column @@ -44,9 +41,6 @@ use Thelia\Model\Map\CouponTableMap; * @method ChildCouponQuery groupById() Group by the id column * @method ChildCouponQuery groupByCode() Group by the code column * @method ChildCouponQuery groupByType() Group by the type column - * @method ChildCouponQuery groupByTitle() Group by the title column - * @method ChildCouponQuery groupByShortDescription() Group by the short_description column - * @method ChildCouponQuery groupByDescription() Group by the description column * @method ChildCouponQuery groupByAmount() Group by the amount column * @method ChildCouponQuery groupByIsUsed() Group by the is_used column * @method ChildCouponQuery groupByIsEnabled() Group by the is_enabled column @@ -64,10 +58,6 @@ use Thelia\Model\Map\CouponTableMap; * @method ChildCouponQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildCouponQuery innerJoin($relation) Adds a INNER JOIN clause to the query * - * @method ChildCouponQuery leftJoinCouponOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponOrder relation - * @method ChildCouponQuery rightJoinCouponOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponOrder relation - * @method ChildCouponQuery innerJoinCouponOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponOrder relation - * * @method ChildCouponQuery leftJoinCouponI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponI18n relation * @method ChildCouponQuery rightJoinCouponI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponI18n relation * @method ChildCouponQuery innerJoinCouponI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponI18n relation @@ -82,9 +72,6 @@ use Thelia\Model\Map\CouponTableMap; * @method ChildCoupon findOneById(int $id) Return the first ChildCoupon filtered by the id column * @method ChildCoupon findOneByCode(string $code) Return the first ChildCoupon filtered by the code column * @method ChildCoupon findOneByType(string $type) Return the first ChildCoupon filtered by the type column - * @method ChildCoupon findOneByTitle(string $title) Return the first ChildCoupon filtered by the title column - * @method ChildCoupon findOneByShortDescription(string $short_description) Return the first ChildCoupon filtered by the short_description column - * @method ChildCoupon findOneByDescription(string $description) Return the first ChildCoupon filtered by the description column * @method ChildCoupon findOneByAmount(double $amount) Return the first ChildCoupon filtered by the amount column * @method ChildCoupon findOneByIsUsed(int $is_used) Return the first ChildCoupon filtered by the is_used column * @method ChildCoupon findOneByIsEnabled(int $is_enabled) Return the first ChildCoupon filtered by the is_enabled column @@ -101,9 +88,6 @@ use Thelia\Model\Map\CouponTableMap; * @method array findById(int $id) Return ChildCoupon objects filtered by the id column * @method array findByCode(string $code) Return ChildCoupon objects filtered by the code column * @method array findByType(string $type) Return ChildCoupon objects filtered by the type column - * @method array findByTitle(string $title) Return ChildCoupon objects filtered by the title column - * @method array findByShortDescription(string $short_description) Return ChildCoupon objects filtered by the short_description column - * @method array findByDescription(string $description) Return ChildCoupon objects filtered by the description column * @method array findByAmount(double $amount) Return ChildCoupon objects filtered by the amount column * @method array findByIsUsed(int $is_used) Return ChildCoupon objects filtered by the is_used column * @method array findByIsEnabled(int $is_enabled) Return ChildCoupon objects filtered by the is_enabled column @@ -211,7 +195,7 @@ abstract class CouponQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, TYPE, TITLE, SHORT_DESCRIPTION, DESCRIPTION, AMOUNT, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES, IS_CUMULATIVE, IS_REMOVING_POSTAGE, MAX_USAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, CREATED_AT, UPDATED_AT, VERSION FROM coupon WHERE ID = :p0'; + $sql = 'SELECT ID, CODE, TYPE, AMOUNT, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES, IS_CUMULATIVE, IS_REMOVING_POSTAGE, MAX_USAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, CREATED_AT, UPDATED_AT, VERSION FROM coupon WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -399,93 +383,6 @@ abstract class CouponQuery extends ModelCriteria return $this->addUsingAlias(CouponTableMap::TYPE, $type, $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 ChildCouponQuery 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(CouponTableMap::TITLE, $title, $comparison); - } - - /** - * Filter the query on the short_description column - * - * Example usage: - * - * $query->filterByShortDescription('fooValue'); // WHERE short_description = 'fooValue' - * $query->filterByShortDescription('%fooValue%'); // WHERE short_description LIKE '%fooValue%' - * - * - * @param string $shortDescription The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponQuery The current query, for fluid interface - */ - public function filterByShortDescription($shortDescription = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($shortDescription)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $shortDescription)) { - $shortDescription = str_replace('*', '%', $shortDescription); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CouponTableMap::SHORT_DESCRIPTION, $shortDescription, $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 ChildCouponQuery 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(CouponTableMap::DESCRIPTION, $description, $comparison); - } - /** * Filter the query on the amount column * @@ -958,79 +855,6 @@ abstract class CouponQuery extends ModelCriteria return $this->addUsingAlias(CouponTableMap::VERSION, $version, $comparison); } - /** - * Filter the query by a related \Thelia\Model\CouponOrder object - * - * @param \Thelia\Model\CouponOrder|ObjectCollection $couponOrder the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponQuery The current query, for fluid interface - */ - public function filterByCouponOrder($couponOrder, $comparison = null) - { - if ($couponOrder instanceof \Thelia\Model\CouponOrder) { - return $this - ->addUsingAlias(CouponTableMap::CODE, $couponOrder->getCode(), $comparison); - } elseif ($couponOrder instanceof ObjectCollection) { - return $this - ->useCouponOrderQuery() - ->filterByPrimaryKeys($couponOrder->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByCouponOrder() only accepts arguments of type \Thelia\Model\CouponOrder or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the CouponOrder relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildCouponQuery The current query, for fluid interface - */ - public function joinCouponOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CouponOrder'); - - // 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, 'CouponOrder'); - } - - return $this; - } - - /** - * Use the CouponOrder relation CouponOrder 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\CouponOrderQuery A secondary query class using the current class as primary query - */ - public function useCouponOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinCouponOrder($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CouponOrder', '\Thelia\Model\CouponOrderQuery'); - } - /** * Filter the query by a related \Thelia\Model\CouponI18n object * diff --git a/core/lib/Thelia/Model/Base/CouponVersion.php b/core/lib/Thelia/Model/Base/CouponVersion.php index 9952d80bc..f2e0c58aa 100644 --- a/core/lib/Thelia/Model/Base/CouponVersion.php +++ b/core/lib/Thelia/Model/Base/CouponVersion.php @@ -73,24 +73,6 @@ abstract class CouponVersion implements ActiveRecordInterface */ protected $type; - /** - * The value for the title field. - * @var string - */ - protected $title; - - /** - * The value for the short_description field. - * @var string - */ - protected $short_description; - - /** - * The value for the description field. - * @var string - */ - protected $description; - /** * The value for the amount field. * @var double @@ -477,39 +459,6 @@ abstract class CouponVersion implements ActiveRecordInterface return $this->type; } - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - - return $this->title; - } - - /** - * Get the [short_description] column value. - * - * @return string - */ - public function getShortDescription() - { - - return $this->short_description; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - - return $this->description; - } - /** * Get the [amount] column value. * @@ -736,69 +685,6 @@ abstract class CouponVersion implements ActiveRecordInterface return $this; } // setType() - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return \Thelia\Model\CouponVersion 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[] = CouponVersionTableMap::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [short_description] column. - * - * @param string $v new value - * @return \Thelia\Model\CouponVersion The current object (for fluent API support) - */ - public function setShortDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->short_description !== $v) { - $this->short_description = $v; - $this->modifiedColumns[] = CouponVersionTableMap::SHORT_DESCRIPTION; - } - - - return $this; - } // setShortDescription() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return \Thelia\Model\CouponVersion 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[] = CouponVersionTableMap::DESCRIPTION; - } - - - return $this; - } // setDescription() - /** * Set the value of [amount] column. * @@ -1109,58 +995,49 @@ abstract class CouponVersion implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponVersionTableMap::translateFieldName('Type', TableMap::TYPE_PHPNAME, $indexType)]; $this->type = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponVersionTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; - $this->title = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponVersionTableMap::translateFieldName('ShortDescription', TableMap::TYPE_PHPNAME, $indexType)]; - $this->short_description = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponVersionTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; - $this->description = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponVersionTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponVersionTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)]; $this->amount = (null !== $col) ? (double) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CouponVersionTableMap::translateFieldName('IsUsed', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponVersionTableMap::translateFieldName('IsUsed', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_used = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CouponVersionTableMap::translateFieldName('IsEnabled', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponVersionTableMap::translateFieldName('IsEnabled', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_enabled = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CouponVersionTableMap::translateFieldName('ExpirationDate', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponVersionTableMap::translateFieldName('ExpirationDate', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->expiration_date = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CouponVersionTableMap::translateFieldName('SerializedRules', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CouponVersionTableMap::translateFieldName('SerializedRules', TableMap::TYPE_PHPNAME, $indexType)]; $this->serialized_rules = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponVersionTableMap::translateFieldName('IsCumulative', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CouponVersionTableMap::translateFieldName('IsCumulative', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_cumulative = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponVersionTableMap::translateFieldName('IsRemovingPostage', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CouponVersionTableMap::translateFieldName('IsRemovingPostage', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_removing_postage = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponVersionTableMap::translateFieldName('MaxUsage', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CouponVersionTableMap::translateFieldName('MaxUsage', TableMap::TYPE_PHPNAME, $indexType)]; $this->max_usage = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponVersionTableMap::translateFieldName('IsAvailableOnSpecialOffers', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponVersionTableMap::translateFieldName('IsAvailableOnSpecialOffers', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_available_on_special_offers = (null !== $col) ? (boolean) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CouponVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponVersionTableMap::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 ? 16 + $startcol : CouponVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : CouponVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; $this->version = (null !== $col) ? (int) $col : null; $this->resetModified(); @@ -1170,7 +1047,7 @@ abstract class CouponVersion implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 18; // 18 = CouponVersionTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 15; // 15 = CouponVersionTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\CouponVersion object", 0, $e); @@ -1400,15 +1277,6 @@ abstract class CouponVersion implements ActiveRecordInterface if ($this->isColumnModified(CouponVersionTableMap::TYPE)) { $modifiedColumns[':p' . $index++] = 'TYPE'; } - if ($this->isColumnModified(CouponVersionTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; - } - if ($this->isColumnModified(CouponVersionTableMap::SHORT_DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'SHORT_DESCRIPTION'; - } - if ($this->isColumnModified(CouponVersionTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; - } if ($this->isColumnModified(CouponVersionTableMap::AMOUNT)) { $modifiedColumns[':p' . $index++] = 'AMOUNT'; } @@ -1465,15 +1333,6 @@ abstract class CouponVersion implements ActiveRecordInterface case 'TYPE': $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR); break; - case 'TITLE': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case 'SHORT_DESCRIPTION': - $stmt->bindValue($identifier, $this->short_description, PDO::PARAM_STR); - break; - case 'DESCRIPTION': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; case 'AMOUNT': $stmt->bindValue($identifier, $this->amount, PDO::PARAM_STR); break; @@ -1575,48 +1434,39 @@ abstract class CouponVersion implements ActiveRecordInterface return $this->getType(); break; case 3: - return $this->getTitle(); - break; - case 4: - return $this->getShortDescription(); - break; - case 5: - return $this->getDescription(); - break; - case 6: return $this->getAmount(); break; - case 7: + case 4: return $this->getIsUsed(); break; - case 8: + case 5: return $this->getIsEnabled(); break; - case 9: + case 6: return $this->getExpirationDate(); break; - case 10: + case 7: return $this->getSerializedRules(); break; - case 11: + case 8: return $this->getIsCumulative(); break; - case 12: + case 9: return $this->getIsRemovingPostage(); break; - case 13: + case 10: return $this->getMaxUsage(); break; - case 14: + case 11: return $this->getIsAvailableOnSpecialOffers(); break; - case 15: + case 12: return $this->getCreatedAt(); break; - case 16: + case 13: return $this->getUpdatedAt(); break; - case 17: + case 14: return $this->getVersion(); break; default: @@ -1651,21 +1501,18 @@ abstract class CouponVersion implements ActiveRecordInterface $keys[0] => $this->getId(), $keys[1] => $this->getCode(), $keys[2] => $this->getType(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getShortDescription(), - $keys[5] => $this->getDescription(), - $keys[6] => $this->getAmount(), - $keys[7] => $this->getIsUsed(), - $keys[8] => $this->getIsEnabled(), - $keys[9] => $this->getExpirationDate(), - $keys[10] => $this->getSerializedRules(), - $keys[11] => $this->getIsCumulative(), - $keys[12] => $this->getIsRemovingPostage(), - $keys[13] => $this->getMaxUsage(), - $keys[14] => $this->getIsAvailableOnSpecialOffers(), - $keys[15] => $this->getCreatedAt(), - $keys[16] => $this->getUpdatedAt(), - $keys[17] => $this->getVersion(), + $keys[3] => $this->getAmount(), + $keys[4] => $this->getIsUsed(), + $keys[5] => $this->getIsEnabled(), + $keys[6] => $this->getExpirationDate(), + $keys[7] => $this->getSerializedRules(), + $keys[8] => $this->getIsCumulative(), + $keys[9] => $this->getIsRemovingPostage(), + $keys[10] => $this->getMaxUsage(), + $keys[11] => $this->getIsAvailableOnSpecialOffers(), + $keys[12] => $this->getCreatedAt(), + $keys[13] => $this->getUpdatedAt(), + $keys[14] => $this->getVersion(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1721,48 +1568,39 @@ abstract class CouponVersion implements ActiveRecordInterface $this->setType($value); break; case 3: - $this->setTitle($value); - break; - case 4: - $this->setShortDescription($value); - break; - case 5: - $this->setDescription($value); - break; - case 6: $this->setAmount($value); break; - case 7: + case 4: $this->setIsUsed($value); break; - case 8: + case 5: $this->setIsEnabled($value); break; - case 9: + case 6: $this->setExpirationDate($value); break; - case 10: + case 7: $this->setSerializedRules($value); break; - case 11: + case 8: $this->setIsCumulative($value); break; - case 12: + case 9: $this->setIsRemovingPostage($value); break; - case 13: + case 10: $this->setMaxUsage($value); break; - case 14: + case 11: $this->setIsAvailableOnSpecialOffers($value); break; - case 15: + case 12: $this->setCreatedAt($value); break; - case 16: + case 13: $this->setUpdatedAt($value); break; - case 17: + case 14: $this->setVersion($value); break; } // switch() @@ -1792,21 +1630,18 @@ abstract class CouponVersion implements ActiveRecordInterface if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setShortDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setDescription($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setAmount($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setIsUsed($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setIsEnabled($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setExpirationDate($arr[$keys[9]]); - if (array_key_exists($keys[10], $arr)) $this->setSerializedRules($arr[$keys[10]]); - if (array_key_exists($keys[11], $arr)) $this->setIsCumulative($arr[$keys[11]]); - if (array_key_exists($keys[12], $arr)) $this->setIsRemovingPostage($arr[$keys[12]]); - if (array_key_exists($keys[13], $arr)) $this->setMaxUsage($arr[$keys[13]]); - if (array_key_exists($keys[14], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[14]]); - if (array_key_exists($keys[15], $arr)) $this->setCreatedAt($arr[$keys[15]]); - if (array_key_exists($keys[16], $arr)) $this->setUpdatedAt($arr[$keys[16]]); - if (array_key_exists($keys[17], $arr)) $this->setVersion($arr[$keys[17]]); + if (array_key_exists($keys[3], $arr)) $this->setAmount($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setIsUsed($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setIsEnabled($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setExpirationDate($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setSerializedRules($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setIsCumulative($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setIsRemovingPostage($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setMaxUsage($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setVersion($arr[$keys[14]]); } /** @@ -1821,9 +1656,6 @@ abstract class CouponVersion implements ActiveRecordInterface if ($this->isColumnModified(CouponVersionTableMap::ID)) $criteria->add(CouponVersionTableMap::ID, $this->id); if ($this->isColumnModified(CouponVersionTableMap::CODE)) $criteria->add(CouponVersionTableMap::CODE, $this->code); if ($this->isColumnModified(CouponVersionTableMap::TYPE)) $criteria->add(CouponVersionTableMap::TYPE, $this->type); - if ($this->isColumnModified(CouponVersionTableMap::TITLE)) $criteria->add(CouponVersionTableMap::TITLE, $this->title); - if ($this->isColumnModified(CouponVersionTableMap::SHORT_DESCRIPTION)) $criteria->add(CouponVersionTableMap::SHORT_DESCRIPTION, $this->short_description); - if ($this->isColumnModified(CouponVersionTableMap::DESCRIPTION)) $criteria->add(CouponVersionTableMap::DESCRIPTION, $this->description); if ($this->isColumnModified(CouponVersionTableMap::AMOUNT)) $criteria->add(CouponVersionTableMap::AMOUNT, $this->amount); if ($this->isColumnModified(CouponVersionTableMap::IS_USED)) $criteria->add(CouponVersionTableMap::IS_USED, $this->is_used); if ($this->isColumnModified(CouponVersionTableMap::IS_ENABLED)) $criteria->add(CouponVersionTableMap::IS_ENABLED, $this->is_enabled); @@ -1909,9 +1741,6 @@ abstract class CouponVersion implements ActiveRecordInterface $copyObj->setId($this->getId()); $copyObj->setCode($this->getCode()); $copyObj->setType($this->getType()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setShortDescription($this->getShortDescription()); - $copyObj->setDescription($this->getDescription()); $copyObj->setAmount($this->getAmount()); $copyObj->setIsUsed($this->getIsUsed()); $copyObj->setIsEnabled($this->getIsEnabled()); @@ -2010,9 +1839,6 @@ abstract class CouponVersion implements ActiveRecordInterface $this->id = null; $this->code = null; $this->type = null; - $this->title = null; - $this->short_description = null; - $this->description = null; $this->amount = null; $this->is_used = null; $this->is_enabled = null; diff --git a/core/lib/Thelia/Model/Base/CouponVersionQuery.php b/core/lib/Thelia/Model/Base/CouponVersionQuery.php index 71ce72aee..ed7e587e7 100644 --- a/core/lib/Thelia/Model/Base/CouponVersionQuery.php +++ b/core/lib/Thelia/Model/Base/CouponVersionQuery.php @@ -24,9 +24,6 @@ use Thelia\Model\Map\CouponVersionTableMap; * @method ChildCouponVersionQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildCouponVersionQuery orderByCode($order = Criteria::ASC) Order by the code column * @method ChildCouponVersionQuery orderByType($order = Criteria::ASC) Order by the type column - * @method ChildCouponVersionQuery orderByTitle($order = Criteria::ASC) Order by the title column - * @method ChildCouponVersionQuery orderByShortDescription($order = Criteria::ASC) Order by the short_description column - * @method ChildCouponVersionQuery orderByDescription($order = Criteria::ASC) Order by the description column * @method ChildCouponVersionQuery orderByAmount($order = Criteria::ASC) Order by the amount column * @method ChildCouponVersionQuery orderByIsUsed($order = Criteria::ASC) Order by the is_used column * @method ChildCouponVersionQuery orderByIsEnabled($order = Criteria::ASC) Order by the is_enabled column @@ -43,9 +40,6 @@ use Thelia\Model\Map\CouponVersionTableMap; * @method ChildCouponVersionQuery groupById() Group by the id column * @method ChildCouponVersionQuery groupByCode() Group by the code column * @method ChildCouponVersionQuery groupByType() Group by the type column - * @method ChildCouponVersionQuery groupByTitle() Group by the title column - * @method ChildCouponVersionQuery groupByShortDescription() Group by the short_description column - * @method ChildCouponVersionQuery groupByDescription() Group by the description column * @method ChildCouponVersionQuery groupByAmount() Group by the amount column * @method ChildCouponVersionQuery groupByIsUsed() Group by the is_used column * @method ChildCouponVersionQuery groupByIsEnabled() Group by the is_enabled column @@ -73,9 +67,6 @@ use Thelia\Model\Map\CouponVersionTableMap; * @method ChildCouponVersion findOneById(int $id) Return the first ChildCouponVersion filtered by the id column * @method ChildCouponVersion findOneByCode(string $code) Return the first ChildCouponVersion filtered by the code column * @method ChildCouponVersion findOneByType(string $type) Return the first ChildCouponVersion filtered by the type column - * @method ChildCouponVersion findOneByTitle(string $title) Return the first ChildCouponVersion filtered by the title column - * @method ChildCouponVersion findOneByShortDescription(string $short_description) Return the first ChildCouponVersion filtered by the short_description column - * @method ChildCouponVersion findOneByDescription(string $description) Return the first ChildCouponVersion filtered by the description column * @method ChildCouponVersion findOneByAmount(double $amount) Return the first ChildCouponVersion filtered by the amount column * @method ChildCouponVersion findOneByIsUsed(int $is_used) Return the first ChildCouponVersion filtered by the is_used column * @method ChildCouponVersion findOneByIsEnabled(int $is_enabled) Return the first ChildCouponVersion filtered by the is_enabled column @@ -92,9 +83,6 @@ use Thelia\Model\Map\CouponVersionTableMap; * @method array findById(int $id) Return ChildCouponVersion objects filtered by the id column * @method array findByCode(string $code) Return ChildCouponVersion objects filtered by the code column * @method array findByType(string $type) Return ChildCouponVersion objects filtered by the type column - * @method array findByTitle(string $title) Return ChildCouponVersion objects filtered by the title column - * @method array findByShortDescription(string $short_description) Return ChildCouponVersion objects filtered by the short_description column - * @method array findByDescription(string $description) Return ChildCouponVersion objects filtered by the description column * @method array findByAmount(double $amount) Return ChildCouponVersion objects filtered by the amount column * @method array findByIsUsed(int $is_used) Return ChildCouponVersion objects filtered by the is_used column * @method array findByIsEnabled(int $is_enabled) Return ChildCouponVersion objects filtered by the is_enabled column @@ -195,7 +183,7 @@ abstract class CouponVersionQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, TYPE, TITLE, SHORT_DESCRIPTION, DESCRIPTION, AMOUNT, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES, IS_CUMULATIVE, IS_REMOVING_POSTAGE, MAX_USAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, CREATED_AT, UPDATED_AT, VERSION FROM coupon_version WHERE ID = :p0 AND VERSION = :p1'; + $sql = 'SELECT ID, CODE, TYPE, AMOUNT, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES, IS_CUMULATIVE, IS_REMOVING_POSTAGE, MAX_USAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, CREATED_AT, UPDATED_AT, VERSION FROM coupon_version WHERE ID = :p0 AND VERSION = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); @@ -397,93 +385,6 @@ abstract class CouponVersionQuery extends ModelCriteria return $this->addUsingAlias(CouponVersionTableMap::TYPE, $type, $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 ChildCouponVersionQuery 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(CouponVersionTableMap::TITLE, $title, $comparison); - } - - /** - * Filter the query on the short_description column - * - * Example usage: - * - * $query->filterByShortDescription('fooValue'); // WHERE short_description = 'fooValue' - * $query->filterByShortDescription('%fooValue%'); // WHERE short_description LIKE '%fooValue%' - * - * - * @param string $shortDescription The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponVersionQuery The current query, for fluid interface - */ - public function filterByShortDescription($shortDescription = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($shortDescription)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $shortDescription)) { - $shortDescription = str_replace('*', '%', $shortDescription); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CouponVersionTableMap::SHORT_DESCRIPTION, $shortDescription, $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 ChildCouponVersionQuery 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(CouponVersionTableMap::DESCRIPTION, $description, $comparison); - } - /** * Filter the query on the amount column * diff --git a/core/lib/Thelia/Model/Base/Folder.php b/core/lib/Thelia/Model/Base/Folder.php index 5c3e7aaa3..1b0c80d94 100755 --- a/core/lib/Thelia/Model/Base/Folder.php +++ b/core/lib/Thelia/Model/Base/Folder.php @@ -31,6 +31,8 @@ use Thelia\Model\FolderImageQuery as ChildFolderImageQuery; use Thelia\Model\FolderQuery as ChildFolderQuery; use Thelia\Model\FolderVersion as ChildFolderVersion; use Thelia\Model\FolderVersionQuery as ChildFolderVersionQuery; +use Thelia\Model\Rewriting as ChildRewriting; +use Thelia\Model\RewritingQuery as ChildRewritingQuery; use Thelia\Model\Map\FolderTableMap; use Thelia\Model\Map\FolderVersionTableMap; @@ -123,6 +125,12 @@ abstract class Folder implements ActiveRecordInterface */ protected $version_created_by; + /** + * @var ObjectCollection|ChildRewriting[] Collection to store aggregation of ChildRewriting objects. + */ + protected $collRewritings; + protected $collRewritingsPartial; + /** * @var ObjectCollection|ChildContentFolder[] Collection to store aggregation of ChildContentFolder objects. */ @@ -194,6 +202,12 @@ abstract class Folder implements ActiveRecordInterface */ protected $contentsScheduledForDeletion = null; + /** + * An array of objects scheduled for deletion. + * @var ObjectCollection + */ + protected $rewritingsScheduledForDeletion = null; + /** * An array of objects scheduled for deletion. * @var ObjectCollection @@ -951,6 +965,8 @@ abstract class Folder implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? + $this->collRewritings = null; + $this->collContentFolders = null; $this->collFolderImages = null; @@ -1134,6 +1150,23 @@ abstract class Folder implements ActiveRecordInterface } } + if ($this->rewritingsScheduledForDeletion !== null) { + if (!$this->rewritingsScheduledForDeletion->isEmpty()) { + \Thelia\Model\RewritingQuery::create() + ->filterByPrimaryKeys($this->rewritingsScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->rewritingsScheduledForDeletion = null; + } + } + + if ($this->collRewritings !== null) { + foreach ($this->collRewritings as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + if ($this->contentFoldersScheduledForDeletion !== null) { if (!$this->contentFoldersScheduledForDeletion->isEmpty()) { \Thelia\Model\ContentFolderQuery::create() @@ -1445,6 +1478,9 @@ abstract class Folder implements ActiveRecordInterface } if ($includeForeignObjects) { + if (null !== $this->collRewritings) { + $result['Rewritings'] = $this->collRewritings->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } if (null !== $this->collContentFolders) { $result['ContentFolders'] = $this->collContentFolders->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } @@ -1651,6 +1687,12 @@ abstract class Folder implements ActiveRecordInterface // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); + foreach ($this->getRewritings() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addRewriting($relObj->copy($deepCopy)); + } + } + foreach ($this->getContentFolders() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addContentFolder($relObj->copy($deepCopy)); @@ -1722,6 +1764,9 @@ abstract class Folder implements ActiveRecordInterface */ public function initRelation($relationName) { + if ('Rewriting' == $relationName) { + return $this->initRewritings(); + } if ('ContentFolder' == $relationName) { return $this->initContentFolders(); } @@ -1739,6 +1784,299 @@ abstract class Folder implements ActiveRecordInterface } } + /** + * Clears out the collRewritings 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 addRewritings() + */ + public function clearRewritings() + { + $this->collRewritings = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Reset is the collRewritings collection loaded partially. + */ + public function resetPartialRewritings($v = true) + { + $this->collRewritingsPartial = $v; + } + + /** + * Initializes the collRewritings collection. + * + * By default this just sets the collRewritings collection to an empty array (like clearcollRewritings()); + * 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 initRewritings($overrideExisting = true) + { + if (null !== $this->collRewritings && !$overrideExisting) { + return; + } + $this->collRewritings = new ObjectCollection(); + $this->collRewritings->setModel('\Thelia\Model\Rewriting'); + } + + /** + * Gets an array of ChildRewriting 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 ChildFolder 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|ChildRewriting[] List of ChildRewriting objects + * @throws PropelException + */ + public function getRewritings($criteria = null, ConnectionInterface $con = null) + { + $partial = $this->collRewritingsPartial && !$this->isNew(); + if (null === $this->collRewritings || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collRewritings) { + // return empty collection + $this->initRewritings(); + } else { + $collRewritings = ChildRewritingQuery::create(null, $criteria) + ->filterByFolder($this) + ->find($con); + + if (null !== $criteria) { + if (false !== $this->collRewritingsPartial && count($collRewritings)) { + $this->initRewritings(false); + + foreach ($collRewritings as $obj) { + if (false == $this->collRewritings->contains($obj)) { + $this->collRewritings->append($obj); + } + } + + $this->collRewritingsPartial = true; + } + + $collRewritings->getInternalIterator()->rewind(); + + return $collRewritings; + } + + if ($partial && $this->collRewritings) { + foreach ($this->collRewritings as $obj) { + if ($obj->isNew()) { + $collRewritings[] = $obj; + } + } + } + + $this->collRewritings = $collRewritings; + $this->collRewritingsPartial = false; + } + } + + return $this->collRewritings; + } + + /** + * Sets a collection of Rewriting 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 $rewritings A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return ChildFolder The current object (for fluent API support) + */ + public function setRewritings(Collection $rewritings, ConnectionInterface $con = null) + { + $rewritingsToDelete = $this->getRewritings(new Criteria(), $con)->diff($rewritings); + + + $this->rewritingsScheduledForDeletion = $rewritingsToDelete; + + foreach ($rewritingsToDelete as $rewritingRemoved) { + $rewritingRemoved->setFolder(null); + } + + $this->collRewritings = null; + foreach ($rewritings as $rewriting) { + $this->addRewriting($rewriting); + } + + $this->collRewritings = $rewritings; + $this->collRewritingsPartial = false; + + return $this; + } + + /** + * Returns the number of related Rewriting objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param ConnectionInterface $con + * @return int Count of related Rewriting objects. + * @throws PropelException + */ + public function countRewritings(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + { + $partial = $this->collRewritingsPartial && !$this->isNew(); + if (null === $this->collRewritings || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collRewritings) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getRewritings()); + } + + $query = ChildRewritingQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByFolder($this) + ->count($con); + } + + return count($this->collRewritings); + } + + /** + * Method called to associate a ChildRewriting object to this object + * through the ChildRewriting foreign key attribute. + * + * @param ChildRewriting $l ChildRewriting + * @return \Thelia\Model\Folder The current object (for fluent API support) + */ + public function addRewriting(ChildRewriting $l) + { + if ($this->collRewritings === null) { + $this->initRewritings(); + $this->collRewritingsPartial = true; + } + + if (!in_array($l, $this->collRewritings->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddRewriting($l); + } + + return $this; + } + + /** + * @param Rewriting $rewriting The rewriting object to add. + */ + protected function doAddRewriting($rewriting) + { + $this->collRewritings[]= $rewriting; + $rewriting->setFolder($this); + } + + /** + * @param Rewriting $rewriting The rewriting object to remove. + * @return ChildFolder The current object (for fluent API support) + */ + public function removeRewriting($rewriting) + { + if ($this->getRewritings()->contains($rewriting)) { + $this->collRewritings->remove($this->collRewritings->search($rewriting)); + if (null === $this->rewritingsScheduledForDeletion) { + $this->rewritingsScheduledForDeletion = clone $this->collRewritings; + $this->rewritingsScheduledForDeletion->clear(); + } + $this->rewritingsScheduledForDeletion[]= $rewriting; + $rewriting->setFolder(null); + } + + return $this; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this Folder is new, it will return + * an empty collection; or if this Folder has previously + * been saved, it will retrieve related Rewritings from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in Folder. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return Collection|ChildRewriting[] List of ChildRewriting objects + */ + public function getRewritingsJoinProduct($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) + { + $query = ChildRewritingQuery::create(null, $criteria); + $query->joinWith('Product', $joinBehavior); + + return $this->getRewritings($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this Folder is new, it will return + * an empty collection; or if this Folder has previously + * been saved, it will retrieve related Rewritings from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in Folder. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return Collection|ChildRewriting[] List of ChildRewriting objects + */ + public function getRewritingsJoinCategory($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) + { + $query = ChildRewritingQuery::create(null, $criteria); + $query->joinWith('Category', $joinBehavior); + + return $this->getRewritings($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this Folder is new, it will return + * an empty collection; or if this Folder has previously + * been saved, it will retrieve related Rewritings from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in Folder. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return Collection|ChildRewriting[] List of ChildRewriting objects + */ + public function getRewritingsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) + { + $query = ChildRewritingQuery::create(null, $criteria); + $query->joinWith('Content', $joinBehavior); + + return $this->getRewritings($query, $con); + } + /** * Clears out the collContentFolders collection * @@ -3084,6 +3422,11 @@ abstract class Folder implements ActiveRecordInterface public function clearAllReferences($deep = false) { if ($deep) { + if ($this->collRewritings) { + foreach ($this->collRewritings as $o) { + $o->clearAllReferences($deep); + } + } if ($this->collContentFolders) { foreach ($this->collContentFolders as $o) { $o->clearAllReferences($deep); @@ -3120,6 +3463,10 @@ abstract class Folder implements ActiveRecordInterface $this->currentLocale = 'en_EN'; $this->currentTranslations = null; + if ($this->collRewritings instanceof Collection) { + $this->collRewritings->clearIterator(); + } + $this->collRewritings = null; if ($this->collContentFolders instanceof Collection) { $this->collContentFolders->clearIterator(); } diff --git a/core/lib/Thelia/Model/Base/FolderQuery.php b/core/lib/Thelia/Model/Base/FolderQuery.php index 28f9bc8a3..22d2f3735 100755 --- a/core/lib/Thelia/Model/Base/FolderQuery.php +++ b/core/lib/Thelia/Model/Base/FolderQuery.php @@ -46,6 +46,10 @@ use Thelia\Model\Map\FolderTableMap; * @method ChildFolderQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildFolderQuery innerJoin($relation) Adds a INNER JOIN clause to the query * + * @method ChildFolderQuery leftJoinRewriting($relationAlias = null) Adds a LEFT JOIN clause to the query using the Rewriting relation + * @method ChildFolderQuery rightJoinRewriting($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rewriting relation + * @method ChildFolderQuery innerJoinRewriting($relationAlias = null) Adds a INNER JOIN clause to the query using the Rewriting relation + * * @method ChildFolderQuery leftJoinContentFolder($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentFolder relation * @method ChildFolderQuery rightJoinContentFolder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentFolder relation * @method ChildFolderQuery innerJoinContentFolder($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentFolder relation @@ -635,6 +639,79 @@ abstract class FolderQuery extends ModelCriteria return $this->addUsingAlias(FolderTableMap::VERSION_CREATED_BY, $versionCreatedBy, $comparison); } + /** + * Filter the query by a related \Thelia\Model\Rewriting object + * + * @param \Thelia\Model\Rewriting|ObjectCollection $rewriting the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildFolderQuery The current query, for fluid interface + */ + public function filterByRewriting($rewriting, $comparison = null) + { + if ($rewriting instanceof \Thelia\Model\Rewriting) { + return $this + ->addUsingAlias(FolderTableMap::ID, $rewriting->getFolderId(), $comparison); + } elseif ($rewriting instanceof ObjectCollection) { + return $this + ->useRewritingQuery() + ->filterByPrimaryKeys($rewriting->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByRewriting() only accepts arguments of type \Thelia\Model\Rewriting or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the Rewriting relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildFolderQuery The current query, for fluid interface + */ + public function joinRewriting($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Rewriting'); + + // 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, 'Rewriting'); + } + + return $this; + } + + /** + * Use the Rewriting relation Rewriting 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\RewritingQuery A secondary query class using the current class as primary query + */ + public function useRewritingQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinRewriting($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Rewriting', '\Thelia\Model\RewritingQuery'); + } + /** * Filter the query by a related \Thelia\Model\ContentFolder object * diff --git a/core/lib/Thelia/Model/Base/Order.php b/core/lib/Thelia/Model/Base/Order.php index ccf7922f3..b815aff34 100755 --- a/core/lib/Thelia/Model/Base/Order.php +++ b/core/lib/Thelia/Model/Base/Order.php @@ -2842,31 +2842,6 @@ abstract class Order implements ActiveRecordInterface return $this; } - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Order is new, it will return - * an empty collection; or if this Order has previously - * been saved, it will retrieve related CouponOrders from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Order. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildCouponOrder[] List of ChildCouponOrder objects - */ - public function getCouponOrdersJoinCoupon($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildCouponOrderQuery::create(null, $criteria); - $query->joinWith('Coupon', $joinBehavior); - - return $this->getCouponOrders($query, $con); - } - /** * Clears the current object and sets all attributes to their default values */ diff --git a/core/lib/Thelia/Model/Base/Product.php b/core/lib/Thelia/Model/Base/Product.php index ce2e2a645..707bd0904 100755 --- a/core/lib/Thelia/Model/Base/Product.php +++ b/core/lib/Thelia/Model/Base/Product.php @@ -41,6 +41,8 @@ use Thelia\Model\ProductSaleElements as ChildProductSaleElements; use Thelia\Model\ProductSaleElementsQuery as ChildProductSaleElementsQuery; use Thelia\Model\ProductVersion as ChildProductVersion; use Thelia\Model\ProductVersionQuery as ChildProductVersionQuery; +use Thelia\Model\Rewriting as ChildRewriting; +use Thelia\Model\RewritingQuery as ChildRewritingQuery; use Thelia\Model\TaxRule as ChildTaxRule; use Thelia\Model\TaxRuleQuery as ChildTaxRuleQuery; use Thelia\Model\Map\ProductTableMap; @@ -189,6 +191,12 @@ abstract class Product implements ActiveRecordInterface protected $collAccessoriesRelatedByAccessory; protected $collAccessoriesRelatedByAccessoryPartial; + /** + * @var ObjectCollection|ChildRewriting[] Collection to store aggregation of ChildRewriting objects. + */ + protected $collRewritings; + protected $collRewritingsPartial; + /** * @var ObjectCollection|ChildCartItem[] Collection to store aggregation of ChildCartItem objects. */ @@ -318,6 +326,12 @@ abstract class Product implements ActiveRecordInterface */ protected $accessoriesRelatedByAccessoryScheduledForDeletion = null; + /** + * An array of objects scheduled for deletion. + * @var ObjectCollection + */ + protected $rewritingsScheduledForDeletion = null; + /** * An array of objects scheduled for deletion. * @var ObjectCollection @@ -1131,6 +1145,8 @@ abstract class Product implements ActiveRecordInterface $this->collAccessoriesRelatedByAccessory = null; + $this->collRewritings = null; + $this->collCartItems = null; $this->collProductAssociatedContents = null; @@ -1499,6 +1515,23 @@ abstract class Product implements ActiveRecordInterface } } + if ($this->rewritingsScheduledForDeletion !== null) { + if (!$this->rewritingsScheduledForDeletion->isEmpty()) { + \Thelia\Model\RewritingQuery::create() + ->filterByPrimaryKeys($this->rewritingsScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->rewritingsScheduledForDeletion = null; + } + } + + if ($this->collRewritings !== null) { + foreach ($this->collRewritings as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + if ($this->cartItemsScheduledForDeletion !== null) { if (!$this->cartItemsScheduledForDeletion->isEmpty()) { \Thelia\Model\CartItemQuery::create() @@ -1827,6 +1860,9 @@ abstract class Product implements ActiveRecordInterface if (null !== $this->collAccessoriesRelatedByAccessory) { $result['AccessoriesRelatedByAccessory'] = $this->collAccessoriesRelatedByAccessory->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } + if (null !== $this->collRewritings) { + $result['Rewritings'] = $this->collRewritings->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } if (null !== $this->collCartItems) { $result['CartItems'] = $this->collCartItems->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } @@ -2078,6 +2114,12 @@ abstract class Product implements ActiveRecordInterface } } + foreach ($this->getRewritings() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addRewriting($relObj->copy($deepCopy)); + } + } + foreach ($this->getCartItems() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCartItem($relObj->copy($deepCopy)); @@ -2215,6 +2257,9 @@ abstract class Product implements ActiveRecordInterface if ('AccessoryRelatedByAccessory' == $relationName) { return $this->initAccessoriesRelatedByAccessory(); } + if ('Rewriting' == $relationName) { + return $this->initRewritings(); + } if ('CartItem' == $relationName) { return $this->initCartItems(); } @@ -3833,6 +3878,299 @@ abstract class Product implements ActiveRecordInterface return $this; } + /** + * Clears out the collRewritings 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 addRewritings() + */ + public function clearRewritings() + { + $this->collRewritings = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Reset is the collRewritings collection loaded partially. + */ + public function resetPartialRewritings($v = true) + { + $this->collRewritingsPartial = $v; + } + + /** + * Initializes the collRewritings collection. + * + * By default this just sets the collRewritings collection to an empty array (like clearcollRewritings()); + * 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 initRewritings($overrideExisting = true) + { + if (null !== $this->collRewritings && !$overrideExisting) { + return; + } + $this->collRewritings = new ObjectCollection(); + $this->collRewritings->setModel('\Thelia\Model\Rewriting'); + } + + /** + * Gets an array of ChildRewriting 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 ChildProduct 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|ChildRewriting[] List of ChildRewriting objects + * @throws PropelException + */ + public function getRewritings($criteria = null, ConnectionInterface $con = null) + { + $partial = $this->collRewritingsPartial && !$this->isNew(); + if (null === $this->collRewritings || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collRewritings) { + // return empty collection + $this->initRewritings(); + } else { + $collRewritings = ChildRewritingQuery::create(null, $criteria) + ->filterByProduct($this) + ->find($con); + + if (null !== $criteria) { + if (false !== $this->collRewritingsPartial && count($collRewritings)) { + $this->initRewritings(false); + + foreach ($collRewritings as $obj) { + if (false == $this->collRewritings->contains($obj)) { + $this->collRewritings->append($obj); + } + } + + $this->collRewritingsPartial = true; + } + + $collRewritings->getInternalIterator()->rewind(); + + return $collRewritings; + } + + if ($partial && $this->collRewritings) { + foreach ($this->collRewritings as $obj) { + if ($obj->isNew()) { + $collRewritings[] = $obj; + } + } + } + + $this->collRewritings = $collRewritings; + $this->collRewritingsPartial = false; + } + } + + return $this->collRewritings; + } + + /** + * Sets a collection of Rewriting 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 $rewritings A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return ChildProduct The current object (for fluent API support) + */ + public function setRewritings(Collection $rewritings, ConnectionInterface $con = null) + { + $rewritingsToDelete = $this->getRewritings(new Criteria(), $con)->diff($rewritings); + + + $this->rewritingsScheduledForDeletion = $rewritingsToDelete; + + foreach ($rewritingsToDelete as $rewritingRemoved) { + $rewritingRemoved->setProduct(null); + } + + $this->collRewritings = null; + foreach ($rewritings as $rewriting) { + $this->addRewriting($rewriting); + } + + $this->collRewritings = $rewritings; + $this->collRewritingsPartial = false; + + return $this; + } + + /** + * Returns the number of related Rewriting objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param ConnectionInterface $con + * @return int Count of related Rewriting objects. + * @throws PropelException + */ + public function countRewritings(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + { + $partial = $this->collRewritingsPartial && !$this->isNew(); + if (null === $this->collRewritings || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collRewritings) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getRewritings()); + } + + $query = ChildRewritingQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByProduct($this) + ->count($con); + } + + return count($this->collRewritings); + } + + /** + * Method called to associate a ChildRewriting object to this object + * through the ChildRewriting foreign key attribute. + * + * @param ChildRewriting $l ChildRewriting + * @return \Thelia\Model\Product The current object (for fluent API support) + */ + public function addRewriting(ChildRewriting $l) + { + if ($this->collRewritings === null) { + $this->initRewritings(); + $this->collRewritingsPartial = true; + } + + if (!in_array($l, $this->collRewritings->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddRewriting($l); + } + + return $this; + } + + /** + * @param Rewriting $rewriting The rewriting object to add. + */ + protected function doAddRewriting($rewriting) + { + $this->collRewritings[]= $rewriting; + $rewriting->setProduct($this); + } + + /** + * @param Rewriting $rewriting The rewriting object to remove. + * @return ChildProduct The current object (for fluent API support) + */ + public function removeRewriting($rewriting) + { + if ($this->getRewritings()->contains($rewriting)) { + $this->collRewritings->remove($this->collRewritings->search($rewriting)); + if (null === $this->rewritingsScheduledForDeletion) { + $this->rewritingsScheduledForDeletion = clone $this->collRewritings; + $this->rewritingsScheduledForDeletion->clear(); + } + $this->rewritingsScheduledForDeletion[]= $rewriting; + $rewriting->setProduct(null); + } + + return $this; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this Product is new, it will return + * an empty collection; or if this Product has previously + * been saved, it will retrieve related Rewritings from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in Product. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return Collection|ChildRewriting[] List of ChildRewriting objects + */ + public function getRewritingsJoinCategory($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) + { + $query = ChildRewritingQuery::create(null, $criteria); + $query->joinWith('Category', $joinBehavior); + + return $this->getRewritings($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this Product is new, it will return + * an empty collection; or if this Product has previously + * been saved, it will retrieve related Rewritings from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in Product. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return Collection|ChildRewriting[] List of ChildRewriting objects + */ + public function getRewritingsJoinFolder($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) + { + $query = ChildRewritingQuery::create(null, $criteria); + $query->joinWith('Folder', $joinBehavior); + + return $this->getRewritings($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this Product is new, it will return + * an empty collection; or if this Product has previously + * been saved, it will retrieve related Rewritings from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in Product. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return Collection|ChildRewriting[] List of ChildRewriting objects + */ + public function getRewritingsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) + { + $query = ChildRewritingQuery::create(null, $criteria); + $query->joinWith('Content', $joinBehavior); + + return $this->getRewritings($query, $con); + } + /** * Clears out the collCartItems collection * @@ -5409,6 +5747,11 @@ abstract class Product implements ActiveRecordInterface $o->clearAllReferences($deep); } } + if ($this->collRewritings) { + foreach ($this->collRewritings as $o) { + $o->clearAllReferences($deep); + } + } if ($this->collCartItems) { foreach ($this->collCartItems as $o) { $o->clearAllReferences($deep); @@ -5478,6 +5821,10 @@ abstract class Product implements ActiveRecordInterface $this->collAccessoriesRelatedByAccessory->clearIterator(); } $this->collAccessoriesRelatedByAccessory = null; + if ($this->collRewritings instanceof Collection) { + $this->collRewritings->clearIterator(); + } + $this->collRewritings = null; if ($this->collCartItems instanceof Collection) { $this->collCartItems->clearIterator(); } diff --git a/core/lib/Thelia/Model/Base/ProductQuery.php b/core/lib/Thelia/Model/Base/ProductQuery.php index 3254bb08b..8a4d4ed18 100755 --- a/core/lib/Thelia/Model/Base/ProductQuery.php +++ b/core/lib/Thelia/Model/Base/ProductQuery.php @@ -80,6 +80,10 @@ use Thelia\Model\Map\ProductTableMap; * @method ChildProductQuery rightJoinAccessoryRelatedByAccessory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AccessoryRelatedByAccessory relation * @method ChildProductQuery innerJoinAccessoryRelatedByAccessory($relationAlias = null) Adds a INNER JOIN clause to the query using the AccessoryRelatedByAccessory relation * + * @method ChildProductQuery leftJoinRewriting($relationAlias = null) Adds a LEFT JOIN clause to the query using the Rewriting relation + * @method ChildProductQuery rightJoinRewriting($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rewriting relation + * @method ChildProductQuery innerJoinRewriting($relationAlias = null) Adds a INNER JOIN clause to the query using the Rewriting relation + * * @method ChildProductQuery leftJoinCartItem($relationAlias = null) Adds a LEFT JOIN clause to the query using the CartItem relation * @method ChildProductQuery rightJoinCartItem($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CartItem relation * @method ChildProductQuery innerJoinCartItem($relationAlias = null) Adds a INNER JOIN clause to the query using the CartItem relation @@ -1284,6 +1288,79 @@ abstract class ProductQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'AccessoryRelatedByAccessory', '\Thelia\Model\AccessoryQuery'); } + /** + * Filter the query by a related \Thelia\Model\Rewriting object + * + * @param \Thelia\Model\Rewriting|ObjectCollection $rewriting the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildProductQuery The current query, for fluid interface + */ + public function filterByRewriting($rewriting, $comparison = null) + { + if ($rewriting instanceof \Thelia\Model\Rewriting) { + return $this + ->addUsingAlias(ProductTableMap::ID, $rewriting->getProductId(), $comparison); + } elseif ($rewriting instanceof ObjectCollection) { + return $this + ->useRewritingQuery() + ->filterByPrimaryKeys($rewriting->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByRewriting() only accepts arguments of type \Thelia\Model\Rewriting or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the Rewriting relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildProductQuery The current query, for fluid interface + */ + public function joinRewriting($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Rewriting'); + + // 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, 'Rewriting'); + } + + return $this; + } + + /** + * Use the Rewriting relation Rewriting 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\RewritingQuery A secondary query class using the current class as primary query + */ + public function useRewritingQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinRewriting($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Rewriting', '\Thelia\Model\RewritingQuery'); + } + /** * Filter the query by a related \Thelia\Model\CartItem object * diff --git a/core/lib/Thelia/Model/Map/CategoryTableMap.php b/core/lib/Thelia/Model/Map/CategoryTableMap.php index 5e692c00f..f94b14e5f 100755 --- a/core/lib/Thelia/Model/Map/CategoryTableMap.php +++ b/core/lib/Thelia/Model/Map/CategoryTableMap.php @@ -193,6 +193,7 @@ class CategoryTableMap extends TableMap $this->addRelation('ProductCategory', '\\Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'ProductCategories'); $this->addRelation('FeatureCategory', '\\Thelia\\Model\\FeatureCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'FeatureCategories'); $this->addRelation('AttributeCategory', '\\Thelia\\Model\\AttributeCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'AttributeCategories'); + $this->addRelation('Rewriting', '\\Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'Rewritings'); $this->addRelation('CategoryImage', '\\Thelia\\Model\\CategoryImage', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryImages'); $this->addRelation('CategoryDocument', '\\Thelia\\Model\\CategoryDocument', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryDocuments'); $this->addRelation('CategoryAssociatedContent', '\\Thelia\\Model\\CategoryAssociatedContent', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryAssociatedContents'); @@ -227,6 +228,7 @@ class CategoryTableMap extends TableMap ProductCategoryTableMap::clearInstancePool(); FeatureCategoryTableMap::clearInstancePool(); AttributeCategoryTableMap::clearInstancePool(); + RewritingTableMap::clearInstancePool(); CategoryImageTableMap::clearInstancePool(); CategoryDocumentTableMap::clearInstancePool(); CategoryAssociatedContentTableMap::clearInstancePool(); diff --git a/core/lib/Thelia/Model/Map/ContentTableMap.php b/core/lib/Thelia/Model/Map/ContentTableMap.php index f89e7fd20..5b6787a28 100755 --- a/core/lib/Thelia/Model/Map/ContentTableMap.php +++ b/core/lib/Thelia/Model/Map/ContentTableMap.php @@ -184,6 +184,7 @@ class ContentTableMap extends TableMap */ public function buildRelations() { + $this->addRelation('Rewriting', '\\Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'Rewritings'); $this->addRelation('ContentFolder', '\\Thelia\\Model\\ContentFolder', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentFolders'); $this->addRelation('ContentImage', '\\Thelia\\Model\\ContentImage', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentImages'); $this->addRelation('ContentDocument', '\\Thelia\\Model\\ContentDocument', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentDocuments'); @@ -215,6 +216,7 @@ class ContentTableMap extends TableMap { // Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + RewritingTableMap::clearInstancePool(); ContentFolderTableMap::clearInstancePool(); ContentImageTableMap::clearInstancePool(); ContentDocumentTableMap::clearInstancePool(); diff --git a/core/lib/Thelia/Model/Map/CouponI18nTableMap.php b/core/lib/Thelia/Model/Map/CouponI18nTableMap.php index 99d49216c..4511a553b 100644 --- a/core/lib/Thelia/Model/Map/CouponI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/CouponI18nTableMap.php @@ -57,7 +57,7 @@ class CouponI18nTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 2; + const NUM_COLUMNS = 5; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class CouponI18nTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 2; + const NUM_HYDRATE_COLUMNS = 5; /** * the column name for the ID field @@ -79,6 +79,21 @@ class CouponI18nTableMap extends TableMap */ const LOCALE = 'coupon_i18n.LOCALE'; + /** + * the column name for the TITLE field + */ + const TITLE = 'coupon_i18n.TITLE'; + + /** + * the column name for the SHORT_DESCRIPTION field + */ + const SHORT_DESCRIPTION = 'coupon_i18n.SHORT_DESCRIPTION'; + + /** + * the column name for the DESCRIPTION field + */ + const DESCRIPTION = 'coupon_i18n.DESCRIPTION'; + /** * The default string format for model objects of the related table */ @@ -91,12 +106,12 @@ class CouponI18nTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Locale', ), - self::TYPE_STUDLYPHPNAME => array('id', 'locale', ), - self::TYPE_COLNAME => array(CouponI18nTableMap::ID, CouponI18nTableMap::LOCALE, ), - self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', ), - self::TYPE_FIELDNAME => array('id', 'locale', ), - self::TYPE_NUM => array(0, 1, ) + self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'ShortDescription', 'Description', ), + self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'shortDescription', 'description', ), + self::TYPE_COLNAME => array(CouponI18nTableMap::ID, CouponI18nTableMap::LOCALE, CouponI18nTableMap::TITLE, CouponI18nTableMap::SHORT_DESCRIPTION, CouponI18nTableMap::DESCRIPTION, ), + self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', ), + self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'short_description', 'description', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) ); /** @@ -106,12 +121,12 @@ class CouponI18nTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, ), - self::TYPE_COLNAME => array(CouponI18nTableMap::ID => 0, CouponI18nTableMap::LOCALE => 1, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, ), - self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, ), - self::TYPE_NUM => array(0, 1, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'ShortDescription' => 3, 'Description' => 4, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'shortDescription' => 3, 'description' => 4, ), + self::TYPE_COLNAME => array(CouponI18nTableMap::ID => 0, CouponI18nTableMap::LOCALE => 1, CouponI18nTableMap::TITLE => 2, CouponI18nTableMap::SHORT_DESCRIPTION => 3, CouponI18nTableMap::DESCRIPTION => 4, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'SHORT_DESCRIPTION' => 3, 'DESCRIPTION' => 4, ), + self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'short_description' => 3, 'description' => 4, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) ); /** @@ -132,6 +147,9 @@ class CouponI18nTableMap extends TableMap // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'coupon', 'ID', true, null, null); $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null); + $this->addColumn('SHORT_DESCRIPTION', 'ShortDescription', 'LONGVARCHAR', true, null, null); + $this->addColumn('DESCRIPTION', 'Description', 'CLOB', true, null, null); } // initialize() /** @@ -331,9 +349,15 @@ class CouponI18nTableMap extends TableMap if (null === $alias) { $criteria->addSelectColumn(CouponI18nTableMap::ID); $criteria->addSelectColumn(CouponI18nTableMap::LOCALE); + $criteria->addSelectColumn(CouponI18nTableMap::TITLE); + $criteria->addSelectColumn(CouponI18nTableMap::SHORT_DESCRIPTION); + $criteria->addSelectColumn(CouponI18nTableMap::DESCRIPTION); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.LOCALE'); + $criteria->addSelectColumn($alias . '.TITLE'); + $criteria->addSelectColumn($alias . '.SHORT_DESCRIPTION'); + $criteria->addSelectColumn($alias . '.DESCRIPTION'); } } diff --git a/core/lib/Thelia/Model/Map/CouponOrderTableMap.php b/core/lib/Thelia/Model/Map/CouponOrderTableMap.php index 1826bcb70..d96183505 100755 --- a/core/lib/Thelia/Model/Map/CouponOrderTableMap.php +++ b/core/lib/Thelia/Model/Map/CouponOrderTableMap.php @@ -57,7 +57,7 @@ class CouponOrderTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 6; + const NUM_COLUMNS = 5; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class CouponOrderTableMap 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 @@ -79,11 +79,6 @@ class CouponOrderTableMap extends TableMap */ const ORDER_ID = 'coupon_order.ORDER_ID'; - /** - * the column name for the CODE field - */ - const CODE = 'coupon_order.CODE'; - /** * the column name for the VALUE field */ @@ -111,12 +106,12 @@ class CouponOrderTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'OrderId', 'Code', 'Value', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'code', 'value', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(CouponOrderTableMap::ID, CouponOrderTableMap::ORDER_ID, CouponOrderTableMap::CODE, CouponOrderTableMap::VALUE, CouponOrderTableMap::CREATED_AT, CouponOrderTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'CODE', 'VALUE', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'order_id', 'code', 'value', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) + self::TYPE_PHPNAME => array('Id', 'OrderId', 'Value', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'value', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(CouponOrderTableMap::ID, CouponOrderTableMap::ORDER_ID, CouponOrderTableMap::VALUE, CouponOrderTableMap::CREATED_AT, CouponOrderTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'VALUE', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'order_id', 'value', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) ); /** @@ -126,12 +121,12 @@ class CouponOrderTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'Code' => 2, 'Value' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'code' => 2, 'value' => 3, 'createdAt' => 4, 'updatedAt' => 5, ), - self::TYPE_COLNAME => array(CouponOrderTableMap::ID => 0, CouponOrderTableMap::ORDER_ID => 1, CouponOrderTableMap::CODE => 2, CouponOrderTableMap::VALUE => 3, CouponOrderTableMap::CREATED_AT => 4, CouponOrderTableMap::UPDATED_AT => 5, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'CODE' => 2, 'VALUE' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ), - self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'code' => 2, 'value' => 3, 'created_at' => 4, 'updated_at' => 5, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) + self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'Value' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'value' => 2, 'createdAt' => 3, 'updatedAt' => 4, ), + self::TYPE_COLNAME => array(CouponOrderTableMap::ID => 0, CouponOrderTableMap::ORDER_ID => 1, CouponOrderTableMap::VALUE => 2, CouponOrderTableMap::CREATED_AT => 3, CouponOrderTableMap::UPDATED_AT => 4, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'VALUE' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ), + self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'value' => 2, 'created_at' => 3, 'updated_at' => 4, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) ); /** @@ -152,7 +147,6 @@ class CouponOrderTableMap extends TableMap // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addForeignKey('ORDER_ID', 'OrderId', 'INTEGER', 'order', 'ID', true, null, null); - $this->addForeignKey('CODE', 'Code', 'VARCHAR', 'coupon', 'CODE', true, 45, null); $this->addColumn('VALUE', 'Value', 'FLOAT', true, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); @@ -164,7 +158,6 @@ class CouponOrderTableMap extends TableMap public function buildRelations() { $this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('order_id' => 'id', ), 'CASCADE', 'RESTRICT'); - $this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('code' => 'code', ), null, null); } // buildRelations() /** @@ -320,14 +313,12 @@ class CouponOrderTableMap extends TableMap if (null === $alias) { $criteria->addSelectColumn(CouponOrderTableMap::ID); $criteria->addSelectColumn(CouponOrderTableMap::ORDER_ID); - $criteria->addSelectColumn(CouponOrderTableMap::CODE); $criteria->addSelectColumn(CouponOrderTableMap::VALUE); $criteria->addSelectColumn(CouponOrderTableMap::CREATED_AT); $criteria->addSelectColumn(CouponOrderTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ORDER_ID'); - $criteria->addSelectColumn($alias . '.CODE'); $criteria->addSelectColumn($alias . '.VALUE'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); diff --git a/core/lib/Thelia/Model/Map/CouponTableMap.php b/core/lib/Thelia/Model/Map/CouponTableMap.php index d3ba620bf..36daa1204 100755 --- a/core/lib/Thelia/Model/Map/CouponTableMap.php +++ b/core/lib/Thelia/Model/Map/CouponTableMap.php @@ -57,7 +57,7 @@ class CouponTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 18; + const NUM_COLUMNS = 15; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class CouponTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 18; + const NUM_HYDRATE_COLUMNS = 15; /** * the column name for the ID field @@ -84,21 +84,6 @@ class CouponTableMap extends TableMap */ const TYPE = 'coupon.TYPE'; - /** - * the column name for the TITLE field - */ - const TITLE = 'coupon.TITLE'; - - /** - * the column name for the SHORT_DESCRIPTION field - */ - const SHORT_DESCRIPTION = 'coupon.SHORT_DESCRIPTION'; - - /** - * the column name for the DESCRIPTION field - */ - const DESCRIPTION = 'coupon.DESCRIPTION'; - /** * the column name for the AMOUNT field */ @@ -180,12 +165,12 @@ class CouponTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Title', 'ShortDescription', 'Description', 'Amount', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRules', 'IsCumulative', 'IsRemovingPostage', 'MaxUsage', 'IsAvailableOnSpecialOffers', 'CreatedAt', 'UpdatedAt', 'Version', ), - self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'title', 'shortDescription', 'description', 'amount', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRules', 'isCumulative', 'isRemovingPostage', 'maxUsage', 'isAvailableOnSpecialOffers', 'createdAt', 'updatedAt', 'version', ), - self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::TYPE, CouponTableMap::TITLE, CouponTableMap::SHORT_DESCRIPTION, CouponTableMap::DESCRIPTION, CouponTableMap::AMOUNT, CouponTableMap::IS_USED, CouponTableMap::IS_ENABLED, CouponTableMap::EXPIRATION_DATE, CouponTableMap::SERIALIZED_RULES, CouponTableMap::IS_CUMULATIVE, CouponTableMap::IS_REMOVING_POSTAGE, CouponTableMap::MAX_USAGE, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, CouponTableMap::VERSION, ), - self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', 'AMOUNT', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'MAX_USAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ), - self::TYPE_FIELDNAME => array('id', 'code', 'type', 'title', 'short_description', 'description', 'amount', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules', 'is_cumulative', 'is_removing_postage', 'max_usage', 'is_available_on_special_offers', 'created_at', 'updated_at', 'version', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Amount', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRules', 'IsCumulative', 'IsRemovingPostage', 'MaxUsage', 'IsAvailableOnSpecialOffers', 'CreatedAt', 'UpdatedAt', 'Version', ), + self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'amount', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRules', 'isCumulative', 'isRemovingPostage', 'maxUsage', 'isAvailableOnSpecialOffers', 'createdAt', 'updatedAt', 'version', ), + self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::TYPE, CouponTableMap::AMOUNT, CouponTableMap::IS_USED, CouponTableMap::IS_ENABLED, CouponTableMap::EXPIRATION_DATE, CouponTableMap::SERIALIZED_RULES, CouponTableMap::IS_CUMULATIVE, CouponTableMap::IS_REMOVING_POSTAGE, CouponTableMap::MAX_USAGE, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, CouponTableMap::VERSION, ), + self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'AMOUNT', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'MAX_USAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ), + self::TYPE_FIELDNAME => array('id', 'code', 'type', 'amount', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules', 'is_cumulative', 'is_removing_postage', 'max_usage', 'is_available_on_special_offers', 'created_at', 'updated_at', 'version', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -195,12 +180,12 @@ class CouponTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Title' => 3, 'ShortDescription' => 4, 'Description' => 5, 'Amount' => 6, 'IsUsed' => 7, 'IsEnabled' => 8, 'ExpirationDate' => 9, 'SerializedRules' => 10, 'IsCumulative' => 11, 'IsRemovingPostage' => 12, 'MaxUsage' => 13, 'IsAvailableOnSpecialOffers' => 14, 'CreatedAt' => 15, 'UpdatedAt' => 16, 'Version' => 17, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'shortDescription' => 4, 'description' => 5, 'amount' => 6, 'isUsed' => 7, 'isEnabled' => 8, 'expirationDate' => 9, 'serializedRules' => 10, 'isCumulative' => 11, 'isRemovingPostage' => 12, 'maxUsage' => 13, 'isAvailableOnSpecialOffers' => 14, 'createdAt' => 15, 'updatedAt' => 16, 'version' => 17, ), - self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::TYPE => 2, CouponTableMap::TITLE => 3, CouponTableMap::SHORT_DESCRIPTION => 4, CouponTableMap::DESCRIPTION => 5, CouponTableMap::AMOUNT => 6, CouponTableMap::IS_USED => 7, CouponTableMap::IS_ENABLED => 8, CouponTableMap::EXPIRATION_DATE => 9, CouponTableMap::SERIALIZED_RULES => 10, CouponTableMap::IS_CUMULATIVE => 11, CouponTableMap::IS_REMOVING_POSTAGE => 12, CouponTableMap::MAX_USAGE => 13, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 14, CouponTableMap::CREATED_AT => 15, CouponTableMap::UPDATED_AT => 16, CouponTableMap::VERSION => 17, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'TITLE' => 3, 'SHORT_DESCRIPTION' => 4, 'DESCRIPTION' => 5, 'AMOUNT' => 6, 'IS_USED' => 7, 'IS_ENABLED' => 8, 'EXPIRATION_DATE' => 9, 'SERIALIZED_RULES' => 10, 'IS_CUMULATIVE' => 11, 'IS_REMOVING_POSTAGE' => 12, 'MAX_USAGE' => 13, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 14, 'CREATED_AT' => 15, 'UPDATED_AT' => 16, 'VERSION' => 17, ), - self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'short_description' => 4, 'description' => 5, 'amount' => 6, 'is_used' => 7, 'is_enabled' => 8, 'expiration_date' => 9, 'serialized_rules' => 10, 'is_cumulative' => 11, 'is_removing_postage' => 12, 'max_usage' => 13, 'is_available_on_special_offers' => 14, 'created_at' => 15, 'updated_at' => 16, 'version' => 17, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Amount' => 3, 'IsUsed' => 4, 'IsEnabled' => 5, 'ExpirationDate' => 6, 'SerializedRules' => 7, 'IsCumulative' => 8, 'IsRemovingPostage' => 9, 'MaxUsage' => 10, 'IsAvailableOnSpecialOffers' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, 'Version' => 14, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'amount' => 3, 'isUsed' => 4, 'isEnabled' => 5, 'expirationDate' => 6, 'serializedRules' => 7, 'isCumulative' => 8, 'isRemovingPostage' => 9, 'maxUsage' => 10, 'isAvailableOnSpecialOffers' => 11, 'createdAt' => 12, 'updatedAt' => 13, 'version' => 14, ), + self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::TYPE => 2, CouponTableMap::AMOUNT => 3, CouponTableMap::IS_USED => 4, CouponTableMap::IS_ENABLED => 5, CouponTableMap::EXPIRATION_DATE => 6, CouponTableMap::SERIALIZED_RULES => 7, CouponTableMap::IS_CUMULATIVE => 8, CouponTableMap::IS_REMOVING_POSTAGE => 9, CouponTableMap::MAX_USAGE => 10, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 11, CouponTableMap::CREATED_AT => 12, CouponTableMap::UPDATED_AT => 13, CouponTableMap::VERSION => 14, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'AMOUNT' => 3, 'IS_USED' => 4, 'IS_ENABLED' => 5, 'EXPIRATION_DATE' => 6, 'SERIALIZED_RULES' => 7, 'IS_CUMULATIVE' => 8, 'IS_REMOVING_POSTAGE' => 9, 'MAX_USAGE' => 10, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, 'VERSION' => 14, ), + self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'amount' => 3, 'is_used' => 4, 'is_enabled' => 5, 'expiration_date' => 6, 'serialized_rules' => 7, 'is_cumulative' => 8, 'is_removing_postage' => 9, 'max_usage' => 10, 'is_available_on_special_offers' => 11, 'created_at' => 12, 'updated_at' => 13, 'version' => 14, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -222,9 +207,6 @@ class CouponTableMap extends TableMap $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null); $this->addColumn('TYPE', 'Type', 'VARCHAR', true, 255, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null); - $this->addColumn('SHORT_DESCRIPTION', 'ShortDescription', 'LONGVARCHAR', true, null, null); - $this->addColumn('DESCRIPTION', 'Description', 'CLOB', true, null, null); $this->addColumn('AMOUNT', 'Amount', 'FLOAT', true, null, null); $this->addColumn('IS_USED', 'IsUsed', 'TINYINT', true, null, null); $this->addColumn('IS_ENABLED', 'IsEnabled', 'TINYINT', true, null, null); @@ -244,7 +226,6 @@ class CouponTableMap extends TableMap */ public function buildRelations() { - $this->addRelation('CouponOrder', '\\Thelia\\Model\\CouponOrder', RelationMap::ONE_TO_MANY, array('code' => 'code', ), null, null, 'CouponOrders'); $this->addRelation('CouponI18n', '\\Thelia\\Model\\CouponI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponI18ns'); $this->addRelation('CouponVersion', '\\Thelia\\Model\\CouponVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponVersions'); } // buildRelations() @@ -259,7 +240,7 @@ class CouponTableMap extends TableMap { return array( 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ), - 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => '', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), + 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, short_description, description', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), 'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'false', 'log_created_by' => 'false', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ), ); } // getBehaviors() @@ -415,9 +396,6 @@ class CouponTableMap extends TableMap $criteria->addSelectColumn(CouponTableMap::ID); $criteria->addSelectColumn(CouponTableMap::CODE); $criteria->addSelectColumn(CouponTableMap::TYPE); - $criteria->addSelectColumn(CouponTableMap::TITLE); - $criteria->addSelectColumn(CouponTableMap::SHORT_DESCRIPTION); - $criteria->addSelectColumn(CouponTableMap::DESCRIPTION); $criteria->addSelectColumn(CouponTableMap::AMOUNT); $criteria->addSelectColumn(CouponTableMap::IS_USED); $criteria->addSelectColumn(CouponTableMap::IS_ENABLED); @@ -434,9 +412,6 @@ class CouponTableMap extends TableMap $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.CODE'); $criteria->addSelectColumn($alias . '.TYPE'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.SHORT_DESCRIPTION'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); $criteria->addSelectColumn($alias . '.AMOUNT'); $criteria->addSelectColumn($alias . '.IS_USED'); $criteria->addSelectColumn($alias . '.IS_ENABLED'); diff --git a/core/lib/Thelia/Model/Map/CouponVersionTableMap.php b/core/lib/Thelia/Model/Map/CouponVersionTableMap.php index 9db387a86..30ce279b8 100644 --- a/core/lib/Thelia/Model/Map/CouponVersionTableMap.php +++ b/core/lib/Thelia/Model/Map/CouponVersionTableMap.php @@ -57,7 +57,7 @@ class CouponVersionTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 18; + const NUM_COLUMNS = 15; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class CouponVersionTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 18; + const NUM_HYDRATE_COLUMNS = 15; /** * the column name for the ID field @@ -84,21 +84,6 @@ class CouponVersionTableMap extends TableMap */ const TYPE = 'coupon_version.TYPE'; - /** - * the column name for the TITLE field - */ - const TITLE = 'coupon_version.TITLE'; - - /** - * the column name for the SHORT_DESCRIPTION field - */ - const SHORT_DESCRIPTION = 'coupon_version.SHORT_DESCRIPTION'; - - /** - * the column name for the DESCRIPTION field - */ - const DESCRIPTION = 'coupon_version.DESCRIPTION'; - /** * the column name for the AMOUNT field */ @@ -171,12 +156,12 @@ class CouponVersionTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Title', 'ShortDescription', 'Description', 'Amount', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRules', 'IsCumulative', 'IsRemovingPostage', 'MaxUsage', 'IsAvailableOnSpecialOffers', 'CreatedAt', 'UpdatedAt', 'Version', ), - self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'title', 'shortDescription', 'description', 'amount', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRules', 'isCumulative', 'isRemovingPostage', 'maxUsage', 'isAvailableOnSpecialOffers', 'createdAt', 'updatedAt', 'version', ), - self::TYPE_COLNAME => array(CouponVersionTableMap::ID, CouponVersionTableMap::CODE, CouponVersionTableMap::TYPE, CouponVersionTableMap::TITLE, CouponVersionTableMap::SHORT_DESCRIPTION, CouponVersionTableMap::DESCRIPTION, CouponVersionTableMap::AMOUNT, CouponVersionTableMap::IS_USED, CouponVersionTableMap::IS_ENABLED, CouponVersionTableMap::EXPIRATION_DATE, CouponVersionTableMap::SERIALIZED_RULES, CouponVersionTableMap::IS_CUMULATIVE, CouponVersionTableMap::IS_REMOVING_POSTAGE, CouponVersionTableMap::MAX_USAGE, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponVersionTableMap::CREATED_AT, CouponVersionTableMap::UPDATED_AT, CouponVersionTableMap::VERSION, ), - self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', 'AMOUNT', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'MAX_USAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ), - self::TYPE_FIELDNAME => array('id', 'code', 'type', 'title', 'short_description', 'description', 'amount', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules', 'is_cumulative', 'is_removing_postage', 'max_usage', 'is_available_on_special_offers', 'created_at', 'updated_at', 'version', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Amount', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRules', 'IsCumulative', 'IsRemovingPostage', 'MaxUsage', 'IsAvailableOnSpecialOffers', 'CreatedAt', 'UpdatedAt', 'Version', ), + self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'amount', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRules', 'isCumulative', 'isRemovingPostage', 'maxUsage', 'isAvailableOnSpecialOffers', 'createdAt', 'updatedAt', 'version', ), + self::TYPE_COLNAME => array(CouponVersionTableMap::ID, CouponVersionTableMap::CODE, CouponVersionTableMap::TYPE, CouponVersionTableMap::AMOUNT, CouponVersionTableMap::IS_USED, CouponVersionTableMap::IS_ENABLED, CouponVersionTableMap::EXPIRATION_DATE, CouponVersionTableMap::SERIALIZED_RULES, CouponVersionTableMap::IS_CUMULATIVE, CouponVersionTableMap::IS_REMOVING_POSTAGE, CouponVersionTableMap::MAX_USAGE, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponVersionTableMap::CREATED_AT, CouponVersionTableMap::UPDATED_AT, CouponVersionTableMap::VERSION, ), + self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'AMOUNT', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'MAX_USAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ), + self::TYPE_FIELDNAME => array('id', 'code', 'type', 'amount', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules', 'is_cumulative', 'is_removing_postage', 'max_usage', 'is_available_on_special_offers', 'created_at', 'updated_at', 'version', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -186,12 +171,12 @@ class CouponVersionTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Title' => 3, 'ShortDescription' => 4, 'Description' => 5, 'Amount' => 6, 'IsUsed' => 7, 'IsEnabled' => 8, 'ExpirationDate' => 9, 'SerializedRules' => 10, 'IsCumulative' => 11, 'IsRemovingPostage' => 12, 'MaxUsage' => 13, 'IsAvailableOnSpecialOffers' => 14, 'CreatedAt' => 15, 'UpdatedAt' => 16, 'Version' => 17, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'shortDescription' => 4, 'description' => 5, 'amount' => 6, 'isUsed' => 7, 'isEnabled' => 8, 'expirationDate' => 9, 'serializedRules' => 10, 'isCumulative' => 11, 'isRemovingPostage' => 12, 'maxUsage' => 13, 'isAvailableOnSpecialOffers' => 14, 'createdAt' => 15, 'updatedAt' => 16, 'version' => 17, ), - self::TYPE_COLNAME => array(CouponVersionTableMap::ID => 0, CouponVersionTableMap::CODE => 1, CouponVersionTableMap::TYPE => 2, CouponVersionTableMap::TITLE => 3, CouponVersionTableMap::SHORT_DESCRIPTION => 4, CouponVersionTableMap::DESCRIPTION => 5, CouponVersionTableMap::AMOUNT => 6, CouponVersionTableMap::IS_USED => 7, CouponVersionTableMap::IS_ENABLED => 8, CouponVersionTableMap::EXPIRATION_DATE => 9, CouponVersionTableMap::SERIALIZED_RULES => 10, CouponVersionTableMap::IS_CUMULATIVE => 11, CouponVersionTableMap::IS_REMOVING_POSTAGE => 12, CouponVersionTableMap::MAX_USAGE => 13, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 14, CouponVersionTableMap::CREATED_AT => 15, CouponVersionTableMap::UPDATED_AT => 16, CouponVersionTableMap::VERSION => 17, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'TITLE' => 3, 'SHORT_DESCRIPTION' => 4, 'DESCRIPTION' => 5, 'AMOUNT' => 6, 'IS_USED' => 7, 'IS_ENABLED' => 8, 'EXPIRATION_DATE' => 9, 'SERIALIZED_RULES' => 10, 'IS_CUMULATIVE' => 11, 'IS_REMOVING_POSTAGE' => 12, 'MAX_USAGE' => 13, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 14, 'CREATED_AT' => 15, 'UPDATED_AT' => 16, 'VERSION' => 17, ), - self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'short_description' => 4, 'description' => 5, 'amount' => 6, 'is_used' => 7, 'is_enabled' => 8, 'expiration_date' => 9, 'serialized_rules' => 10, 'is_cumulative' => 11, 'is_removing_postage' => 12, 'max_usage' => 13, 'is_available_on_special_offers' => 14, 'created_at' => 15, 'updated_at' => 16, 'version' => 17, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Amount' => 3, 'IsUsed' => 4, 'IsEnabled' => 5, 'ExpirationDate' => 6, 'SerializedRules' => 7, 'IsCumulative' => 8, 'IsRemovingPostage' => 9, 'MaxUsage' => 10, 'IsAvailableOnSpecialOffers' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, 'Version' => 14, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'amount' => 3, 'isUsed' => 4, 'isEnabled' => 5, 'expirationDate' => 6, 'serializedRules' => 7, 'isCumulative' => 8, 'isRemovingPostage' => 9, 'maxUsage' => 10, 'isAvailableOnSpecialOffers' => 11, 'createdAt' => 12, 'updatedAt' => 13, 'version' => 14, ), + self::TYPE_COLNAME => array(CouponVersionTableMap::ID => 0, CouponVersionTableMap::CODE => 1, CouponVersionTableMap::TYPE => 2, CouponVersionTableMap::AMOUNT => 3, CouponVersionTableMap::IS_USED => 4, CouponVersionTableMap::IS_ENABLED => 5, CouponVersionTableMap::EXPIRATION_DATE => 6, CouponVersionTableMap::SERIALIZED_RULES => 7, CouponVersionTableMap::IS_CUMULATIVE => 8, CouponVersionTableMap::IS_REMOVING_POSTAGE => 9, CouponVersionTableMap::MAX_USAGE => 10, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 11, CouponVersionTableMap::CREATED_AT => 12, CouponVersionTableMap::UPDATED_AT => 13, CouponVersionTableMap::VERSION => 14, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'AMOUNT' => 3, 'IS_USED' => 4, 'IS_ENABLED' => 5, 'EXPIRATION_DATE' => 6, 'SERIALIZED_RULES' => 7, 'IS_CUMULATIVE' => 8, 'IS_REMOVING_POSTAGE' => 9, 'MAX_USAGE' => 10, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, 'VERSION' => 14, ), + self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'amount' => 3, 'is_used' => 4, 'is_enabled' => 5, 'expiration_date' => 6, 'serialized_rules' => 7, 'is_cumulative' => 8, 'is_removing_postage' => 9, 'max_usage' => 10, 'is_available_on_special_offers' => 11, 'created_at' => 12, 'updated_at' => 13, 'version' => 14, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -213,9 +198,6 @@ class CouponVersionTableMap extends TableMap $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'coupon', 'ID', true, null, null); $this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null); $this->addColumn('TYPE', 'Type', 'VARCHAR', true, 255, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null); - $this->addColumn('SHORT_DESCRIPTION', 'ShortDescription', 'LONGVARCHAR', true, null, null); - $this->addColumn('DESCRIPTION', 'Description', 'CLOB', true, null, null); $this->addColumn('AMOUNT', 'Amount', 'FLOAT', true, null, null); $this->addColumn('IS_USED', 'IsUsed', 'TINYINT', true, null, null); $this->addColumn('IS_ENABLED', 'IsEnabled', 'TINYINT', true, null, null); @@ -305,11 +287,11 @@ class CouponVersionTableMap extends TableMap public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { // If the PK cannot be derived from the row, return NULL. - if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 17 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) { + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 14 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) { return null; } - return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 17 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)])); + return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 14 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)])); } /** @@ -428,9 +410,6 @@ class CouponVersionTableMap extends TableMap $criteria->addSelectColumn(CouponVersionTableMap::ID); $criteria->addSelectColumn(CouponVersionTableMap::CODE); $criteria->addSelectColumn(CouponVersionTableMap::TYPE); - $criteria->addSelectColumn(CouponVersionTableMap::TITLE); - $criteria->addSelectColumn(CouponVersionTableMap::SHORT_DESCRIPTION); - $criteria->addSelectColumn(CouponVersionTableMap::DESCRIPTION); $criteria->addSelectColumn(CouponVersionTableMap::AMOUNT); $criteria->addSelectColumn(CouponVersionTableMap::IS_USED); $criteria->addSelectColumn(CouponVersionTableMap::IS_ENABLED); @@ -447,9 +426,6 @@ class CouponVersionTableMap extends TableMap $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.CODE'); $criteria->addSelectColumn($alias . '.TYPE'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.SHORT_DESCRIPTION'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); $criteria->addSelectColumn($alias . '.AMOUNT'); $criteria->addSelectColumn($alias . '.IS_USED'); $criteria->addSelectColumn($alias . '.IS_ENABLED'); diff --git a/core/lib/Thelia/Model/Map/FolderTableMap.php b/core/lib/Thelia/Model/Map/FolderTableMap.php index 7f4dde6d0..08871715b 100755 --- a/core/lib/Thelia/Model/Map/FolderTableMap.php +++ b/core/lib/Thelia/Model/Map/FolderTableMap.php @@ -190,6 +190,7 @@ class FolderTableMap extends TableMap */ public function buildRelations() { + $this->addRelation('Rewriting', '\\Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT', 'Rewritings'); $this->addRelation('ContentFolder', '\\Thelia\\Model\\ContentFolder', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT', 'ContentFolders'); $this->addRelation('FolderImage', '\\Thelia\\Model\\FolderImage', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT', 'FolderImages'); $this->addRelation('FolderDocument', '\\Thelia\\Model\\FolderDocument', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT', 'FolderDocuments'); @@ -219,6 +220,7 @@ class FolderTableMap extends TableMap { // Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + RewritingTableMap::clearInstancePool(); ContentFolderTableMap::clearInstancePool(); FolderImageTableMap::clearInstancePool(); FolderDocumentTableMap::clearInstancePool(); diff --git a/core/lib/Thelia/Model/Map/ProductTableMap.php b/core/lib/Thelia/Model/Map/ProductTableMap.php index 1d46d483e..81badfba0 100755 --- a/core/lib/Thelia/Model/Map/ProductTableMap.php +++ b/core/lib/Thelia/Model/Map/ProductTableMap.php @@ -204,6 +204,7 @@ class ProductTableMap extends TableMap $this->addRelation('ProductDocument', '\\Thelia\\Model\\ProductDocument', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductDocuments'); $this->addRelation('AccessoryRelatedByProductId', '\\Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'AccessoriesRelatedByProductId'); $this->addRelation('AccessoryRelatedByAccessory', '\\Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'accessory', ), 'CASCADE', 'RESTRICT', 'AccessoriesRelatedByAccessory'); + $this->addRelation('Rewriting', '\\Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'Rewritings'); $this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), null, null, 'CartItems'); $this->addRelation('ProductAssociatedContent', '\\Thelia\\Model\\ProductAssociatedContent', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductAssociatedContents'); $this->addRelation('ProductI18n', '\\Thelia\\Model\\ProductI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductI18ns'); @@ -240,6 +241,7 @@ class ProductTableMap extends TableMap ProductImageTableMap::clearInstancePool(); ProductDocumentTableMap::clearInstancePool(); AccessoryTableMap::clearInstancePool(); + RewritingTableMap::clearInstancePool(); ProductAssociatedContentTableMap::clearInstancePool(); ProductI18nTableMap::clearInstancePool(); ProductVersionTableMap::clearInstancePool();