associated content for categories and products tables

This commit is contained in:
Etienne Roudeix
2013-08-22 17:54:19 +02:00
parent ec3ab5c3aa
commit 7ef0339784
23 changed files with 4037 additions and 4935 deletions

View File

@@ -22,6 +22,8 @@ use Thelia\Model\AttributeCategory as ChildAttributeCategory;
use Thelia\Model\AttributeCategoryQuery as ChildAttributeCategoryQuery;
use Thelia\Model\AttributeQuery as ChildAttributeQuery;
use Thelia\Model\Category as ChildCategory;
use Thelia\Model\CategoryAssociatedContent as ChildCategoryAssociatedContent;
use Thelia\Model\CategoryAssociatedContentQuery as ChildCategoryAssociatedContentQuery;
use Thelia\Model\CategoryDocument as ChildCategoryDocument;
use Thelia\Model\CategoryDocumentQuery as ChildCategoryDocumentQuery;
use Thelia\Model\CategoryI18n as ChildCategoryI18n;
@@ -31,8 +33,6 @@ use Thelia\Model\CategoryImageQuery as ChildCategoryImageQuery;
use Thelia\Model\CategoryQuery as ChildCategoryQuery;
use Thelia\Model\CategoryVersion as ChildCategoryVersion;
use Thelia\Model\CategoryVersionQuery as ChildCategoryVersionQuery;
use Thelia\Model\ContentAssoc as ChildContentAssoc;
use Thelia\Model\ContentAssocQuery as ChildContentAssocQuery;
use Thelia\Model\Feature as ChildFeature;
use Thelia\Model\FeatureCategory as ChildFeatureCategory;
use Thelia\Model\FeatureCategoryQuery as ChildFeatureCategoryQuery;
@@ -153,12 +153,6 @@ abstract class Category implements ActiveRecordInterface
protected $collAttributeCategories;
protected $collAttributeCategoriesPartial;
/**
* @var ObjectCollection|ChildContentAssoc[] Collection to store aggregation of ChildContentAssoc objects.
*/
protected $collContentAssocs;
protected $collContentAssocsPartial;
/**
* @var ObjectCollection|ChildRewriting[] Collection to store aggregation of ChildRewriting objects.
*/
@@ -177,6 +171,12 @@ abstract class Category implements ActiveRecordInterface
protected $collCategoryDocuments;
protected $collCategoryDocumentsPartial;
/**
* @var ObjectCollection|ChildCategoryAssociatedContent[] Collection to store aggregation of ChildCategoryAssociatedContent objects.
*/
protected $collCategoryAssociatedContents;
protected $collCategoryAssociatedContentsPartial;
/**
* @var ObjectCollection|ChildCategoryI18n[] Collection to store aggregation of ChildCategoryI18n objects.
*/
@@ -270,12 +270,6 @@ abstract class Category implements ActiveRecordInterface
*/
protected $attributeCategoriesScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $contentAssocsScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var ObjectCollection
@@ -294,6 +288,12 @@ abstract class Category implements ActiveRecordInterface
*/
protected $categoryDocumentsScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $categoryAssociatedContentsScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var ObjectCollection
@@ -1039,14 +1039,14 @@ abstract class Category implements ActiveRecordInterface
$this->collAttributeCategories = null;
$this->collContentAssocs = null;
$this->collRewritings = null;
$this->collCategoryImages = null;
$this->collCategoryDocuments = null;
$this->collCategoryAssociatedContents = null;
$this->collCategoryI18ns = null;
$this->collCategoryVersions = null;
@@ -1331,23 +1331,6 @@ abstract class Category implements ActiveRecordInterface
}
}
if ($this->contentAssocsScheduledForDeletion !== null) {
if (!$this->contentAssocsScheduledForDeletion->isEmpty()) {
\Thelia\Model\ContentAssocQuery::create()
->filterByPrimaryKeys($this->contentAssocsScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->contentAssocsScheduledForDeletion = null;
}
}
if ($this->collContentAssocs !== null) {
foreach ($this->collContentAssocs as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->rewritingsScheduledForDeletion !== null) {
if (!$this->rewritingsScheduledForDeletion->isEmpty()) {
\Thelia\Model\RewritingQuery::create()
@@ -1399,6 +1382,23 @@ abstract class Category implements ActiveRecordInterface
}
}
if ($this->categoryAssociatedContentsScheduledForDeletion !== null) {
if (!$this->categoryAssociatedContentsScheduledForDeletion->isEmpty()) {
\Thelia\Model\CategoryAssociatedContentQuery::create()
->filterByPrimaryKeys($this->categoryAssociatedContentsScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->categoryAssociatedContentsScheduledForDeletion = null;
}
}
if ($this->collCategoryAssociatedContents !== null) {
foreach ($this->collCategoryAssociatedContents as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->categoryI18nsScheduledForDeletion !== null) {
if (!$this->categoryI18nsScheduledForDeletion->isEmpty()) {
\Thelia\Model\CategoryI18nQuery::create()
@@ -1668,9 +1668,6 @@ abstract class Category implements ActiveRecordInterface
if (null !== $this->collAttributeCategories) {
$result['AttributeCategories'] = $this->collAttributeCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collContentAssocs) {
$result['ContentAssocs'] = $this->collContentAssocs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collRewritings) {
$result['Rewritings'] = $this->collRewritings->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
@@ -1680,6 +1677,9 @@ abstract class Category implements ActiveRecordInterface
if (null !== $this->collCategoryDocuments) {
$result['CategoryDocuments'] = $this->collCategoryDocuments->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collCategoryAssociatedContents) {
$result['CategoryAssociatedContents'] = $this->collCategoryAssociatedContents->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collCategoryI18ns) {
$result['CategoryI18ns'] = $this->collCategoryI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
@@ -1895,12 +1895,6 @@ abstract class Category implements ActiveRecordInterface
}
}
foreach ($this->getContentAssocs() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addContentAssoc($relObj->copy($deepCopy));
}
}
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));
@@ -1919,6 +1913,12 @@ abstract class Category implements ActiveRecordInterface
}
}
foreach ($this->getCategoryAssociatedContents() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCategoryAssociatedContent($relObj->copy($deepCopy));
}
}
foreach ($this->getCategoryI18ns() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCategoryI18n($relObj->copy($deepCopy));
@@ -1981,9 +1981,6 @@ abstract class Category implements ActiveRecordInterface
if ('AttributeCategory' == $relationName) {
return $this->initAttributeCategories();
}
if ('ContentAssoc' == $relationName) {
return $this->initContentAssocs();
}
if ('Rewriting' == $relationName) {
return $this->initRewritings();
}
@@ -1993,6 +1990,9 @@ abstract class Category implements ActiveRecordInterface
if ('CategoryDocument' == $relationName) {
return $this->initCategoryDocuments();
}
if ('CategoryAssociatedContent' == $relationName) {
return $this->initCategoryAssociatedContents();
}
if ('CategoryI18n' == $relationName) {
return $this->initCategoryI18ns();
}
@@ -2733,274 +2733,6 @@ abstract class Category implements ActiveRecordInterface
return $this->getAttributeCategories($query, $con);
}
/**
* Clears out the collContentAssocs 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 addContentAssocs()
*/
public function clearContentAssocs()
{
$this->collContentAssocs = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Reset is the collContentAssocs collection loaded partially.
*/
public function resetPartialContentAssocs($v = true)
{
$this->collContentAssocsPartial = $v;
}
/**
* Initializes the collContentAssocs collection.
*
* By default this just sets the collContentAssocs collection to an empty array (like clearcollContentAssocs());
* 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 initContentAssocs($overrideExisting = true)
{
if (null !== $this->collContentAssocs && !$overrideExisting) {
return;
}
$this->collContentAssocs = new ObjectCollection();
$this->collContentAssocs->setModel('\Thelia\Model\ContentAssoc');
}
/**
* Gets an array of ChildContentAssoc 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|ChildContentAssoc[] List of ChildContentAssoc objects
* @throws PropelException
*/
public function getContentAssocs($criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collContentAssocsPartial && !$this->isNew();
if (null === $this->collContentAssocs || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collContentAssocs) {
// return empty collection
$this->initContentAssocs();
} else {
$collContentAssocs = ChildContentAssocQuery::create(null, $criteria)
->filterByCategory($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collContentAssocsPartial && count($collContentAssocs)) {
$this->initContentAssocs(false);
foreach ($collContentAssocs as $obj) {
if (false == $this->collContentAssocs->contains($obj)) {
$this->collContentAssocs->append($obj);
}
}
$this->collContentAssocsPartial = true;
}
$collContentAssocs->getInternalIterator()->rewind();
return $collContentAssocs;
}
if ($partial && $this->collContentAssocs) {
foreach ($this->collContentAssocs as $obj) {
if ($obj->isNew()) {
$collContentAssocs[] = $obj;
}
}
}
$this->collContentAssocs = $collContentAssocs;
$this->collContentAssocsPartial = false;
}
}
return $this->collContentAssocs;
}
/**
* Sets a collection of ContentAssoc 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 $contentAssocs A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildCategory The current object (for fluent API support)
*/
public function setContentAssocs(Collection $contentAssocs, ConnectionInterface $con = null)
{
$contentAssocsToDelete = $this->getContentAssocs(new Criteria(), $con)->diff($contentAssocs);
$this->contentAssocsScheduledForDeletion = $contentAssocsToDelete;
foreach ($contentAssocsToDelete as $contentAssocRemoved) {
$contentAssocRemoved->setCategory(null);
}
$this->collContentAssocs = null;
foreach ($contentAssocs as $contentAssoc) {
$this->addContentAssoc($contentAssoc);
}
$this->collContentAssocs = $contentAssocs;
$this->collContentAssocsPartial = false;
return $this;
}
/**
* Returns the number of related ContentAssoc objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param ConnectionInterface $con
* @return int Count of related ContentAssoc objects.
* @throws PropelException
*/
public function countContentAssocs(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collContentAssocsPartial && !$this->isNew();
if (null === $this->collContentAssocs || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collContentAssocs) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getContentAssocs());
}
$query = ChildContentAssocQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByCategory($this)
->count($con);
}
return count($this->collContentAssocs);
}
/**
* Method called to associate a ChildContentAssoc object to this object
* through the ChildContentAssoc foreign key attribute.
*
* @param ChildContentAssoc $l ChildContentAssoc
* @return \Thelia\Model\Category The current object (for fluent API support)
*/
public function addContentAssoc(ChildContentAssoc $l)
{
if ($this->collContentAssocs === null) {
$this->initContentAssocs();
$this->collContentAssocsPartial = true;
}
if (!in_array($l, $this->collContentAssocs->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddContentAssoc($l);
}
return $this;
}
/**
* @param ContentAssoc $contentAssoc The contentAssoc object to add.
*/
protected function doAddContentAssoc($contentAssoc)
{
$this->collContentAssocs[]= $contentAssoc;
$contentAssoc->setCategory($this);
}
/**
* @param ContentAssoc $contentAssoc The contentAssoc object to remove.
* @return ChildCategory The current object (for fluent API support)
*/
public function removeContentAssoc($contentAssoc)
{
if ($this->getContentAssocs()->contains($contentAssoc)) {
$this->collContentAssocs->remove($this->collContentAssocs->search($contentAssoc));
if (null === $this->contentAssocsScheduledForDeletion) {
$this->contentAssocsScheduledForDeletion = clone $this->collContentAssocs;
$this->contentAssocsScheduledForDeletion->clear();
}
$this->contentAssocsScheduledForDeletion[]= $contentAssoc;
$contentAssoc->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 ContentAssocs 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|ChildContentAssoc[] List of ChildContentAssoc objects
*/
public function getContentAssocsJoinProduct($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildContentAssocQuery::create(null, $criteria);
$query->joinWith('Product', $joinBehavior);
return $this->getContentAssocs($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 ContentAssocs 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|ChildContentAssoc[] List of ChildContentAssoc objects
*/
public function getContentAssocsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildContentAssocQuery::create(null, $criteria);
$query->joinWith('Content', $joinBehavior);
return $this->getContentAssocs($query, $con);
}
/**
* Clears out the collRewritings collection
*
@@ -3730,6 +3462,249 @@ abstract class Category implements ActiveRecordInterface
return $this;
}
/**
* Clears out the collCategoryAssociatedContents 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 addCategoryAssociatedContents()
*/
public function clearCategoryAssociatedContents()
{
$this->collCategoryAssociatedContents = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Reset is the collCategoryAssociatedContents collection loaded partially.
*/
public function resetPartialCategoryAssociatedContents($v = true)
{
$this->collCategoryAssociatedContentsPartial = $v;
}
/**
* Initializes the collCategoryAssociatedContents collection.
*
* By default this just sets the collCategoryAssociatedContents collection to an empty array (like clearcollCategoryAssociatedContents());
* 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 initCategoryAssociatedContents($overrideExisting = true)
{
if (null !== $this->collCategoryAssociatedContents && !$overrideExisting) {
return;
}
$this->collCategoryAssociatedContents = new ObjectCollection();
$this->collCategoryAssociatedContents->setModel('\Thelia\Model\CategoryAssociatedContent');
}
/**
* Gets an array of ChildCategoryAssociatedContent 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|ChildCategoryAssociatedContent[] List of ChildCategoryAssociatedContent objects
* @throws PropelException
*/
public function getCategoryAssociatedContents($criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collCategoryAssociatedContentsPartial && !$this->isNew();
if (null === $this->collCategoryAssociatedContents || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collCategoryAssociatedContents) {
// return empty collection
$this->initCategoryAssociatedContents();
} else {
$collCategoryAssociatedContents = ChildCategoryAssociatedContentQuery::create(null, $criteria)
->filterByCategory($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collCategoryAssociatedContentsPartial && count($collCategoryAssociatedContents)) {
$this->initCategoryAssociatedContents(false);
foreach ($collCategoryAssociatedContents as $obj) {
if (false == $this->collCategoryAssociatedContents->contains($obj)) {
$this->collCategoryAssociatedContents->append($obj);
}
}
$this->collCategoryAssociatedContentsPartial = true;
}
$collCategoryAssociatedContents->getInternalIterator()->rewind();
return $collCategoryAssociatedContents;
}
if ($partial && $this->collCategoryAssociatedContents) {
foreach ($this->collCategoryAssociatedContents as $obj) {
if ($obj->isNew()) {
$collCategoryAssociatedContents[] = $obj;
}
}
}
$this->collCategoryAssociatedContents = $collCategoryAssociatedContents;
$this->collCategoryAssociatedContentsPartial = false;
}
}
return $this->collCategoryAssociatedContents;
}
/**
* Sets a collection of CategoryAssociatedContent 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 $categoryAssociatedContents A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildCategory The current object (for fluent API support)
*/
public function setCategoryAssociatedContents(Collection $categoryAssociatedContents, ConnectionInterface $con = null)
{
$categoryAssociatedContentsToDelete = $this->getCategoryAssociatedContents(new Criteria(), $con)->diff($categoryAssociatedContents);
$this->categoryAssociatedContentsScheduledForDeletion = $categoryAssociatedContentsToDelete;
foreach ($categoryAssociatedContentsToDelete as $categoryAssociatedContentRemoved) {
$categoryAssociatedContentRemoved->setCategory(null);
}
$this->collCategoryAssociatedContents = null;
foreach ($categoryAssociatedContents as $categoryAssociatedContent) {
$this->addCategoryAssociatedContent($categoryAssociatedContent);
}
$this->collCategoryAssociatedContents = $categoryAssociatedContents;
$this->collCategoryAssociatedContentsPartial = false;
return $this;
}
/**
* Returns the number of related CategoryAssociatedContent objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param ConnectionInterface $con
* @return int Count of related CategoryAssociatedContent objects.
* @throws PropelException
*/
public function countCategoryAssociatedContents(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collCategoryAssociatedContentsPartial && !$this->isNew();
if (null === $this->collCategoryAssociatedContents || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collCategoryAssociatedContents) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getCategoryAssociatedContents());
}
$query = ChildCategoryAssociatedContentQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByCategory($this)
->count($con);
}
return count($this->collCategoryAssociatedContents);
}
/**
* Method called to associate a ChildCategoryAssociatedContent object to this object
* through the ChildCategoryAssociatedContent foreign key attribute.
*
* @param ChildCategoryAssociatedContent $l ChildCategoryAssociatedContent
* @return \Thelia\Model\Category The current object (for fluent API support)
*/
public function addCategoryAssociatedContent(ChildCategoryAssociatedContent $l)
{
if ($this->collCategoryAssociatedContents === null) {
$this->initCategoryAssociatedContents();
$this->collCategoryAssociatedContentsPartial = true;
}
if (!in_array($l, $this->collCategoryAssociatedContents->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddCategoryAssociatedContent($l);
}
return $this;
}
/**
* @param CategoryAssociatedContent $categoryAssociatedContent The categoryAssociatedContent object to add.
*/
protected function doAddCategoryAssociatedContent($categoryAssociatedContent)
{
$this->collCategoryAssociatedContents[]= $categoryAssociatedContent;
$categoryAssociatedContent->setCategory($this);
}
/**
* @param CategoryAssociatedContent $categoryAssociatedContent The categoryAssociatedContent object to remove.
* @return ChildCategory The current object (for fluent API support)
*/
public function removeCategoryAssociatedContent($categoryAssociatedContent)
{
if ($this->getCategoryAssociatedContents()->contains($categoryAssociatedContent)) {
$this->collCategoryAssociatedContents->remove($this->collCategoryAssociatedContents->search($categoryAssociatedContent));
if (null === $this->categoryAssociatedContentsScheduledForDeletion) {
$this->categoryAssociatedContentsScheduledForDeletion = clone $this->collCategoryAssociatedContents;
$this->categoryAssociatedContentsScheduledForDeletion->clear();
}
$this->categoryAssociatedContentsScheduledForDeletion[]= clone $categoryAssociatedContent;
$categoryAssociatedContent->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 CategoryAssociatedContents 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|ChildCategoryAssociatedContent[] List of ChildCategoryAssociatedContent objects
*/
public function getCategoryAssociatedContentsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildCategoryAssociatedContentQuery::create(null, $criteria);
$query->joinWith('Content', $joinBehavior);
return $this->getCategoryAssociatedContents($query, $con);
}
/**
* Clears out the collCategoryI18ns collection
*
@@ -4774,11 +4749,6 @@ abstract class Category implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
if ($this->collContentAssocs) {
foreach ($this->collContentAssocs as $o) {
$o->clearAllReferences($deep);
}
}
if ($this->collRewritings) {
foreach ($this->collRewritings as $o) {
$o->clearAllReferences($deep);
@@ -4794,6 +4764,11 @@ abstract class Category implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
if ($this->collCategoryAssociatedContents) {
foreach ($this->collCategoryAssociatedContents as $o) {
$o->clearAllReferences($deep);
}
}
if ($this->collCategoryI18ns) {
foreach ($this->collCategoryI18ns as $o) {
$o->clearAllReferences($deep);
@@ -4837,10 +4812,6 @@ abstract class Category implements ActiveRecordInterface
$this->collAttributeCategories->clearIterator();
}
$this->collAttributeCategories = null;
if ($this->collContentAssocs instanceof Collection) {
$this->collContentAssocs->clearIterator();
}
$this->collContentAssocs = null;
if ($this->collRewritings instanceof Collection) {
$this->collRewritings->clearIterator();
}
@@ -4853,6 +4824,10 @@ abstract class Category implements ActiveRecordInterface
$this->collCategoryDocuments->clearIterator();
}
$this->collCategoryDocuments = null;
if ($this->collCategoryAssociatedContents instanceof Collection) {
$this->collCategoryAssociatedContents->clearIterator();
}
$this->collCategoryAssociatedContents = null;
if ($this->collCategoryI18ns instanceof Collection) {
$this->collCategoryI18ns->clearIterator();
}

View File

@@ -58,10 +58,6 @@ 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 leftJoinContentAssoc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentAssoc relation
* @method ChildCategoryQuery rightJoinContentAssoc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentAssoc relation
* @method ChildCategoryQuery innerJoinContentAssoc($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentAssoc 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
@@ -74,6 +70,10 @@ use Thelia\Model\Map\CategoryTableMap;
* @method ChildCategoryQuery rightJoinCategoryDocument($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryDocument relation
* @method ChildCategoryQuery innerJoinCategoryDocument($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryDocument relation
*
* @method ChildCategoryQuery leftJoinCategoryAssociatedContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryAssociatedContent relation
* @method ChildCategoryQuery rightJoinCategoryAssociatedContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryAssociatedContent relation
* @method ChildCategoryQuery innerJoinCategoryAssociatedContent($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryAssociatedContent relation
*
* @method ChildCategoryQuery leftJoinCategoryI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryI18n relation
* @method ChildCategoryQuery rightJoinCategoryI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryI18n relation
* @method ChildCategoryQuery innerJoinCategoryI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryI18n relation
@@ -870,79 +870,6 @@ abstract class CategoryQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'AttributeCategory', '\Thelia\Model\AttributeCategoryQuery');
}
/**
* Filter the query by a related \Thelia\Model\ContentAssoc object
*
* @param \Thelia\Model\ContentAssoc|ObjectCollection $contentAssoc 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 filterByContentAssoc($contentAssoc, $comparison = null)
{
if ($contentAssoc instanceof \Thelia\Model\ContentAssoc) {
return $this
->addUsingAlias(CategoryTableMap::ID, $contentAssoc->getCategoryId(), $comparison);
} elseif ($contentAssoc instanceof ObjectCollection) {
return $this
->useContentAssocQuery()
->filterByPrimaryKeys($contentAssoc->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByContentAssoc() only accepts arguments of type \Thelia\Model\ContentAssoc or Collection');
}
}
/**
* Adds a JOIN clause to the query using the ContentAssoc 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 joinContentAssoc($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ContentAssoc');
// 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, 'ContentAssoc');
}
return $this;
}
/**
* Use the ContentAssoc relation ContentAssoc 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\ContentAssocQuery A secondary query class using the current class as primary query
*/
public function useContentAssocQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinContentAssoc($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ContentAssoc', '\Thelia\Model\ContentAssocQuery');
}
/**
* Filter the query by a related \Thelia\Model\Rewriting object
*
@@ -1162,6 +1089,79 @@ abstract class CategoryQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'CategoryDocument', '\Thelia\Model\CategoryDocumentQuery');
}
/**
* Filter the query by a related \Thelia\Model\CategoryAssociatedContent object
*
* @param \Thelia\Model\CategoryAssociatedContent|ObjectCollection $categoryAssociatedContent 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 filterByCategoryAssociatedContent($categoryAssociatedContent, $comparison = null)
{
if ($categoryAssociatedContent instanceof \Thelia\Model\CategoryAssociatedContent) {
return $this
->addUsingAlias(CategoryTableMap::ID, $categoryAssociatedContent->getCategoryId(), $comparison);
} elseif ($categoryAssociatedContent instanceof ObjectCollection) {
return $this
->useCategoryAssociatedContentQuery()
->filterByPrimaryKeys($categoryAssociatedContent->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCategoryAssociatedContent() only accepts arguments of type \Thelia\Model\CategoryAssociatedContent or Collection');
}
}
/**
* Adds a JOIN clause to the query using the CategoryAssociatedContent 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 joinCategoryAssociatedContent($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CategoryAssociatedContent');
// 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, 'CategoryAssociatedContent');
}
return $this;
}
/**
* Use the CategoryAssociatedContent relation CategoryAssociatedContent 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\CategoryAssociatedContentQuery A secondary query class using the current class as primary query
*/
public function useCategoryAssociatedContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCategoryAssociatedContent($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CategoryAssociatedContent', '\Thelia\Model\CategoryAssociatedContentQuery');
}
/**
* Filter the query by a related \Thelia\Model\CategoryI18n object
*

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,930 +0,0 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\ContentAssoc as ChildContentAssoc;
use Thelia\Model\ContentAssocQuery as ChildContentAssocQuery;
use Thelia\Model\Map\ContentAssocTableMap;
/**
* Base class that represents a query for the 'content_assoc' table.
*
*
*
* @method ChildContentAssocQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildContentAssocQuery orderByCategoryId($order = Criteria::ASC) Order by the category_id column
* @method ChildContentAssocQuery orderByProductId($order = Criteria::ASC) Order by the product_id column
* @method ChildContentAssocQuery orderByContentId($order = Criteria::ASC) Order by the content_id column
* @method ChildContentAssocQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildContentAssocQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildContentAssocQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildContentAssocQuery groupById() Group by the id column
* @method ChildContentAssocQuery groupByCategoryId() Group by the category_id column
* @method ChildContentAssocQuery groupByProductId() Group by the product_id column
* @method ChildContentAssocQuery groupByContentId() Group by the content_id column
* @method ChildContentAssocQuery groupByPosition() Group by the position column
* @method ChildContentAssocQuery groupByCreatedAt() Group by the created_at column
* @method ChildContentAssocQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildContentAssocQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildContentAssocQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildContentAssocQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildContentAssocQuery leftJoinCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the Category relation
* @method ChildContentAssocQuery rightJoinCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Category relation
* @method ChildContentAssocQuery innerJoinCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the Category relation
*
* @method ChildContentAssocQuery leftJoinProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the Product relation
* @method ChildContentAssocQuery rightJoinProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Product relation
* @method ChildContentAssocQuery innerJoinProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the Product relation
*
* @method ChildContentAssocQuery leftJoinContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the Content relation
* @method ChildContentAssocQuery rightJoinContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Content relation
* @method ChildContentAssocQuery innerJoinContent($relationAlias = null) Adds a INNER JOIN clause to the query using the Content relation
*
* @method ChildContentAssoc findOne(ConnectionInterface $con = null) Return the first ChildContentAssoc matching the query
* @method ChildContentAssoc findOneOrCreate(ConnectionInterface $con = null) Return the first ChildContentAssoc matching the query, or a new ChildContentAssoc object populated from the query conditions when no match is found
*
* @method ChildContentAssoc findOneById(int $id) Return the first ChildContentAssoc filtered by the id column
* @method ChildContentAssoc findOneByCategoryId(int $category_id) Return the first ChildContentAssoc filtered by the category_id column
* @method ChildContentAssoc findOneByProductId(int $product_id) Return the first ChildContentAssoc filtered by the product_id column
* @method ChildContentAssoc findOneByContentId(int $content_id) Return the first ChildContentAssoc filtered by the content_id column
* @method ChildContentAssoc findOneByPosition(int $position) Return the first ChildContentAssoc filtered by the position column
* @method ChildContentAssoc findOneByCreatedAt(string $created_at) Return the first ChildContentAssoc filtered by the created_at column
* @method ChildContentAssoc findOneByUpdatedAt(string $updated_at) Return the first ChildContentAssoc filtered by the updated_at column
*
* @method array findById(int $id) Return ChildContentAssoc objects filtered by the id column
* @method array findByCategoryId(int $category_id) Return ChildContentAssoc objects filtered by the category_id column
* @method array findByProductId(int $product_id) Return ChildContentAssoc objects filtered by the product_id column
* @method array findByContentId(int $content_id) Return ChildContentAssoc objects filtered by the content_id column
* @method array findByPosition(int $position) Return ChildContentAssoc objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return ChildContentAssoc objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildContentAssoc objects filtered by the updated_at column
*
*/
abstract class ContentAssocQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\ContentAssocQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\ContentAssoc', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildContentAssocQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildContentAssocQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\ContentAssocQuery) {
return $criteria;
}
$query = new \Thelia\Model\ContentAssocQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildContentAssoc|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = ContentAssocTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(ContentAssocTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildContentAssoc A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, CATEGORY_ID, PRODUCT_ID, CONTENT_ID, POSITION, CREATED_AT, UPDATED_AT FROM content_assoc WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildContentAssoc();
$obj->hydrate($row);
ContentAssocTableMap::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildContentAssoc|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(ContentAssocTableMap::ID, $key, Criteria::EQUAL);
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(ContentAssocTableMap::ID, $keys, Criteria::IN);
}
/**
* Filter the query on the id column
*
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @param mixed $id The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(ContentAssocTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(ContentAssocTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentAssocTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the category_id column
*
* Example usage:
* <code>
* $query->filterByCategoryId(1234); // WHERE category_id = 1234
* $query->filterByCategoryId(array(12, 34)); // WHERE category_id IN (12, 34)
* $query->filterByCategoryId(array('min' => 12)); // WHERE category_id > 12
* </code>
*
* @see filterByCategory()
*
* @param mixed $categoryId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function filterByCategoryId($categoryId = null, $comparison = null)
{
if (is_array($categoryId)) {
$useMinMax = false;
if (isset($categoryId['min'])) {
$this->addUsingAlias(ContentAssocTableMap::CATEGORY_ID, $categoryId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($categoryId['max'])) {
$this->addUsingAlias(ContentAssocTableMap::CATEGORY_ID, $categoryId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentAssocTableMap::CATEGORY_ID, $categoryId, $comparison);
}
/**
* Filter the query on the product_id column
*
* Example usage:
* <code>
* $query->filterByProductId(1234); // WHERE product_id = 1234
* $query->filterByProductId(array(12, 34)); // WHERE product_id IN (12, 34)
* $query->filterByProductId(array('min' => 12)); // WHERE product_id > 12
* </code>
*
* @see filterByProduct()
*
* @param mixed $productId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function filterByProductId($productId = null, $comparison = null)
{
if (is_array($productId)) {
$useMinMax = false;
if (isset($productId['min'])) {
$this->addUsingAlias(ContentAssocTableMap::PRODUCT_ID, $productId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($productId['max'])) {
$this->addUsingAlias(ContentAssocTableMap::PRODUCT_ID, $productId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentAssocTableMap::PRODUCT_ID, $productId, $comparison);
}
/**
* Filter the query on the content_id column
*
* Example usage:
* <code>
* $query->filterByContentId(1234); // WHERE content_id = 1234
* $query->filterByContentId(array(12, 34)); // WHERE content_id IN (12, 34)
* $query->filterByContentId(array('min' => 12)); // WHERE content_id > 12
* </code>
*
* @see filterByContent()
*
* @param mixed $contentId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function filterByContentId($contentId = null, $comparison = null)
{
if (is_array($contentId)) {
$useMinMax = false;
if (isset($contentId['min'])) {
$this->addUsingAlias(ContentAssocTableMap::CONTENT_ID, $contentId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($contentId['max'])) {
$this->addUsingAlias(ContentAssocTableMap::CONTENT_ID, $contentId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentAssocTableMap::CONTENT_ID, $contentId, $comparison);
}
/**
* Filter the query on the position column
*
* Example usage:
* <code>
* $query->filterByPosition(1234); // WHERE position = 1234
* $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
* $query->filterByPosition(array('min' => 12)); // WHERE position > 12
* </code>
*
* @param mixed $position The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function filterByPosition($position = null, $comparison = null)
{
if (is_array($position)) {
$useMinMax = false;
if (isset($position['min'])) {
$this->addUsingAlias(ContentAssocTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(ContentAssocTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentAssocTableMap::POSITION, $position, $comparison);
}
/**
* Filter the query on the created_at column
*
* Example usage:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function filterByCreatedAt($createdAt = null, $comparison = null)
{
if (is_array($createdAt)) {
$useMinMax = false;
if (isset($createdAt['min'])) {
$this->addUsingAlias(ContentAssocTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(ContentAssocTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentAssocTableMap::CREATED_AT, $createdAt, $comparison);
}
/**
* Filter the query on the updated_at column
*
* Example usage:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{
if (is_array($updatedAt)) {
$useMinMax = false;
if (isset($updatedAt['min'])) {
$this->addUsingAlias(ContentAssocTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(ContentAssocTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentAssocTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Category object
*
* @param \Thelia\Model\Category|ObjectCollection $category The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function filterByCategory($category, $comparison = null)
{
if ($category instanceof \Thelia\Model\Category) {
return $this
->addUsingAlias(ContentAssocTableMap::CATEGORY_ID, $category->getId(), $comparison);
} elseif ($category instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ContentAssocTableMap::CATEGORY_ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCategory() only accepts arguments of type \Thelia\Model\Category or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Category relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function joinCategory($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Category');
// 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, 'Category');
}
return $this;
}
/**
* Use the Category relation Category 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\CategoryQuery A secondary query class using the current class as primary query
*/
public function useCategoryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCategory($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Category', '\Thelia\Model\CategoryQuery');
}
/**
* Filter the query by a related \Thelia\Model\Product object
*
* @param \Thelia\Model\Product|ObjectCollection $product The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function filterByProduct($product, $comparison = null)
{
if ($product instanceof \Thelia\Model\Product) {
return $this
->addUsingAlias(ContentAssocTableMap::PRODUCT_ID, $product->getId(), $comparison);
} elseif ($product instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ContentAssocTableMap::PRODUCT_ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByProduct() only accepts arguments of type \Thelia\Model\Product or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Product relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function joinProduct($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Product');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'Product');
}
return $this;
}
/**
* Use the Product relation Product object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query
*/
public function useProductQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinProduct($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery');
}
/**
* Filter the query by a related \Thelia\Model\Content object
*
* @param \Thelia\Model\Content|ObjectCollection $content The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function filterByContent($content, $comparison = null)
{
if ($content instanceof \Thelia\Model\Content) {
return $this
->addUsingAlias(ContentAssocTableMap::CONTENT_ID, $content->getId(), $comparison);
} elseif ($content instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ContentAssocTableMap::CONTENT_ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByContent() only accepts arguments of type \Thelia\Model\Content or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Content relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function joinContent($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Content');
// 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, 'Content');
}
return $this;
}
/**
* Use the Content relation Content 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\ContentQuery A secondary query class using the current class as primary query
*/
public function useContentQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinContent($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Content', '\Thelia\Model\ContentQuery');
}
/**
* Exclude object from result
*
* @param ChildContentAssoc $contentAssoc Object to remove from the list of results
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function prune($contentAssoc = null)
{
if ($contentAssoc) {
$this->addUsingAlias(ContentAssocTableMap::ID, $contentAssoc->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the content_assoc table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(ContentAssocTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($con);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
ContentAssocTableMap::clearInstancePool();
ContentAssocTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildContentAssoc or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildContentAssoc object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(ContentAssocTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(ContentAssocTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
ContentAssocTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
ContentAssocTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(ContentAssocTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(ContentAssocTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(ContentAssocTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(ContentAssocTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(ContentAssocTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildContentAssocQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(ContentAssocTableMap::CREATED_AT);
}
} // ContentAssocQuery

View File

@@ -44,10 +44,6 @@ 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 leftJoinContentAssoc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentAssoc relation
* @method ChildContentQuery rightJoinContentAssoc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentAssoc relation
* @method ChildContentQuery innerJoinContentAssoc($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentAssoc relation
*
* @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
@@ -64,6 +60,14 @@ use Thelia\Model\Map\ContentTableMap;
* @method ChildContentQuery rightJoinContentDocument($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentDocument relation
* @method ChildContentQuery innerJoinContentDocument($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentDocument relation
*
* @method ChildContentQuery leftJoinProductAssociatedContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductAssociatedContent relation
* @method ChildContentQuery rightJoinProductAssociatedContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductAssociatedContent relation
* @method ChildContentQuery innerJoinProductAssociatedContent($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductAssociatedContent relation
*
* @method ChildContentQuery leftJoinCategoryAssociatedContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryAssociatedContent relation
* @method ChildContentQuery rightJoinCategoryAssociatedContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryAssociatedContent relation
* @method ChildContentQuery innerJoinCategoryAssociatedContent($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryAssociatedContent relation
*
* @method ChildContentQuery leftJoinContentI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentI18n relation
* @method ChildContentQuery rightJoinContentI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentI18n relation
* @method ChildContentQuery innerJoinContentI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentI18n relation
@@ -598,79 +602,6 @@ abstract class ContentQuery extends ModelCriteria
return $this->addUsingAlias(ContentTableMap::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\ContentAssoc object
*
* @param \Thelia\Model\ContentAssoc|ObjectCollection $contentAssoc 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 filterByContentAssoc($contentAssoc, $comparison = null)
{
if ($contentAssoc instanceof \Thelia\Model\ContentAssoc) {
return $this
->addUsingAlias(ContentTableMap::ID, $contentAssoc->getContentId(), $comparison);
} elseif ($contentAssoc instanceof ObjectCollection) {
return $this
->useContentAssocQuery()
->filterByPrimaryKeys($contentAssoc->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByContentAssoc() only accepts arguments of type \Thelia\Model\ContentAssoc or Collection');
}
}
/**
* Adds a JOIN clause to the query using the ContentAssoc 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 joinContentAssoc($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ContentAssoc');
// 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, 'ContentAssoc');
}
return $this;
}
/**
* Use the ContentAssoc relation ContentAssoc 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\ContentAssocQuery A secondary query class using the current class as primary query
*/
public function useContentAssocQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinContentAssoc($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ContentAssoc', '\Thelia\Model\ContentAssocQuery');
}
/**
* Filter the query by a related \Thelia\Model\Rewriting object
*
@@ -963,6 +894,152 @@ abstract class ContentQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'ContentDocument', '\Thelia\Model\ContentDocumentQuery');
}
/**
* Filter the query by a related \Thelia\Model\ProductAssociatedContent object
*
* @param \Thelia\Model\ProductAssociatedContent|ObjectCollection $productAssociatedContent 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 filterByProductAssociatedContent($productAssociatedContent, $comparison = null)
{
if ($productAssociatedContent instanceof \Thelia\Model\ProductAssociatedContent) {
return $this
->addUsingAlias(ContentTableMap::ID, $productAssociatedContent->getContentId(), $comparison);
} elseif ($productAssociatedContent instanceof ObjectCollection) {
return $this
->useProductAssociatedContentQuery()
->filterByPrimaryKeys($productAssociatedContent->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByProductAssociatedContent() only accepts arguments of type \Thelia\Model\ProductAssociatedContent or Collection');
}
}
/**
* Adds a JOIN clause to the query using the ProductAssociatedContent 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 joinProductAssociatedContent($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ProductAssociatedContent');
// 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, 'ProductAssociatedContent');
}
return $this;
}
/**
* Use the ProductAssociatedContent relation ProductAssociatedContent 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\ProductAssociatedContentQuery A secondary query class using the current class as primary query
*/
public function useProductAssociatedContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinProductAssociatedContent($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ProductAssociatedContent', '\Thelia\Model\ProductAssociatedContentQuery');
}
/**
* Filter the query by a related \Thelia\Model\CategoryAssociatedContent object
*
* @param \Thelia\Model\CategoryAssociatedContent|ObjectCollection $categoryAssociatedContent 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 filterByCategoryAssociatedContent($categoryAssociatedContent, $comparison = null)
{
if ($categoryAssociatedContent instanceof \Thelia\Model\CategoryAssociatedContent) {
return $this
->addUsingAlias(ContentTableMap::ID, $categoryAssociatedContent->getContentId(), $comparison);
} elseif ($categoryAssociatedContent instanceof ObjectCollection) {
return $this
->useCategoryAssociatedContentQuery()
->filterByPrimaryKeys($categoryAssociatedContent->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCategoryAssociatedContent() only accepts arguments of type \Thelia\Model\CategoryAssociatedContent or Collection');
}
}
/**
* Adds a JOIN clause to the query using the CategoryAssociatedContent 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 joinCategoryAssociatedContent($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CategoryAssociatedContent');
// 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, 'CategoryAssociatedContent');
}
return $this;
}
/**
* Use the CategoryAssociatedContent relation CategoryAssociatedContent 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\CategoryAssociatedContentQuery A secondary query class using the current class as primary query
*/
public function useCategoryAssociatedContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCategoryAssociatedContent($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CategoryAssociatedContent', '\Thelia\Model\CategoryAssociatedContentQuery');
}
/**
* Filter the query by a related \Thelia\Model\ContentI18n object
*

File diff suppressed because it is too large Load Diff

View File

@@ -16,8 +16,10 @@ 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;
@@ -97,6 +99,11 @@ 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.
@@ -506,6 +513,10 @@ abstract class CouponOrder implements ActiveRecordInterface
$this->modifiedColumns[] = CouponOrderTableMap::CODE;
}
if ($this->aCoupon !== null && $this->aCoupon->getCode() !== $v) {
$this->aCoupon = null;
}
return $this;
} // setCode()
@@ -666,6 +677,9 @@ 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
/**
@@ -706,6 +720,7 @@ abstract class CouponOrder implements ActiveRecordInterface
if ($deep) { // also de-associate any related objects?
$this->aOrder = null;
$this->aCoupon = null;
} // if (deep)
}
@@ -840,6 +855,13 @@ 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()) {
@@ -1050,6 +1072,9 @@ 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;
@@ -1296,6 +1321,59 @@ 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
*/
@@ -1329,6 +1407,7 @@ abstract class CouponOrder implements ActiveRecordInterface
} // if ($deep)
$this->aOrder = null;
$this->aCoupon = null;
}
/**

View File

@@ -43,6 +43,10 @@ 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
*
@@ -551,6 +555,81 @@ 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
*

View File

@@ -13,6 +13,7 @@ use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\Coupon as ChildCoupon;
use Thelia\Model\CouponI18nQuery as ChildCouponI18nQuery;
use Thelia\Model\CouponQuery as ChildCouponQuery;
use Thelia\Model\Map\CouponTableMap;
@@ -23,63 +24,94 @@ 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 orderByAction($order = Criteria::ASC) Order by the action 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 orderByValue($order = Criteria::ASC) Order by the value column
* @method ChildCouponQuery orderByUsed($order = Criteria::ASC) Order by the used column
* @method ChildCouponQuery orderByAvailableSince($order = Criteria::ASC) Order by the available_since column
* @method ChildCouponQuery orderByDateLimit($order = Criteria::ASC) Order by the date_limit column
* @method ChildCouponQuery orderByActivate($order = Criteria::ASC) Order by the activate 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
* @method ChildCouponQuery orderByExpirationDate($order = Criteria::ASC) Order by the expiration_date column
* @method ChildCouponQuery orderBySerializedRules($order = Criteria::ASC) Order by the serialized_rules column
* @method ChildCouponQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCouponQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* @method ChildCouponQuery orderByVersion($order = Criteria::ASC) Order by the version column
*
* @method ChildCouponQuery groupById() Group by the id column
* @method ChildCouponQuery groupByCode() Group by the code column
* @method ChildCouponQuery groupByAction() Group by the action 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 groupByValue() Group by the value column
* @method ChildCouponQuery groupByUsed() Group by the used column
* @method ChildCouponQuery groupByAvailableSince() Group by the available_since column
* @method ChildCouponQuery groupByDateLimit() Group by the date_limit column
* @method ChildCouponQuery groupByActivate() Group by the activate column
* @method ChildCouponQuery groupByIsUsed() Group by the is_used column
* @method ChildCouponQuery groupByIsEnabled() Group by the is_enabled column
* @method ChildCouponQuery groupByExpirationDate() Group by the expiration_date column
* @method ChildCouponQuery groupBySerializedRules() Group by the serialized_rules column
* @method ChildCouponQuery groupByCreatedAt() Group by the created_at column
* @method ChildCouponQuery groupByUpdatedAt() Group by the updated_at column
* @method ChildCouponQuery groupByVersion() Group by the version column
*
* @method ChildCouponQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @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 leftJoinCouponRule($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponRule relation
* @method ChildCouponQuery rightJoinCouponRule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponRule relation
* @method ChildCouponQuery innerJoinCouponRule($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponRule relation
* @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
*
* @method ChildCouponQuery leftJoinCouponVersion($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponVersion relation
* @method ChildCouponQuery rightJoinCouponVersion($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponVersion relation
* @method ChildCouponQuery innerJoinCouponVersion($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponVersion relation
*
* @method ChildCoupon findOne(ConnectionInterface $con = null) Return the first ChildCoupon matching the query
* @method ChildCoupon findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCoupon matching the query, or a new ChildCoupon object populated from the query conditions when no match is found
*
* @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 findOneByAction(string $action) Return the first ChildCoupon filtered by the action 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 findOneByValue(double $value) Return the first ChildCoupon filtered by the value column
* @method ChildCoupon findOneByUsed(int $used) Return the first ChildCoupon filtered by the used column
* @method ChildCoupon findOneByAvailableSince(string $available_since) Return the first ChildCoupon filtered by the available_since column
* @method ChildCoupon findOneByDateLimit(string $date_limit) Return the first ChildCoupon filtered by the date_limit column
* @method ChildCoupon findOneByActivate(int $activate) Return the first ChildCoupon filtered by the activate 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
* @method ChildCoupon findOneByExpirationDate(string $expiration_date) Return the first ChildCoupon filtered by the expiration_date column
* @method ChildCoupon findOneBySerializedRules(string $serialized_rules) Return the first ChildCoupon filtered by the serialized_rules column
* @method ChildCoupon findOneByCreatedAt(string $created_at) Return the first ChildCoupon filtered by the created_at column
* @method ChildCoupon findOneByUpdatedAt(string $updated_at) Return the first ChildCoupon filtered by the updated_at column
* @method ChildCoupon findOneByVersion(int $version) Return the first ChildCoupon filtered by the version column
*
* @method 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 findByAction(string $action) Return ChildCoupon objects filtered by the action 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 findByValue(double $value) Return ChildCoupon objects filtered by the value column
* @method array findByUsed(int $used) Return ChildCoupon objects filtered by the used column
* @method array findByAvailableSince(string $available_since) Return ChildCoupon objects filtered by the available_since column
* @method array findByDateLimit(string $date_limit) Return ChildCoupon objects filtered by the date_limit column
* @method array findByActivate(int $activate) Return ChildCoupon objects filtered by the activate 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
* @method array findByExpirationDate(string $expiration_date) Return ChildCoupon objects filtered by the expiration_date column
* @method array findBySerializedRules(string $serialized_rules) Return ChildCoupon objects filtered by the serialized_rules column
* @method array findByCreatedAt(string $created_at) Return ChildCoupon objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCoupon objects filtered by the updated_at column
* @method array findByVersion(int $version) Return ChildCoupon objects filtered by the version column
*
*/
abstract class CouponQuery extends ModelCriteria
{
// versionable behavior
/**
* Whether the versioning is enabled
*/
static $isVersioningEnabled = true;
/**
* Initializes internal state of \Thelia\Model\Base\CouponQuery object.
*
@@ -163,7 +195,7 @@ abstract class CouponQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, CODE, ACTION, VALUE, USED, AVAILABLE_SINCE, DATE_LIMIT, ACTIVATE, CREATED_AT, UPDATED_AT FROM coupon WHERE ID = :p0';
$sql = 'SELECT ID, CODE, TYPE, TITLE, SHORT_DESCRIPTION, DESCRIPTION, VALUE, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES, CREATED_AT, UPDATED_AT, VERSION FROM coupon WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -323,32 +355,119 @@ abstract class CouponQuery extends ModelCriteria
}
/**
* Filter the query on the action column
* Filter the query on the type column
*
* Example usage:
* <code>
* $query->filterByAction('fooValue'); // WHERE action = 'fooValue'
* $query->filterByAction('%fooValue%'); // WHERE action LIKE '%fooValue%'
* $query->filterByType('fooValue'); // WHERE type = 'fooValue'
* $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%'
* </code>
*
* @param string $action The value to use as filter.
* @param string $type 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 filterByAction($action = null, $comparison = null)
public function filterByType($type = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($action)) {
if (is_array($type)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $action)) {
$action = str_replace('*', '%', $action);
} elseif (preg_match('/[\%\*]/', $type)) {
$type = str_replace('*', '%', $type);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CouponTableMap::ACTION, $action, $comparison);
return $this->addUsingAlias(CouponTableMap::TYPE, $type, $comparison);
}
/**
* Filter the query on the title column
*
* Example usage:
* <code>
* $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
* $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
* </code>
*
* @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:
* <code>
* $query->filterByShortDescription('fooValue'); // WHERE short_description = 'fooValue'
* $query->filterByShortDescription('%fooValue%'); // WHERE short_description LIKE '%fooValue%'
* </code>
*
* @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:
* <code>
* $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
* $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
* </code>
*
* @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);
}
/**
@@ -393,16 +512,16 @@ abstract class CouponQuery extends ModelCriteria
}
/**
* Filter the query on the used column
* Filter the query on the is_used column
*
* Example usage:
* <code>
* $query->filterByUsed(1234); // WHERE used = 1234
* $query->filterByUsed(array(12, 34)); // WHERE used IN (12, 34)
* $query->filterByUsed(array('min' => 12)); // WHERE used > 12
* $query->filterByIsUsed(1234); // WHERE is_used = 1234
* $query->filterByIsUsed(array(12, 34)); // WHERE is_used IN (12, 34)
* $query->filterByIsUsed(array('min' => 12)); // WHERE is_used > 12
* </code>
*
* @param mixed $used The value to use as filter.
* @param mixed $isUsed The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@@ -410,16 +529,16 @@ abstract class CouponQuery extends ModelCriteria
*
* @return ChildCouponQuery The current query, for fluid interface
*/
public function filterByUsed($used = null, $comparison = null)
public function filterByIsUsed($isUsed = null, $comparison = null)
{
if (is_array($used)) {
if (is_array($isUsed)) {
$useMinMax = false;
if (isset($used['min'])) {
$this->addUsingAlias(CouponTableMap::USED, $used['min'], Criteria::GREATER_EQUAL);
if (isset($isUsed['min'])) {
$this->addUsingAlias(CouponTableMap::IS_USED, $isUsed['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($used['max'])) {
$this->addUsingAlias(CouponTableMap::USED, $used['max'], Criteria::LESS_EQUAL);
if (isset($isUsed['max'])) {
$this->addUsingAlias(CouponTableMap::IS_USED, $isUsed['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
@@ -430,20 +549,61 @@ abstract class CouponQuery extends ModelCriteria
}
}
return $this->addUsingAlias(CouponTableMap::USED, $used, $comparison);
return $this->addUsingAlias(CouponTableMap::IS_USED, $isUsed, $comparison);
}
/**
* Filter the query on the available_since column
* Filter the query on the is_enabled column
*
* Example usage:
* <code>
* $query->filterByAvailableSince('2011-03-14'); // WHERE available_since = '2011-03-14'
* $query->filterByAvailableSince('now'); // WHERE available_since = '2011-03-14'
* $query->filterByAvailableSince(array('max' => 'yesterday')); // WHERE available_since > '2011-03-13'
* $query->filterByIsEnabled(1234); // WHERE is_enabled = 1234
* $query->filterByIsEnabled(array(12, 34)); // WHERE is_enabled IN (12, 34)
* $query->filterByIsEnabled(array('min' => 12)); // WHERE is_enabled > 12
* </code>
*
* @param mixed $availableSince The value to use as filter.
* @param mixed $isEnabled The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCouponQuery The current query, for fluid interface
*/
public function filterByIsEnabled($isEnabled = null, $comparison = null)
{
if (is_array($isEnabled)) {
$useMinMax = false;
if (isset($isEnabled['min'])) {
$this->addUsingAlias(CouponTableMap::IS_ENABLED, $isEnabled['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($isEnabled['max'])) {
$this->addUsingAlias(CouponTableMap::IS_ENABLED, $isEnabled['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponTableMap::IS_ENABLED, $isEnabled, $comparison);
}
/**
* Filter the query on the expiration_date column
*
* Example usage:
* <code>
* $query->filterByExpirationDate('2011-03-14'); // WHERE expiration_date = '2011-03-14'
* $query->filterByExpirationDate('now'); // WHERE expiration_date = '2011-03-14'
* $query->filterByExpirationDate(array('max' => 'yesterday')); // WHERE expiration_date > '2011-03-13'
* </code>
*
* @param mixed $expirationDate The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
@@ -453,16 +613,16 @@ abstract class CouponQuery extends ModelCriteria
*
* @return ChildCouponQuery The current query, for fluid interface
*/
public function filterByAvailableSince($availableSince = null, $comparison = null)
public function filterByExpirationDate($expirationDate = null, $comparison = null)
{
if (is_array($availableSince)) {
if (is_array($expirationDate)) {
$useMinMax = false;
if (isset($availableSince['min'])) {
$this->addUsingAlias(CouponTableMap::AVAILABLE_SINCE, $availableSince['min'], Criteria::GREATER_EQUAL);
if (isset($expirationDate['min'])) {
$this->addUsingAlias(CouponTableMap::EXPIRATION_DATE, $expirationDate['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($availableSince['max'])) {
$this->addUsingAlias(CouponTableMap::AVAILABLE_SINCE, $availableSince['max'], Criteria::LESS_EQUAL);
if (isset($expirationDate['max'])) {
$this->addUsingAlias(CouponTableMap::EXPIRATION_DATE, $expirationDate['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
@@ -473,91 +633,36 @@ abstract class CouponQuery extends ModelCriteria
}
}
return $this->addUsingAlias(CouponTableMap::AVAILABLE_SINCE, $availableSince, $comparison);
return $this->addUsingAlias(CouponTableMap::EXPIRATION_DATE, $expirationDate, $comparison);
}
/**
* Filter the query on the date_limit column
* Filter the query on the serialized_rules column
*
* Example usage:
* <code>
* $query->filterByDateLimit('2011-03-14'); // WHERE date_limit = '2011-03-14'
* $query->filterByDateLimit('now'); // WHERE date_limit = '2011-03-14'
* $query->filterByDateLimit(array('max' => 'yesterday')); // WHERE date_limit > '2011-03-13'
* $query->filterBySerializedRules('fooValue'); // WHERE serialized_rules = 'fooValue'
* $query->filterBySerializedRules('%fooValue%'); // WHERE serialized_rules LIKE '%fooValue%'
* </code>
*
* @param mixed $dateLimit The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $serializedRules 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 filterByDateLimit($dateLimit = null, $comparison = null)
public function filterBySerializedRules($serializedRules = null, $comparison = null)
{
if (is_array($dateLimit)) {
$useMinMax = false;
if (isset($dateLimit['min'])) {
$this->addUsingAlias(CouponTableMap::DATE_LIMIT, $dateLimit['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dateLimit['max'])) {
$this->addUsingAlias(CouponTableMap::DATE_LIMIT, $dateLimit['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
if (null === $comparison) {
if (is_array($serializedRules)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $serializedRules)) {
$serializedRules = str_replace('*', '%', $serializedRules);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CouponTableMap::DATE_LIMIT, $dateLimit, $comparison);
}
/**
* Filter the query on the activate column
*
* Example usage:
* <code>
* $query->filterByActivate(1234); // WHERE activate = 1234
* $query->filterByActivate(array(12, 34)); // WHERE activate IN (12, 34)
* $query->filterByActivate(array('min' => 12)); // WHERE activate > 12
* </code>
*
* @param mixed $activate The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCouponQuery The current query, for fluid interface
*/
public function filterByActivate($activate = null, $comparison = null)
{
if (is_array($activate)) {
$useMinMax = false;
if (isset($activate['min'])) {
$this->addUsingAlias(CouponTableMap::ACTIVATE, $activate['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($activate['max'])) {
$this->addUsingAlias(CouponTableMap::ACTIVATE, $activate['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponTableMap::ACTIVATE, $activate, $comparison);
return $this->addUsingAlias(CouponTableMap::SERIALIZED_RULES, $serializedRules, $comparison);
}
/**
@@ -647,40 +752,81 @@ abstract class CouponQuery extends ModelCriteria
}
/**
* Filter the query by a related \Thelia\Model\CouponRule object
* Filter the query on the version column
*
* @param \Thelia\Model\CouponRule|ObjectCollection $couponRule the related object to use as filter
* Example usage:
* <code>
* $query->filterByVersion(1234); // WHERE version = 1234
* $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34)
* $query->filterByVersion(array('min' => 12)); // WHERE version > 12
* </code>
*
* @param mixed $version The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCouponQuery The current query, for fluid interface
*/
public function filterByVersion($version = null, $comparison = null)
{
if (is_array($version)) {
$useMinMax = false;
if (isset($version['min'])) {
$this->addUsingAlias(CouponTableMap::VERSION, $version['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($version['max'])) {
$this->addUsingAlias(CouponTableMap::VERSION, $version['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
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 filterByCouponRule($couponRule, $comparison = null)
public function filterByCouponOrder($couponOrder, $comparison = null)
{
if ($couponRule instanceof \Thelia\Model\CouponRule) {
if ($couponOrder instanceof \Thelia\Model\CouponOrder) {
return $this
->addUsingAlias(CouponTableMap::ID, $couponRule->getCouponId(), $comparison);
} elseif ($couponRule instanceof ObjectCollection) {
->addUsingAlias(CouponTableMap::CODE, $couponOrder->getCode(), $comparison);
} elseif ($couponOrder instanceof ObjectCollection) {
return $this
->useCouponRuleQuery()
->filterByPrimaryKeys($couponRule->getPrimaryKeys())
->useCouponOrderQuery()
->filterByPrimaryKeys($couponOrder->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCouponRule() only accepts arguments of type \Thelia\Model\CouponRule or Collection');
throw new PropelException('filterByCouponOrder() only accepts arguments of type \Thelia\Model\CouponOrder or Collection');
}
}
/**
* Adds a JOIN clause to the query using the CouponRule relation
* 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 joinCouponRule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
public function joinCouponOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CouponRule');
$relationMap = $tableMap->getRelation('CouponOrder');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -695,14 +841,14 @@ abstract class CouponQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CouponRule');
$this->addJoinObject($join, 'CouponOrder');
}
return $this;
}
/**
* Use the CouponRule relation CouponRule object
* Use the CouponOrder relation CouponOrder object
*
* @see useQuery()
*
@@ -710,13 +856,159 @@ abstract class CouponQuery extends ModelCriteria
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\CouponRuleQuery A secondary query class using the current class as primary query
* @return \Thelia\Model\CouponOrderQuery A secondary query class using the current class as primary query
*/
public function useCouponRuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
public function useCouponOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCouponRule($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CouponRule', '\Thelia\Model\CouponRuleQuery');
->joinCouponOrder($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CouponOrder', '\Thelia\Model\CouponOrderQuery');
}
/**
* Filter the query by a related \Thelia\Model\CouponI18n object
*
* @param \Thelia\Model\CouponI18n|ObjectCollection $couponI18n 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 filterByCouponI18n($couponI18n, $comparison = null)
{
if ($couponI18n instanceof \Thelia\Model\CouponI18n) {
return $this
->addUsingAlias(CouponTableMap::ID, $couponI18n->getId(), $comparison);
} elseif ($couponI18n instanceof ObjectCollection) {
return $this
->useCouponI18nQuery()
->filterByPrimaryKeys($couponI18n->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCouponI18n() only accepts arguments of type \Thelia\Model\CouponI18n or Collection');
}
}
/**
* Adds a JOIN clause to the query using the CouponI18n 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 joinCouponI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CouponI18n');
// 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, 'CouponI18n');
}
return $this;
}
/**
* Use the CouponI18n relation CouponI18n 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\CouponI18nQuery A secondary query class using the current class as primary query
*/
public function useCouponI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinCouponI18n($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CouponI18n', '\Thelia\Model\CouponI18nQuery');
}
/**
* Filter the query by a related \Thelia\Model\CouponVersion object
*
* @param \Thelia\Model\CouponVersion|ObjectCollection $couponVersion 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 filterByCouponVersion($couponVersion, $comparison = null)
{
if ($couponVersion instanceof \Thelia\Model\CouponVersion) {
return $this
->addUsingAlias(CouponTableMap::ID, $couponVersion->getId(), $comparison);
} elseif ($couponVersion instanceof ObjectCollection) {
return $this
->useCouponVersionQuery()
->filterByPrimaryKeys($couponVersion->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCouponVersion() only accepts arguments of type \Thelia\Model\CouponVersion or Collection');
}
}
/**
* Adds a JOIN clause to the query using the CouponVersion 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 joinCouponVersion($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CouponVersion');
// 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, 'CouponVersion');
}
return $this;
}
/**
* Use the CouponVersion relation CouponVersion 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\CouponVersionQuery A secondary query class using the current class as primary query
*/
public function useCouponVersionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCouponVersion($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CouponVersion', '\Thelia\Model\CouponVersionQuery');
}
/**
@@ -876,4 +1168,89 @@ abstract class CouponQuery extends ModelCriteria
return $this->addAscendingOrderByColumn(CouponTableMap::CREATED_AT);
}
// i18n behavior
/**
* Adds a JOIN clause to the query using the i18n relation
*
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return ChildCouponQuery The current query, for fluid interface
*/
public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$relationName = $relationAlias ? $relationAlias : 'CouponI18n';
return $this
->joinCouponI18n($relationAlias, $joinType)
->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
}
/**
* Adds a JOIN clause to the query and hydrates the related I18n object.
* Shortcut for $c->joinI18n($locale)->with()
*
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return ChildCouponQuery The current query, for fluid interface
*/
public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
{
$this
->joinI18n($locale, null, $joinType)
->with('CouponI18n');
$this->with['CouponI18n']->setIsWithOneToMany(false);
return $this;
}
/**
* Use the I18n relation query object
*
* @see useQuery()
*
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return ChildCouponI18nQuery A secondary query class using the current class as primary query
*/
public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinI18n($locale, $relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CouponI18n', '\Thelia\Model\CouponI18nQuery');
}
// versionable behavior
/**
* Checks whether versioning is enabled
*
* @return boolean
*/
static public function isVersioningEnabled()
{
return self::$isVersioningEnabled;
}
/**
* Enables versioning
*/
static public function enableVersioning()
{
self::$isVersioningEnabled = true;
}
/**
* Disables versioning
*/
static public function disableVersioning()
{
self::$isVersioningEnabled = false;
}
} // CouponQuery

View File

@@ -2842,6 +2842,31 @@ 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
*/

View File

@@ -23,11 +23,11 @@ use Thelia\Model\CartItem as ChildCartItem;
use Thelia\Model\CartItemQuery as ChildCartItemQuery;
use Thelia\Model\Category as ChildCategory;
use Thelia\Model\CategoryQuery as ChildCategoryQuery;
use Thelia\Model\ContentAssoc as ChildContentAssoc;
use Thelia\Model\ContentAssocQuery as ChildContentAssocQuery;
use Thelia\Model\FeatureProduct as ChildFeatureProduct;
use Thelia\Model\FeatureProductQuery as ChildFeatureProductQuery;
use Thelia\Model\Product as ChildProduct;
use Thelia\Model\ProductAssociatedContent as ChildProductAssociatedContent;
use Thelia\Model\ProductAssociatedContentQuery as ChildProductAssociatedContentQuery;
use Thelia\Model\ProductCategory as ChildProductCategory;
use Thelia\Model\ProductCategoryQuery as ChildProductCategoryQuery;
use Thelia\Model\ProductDocument as ChildProductDocument;
@@ -167,12 +167,6 @@ abstract class Product implements ActiveRecordInterface
protected $collProductSaleElementss;
protected $collProductSaleElementssPartial;
/**
* @var ObjectCollection|ChildContentAssoc[] Collection to store aggregation of ChildContentAssoc objects.
*/
protected $collContentAssocs;
protected $collContentAssocsPartial;
/**
* @var ObjectCollection|ChildProductImage[] Collection to store aggregation of ChildProductImage objects.
*/
@@ -209,6 +203,12 @@ abstract class Product implements ActiveRecordInterface
protected $collCartItems;
protected $collCartItemsPartial;
/**
* @var ObjectCollection|ChildProductAssociatedContent[] Collection to store aggregation of ChildProductAssociatedContent objects.
*/
protected $collProductAssociatedContents;
protected $collProductAssociatedContentsPartial;
/**
* @var ObjectCollection|ChildProductI18n[] Collection to store aggregation of ChildProductI18n objects.
*/
@@ -302,12 +302,6 @@ abstract class Product implements ActiveRecordInterface
*/
protected $productSaleElementssScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $contentAssocsScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var ObjectCollection
@@ -344,6 +338,12 @@ abstract class Product implements ActiveRecordInterface
*/
protected $cartItemsScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $productAssociatedContentsScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var ObjectCollection
@@ -1137,8 +1137,6 @@ abstract class Product implements ActiveRecordInterface
$this->collProductSaleElementss = null;
$this->collContentAssocs = null;
$this->collProductImages = null;
$this->collProductDocuments = null;
@@ -1151,6 +1149,8 @@ abstract class Product implements ActiveRecordInterface
$this->collCartItems = null;
$this->collProductAssociatedContents = null;
$this->collProductI18ns = null;
$this->collProductVersions = null;
@@ -1447,23 +1447,6 @@ abstract class Product implements ActiveRecordInterface
}
}
if ($this->contentAssocsScheduledForDeletion !== null) {
if (!$this->contentAssocsScheduledForDeletion->isEmpty()) {
\Thelia\Model\ContentAssocQuery::create()
->filterByPrimaryKeys($this->contentAssocsScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->contentAssocsScheduledForDeletion = null;
}
}
if ($this->collContentAssocs !== null) {
foreach ($this->collContentAssocs as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->productImagesScheduledForDeletion !== null) {
if (!$this->productImagesScheduledForDeletion->isEmpty()) {
\Thelia\Model\ProductImageQuery::create()
@@ -1566,6 +1549,23 @@ abstract class Product implements ActiveRecordInterface
}
}
if ($this->productAssociatedContentsScheduledForDeletion !== null) {
if (!$this->productAssociatedContentsScheduledForDeletion->isEmpty()) {
\Thelia\Model\ProductAssociatedContentQuery::create()
->filterByPrimaryKeys($this->productAssociatedContentsScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->productAssociatedContentsScheduledForDeletion = null;
}
}
if ($this->collProductAssociatedContents !== null) {
foreach ($this->collProductAssociatedContents as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->productI18nsScheduledForDeletion !== null) {
if (!$this->productI18nsScheduledForDeletion->isEmpty()) {
\Thelia\Model\ProductI18nQuery::create()
@@ -1848,9 +1848,6 @@ abstract class Product implements ActiveRecordInterface
if (null !== $this->collProductSaleElementss) {
$result['ProductSaleElementss'] = $this->collProductSaleElementss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collContentAssocs) {
$result['ContentAssocs'] = $this->collContentAssocs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collProductImages) {
$result['ProductImages'] = $this->collProductImages->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
@@ -1869,6 +1866,9 @@ abstract class Product implements ActiveRecordInterface
if (null !== $this->collCartItems) {
$result['CartItems'] = $this->collCartItems->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collProductAssociatedContents) {
$result['ProductAssociatedContents'] = $this->collProductAssociatedContents->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collProductI18ns) {
$result['ProductI18ns'] = $this->collProductI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
@@ -2090,12 +2090,6 @@ abstract class Product implements ActiveRecordInterface
}
}
foreach ($this->getContentAssocs() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addContentAssoc($relObj->copy($deepCopy));
}
}
foreach ($this->getProductImages() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addProductImage($relObj->copy($deepCopy));
@@ -2132,6 +2126,12 @@ abstract class Product implements ActiveRecordInterface
}
}
foreach ($this->getProductAssociatedContents() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addProductAssociatedContent($relObj->copy($deepCopy));
}
}
foreach ($this->getProductI18ns() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addProductI18n($relObj->copy($deepCopy));
@@ -2245,9 +2245,6 @@ abstract class Product implements ActiveRecordInterface
if ('ProductSaleElements' == $relationName) {
return $this->initProductSaleElementss();
}
if ('ContentAssoc' == $relationName) {
return $this->initContentAssocs();
}
if ('ProductImage' == $relationName) {
return $this->initProductImages();
}
@@ -2266,6 +2263,9 @@ abstract class Product implements ActiveRecordInterface
if ('CartItem' == $relationName) {
return $this->initCartItems();
}
if ('ProductAssociatedContent' == $relationName) {
return $this->initProductAssociatedContents();
}
if ('ProductI18n' == $relationName) {
return $this->initProductI18ns();
}
@@ -3006,274 +3006,6 @@ abstract class Product implements ActiveRecordInterface
return $this;
}
/**
* Clears out the collContentAssocs 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 addContentAssocs()
*/
public function clearContentAssocs()
{
$this->collContentAssocs = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Reset is the collContentAssocs collection loaded partially.
*/
public function resetPartialContentAssocs($v = true)
{
$this->collContentAssocsPartial = $v;
}
/**
* Initializes the collContentAssocs collection.
*
* By default this just sets the collContentAssocs collection to an empty array (like clearcollContentAssocs());
* 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 initContentAssocs($overrideExisting = true)
{
if (null !== $this->collContentAssocs && !$overrideExisting) {
return;
}
$this->collContentAssocs = new ObjectCollection();
$this->collContentAssocs->setModel('\Thelia\Model\ContentAssoc');
}
/**
* Gets an array of ChildContentAssoc 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|ChildContentAssoc[] List of ChildContentAssoc objects
* @throws PropelException
*/
public function getContentAssocs($criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collContentAssocsPartial && !$this->isNew();
if (null === $this->collContentAssocs || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collContentAssocs) {
// return empty collection
$this->initContentAssocs();
} else {
$collContentAssocs = ChildContentAssocQuery::create(null, $criteria)
->filterByProduct($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collContentAssocsPartial && count($collContentAssocs)) {
$this->initContentAssocs(false);
foreach ($collContentAssocs as $obj) {
if (false == $this->collContentAssocs->contains($obj)) {
$this->collContentAssocs->append($obj);
}
}
$this->collContentAssocsPartial = true;
}
$collContentAssocs->getInternalIterator()->rewind();
return $collContentAssocs;
}
if ($partial && $this->collContentAssocs) {
foreach ($this->collContentAssocs as $obj) {
if ($obj->isNew()) {
$collContentAssocs[] = $obj;
}
}
}
$this->collContentAssocs = $collContentAssocs;
$this->collContentAssocsPartial = false;
}
}
return $this->collContentAssocs;
}
/**
* Sets a collection of ContentAssoc 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 $contentAssocs A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildProduct The current object (for fluent API support)
*/
public function setContentAssocs(Collection $contentAssocs, ConnectionInterface $con = null)
{
$contentAssocsToDelete = $this->getContentAssocs(new Criteria(), $con)->diff($contentAssocs);
$this->contentAssocsScheduledForDeletion = $contentAssocsToDelete;
foreach ($contentAssocsToDelete as $contentAssocRemoved) {
$contentAssocRemoved->setProduct(null);
}
$this->collContentAssocs = null;
foreach ($contentAssocs as $contentAssoc) {
$this->addContentAssoc($contentAssoc);
}
$this->collContentAssocs = $contentAssocs;
$this->collContentAssocsPartial = false;
return $this;
}
/**
* Returns the number of related ContentAssoc objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param ConnectionInterface $con
* @return int Count of related ContentAssoc objects.
* @throws PropelException
*/
public function countContentAssocs(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collContentAssocsPartial && !$this->isNew();
if (null === $this->collContentAssocs || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collContentAssocs) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getContentAssocs());
}
$query = ChildContentAssocQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByProduct($this)
->count($con);
}
return count($this->collContentAssocs);
}
/**
* Method called to associate a ChildContentAssoc object to this object
* through the ChildContentAssoc foreign key attribute.
*
* @param ChildContentAssoc $l ChildContentAssoc
* @return \Thelia\Model\Product The current object (for fluent API support)
*/
public function addContentAssoc(ChildContentAssoc $l)
{
if ($this->collContentAssocs === null) {
$this->initContentAssocs();
$this->collContentAssocsPartial = true;
}
if (!in_array($l, $this->collContentAssocs->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddContentAssoc($l);
}
return $this;
}
/**
* @param ContentAssoc $contentAssoc The contentAssoc object to add.
*/
protected function doAddContentAssoc($contentAssoc)
{
$this->collContentAssocs[]= $contentAssoc;
$contentAssoc->setProduct($this);
}
/**
* @param ContentAssoc $contentAssoc The contentAssoc object to remove.
* @return ChildProduct The current object (for fluent API support)
*/
public function removeContentAssoc($contentAssoc)
{
if ($this->getContentAssocs()->contains($contentAssoc)) {
$this->collContentAssocs->remove($this->collContentAssocs->search($contentAssoc));
if (null === $this->contentAssocsScheduledForDeletion) {
$this->contentAssocsScheduledForDeletion = clone $this->collContentAssocs;
$this->contentAssocsScheduledForDeletion->clear();
}
$this->contentAssocsScheduledForDeletion[]= $contentAssoc;
$contentAssoc->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 ContentAssocs 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|ChildContentAssoc[] List of ChildContentAssoc objects
*/
public function getContentAssocsJoinCategory($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildContentAssocQuery::create(null, $criteria);
$query->joinWith('Category', $joinBehavior);
return $this->getContentAssocs($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 ContentAssocs 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|ChildContentAssoc[] List of ChildContentAssoc objects
*/
public function getContentAssocsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildContentAssocQuery::create(null, $criteria);
$query->joinWith('Content', $joinBehavior);
return $this->getContentAssocs($query, $con);
}
/**
* Clears out the collProductImages collection
*
@@ -4707,6 +4439,249 @@ abstract class Product implements ActiveRecordInterface
return $this->getCartItems($query, $con);
}
/**
* Clears out the collProductAssociatedContents 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 addProductAssociatedContents()
*/
public function clearProductAssociatedContents()
{
$this->collProductAssociatedContents = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Reset is the collProductAssociatedContents collection loaded partially.
*/
public function resetPartialProductAssociatedContents($v = true)
{
$this->collProductAssociatedContentsPartial = $v;
}
/**
* Initializes the collProductAssociatedContents collection.
*
* By default this just sets the collProductAssociatedContents collection to an empty array (like clearcollProductAssociatedContents());
* 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 initProductAssociatedContents($overrideExisting = true)
{
if (null !== $this->collProductAssociatedContents && !$overrideExisting) {
return;
}
$this->collProductAssociatedContents = new ObjectCollection();
$this->collProductAssociatedContents->setModel('\Thelia\Model\ProductAssociatedContent');
}
/**
* Gets an array of ChildProductAssociatedContent 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|ChildProductAssociatedContent[] List of ChildProductAssociatedContent objects
* @throws PropelException
*/
public function getProductAssociatedContents($criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collProductAssociatedContentsPartial && !$this->isNew();
if (null === $this->collProductAssociatedContents || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collProductAssociatedContents) {
// return empty collection
$this->initProductAssociatedContents();
} else {
$collProductAssociatedContents = ChildProductAssociatedContentQuery::create(null, $criteria)
->filterByProduct($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collProductAssociatedContentsPartial && count($collProductAssociatedContents)) {
$this->initProductAssociatedContents(false);
foreach ($collProductAssociatedContents as $obj) {
if (false == $this->collProductAssociatedContents->contains($obj)) {
$this->collProductAssociatedContents->append($obj);
}
}
$this->collProductAssociatedContentsPartial = true;
}
$collProductAssociatedContents->getInternalIterator()->rewind();
return $collProductAssociatedContents;
}
if ($partial && $this->collProductAssociatedContents) {
foreach ($this->collProductAssociatedContents as $obj) {
if ($obj->isNew()) {
$collProductAssociatedContents[] = $obj;
}
}
}
$this->collProductAssociatedContents = $collProductAssociatedContents;
$this->collProductAssociatedContentsPartial = false;
}
}
return $this->collProductAssociatedContents;
}
/**
* Sets a collection of ProductAssociatedContent 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 $productAssociatedContents A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildProduct The current object (for fluent API support)
*/
public function setProductAssociatedContents(Collection $productAssociatedContents, ConnectionInterface $con = null)
{
$productAssociatedContentsToDelete = $this->getProductAssociatedContents(new Criteria(), $con)->diff($productAssociatedContents);
$this->productAssociatedContentsScheduledForDeletion = $productAssociatedContentsToDelete;
foreach ($productAssociatedContentsToDelete as $productAssociatedContentRemoved) {
$productAssociatedContentRemoved->setProduct(null);
}
$this->collProductAssociatedContents = null;
foreach ($productAssociatedContents as $productAssociatedContent) {
$this->addProductAssociatedContent($productAssociatedContent);
}
$this->collProductAssociatedContents = $productAssociatedContents;
$this->collProductAssociatedContentsPartial = false;
return $this;
}
/**
* Returns the number of related ProductAssociatedContent objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param ConnectionInterface $con
* @return int Count of related ProductAssociatedContent objects.
* @throws PropelException
*/
public function countProductAssociatedContents(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collProductAssociatedContentsPartial && !$this->isNew();
if (null === $this->collProductAssociatedContents || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collProductAssociatedContents) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getProductAssociatedContents());
}
$query = ChildProductAssociatedContentQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByProduct($this)
->count($con);
}
return count($this->collProductAssociatedContents);
}
/**
* Method called to associate a ChildProductAssociatedContent object to this object
* through the ChildProductAssociatedContent foreign key attribute.
*
* @param ChildProductAssociatedContent $l ChildProductAssociatedContent
* @return \Thelia\Model\Product The current object (for fluent API support)
*/
public function addProductAssociatedContent(ChildProductAssociatedContent $l)
{
if ($this->collProductAssociatedContents === null) {
$this->initProductAssociatedContents();
$this->collProductAssociatedContentsPartial = true;
}
if (!in_array($l, $this->collProductAssociatedContents->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddProductAssociatedContent($l);
}
return $this;
}
/**
* @param ProductAssociatedContent $productAssociatedContent The productAssociatedContent object to add.
*/
protected function doAddProductAssociatedContent($productAssociatedContent)
{
$this->collProductAssociatedContents[]= $productAssociatedContent;
$productAssociatedContent->setProduct($this);
}
/**
* @param ProductAssociatedContent $productAssociatedContent The productAssociatedContent object to remove.
* @return ChildProduct The current object (for fluent API support)
*/
public function removeProductAssociatedContent($productAssociatedContent)
{
if ($this->getProductAssociatedContents()->contains($productAssociatedContent)) {
$this->collProductAssociatedContents->remove($this->collProductAssociatedContents->search($productAssociatedContent));
if (null === $this->productAssociatedContentsScheduledForDeletion) {
$this->productAssociatedContentsScheduledForDeletion = clone $this->collProductAssociatedContents;
$this->productAssociatedContentsScheduledForDeletion->clear();
}
$this->productAssociatedContentsScheduledForDeletion[]= clone $productAssociatedContent;
$productAssociatedContent->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 ProductAssociatedContents 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|ChildProductAssociatedContent[] List of ChildProductAssociatedContent objects
*/
public function getProductAssociatedContentsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildProductAssociatedContentQuery::create(null, $criteria);
$query->joinWith('Content', $joinBehavior);
return $this->getProductAssociatedContents($query, $con);
}
/**
* Clears out the collProductI18ns collection
*
@@ -5752,11 +5727,6 @@ abstract class Product implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
if ($this->collContentAssocs) {
foreach ($this->collContentAssocs as $o) {
$o->clearAllReferences($deep);
}
}
if ($this->collProductImages) {
foreach ($this->collProductImages as $o) {
$o->clearAllReferences($deep);
@@ -5787,6 +5757,11 @@ abstract class Product implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
if ($this->collProductAssociatedContents) {
foreach ($this->collProductAssociatedContents as $o) {
$o->clearAllReferences($deep);
}
}
if ($this->collProductI18ns) {
foreach ($this->collProductI18ns as $o) {
$o->clearAllReferences($deep);
@@ -5830,10 +5805,6 @@ abstract class Product implements ActiveRecordInterface
$this->collProductSaleElementss->clearIterator();
}
$this->collProductSaleElementss = null;
if ($this->collContentAssocs instanceof Collection) {
$this->collContentAssocs->clearIterator();
}
$this->collContentAssocs = null;
if ($this->collProductImages instanceof Collection) {
$this->collProductImages->clearIterator();
}
@@ -5858,6 +5829,10 @@ abstract class Product implements ActiveRecordInterface
$this->collCartItems->clearIterator();
}
$this->collCartItems = null;
if ($this->collProductAssociatedContents instanceof Collection) {
$this->collProductAssociatedContents->clearIterator();
}
$this->collProductAssociatedContents = null;
if ($this->collProductI18ns instanceof Collection) {
$this->collProductI18ns->clearIterator();
}

View File

@@ -64,10 +64,6 @@ use Thelia\Model\Map\ProductTableMap;
* @method ChildProductQuery rightJoinProductSaleElements($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductSaleElements relation
* @method ChildProductQuery innerJoinProductSaleElements($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductSaleElements relation
*
* @method ChildProductQuery leftJoinContentAssoc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentAssoc relation
* @method ChildProductQuery rightJoinContentAssoc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentAssoc relation
* @method ChildProductQuery innerJoinContentAssoc($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentAssoc relation
*
* @method ChildProductQuery leftJoinProductImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductImage relation
* @method ChildProductQuery rightJoinProductImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductImage relation
* @method ChildProductQuery innerJoinProductImage($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductImage relation
@@ -92,6 +88,10 @@ use Thelia\Model\Map\ProductTableMap;
* @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
*
* @method ChildProductQuery leftJoinProductAssociatedContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductAssociatedContent relation
* @method ChildProductQuery rightJoinProductAssociatedContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductAssociatedContent relation
* @method ChildProductQuery innerJoinProductAssociatedContent($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductAssociatedContent relation
*
* @method ChildProductQuery leftJoinProductI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductI18n relation
* @method ChildProductQuery rightJoinProductI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductI18n relation
* @method ChildProductQuery innerJoinProductI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductI18n relation
@@ -996,79 +996,6 @@ abstract class ProductQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'ProductSaleElements', '\Thelia\Model\ProductSaleElementsQuery');
}
/**
* Filter the query by a related \Thelia\Model\ContentAssoc object
*
* @param \Thelia\Model\ContentAssoc|ObjectCollection $contentAssoc 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 filterByContentAssoc($contentAssoc, $comparison = null)
{
if ($contentAssoc instanceof \Thelia\Model\ContentAssoc) {
return $this
->addUsingAlias(ProductTableMap::ID, $contentAssoc->getProductId(), $comparison);
} elseif ($contentAssoc instanceof ObjectCollection) {
return $this
->useContentAssocQuery()
->filterByPrimaryKeys($contentAssoc->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByContentAssoc() only accepts arguments of type \Thelia\Model\ContentAssoc or Collection');
}
}
/**
* Adds a JOIN clause to the query using the ContentAssoc 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 joinContentAssoc($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ContentAssoc');
// 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, 'ContentAssoc');
}
return $this;
}
/**
* Use the ContentAssoc relation ContentAssoc 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\ContentAssocQuery A secondary query class using the current class as primary query
*/
public function useContentAssocQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinContentAssoc($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ContentAssoc', '\Thelia\Model\ContentAssocQuery');
}
/**
* Filter the query by a related \Thelia\Model\ProductImage object
*
@@ -1507,6 +1434,79 @@ abstract class ProductQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'CartItem', '\Thelia\Model\CartItemQuery');
}
/**
* Filter the query by a related \Thelia\Model\ProductAssociatedContent object
*
* @param \Thelia\Model\ProductAssociatedContent|ObjectCollection $productAssociatedContent 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 filterByProductAssociatedContent($productAssociatedContent, $comparison = null)
{
if ($productAssociatedContent instanceof \Thelia\Model\ProductAssociatedContent) {
return $this
->addUsingAlias(ProductTableMap::ID, $productAssociatedContent->getProductId(), $comparison);
} elseif ($productAssociatedContent instanceof ObjectCollection) {
return $this
->useProductAssociatedContentQuery()
->filterByPrimaryKeys($productAssociatedContent->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByProductAssociatedContent() only accepts arguments of type \Thelia\Model\ProductAssociatedContent or Collection');
}
}
/**
* Adds a JOIN clause to the query using the ProductAssociatedContent 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 joinProductAssociatedContent($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ProductAssociatedContent');
// 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, 'ProductAssociatedContent');
}
return $this;
}
/**
* Use the ProductAssociatedContent relation ProductAssociatedContent 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\ProductAssociatedContentQuery A secondary query class using the current class as primary query
*/
public function useProductAssociatedContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinProductAssociatedContent($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ProductAssociatedContent', '\Thelia\Model\ProductAssociatedContentQuery');
}
/**
* Filter the query by a related \Thelia\Model\ProductI18n object
*

View File

@@ -1,9 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\ContentAssoc as BaseContentAssoc;
class ContentAssoc extends BaseContentAssoc {
}

View File

@@ -1,20 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\ContentAssocQuery as BaseContentAssocQuery;
/**
* Skeleton subclass for performing query and update operations on the 'content_assoc' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
*/
class ContentAssocQuery extends BaseContentAssocQuery {
} // ContentAssocQuery

View File

@@ -193,10 +193,10 @@ 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('ContentAssoc', '\\Thelia\\Model\\ContentAssoc', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'ContentAssocs');
$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');
$this->addRelation('CategoryI18n', '\\Thelia\\Model\\CategoryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CategoryI18ns');
$this->addRelation('CategoryVersion', '\\Thelia\\Model\\CategoryVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CategoryVersions');
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Products');
@@ -228,10 +228,10 @@ class CategoryTableMap extends TableMap
ProductCategoryTableMap::clearInstancePool();
FeatureCategoryTableMap::clearInstancePool();
AttributeCategoryTableMap::clearInstancePool();
ContentAssocTableMap::clearInstancePool();
RewritingTableMap::clearInstancePool();
CategoryImageTableMap::clearInstancePool();
CategoryDocumentTableMap::clearInstancePool();
CategoryAssociatedContentTableMap::clearInstancePool();
CategoryI18nTableMap::clearInstancePool();
CategoryVersionTableMap::clearInstancePool();
}

View File

@@ -1,465 +0,0 @@
<?php
namespace Thelia\Model\Map;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
use Thelia\Model\ContentAssoc;
use Thelia\Model\ContentAssocQuery;
/**
* This class defines the structure of the 'content_assoc' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
*/
class ContentAssocTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Thelia.Model.Map.ContentAssocTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'content_assoc';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Thelia\\Model\\ContentAssoc';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Thelia.Model.ContentAssoc';
/**
* The total number of columns
*/
const NUM_COLUMNS = 7;
/**
* The number of lazy-loaded columns
*/
const NUM_LAZY_LOAD_COLUMNS = 0;
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 7;
/**
* the column name for the ID field
*/
const ID = 'content_assoc.ID';
/**
* the column name for the CATEGORY_ID field
*/
const CATEGORY_ID = 'content_assoc.CATEGORY_ID';
/**
* the column name for the PRODUCT_ID field
*/
const PRODUCT_ID = 'content_assoc.PRODUCT_ID';
/**
* the column name for the CONTENT_ID field
*/
const CONTENT_ID = 'content_assoc.CONTENT_ID';
/**
* the column name for the POSITION field
*/
const POSITION = 'content_assoc.POSITION';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'content_assoc.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'content_assoc.UPDATED_AT';
/**
* The default string format for model objects of the related table
*/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'CategoryId', 'ProductId', 'ContentId', 'Position', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'categoryId', 'productId', 'contentId', 'position', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(ContentAssocTableMap::ID, ContentAssocTableMap::CATEGORY_ID, ContentAssocTableMap::PRODUCT_ID, ContentAssocTableMap::CONTENT_ID, ContentAssocTableMap::POSITION, ContentAssocTableMap::CREATED_AT, ContentAssocTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'CATEGORY_ID', 'PRODUCT_ID', 'CONTENT_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'category_id', 'product_id', 'content_id', 'position', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'CategoryId' => 1, 'ProductId' => 2, 'ContentId' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'categoryId' => 1, 'productId' => 2, 'contentId' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
self::TYPE_COLNAME => array(ContentAssocTableMap::ID => 0, ContentAssocTableMap::CATEGORY_ID => 1, ContentAssocTableMap::PRODUCT_ID => 2, ContentAssocTableMap::CONTENT_ID => 3, ContentAssocTableMap::POSITION => 4, ContentAssocTableMap::CREATED_AT => 5, ContentAssocTableMap::UPDATED_AT => 6, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CATEGORY_ID' => 1, 'PRODUCT_ID' => 2, 'CONTENT_ID' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
self::TYPE_FIELDNAME => array('id' => 0, 'category_id' => 1, 'product_id' => 2, 'content_id' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
);
/**
* Initialize the table attributes and columns
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('content_assoc');
$this->setPhpName('ContentAssoc');
$this->setClassName('\\Thelia\\Model\\ContentAssoc');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('CATEGORY_ID', 'CategoryId', 'INTEGER', 'category', 'ID', false, null, null);
$this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', false, null, null);
$this->addForeignKey('CONTENT_ID', 'ContentId', 'INTEGER', 'content', 'ID', false, null, null);
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('Category', '\\Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('Content', '\\Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('content_id' => 'id', ), 'CASCADE', 'RESTRICT');
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
);
} // getBehaviors()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*/
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
// If the PK cannot be derived from the row, return NULL.
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
return (int) $row[
$indexType == TableMap::TYPE_NUM
? 0 + $offset
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
];
}
/**
* The class that the tableMap will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is translated into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
*/
public static function getOMClass($withPrefix = true)
{
return $withPrefix ? ContentAssocTableMap::CLASS_DEFAULT : ContentAssocTableMap::OM_CLASS;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row row returned by DataFetcher->fetch().
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (ContentAssoc object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = ContentAssocTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = ContentAssocTableMap::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $offset, true); // rehydrate
$col = $offset + ContentAssocTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = ContentAssocTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
ContentAssocTableMap::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @param DataFetcherInterface $dataFetcher
* @return array
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(DataFetcherInterface $dataFetcher)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = static::getOMClass(false);
// populate the object(s)
while ($row = $dataFetcher->fetch()) {
$key = ContentAssocTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = ContentAssocTableMap::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, 0, true); // rehydrate
$results[] = $obj;
} else {
$obj = new $cls();
$obj->hydrate($row);
$results[] = $obj;
ContentAssocTableMap::addInstanceToPool($obj, $key);
} // if key exists
}
return $results;
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(ContentAssocTableMap::ID);
$criteria->addSelectColumn(ContentAssocTableMap::CATEGORY_ID);
$criteria->addSelectColumn(ContentAssocTableMap::PRODUCT_ID);
$criteria->addSelectColumn(ContentAssocTableMap::CONTENT_ID);
$criteria->addSelectColumn(ContentAssocTableMap::POSITION);
$criteria->addSelectColumn(ContentAssocTableMap::CREATED_AT);
$criteria->addSelectColumn(ContentAssocTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.CATEGORY_ID');
$criteria->addSelectColumn($alias . '.PRODUCT_ID');
$criteria->addSelectColumn($alias . '.CONTENT_ID');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the TableMap related to this object.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getServiceContainer()->getDatabaseMap(ContentAssocTableMap::DATABASE_NAME)->getTable(ContentAssocTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(ContentAssocTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(ContentAssocTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new ContentAssocTableMap());
}
}
/**
* Performs a DELETE on the database, given a ContentAssoc or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ContentAssoc object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(ContentAssocTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Thelia\Model\ContentAssoc) { // it's a model object
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(ContentAssocTableMap::DATABASE_NAME);
$criteria->add(ContentAssocTableMap::ID, (array) $values, Criteria::IN);
}
$query = ContentAssocQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { ContentAssocTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { ContentAssocTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the content_assoc table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll(ConnectionInterface $con = null)
{
return ContentAssocQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a ContentAssoc or Criteria object.
*
* @param mixed $criteria Criteria or ContentAssoc object containing data that is used to create the INSERT statement.
* @param ConnectionInterface $con the ConnectionInterface connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($criteria, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(ContentAssocTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from ContentAssoc object
}
if ($criteria->containsKey(ContentAssocTableMap::ID) && $criteria->keyContainsValue(ContentAssocTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ContentAssocTableMap::ID.')');
}
// Set the correct dbName
$query = ContentAssocQuery::create()->mergeWith($criteria);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = $query->doInsert($con);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
} // ContentAssocTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
ContentAssocTableMap::buildTableMap();

View File

@@ -184,11 +184,12 @@ class ContentTableMap extends TableMap
*/
public function buildRelations()
{
$this->addRelation('ContentAssoc', '\\Thelia\\Model\\ContentAssoc', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentAssocs');
$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');
$this->addRelation('ProductAssociatedContent', '\\Thelia\\Model\\ProductAssociatedContent', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ProductAssociatedContents');
$this->addRelation('CategoryAssociatedContent', '\\Thelia\\Model\\CategoryAssociatedContent', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'CategoryAssociatedContents');
$this->addRelation('ContentI18n', '\\Thelia\\Model\\ContentI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ContentI18ns');
$this->addRelation('ContentVersion', '\\Thelia\\Model\\ContentVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ContentVersions');
$this->addRelation('Folder', '\\Thelia\\Model\\Folder', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Folders');
@@ -215,11 +216,12 @@ 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.
ContentAssocTableMap::clearInstancePool();
RewritingTableMap::clearInstancePool();
ContentFolderTableMap::clearInstancePool();
ContentImageTableMap::clearInstancePool();
ContentDocumentTableMap::clearInstancePool();
ProductAssociatedContentTableMap::clearInstancePool();
CategoryAssociatedContentTableMap::clearInstancePool();
ContentI18nTableMap::clearInstancePool();
ContentVersionTableMap::clearInstancePool();
}

View File

@@ -152,7 +152,7 @@ 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->addColumn('CODE', 'Code', 'VARCHAR', true, 45, 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,6 +164,7 @@ 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()
/**

View File

@@ -57,7 +57,7 @@ class CouponTableMap extends TableMap
/**
* The total number of columns
*/
const NUM_COLUMNS = 10;
const NUM_COLUMNS = 14;
/**
* 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 = 10;
const NUM_HYDRATE_COLUMNS = 14;
/**
* the column name for the ID field
@@ -80,9 +80,24 @@ class CouponTableMap extends TableMap
const CODE = 'coupon.CODE';
/**
* the column name for the ACTION field
* the column name for the TYPE field
*/
const ACTION = 'coupon.ACTION';
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 VALUE field
@@ -90,24 +105,24 @@ class CouponTableMap extends TableMap
const VALUE = 'coupon.VALUE';
/**
* the column name for the USED field
* the column name for the IS_USED field
*/
const USED = 'coupon.USED';
const IS_USED = 'coupon.IS_USED';
/**
* the column name for the AVAILABLE_SINCE field
* the column name for the IS_ENABLED field
*/
const AVAILABLE_SINCE = 'coupon.AVAILABLE_SINCE';
const IS_ENABLED = 'coupon.IS_ENABLED';
/**
* the column name for the DATE_LIMIT field
* the column name for the EXPIRATION_DATE field
*/
const DATE_LIMIT = 'coupon.DATE_LIMIT';
const EXPIRATION_DATE = 'coupon.EXPIRATION_DATE';
/**
* the column name for the ACTIVATE field
* the column name for the SERIALIZED_RULES field
*/
const ACTIVATE = 'coupon.ACTIVATE';
const SERIALIZED_RULES = 'coupon.SERIALIZED_RULES';
/**
* the column name for the CREATED_AT field
@@ -119,11 +134,25 @@ class CouponTableMap extends TableMap
*/
const UPDATED_AT = 'coupon.UPDATED_AT';
/**
* the column name for the VERSION field
*/
const VERSION = 'coupon.VERSION';
/**
* The default string format for model objects of the related table
*/
const DEFAULT_STRING_FORMAT = 'YAML';
// i18n behavior
/**
* The default locale to use for translations.
*
* @var string
*/
const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -131,12 +160,12 @@ class CouponTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Code', 'Action', 'Value', 'Used', 'AvailableSince', 'DateLimit', 'Activate', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'action', 'value', 'used', 'availableSince', 'dateLimit', 'activate', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::ACTION, CouponTableMap::VALUE, CouponTableMap::USED, CouponTableMap::AVAILABLE_SINCE, CouponTableMap::DATE_LIMIT, CouponTableMap::ACTIVATE, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'ACTION', 'VALUE', 'USED', 'AVAILABLE_SINCE', 'DATE_LIMIT', 'ACTIVATE', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'code', 'action', 'value', 'used', 'available_since', 'date_limit', 'activate', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Title', 'ShortDescription', 'Description', 'Value', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRules', 'CreatedAt', 'UpdatedAt', 'Version', ),
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'title', 'shortDescription', 'description', 'value', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRules', 'createdAt', 'updatedAt', 'version', ),
self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::TYPE, CouponTableMap::TITLE, CouponTableMap::SHORT_DESCRIPTION, CouponTableMap::DESCRIPTION, CouponTableMap::VALUE, CouponTableMap::IS_USED, CouponTableMap::IS_ENABLED, CouponTableMap::EXPIRATION_DATE, CouponTableMap::SERIALIZED_RULES, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, CouponTableMap::VERSION, ),
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', 'VALUE', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ),
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'title', 'short_description', 'description', 'value', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules', 'created_at', 'updated_at', 'version', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
);
/**
@@ -146,12 +175,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, 'Action' => 2, 'Value' => 3, 'Used' => 4, 'AvailableSince' => 5, 'DateLimit' => 6, 'Activate' => 7, 'CreatedAt' => 8, 'UpdatedAt' => 9, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'action' => 2, 'value' => 3, 'used' => 4, 'availableSince' => 5, 'dateLimit' => 6, 'activate' => 7, 'createdAt' => 8, 'updatedAt' => 9, ),
self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::ACTION => 2, CouponTableMap::VALUE => 3, CouponTableMap::USED => 4, CouponTableMap::AVAILABLE_SINCE => 5, CouponTableMap::DATE_LIMIT => 6, CouponTableMap::ACTIVATE => 7, CouponTableMap::CREATED_AT => 8, CouponTableMap::UPDATED_AT => 9, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'ACTION' => 2, 'VALUE' => 3, 'USED' => 4, 'AVAILABLE_SINCE' => 5, 'DATE_LIMIT' => 6, 'ACTIVATE' => 7, 'CREATED_AT' => 8, 'UPDATED_AT' => 9, ),
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'action' => 2, 'value' => 3, 'used' => 4, 'available_since' => 5, 'date_limit' => 6, 'activate' => 7, 'created_at' => 8, 'updated_at' => 9, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Title' => 3, 'ShortDescription' => 4, 'Description' => 5, 'Value' => 6, 'IsUsed' => 7, 'IsEnabled' => 8, 'ExpirationDate' => 9, 'SerializedRules' => 10, 'CreatedAt' => 11, 'UpdatedAt' => 12, 'Version' => 13, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'shortDescription' => 4, 'description' => 5, 'value' => 6, 'isUsed' => 7, 'isEnabled' => 8, 'expirationDate' => 9, 'serializedRules' => 10, 'createdAt' => 11, 'updatedAt' => 12, 'version' => 13, ),
self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::TYPE => 2, CouponTableMap::TITLE => 3, CouponTableMap::SHORT_DESCRIPTION => 4, CouponTableMap::DESCRIPTION => 5, CouponTableMap::VALUE => 6, CouponTableMap::IS_USED => 7, CouponTableMap::IS_ENABLED => 8, CouponTableMap::EXPIRATION_DATE => 9, CouponTableMap::SERIALIZED_RULES => 10, CouponTableMap::CREATED_AT => 11, CouponTableMap::UPDATED_AT => 12, CouponTableMap::VERSION => 13, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'TITLE' => 3, 'SHORT_DESCRIPTION' => 4, 'DESCRIPTION' => 5, 'VALUE' => 6, 'IS_USED' => 7, 'IS_ENABLED' => 8, 'EXPIRATION_DATE' => 9, 'SERIALIZED_RULES' => 10, 'CREATED_AT' => 11, 'UPDATED_AT' => 12, 'VERSION' => 13, ),
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'short_description' => 4, 'description' => 5, 'value' => 6, 'is_used' => 7, 'is_enabled' => 8, 'expiration_date' => 9, 'serialized_rules' => 10, 'created_at' => 11, 'updated_at' => 12, 'version' => 13, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
);
/**
@@ -172,14 +201,18 @@ class CouponTableMap extends TableMap
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null);
$this->addColumn('ACTION', 'Action', 'VARCHAR', true, 255, 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('VALUE', 'Value', 'FLOAT', true, null, null);
$this->addColumn('USED', 'Used', 'TINYINT', false, null, null);
$this->addColumn('AVAILABLE_SINCE', 'AvailableSince', 'TIMESTAMP', false, null, null);
$this->addColumn('DATE_LIMIT', 'DateLimit', 'TIMESTAMP', false, null, null);
$this->addColumn('ACTIVATE', 'Activate', 'TINYINT', false, null, null);
$this->addColumn('IS_USED', 'IsUsed', 'TINYINT', true, null, null);
$this->addColumn('IS_ENABLED', 'IsEnabled', 'TINYINT', true, null, null);
$this->addColumn('EXPIRATION_DATE', 'ExpirationDate', 'TIMESTAMP', true, null, null);
$this->addColumn('SERIALIZED_RULES', 'SerializedRules', 'LONGVARCHAR', true, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0);
} // initialize()
/**
@@ -187,7 +220,9 @@ class CouponTableMap extends TableMap
*/
public function buildRelations()
{
$this->addRelation('CouponRule', '\\Thelia\\Model\\CouponRule', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', 'RESTRICT', 'CouponRules');
$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()
/**
@@ -200,6 +235,8 @@ 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' => '', ),
'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()
/**
@@ -209,7 +246,8 @@ class CouponTableMap 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.
CouponRuleTableMap::clearInstancePool();
CouponI18nTableMap::clearInstancePool();
CouponVersionTableMap::clearInstancePool();
}
/**
@@ -352,25 +390,33 @@ class CouponTableMap extends TableMap
if (null === $alias) {
$criteria->addSelectColumn(CouponTableMap::ID);
$criteria->addSelectColumn(CouponTableMap::CODE);
$criteria->addSelectColumn(CouponTableMap::ACTION);
$criteria->addSelectColumn(CouponTableMap::TYPE);
$criteria->addSelectColumn(CouponTableMap::TITLE);
$criteria->addSelectColumn(CouponTableMap::SHORT_DESCRIPTION);
$criteria->addSelectColumn(CouponTableMap::DESCRIPTION);
$criteria->addSelectColumn(CouponTableMap::VALUE);
$criteria->addSelectColumn(CouponTableMap::USED);
$criteria->addSelectColumn(CouponTableMap::AVAILABLE_SINCE);
$criteria->addSelectColumn(CouponTableMap::DATE_LIMIT);
$criteria->addSelectColumn(CouponTableMap::ACTIVATE);
$criteria->addSelectColumn(CouponTableMap::IS_USED);
$criteria->addSelectColumn(CouponTableMap::IS_ENABLED);
$criteria->addSelectColumn(CouponTableMap::EXPIRATION_DATE);
$criteria->addSelectColumn(CouponTableMap::SERIALIZED_RULES);
$criteria->addSelectColumn(CouponTableMap::CREATED_AT);
$criteria->addSelectColumn(CouponTableMap::UPDATED_AT);
$criteria->addSelectColumn(CouponTableMap::VERSION);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.CODE');
$criteria->addSelectColumn($alias . '.ACTION');
$criteria->addSelectColumn($alias . '.TYPE');
$criteria->addSelectColumn($alias . '.TITLE');
$criteria->addSelectColumn($alias . '.SHORT_DESCRIPTION');
$criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.VALUE');
$criteria->addSelectColumn($alias . '.USED');
$criteria->addSelectColumn($alias . '.AVAILABLE_SINCE');
$criteria->addSelectColumn($alias . '.DATE_LIMIT');
$criteria->addSelectColumn($alias . '.ACTIVATE');
$criteria->addSelectColumn($alias . '.IS_USED');
$criteria->addSelectColumn($alias . '.IS_ENABLED');
$criteria->addSelectColumn($alias . '.EXPIRATION_DATE');
$criteria->addSelectColumn($alias . '.SERIALIZED_RULES');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
$criteria->addSelectColumn($alias . '.VERSION');
}
}

View File

@@ -200,13 +200,13 @@ class ProductTableMap extends TableMap
$this->addRelation('ProductCategory', '\\Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductCategories');
$this->addRelation('FeatureProduct', '\\Thelia\\Model\\FeatureProduct', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'FeatureProducts');
$this->addRelation('ProductSaleElements', '\\Thelia\\Model\\ProductSaleElements', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductSaleElementss');
$this->addRelation('ContentAssoc', '\\Thelia\\Model\\ContentAssoc', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ContentAssocs');
$this->addRelation('ProductImage', '\\Thelia\\Model\\ProductImage', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductImages');
$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');
$this->addRelation('ProductVersion', '\\Thelia\\Model\\ProductVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductVersions');
$this->addRelation('Category', '\\Thelia\\Model\\Category', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Categories');
@@ -238,11 +238,11 @@ class ProductTableMap extends TableMap
ProductCategoryTableMap::clearInstancePool();
FeatureProductTableMap::clearInstancePool();
ProductSaleElementsTableMap::clearInstancePool();
ContentAssocTableMap::clearInstancePool();
ProductImageTableMap::clearInstancePool();
ProductDocumentTableMap::clearInstancePool();
AccessoryTableMap::clearInstancePool();
RewritingTableMap::clearInstancePool();
ProductAssociatedContentTableMap::clearInstancePool();
ProductI18nTableMap::clearInstancePool();
ProductVersionTableMap::clearInstancePool();
}