+ * $query->filterByRememberMeToken('fooValue'); // WHERE remember_me_token = 'fooValue'
+ * $query->filterByRememberMeToken('%fooValue%'); // WHERE remember_me_token LIKE '%fooValue%'
+ *
+ *
+ * @param string $rememberMeToken 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 ChildAdminQuery The current query, for fluid interface
+ */
+ public function filterByRememberMeToken($rememberMeToken = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($rememberMeToken)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $rememberMeToken)) {
+ $rememberMeToken = str_replace('*', '%', $rememberMeToken);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(AdminTableMap::REMEMBER_ME_TOKEN, $rememberMeToken, $comparison);
+ }
+
+ /**
+ * Filter the query on the remember_me_serial column
+ *
+ * Example usage:
+ *
+ * $query->filterByRememberMeSerial('fooValue'); // WHERE remember_me_serial = 'fooValue'
+ * $query->filterByRememberMeSerial('%fooValue%'); // WHERE remember_me_serial LIKE '%fooValue%'
+ *
+ *
+ * @param string $rememberMeSerial 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 ChildAdminQuery The current query, for fluid interface
+ */
+ public function filterByRememberMeSerial($rememberMeSerial = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($rememberMeSerial)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $rememberMeSerial)) {
+ $rememberMeSerial = str_replace('*', '%', $rememberMeSerial);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(AdminTableMap::REMEMBER_ME_SERIAL, $rememberMeSerial, $comparison);
+ }
+
/**
* Filter the query on the created_at column
*
diff --git a/core/lib/Thelia/Model/Base/Attribute.php b/core/lib/Thelia/Model/Base/Attribute.php
index 3c754c3b5..64e765fdd 100644
--- a/core/lib/Thelia/Model/Base/Attribute.php
+++ b/core/lib/Thelia/Model/Base/Attribute.php
@@ -20,15 +20,15 @@ use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\Attribute as ChildAttribute;
use Thelia\Model\AttributeAv as ChildAttributeAv;
use Thelia\Model\AttributeAvQuery as ChildAttributeAvQuery;
-use Thelia\Model\AttributeCategory as ChildAttributeCategory;
-use Thelia\Model\AttributeCategoryQuery as ChildAttributeCategoryQuery;
use Thelia\Model\AttributeCombination as ChildAttributeCombination;
use Thelia\Model\AttributeCombinationQuery as ChildAttributeCombinationQuery;
use Thelia\Model\AttributeI18n as ChildAttributeI18n;
use Thelia\Model\AttributeI18nQuery as ChildAttributeI18nQuery;
use Thelia\Model\AttributeQuery as ChildAttributeQuery;
-use Thelia\Model\Category as ChildCategory;
-use Thelia\Model\CategoryQuery as ChildCategoryQuery;
+use Thelia\Model\AttributeTemplate as ChildAttributeTemplate;
+use Thelia\Model\AttributeTemplateQuery as ChildAttributeTemplateQuery;
+use Thelia\Model\Template as ChildTemplate;
+use Thelia\Model\TemplateQuery as ChildTemplateQuery;
use Thelia\Model\Map\AttributeTableMap;
abstract class Attribute implements ActiveRecordInterface
@@ -102,10 +102,10 @@ abstract class Attribute implements ActiveRecordInterface
protected $collAttributeCombinationsPartial;
/**
- * @var ObjectCollection|ChildAttributeCategory[] Collection to store aggregation of ChildAttributeCategory objects.
+ * @var ObjectCollection|ChildAttributeTemplate[] Collection to store aggregation of ChildAttributeTemplate objects.
*/
- protected $collAttributeCategories;
- protected $collAttributeCategoriesPartial;
+ protected $collAttributeTemplates;
+ protected $collAttributeTemplatesPartial;
/**
* @var ObjectCollection|ChildAttributeI18n[] Collection to store aggregation of ChildAttributeI18n objects.
@@ -114,9 +114,9 @@ abstract class Attribute implements ActiveRecordInterface
protected $collAttributeI18nsPartial;
/**
- * @var ChildCategory[] Collection to store aggregation of ChildCategory objects.
+ * @var ChildTemplate[] Collection to store aggregation of ChildTemplate objects.
*/
- protected $collCategories;
+ protected $collTemplates;
/**
* Flag to prevent endless save loop, if this object is referenced
@@ -144,7 +144,7 @@ abstract class Attribute implements ActiveRecordInterface
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
- protected $categoriesScheduledForDeletion = null;
+ protected $templatesScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
@@ -162,7 +162,7 @@ abstract class Attribute implements ActiveRecordInterface
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
- protected $attributeCategoriesScheduledForDeletion = null;
+ protected $attributeTemplatesScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
@@ -697,11 +697,11 @@ abstract class Attribute implements ActiveRecordInterface
$this->collAttributeCombinations = null;
- $this->collAttributeCategories = null;
+ $this->collAttributeTemplates = null;
$this->collAttributeI18ns = null;
- $this->collCategories = null;
+ $this->collTemplates = null;
} // if (deep)
}
@@ -835,29 +835,29 @@ abstract class Attribute implements ActiveRecordInterface
$this->resetModified();
}
- if ($this->categoriesScheduledForDeletion !== null) {
- if (!$this->categoriesScheduledForDeletion->isEmpty()) {
+ if ($this->templatesScheduledForDeletion !== null) {
+ if (!$this->templatesScheduledForDeletion->isEmpty()) {
$pks = array();
$pk = $this->getPrimaryKey();
- foreach ($this->categoriesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
- $pks[] = array($remotePk, $pk);
+ foreach ($this->templatesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
+ $pks[] = array($pk, $remotePk);
}
- AttributeCategoryQuery::create()
+ AttributeTemplateQuery::create()
->filterByPrimaryKeys($pks)
->delete($con);
- $this->categoriesScheduledForDeletion = null;
+ $this->templatesScheduledForDeletion = null;
}
- foreach ($this->getCategories() as $category) {
- if ($category->isModified()) {
- $category->save($con);
+ foreach ($this->getTemplates() as $template) {
+ if ($template->isModified()) {
+ $template->save($con);
}
}
- } elseif ($this->collCategories) {
- foreach ($this->collCategories as $category) {
- if ($category->isModified()) {
- $category->save($con);
+ } elseif ($this->collTemplates) {
+ foreach ($this->collTemplates as $template) {
+ if ($template->isModified()) {
+ $template->save($con);
}
}
}
@@ -896,17 +896,17 @@ abstract class Attribute implements ActiveRecordInterface
}
}
- if ($this->attributeCategoriesScheduledForDeletion !== null) {
- if (!$this->attributeCategoriesScheduledForDeletion->isEmpty()) {
- \Thelia\Model\AttributeCategoryQuery::create()
- ->filterByPrimaryKeys($this->attributeCategoriesScheduledForDeletion->getPrimaryKeys(false))
+ if ($this->attributeTemplatesScheduledForDeletion !== null) {
+ if (!$this->attributeTemplatesScheduledForDeletion->isEmpty()) {
+ \Thelia\Model\AttributeTemplateQuery::create()
+ ->filterByPrimaryKeys($this->attributeTemplatesScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
- $this->attributeCategoriesScheduledForDeletion = null;
+ $this->attributeTemplatesScheduledForDeletion = null;
}
}
- if ($this->collAttributeCategories !== null) {
- foreach ($this->collAttributeCategories as $referrerFK) {
+ if ($this->collAttributeTemplates !== null) {
+ foreach ($this->collAttributeTemplates as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
@@ -1112,8 +1112,8 @@ abstract class Attribute implements ActiveRecordInterface
if (null !== $this->collAttributeCombinations) {
$result['AttributeCombinations'] = $this->collAttributeCombinations->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
- if (null !== $this->collAttributeCategories) {
- $result['AttributeCategories'] = $this->collAttributeCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ if (null !== $this->collAttributeTemplates) {
+ $result['AttributeTemplates'] = $this->collAttributeTemplates->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collAttributeI18ns) {
$result['AttributeI18ns'] = $this->collAttributeI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
@@ -1291,9 +1291,9 @@ abstract class Attribute implements ActiveRecordInterface
}
}
- foreach ($this->getAttributeCategories() as $relObj) {
+ foreach ($this->getAttributeTemplates() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addAttributeCategory($relObj->copy($deepCopy));
+ $copyObj->addAttributeTemplate($relObj->copy($deepCopy));
}
}
@@ -1350,8 +1350,8 @@ abstract class Attribute implements ActiveRecordInterface
if ('AttributeCombination' == $relationName) {
return $this->initAttributeCombinations();
}
- if ('AttributeCategory' == $relationName) {
- return $this->initAttributeCategories();
+ if ('AttributeTemplate' == $relationName) {
+ return $this->initAttributeTemplates();
}
if ('AttributeI18n' == $relationName) {
return $this->initAttributeI18ns();
@@ -1848,31 +1848,31 @@ abstract class Attribute implements ActiveRecordInterface
}
/**
- * Clears out the collAttributeCategories collection
+ * Clears out the collAttributeTemplates 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 addAttributeCategories()
+ * @see addAttributeTemplates()
*/
- public function clearAttributeCategories()
+ public function clearAttributeTemplates()
{
- $this->collAttributeCategories = null; // important to set this to NULL since that means it is uninitialized
+ $this->collAttributeTemplates = null; // important to set this to NULL since that means it is uninitialized
}
/**
- * Reset is the collAttributeCategories collection loaded partially.
+ * Reset is the collAttributeTemplates collection loaded partially.
*/
- public function resetPartialAttributeCategories($v = true)
+ public function resetPartialAttributeTemplates($v = true)
{
- $this->collAttributeCategoriesPartial = $v;
+ $this->collAttributeTemplatesPartial = $v;
}
/**
- * Initializes the collAttributeCategories collection.
+ * Initializes the collAttributeTemplates collection.
*
- * By default this just sets the collAttributeCategories collection to an empty array (like clearcollAttributeCategories());
+ * By default this just sets the collAttributeTemplates collection to an empty array (like clearcollAttributeTemplates());
* 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.
*
@@ -1881,17 +1881,17 @@ abstract class Attribute implements ActiveRecordInterface
*
* @return void
*/
- public function initAttributeCategories($overrideExisting = true)
+ public function initAttributeTemplates($overrideExisting = true)
{
- if (null !== $this->collAttributeCategories && !$overrideExisting) {
+ if (null !== $this->collAttributeTemplates && !$overrideExisting) {
return;
}
- $this->collAttributeCategories = new ObjectCollection();
- $this->collAttributeCategories->setModel('\Thelia\Model\AttributeCategory');
+ $this->collAttributeTemplates = new ObjectCollection();
+ $this->collAttributeTemplates->setModel('\Thelia\Model\AttributeTemplate');
}
/**
- * Gets an array of ChildAttributeCategory objects which contain a foreign key that references this object.
+ * Gets an array of ChildAttributeTemplate 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.
@@ -1901,109 +1901,109 @@ abstract class Attribute implements ActiveRecordInterface
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
- * @return Collection|ChildAttributeCategory[] List of ChildAttributeCategory objects
+ * @return Collection|ChildAttributeTemplate[] List of ChildAttributeTemplate objects
* @throws PropelException
*/
- public function getAttributeCategories($criteria = null, ConnectionInterface $con = null)
+ public function getAttributeTemplates($criteria = null, ConnectionInterface $con = null)
{
- $partial = $this->collAttributeCategoriesPartial && !$this->isNew();
- if (null === $this->collAttributeCategories || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collAttributeCategories) {
+ $partial = $this->collAttributeTemplatesPartial && !$this->isNew();
+ if (null === $this->collAttributeTemplates || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collAttributeTemplates) {
// return empty collection
- $this->initAttributeCategories();
+ $this->initAttributeTemplates();
} else {
- $collAttributeCategories = ChildAttributeCategoryQuery::create(null, $criteria)
+ $collAttributeTemplates = ChildAttributeTemplateQuery::create(null, $criteria)
->filterByAttribute($this)
->find($con);
if (null !== $criteria) {
- if (false !== $this->collAttributeCategoriesPartial && count($collAttributeCategories)) {
- $this->initAttributeCategories(false);
+ if (false !== $this->collAttributeTemplatesPartial && count($collAttributeTemplates)) {
+ $this->initAttributeTemplates(false);
- foreach ($collAttributeCategories as $obj) {
- if (false == $this->collAttributeCategories->contains($obj)) {
- $this->collAttributeCategories->append($obj);
+ foreach ($collAttributeTemplates as $obj) {
+ if (false == $this->collAttributeTemplates->contains($obj)) {
+ $this->collAttributeTemplates->append($obj);
}
}
- $this->collAttributeCategoriesPartial = true;
+ $this->collAttributeTemplatesPartial = true;
}
- $collAttributeCategories->getInternalIterator()->rewind();
+ $collAttributeTemplates->getInternalIterator()->rewind();
- return $collAttributeCategories;
+ return $collAttributeTemplates;
}
- if ($partial && $this->collAttributeCategories) {
- foreach ($this->collAttributeCategories as $obj) {
+ if ($partial && $this->collAttributeTemplates) {
+ foreach ($this->collAttributeTemplates as $obj) {
if ($obj->isNew()) {
- $collAttributeCategories[] = $obj;
+ $collAttributeTemplates[] = $obj;
}
}
}
- $this->collAttributeCategories = $collAttributeCategories;
- $this->collAttributeCategoriesPartial = false;
+ $this->collAttributeTemplates = $collAttributeTemplates;
+ $this->collAttributeTemplatesPartial = false;
}
}
- return $this->collAttributeCategories;
+ return $this->collAttributeTemplates;
}
/**
- * Sets a collection of AttributeCategory objects related by a one-to-many relationship
+ * Sets a collection of AttributeTemplate 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 $attributeCategories A Propel collection.
+ * @param Collection $attributeTemplates A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildAttribute The current object (for fluent API support)
*/
- public function setAttributeCategories(Collection $attributeCategories, ConnectionInterface $con = null)
+ public function setAttributeTemplates(Collection $attributeTemplates, ConnectionInterface $con = null)
{
- $attributeCategoriesToDelete = $this->getAttributeCategories(new Criteria(), $con)->diff($attributeCategories);
+ $attributeTemplatesToDelete = $this->getAttributeTemplates(new Criteria(), $con)->diff($attributeTemplates);
- $this->attributeCategoriesScheduledForDeletion = $attributeCategoriesToDelete;
+ $this->attributeTemplatesScheduledForDeletion = $attributeTemplatesToDelete;
- foreach ($attributeCategoriesToDelete as $attributeCategoryRemoved) {
- $attributeCategoryRemoved->setAttribute(null);
+ foreach ($attributeTemplatesToDelete as $attributeTemplateRemoved) {
+ $attributeTemplateRemoved->setAttribute(null);
}
- $this->collAttributeCategories = null;
- foreach ($attributeCategories as $attributeCategory) {
- $this->addAttributeCategory($attributeCategory);
+ $this->collAttributeTemplates = null;
+ foreach ($attributeTemplates as $attributeTemplate) {
+ $this->addAttributeTemplate($attributeTemplate);
}
- $this->collAttributeCategories = $attributeCategories;
- $this->collAttributeCategoriesPartial = false;
+ $this->collAttributeTemplates = $attributeTemplates;
+ $this->collAttributeTemplatesPartial = false;
return $this;
}
/**
- * Returns the number of related AttributeCategory objects.
+ * Returns the number of related AttributeTemplate objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param ConnectionInterface $con
- * @return int Count of related AttributeCategory objects.
+ * @return int Count of related AttributeTemplate objects.
* @throws PropelException
*/
- public function countAttributeCategories(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
+ public function countAttributeTemplates(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
- $partial = $this->collAttributeCategoriesPartial && !$this->isNew();
- if (null === $this->collAttributeCategories || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collAttributeCategories) {
+ $partial = $this->collAttributeTemplatesPartial && !$this->isNew();
+ if (null === $this->collAttributeTemplates || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collAttributeTemplates) {
return 0;
}
if ($partial && !$criteria) {
- return count($this->getAttributeCategories());
+ return count($this->getAttributeTemplates());
}
- $query = ChildAttributeCategoryQuery::create(null, $criteria);
+ $query = ChildAttributeTemplateQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -2013,53 +2013,53 @@ abstract class Attribute implements ActiveRecordInterface
->count($con);
}
- return count($this->collAttributeCategories);
+ return count($this->collAttributeTemplates);
}
/**
- * Method called to associate a ChildAttributeCategory object to this object
- * through the ChildAttributeCategory foreign key attribute.
+ * Method called to associate a ChildAttributeTemplate object to this object
+ * through the ChildAttributeTemplate foreign key attribute.
*
- * @param ChildAttributeCategory $l ChildAttributeCategory
+ * @param ChildAttributeTemplate $l ChildAttributeTemplate
* @return \Thelia\Model\Attribute The current object (for fluent API support)
*/
- public function addAttributeCategory(ChildAttributeCategory $l)
+ public function addAttributeTemplate(ChildAttributeTemplate $l)
{
- if ($this->collAttributeCategories === null) {
- $this->initAttributeCategories();
- $this->collAttributeCategoriesPartial = true;
+ if ($this->collAttributeTemplates === null) {
+ $this->initAttributeTemplates();
+ $this->collAttributeTemplatesPartial = true;
}
- if (!in_array($l, $this->collAttributeCategories->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
- $this->doAddAttributeCategory($l);
+ if (!in_array($l, $this->collAttributeTemplates->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddAttributeTemplate($l);
}
return $this;
}
/**
- * @param AttributeCategory $attributeCategory The attributeCategory object to add.
+ * @param AttributeTemplate $attributeTemplate The attributeTemplate object to add.
*/
- protected function doAddAttributeCategory($attributeCategory)
+ protected function doAddAttributeTemplate($attributeTemplate)
{
- $this->collAttributeCategories[]= $attributeCategory;
- $attributeCategory->setAttribute($this);
+ $this->collAttributeTemplates[]= $attributeTemplate;
+ $attributeTemplate->setAttribute($this);
}
/**
- * @param AttributeCategory $attributeCategory The attributeCategory object to remove.
+ * @param AttributeTemplate $attributeTemplate The attributeTemplate object to remove.
* @return ChildAttribute The current object (for fluent API support)
*/
- public function removeAttributeCategory($attributeCategory)
+ public function removeAttributeTemplate($attributeTemplate)
{
- if ($this->getAttributeCategories()->contains($attributeCategory)) {
- $this->collAttributeCategories->remove($this->collAttributeCategories->search($attributeCategory));
- if (null === $this->attributeCategoriesScheduledForDeletion) {
- $this->attributeCategoriesScheduledForDeletion = clone $this->collAttributeCategories;
- $this->attributeCategoriesScheduledForDeletion->clear();
+ if ($this->getAttributeTemplates()->contains($attributeTemplate)) {
+ $this->collAttributeTemplates->remove($this->collAttributeTemplates->search($attributeTemplate));
+ if (null === $this->attributeTemplatesScheduledForDeletion) {
+ $this->attributeTemplatesScheduledForDeletion = clone $this->collAttributeTemplates;
+ $this->attributeTemplatesScheduledForDeletion->clear();
}
- $this->attributeCategoriesScheduledForDeletion[]= clone $attributeCategory;
- $attributeCategory->setAttribute(null);
+ $this->attributeTemplatesScheduledForDeletion[]= clone $attributeTemplate;
+ $attributeTemplate->setAttribute(null);
}
return $this;
@@ -2071,7 +2071,7 @@ abstract class Attribute implements ActiveRecordInterface
* an identical criteria, it returns the collection.
* Otherwise if this Attribute is new, it will return
* an empty collection; or if this Attribute has previously
- * been saved, it will retrieve related AttributeCategories from storage.
+ * been saved, it will retrieve related AttributeTemplates from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
@@ -2080,14 +2080,14 @@ abstract class Attribute implements ActiveRecordInterface
* @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|ChildAttributeCategory[] List of ChildAttributeCategory objects
+ * @return Collection|ChildAttributeTemplate[] List of ChildAttributeTemplate objects
*/
- public function getAttributeCategoriesJoinCategory($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ public function getAttributeTemplatesJoinTemplate($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
- $query = ChildAttributeCategoryQuery::create(null, $criteria);
- $query->joinWith('Category', $joinBehavior);
+ $query = ChildAttributeTemplateQuery::create(null, $criteria);
+ $query->joinWith('Template', $joinBehavior);
- return $this->getAttributeCategories($query, $con);
+ return $this->getAttributeTemplates($query, $con);
}
/**
@@ -2316,38 +2316,38 @@ abstract class Attribute implements ActiveRecordInterface
}
/**
- * Clears out the collCategories collection
+ * Clears out the collTemplates 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 addCategories()
+ * @see addTemplates()
*/
- public function clearCategories()
+ public function clearTemplates()
{
- $this->collCategories = null; // important to set this to NULL since that means it is uninitialized
- $this->collCategoriesPartial = null;
+ $this->collTemplates = null; // important to set this to NULL since that means it is uninitialized
+ $this->collTemplatesPartial = null;
}
/**
- * Initializes the collCategories collection.
+ * Initializes the collTemplates collection.
*
- * By default this just sets the collCategories collection to an empty collection (like clearCategories());
+ * By default this just sets the collTemplates collection to an empty collection (like clearTemplates());
* 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.
*
* @return void
*/
- public function initCategories()
+ public function initTemplates()
{
- $this->collCategories = new ObjectCollection();
- $this->collCategories->setModel('\Thelia\Model\Category');
+ $this->collTemplates = new ObjectCollection();
+ $this->collTemplates->setModel('\Thelia\Model\Template');
}
/**
- * Gets a collection of ChildCategory objects related by a many-to-many relationship
- * to the current object by way of the attribute_category cross-reference table.
+ * Gets a collection of ChildTemplate objects related by a many-to-many relationship
+ * to the current object by way of the attribute_template cross-reference table.
*
* 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.
@@ -2358,73 +2358,73 @@ abstract class Attribute implements ActiveRecordInterface
* @param Criteria $criteria Optional query object to filter the query
* @param ConnectionInterface $con Optional connection object
*
- * @return ObjectCollection|ChildCategory[] List of ChildCategory objects
+ * @return ObjectCollection|ChildTemplate[] List of ChildTemplate objects
*/
- public function getCategories($criteria = null, ConnectionInterface $con = null)
+ public function getTemplates($criteria = null, ConnectionInterface $con = null)
{
- if (null === $this->collCategories || null !== $criteria) {
- if ($this->isNew() && null === $this->collCategories) {
+ if (null === $this->collTemplates || null !== $criteria) {
+ if ($this->isNew() && null === $this->collTemplates) {
// return empty collection
- $this->initCategories();
+ $this->initTemplates();
} else {
- $collCategories = ChildCategoryQuery::create(null, $criteria)
+ $collTemplates = ChildTemplateQuery::create(null, $criteria)
->filterByAttribute($this)
->find($con);
if (null !== $criteria) {
- return $collCategories;
+ return $collTemplates;
}
- $this->collCategories = $collCategories;
+ $this->collTemplates = $collTemplates;
}
}
- return $this->collCategories;
+ return $this->collTemplates;
}
/**
- * Sets a collection of Category objects related by a many-to-many relationship
- * to the current object by way of the attribute_category cross-reference table.
+ * Sets a collection of Template objects related by a many-to-many relationship
+ * to the current object by way of the attribute_template cross-reference table.
* 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 $categories A Propel collection.
+ * @param Collection $templates A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildAttribute The current object (for fluent API support)
*/
- public function setCategories(Collection $categories, ConnectionInterface $con = null)
+ public function setTemplates(Collection $templates, ConnectionInterface $con = null)
{
- $this->clearCategories();
- $currentCategories = $this->getCategories();
+ $this->clearTemplates();
+ $currentTemplates = $this->getTemplates();
- $this->categoriesScheduledForDeletion = $currentCategories->diff($categories);
+ $this->templatesScheduledForDeletion = $currentTemplates->diff($templates);
- foreach ($categories as $category) {
- if (!$currentCategories->contains($category)) {
- $this->doAddCategory($category);
+ foreach ($templates as $template) {
+ if (!$currentTemplates->contains($template)) {
+ $this->doAddTemplate($template);
}
}
- $this->collCategories = $categories;
+ $this->collTemplates = $templates;
return $this;
}
/**
- * Gets the number of ChildCategory objects related by a many-to-many relationship
- * to the current object by way of the attribute_category cross-reference table.
+ * Gets the number of ChildTemplate objects related by a many-to-many relationship
+ * to the current object by way of the attribute_template cross-reference table.
*
* @param Criteria $criteria Optional query object to filter the query
* @param boolean $distinct Set to true to force count distinct
* @param ConnectionInterface $con Optional connection object
*
- * @return int the number of related ChildCategory objects
+ * @return int the number of related ChildTemplate objects
*/
- public function countCategories($criteria = null, $distinct = false, ConnectionInterface $con = null)
+ public function countTemplates($criteria = null, $distinct = false, ConnectionInterface $con = null)
{
- if (null === $this->collCategories || null !== $criteria) {
- if ($this->isNew() && null === $this->collCategories) {
+ if (null === $this->collTemplates || null !== $criteria) {
+ if ($this->isNew() && null === $this->collTemplates) {
return 0;
} else {
- $query = ChildCategoryQuery::create(null, $criteria);
+ $query = ChildTemplateQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -2434,65 +2434,65 @@ abstract class Attribute implements ActiveRecordInterface
->count($con);
}
} else {
- return count($this->collCategories);
+ return count($this->collTemplates);
}
}
/**
- * Associate a ChildCategory object to this object
- * through the attribute_category cross reference table.
+ * Associate a ChildTemplate object to this object
+ * through the attribute_template cross reference table.
*
- * @param ChildCategory $category The ChildAttributeCategory object to relate
+ * @param ChildTemplate $template The ChildAttributeTemplate object to relate
* @return ChildAttribute The current object (for fluent API support)
*/
- public function addCategory(ChildCategory $category)
+ public function addTemplate(ChildTemplate $template)
{
- if ($this->collCategories === null) {
- $this->initCategories();
+ if ($this->collTemplates === null) {
+ $this->initTemplates();
}
- if (!$this->collCategories->contains($category)) { // only add it if the **same** object is not already associated
- $this->doAddCategory($category);
- $this->collCategories[] = $category;
+ if (!$this->collTemplates->contains($template)) { // only add it if the **same** object is not already associated
+ $this->doAddTemplate($template);
+ $this->collTemplates[] = $template;
}
return $this;
}
/**
- * @param Category $category The category object to add.
+ * @param Template $template The template object to add.
*/
- protected function doAddCategory($category)
+ protected function doAddTemplate($template)
{
- $attributeCategory = new ChildAttributeCategory();
- $attributeCategory->setCategory($category);
- $this->addAttributeCategory($attributeCategory);
+ $attributeTemplate = new ChildAttributeTemplate();
+ $attributeTemplate->setTemplate($template);
+ $this->addAttributeTemplate($attributeTemplate);
// set the back reference to this object directly as using provided method either results
// in endless loop or in multiple relations
- if (!$category->getAttributes()->contains($this)) {
- $foreignCollection = $category->getAttributes();
+ if (!$template->getAttributes()->contains($this)) {
+ $foreignCollection = $template->getAttributes();
$foreignCollection[] = $this;
}
}
/**
- * Remove a ChildCategory object to this object
- * through the attribute_category cross reference table.
+ * Remove a ChildTemplate object to this object
+ * through the attribute_template cross reference table.
*
- * @param ChildCategory $category The ChildAttributeCategory object to relate
+ * @param ChildTemplate $template The ChildAttributeTemplate object to relate
* @return ChildAttribute The current object (for fluent API support)
*/
- public function removeCategory(ChildCategory $category)
+ public function removeTemplate(ChildTemplate $template)
{
- if ($this->getCategories()->contains($category)) {
- $this->collCategories->remove($this->collCategories->search($category));
+ if ($this->getTemplates()->contains($template)) {
+ $this->collTemplates->remove($this->collTemplates->search($template));
- if (null === $this->categoriesScheduledForDeletion) {
- $this->categoriesScheduledForDeletion = clone $this->collCategories;
- $this->categoriesScheduledForDeletion->clear();
+ if (null === $this->templatesScheduledForDeletion) {
+ $this->templatesScheduledForDeletion = clone $this->collTemplates;
+ $this->templatesScheduledForDeletion->clear();
}
- $this->categoriesScheduledForDeletion[] = $category;
+ $this->templatesScheduledForDeletion[] = $template;
}
return $this;
@@ -2536,8 +2536,8 @@ abstract class Attribute implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
- if ($this->collAttributeCategories) {
- foreach ($this->collAttributeCategories as $o) {
+ if ($this->collAttributeTemplates) {
+ foreach ($this->collAttributeTemplates as $o) {
$o->clearAllReferences($deep);
}
}
@@ -2546,8 +2546,8 @@ abstract class Attribute implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
- if ($this->collCategories) {
- foreach ($this->collCategories as $o) {
+ if ($this->collTemplates) {
+ foreach ($this->collTemplates as $o) {
$o->clearAllReferences($deep);
}
}
@@ -2565,18 +2565,18 @@ abstract class Attribute implements ActiveRecordInterface
$this->collAttributeCombinations->clearIterator();
}
$this->collAttributeCombinations = null;
- if ($this->collAttributeCategories instanceof Collection) {
- $this->collAttributeCategories->clearIterator();
+ if ($this->collAttributeTemplates instanceof Collection) {
+ $this->collAttributeTemplates->clearIterator();
}
- $this->collAttributeCategories = null;
+ $this->collAttributeTemplates = null;
if ($this->collAttributeI18ns instanceof Collection) {
$this->collAttributeI18ns->clearIterator();
}
$this->collAttributeI18ns = null;
- if ($this->collCategories instanceof Collection) {
- $this->collCategories->clearIterator();
+ if ($this->collTemplates instanceof Collection) {
+ $this->collTemplates->clearIterator();
}
- $this->collCategories = null;
+ $this->collTemplates = null;
}
/**
diff --git a/core/lib/Thelia/Model/Base/AttributeQuery.php b/core/lib/Thelia/Model/Base/AttributeQuery.php
index cabbaf7ac..b496289f8 100644
--- a/core/lib/Thelia/Model/Base/AttributeQuery.php
+++ b/core/lib/Thelia/Model/Base/AttributeQuery.php
@@ -44,9 +44,9 @@ use Thelia\Model\Map\AttributeTableMap;
* @method ChildAttributeQuery rightJoinAttributeCombination($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCombination relation
* @method ChildAttributeQuery innerJoinAttributeCombination($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCombination relation
*
- * @method ChildAttributeQuery leftJoinAttributeCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeCategory relation
- * @method ChildAttributeQuery rightJoinAttributeCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCategory relation
- * @method ChildAttributeQuery innerJoinAttributeCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCategory relation
+ * @method ChildAttributeQuery leftJoinAttributeTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeTemplate relation
+ * @method ChildAttributeQuery rightJoinAttributeTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeTemplate relation
+ * @method ChildAttributeQuery innerJoinAttributeTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeTemplate relation
*
* @method ChildAttributeQuery leftJoinAttributeI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeI18n relation
* @method ChildAttributeQuery rightJoinAttributeI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeI18n relation
@@ -556,40 +556,40 @@ abstract class AttributeQuery extends ModelCriteria
}
/**
- * Filter the query by a related \Thelia\Model\AttributeCategory object
+ * Filter the query by a related \Thelia\Model\AttributeTemplate object
*
- * @param \Thelia\Model\AttributeCategory|ObjectCollection $attributeCategory the related object to use as filter
+ * @param \Thelia\Model\AttributeTemplate|ObjectCollection $attributeTemplate the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAttributeQuery The current query, for fluid interface
*/
- public function filterByAttributeCategory($attributeCategory, $comparison = null)
+ public function filterByAttributeTemplate($attributeTemplate, $comparison = null)
{
- if ($attributeCategory instanceof \Thelia\Model\AttributeCategory) {
+ if ($attributeTemplate instanceof \Thelia\Model\AttributeTemplate) {
return $this
- ->addUsingAlias(AttributeTableMap::ID, $attributeCategory->getAttributeId(), $comparison);
- } elseif ($attributeCategory instanceof ObjectCollection) {
+ ->addUsingAlias(AttributeTableMap::ID, $attributeTemplate->getAttributeId(), $comparison);
+ } elseif ($attributeTemplate instanceof ObjectCollection) {
return $this
- ->useAttributeCategoryQuery()
- ->filterByPrimaryKeys($attributeCategory->getPrimaryKeys())
+ ->useAttributeTemplateQuery()
+ ->filterByPrimaryKeys($attributeTemplate->getPrimaryKeys())
->endUse();
} else {
- throw new PropelException('filterByAttributeCategory() only accepts arguments of type \Thelia\Model\AttributeCategory or Collection');
+ throw new PropelException('filterByAttributeTemplate() only accepts arguments of type \Thelia\Model\AttributeTemplate or Collection');
}
}
/**
- * Adds a JOIN clause to the query using the AttributeCategory relation
+ * Adds a JOIN clause to the query using the AttributeTemplate relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildAttributeQuery The current query, for fluid interface
*/
- public function joinAttributeCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function joinAttributeTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('AttributeCategory');
+ $relationMap = $tableMap->getRelation('AttributeTemplate');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -604,14 +604,14 @@ abstract class AttributeQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
- $this->addJoinObject($join, 'AttributeCategory');
+ $this->addJoinObject($join, 'AttributeTemplate');
}
return $this;
}
/**
- * Use the AttributeCategory relation AttributeCategory object
+ * Use the AttributeTemplate relation AttributeTemplate object
*
* @see useQuery()
*
@@ -619,13 +619,13 @@ abstract class AttributeQuery 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\AttributeCategoryQuery A secondary query class using the current class as primary query
+ * @return \Thelia\Model\AttributeTemplateQuery A secondary query class using the current class as primary query
*/
- public function useAttributeCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function useAttributeTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
- ->joinAttributeCategory($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'AttributeCategory', '\Thelia\Model\AttributeCategoryQuery');
+ ->joinAttributeTemplate($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'AttributeTemplate', '\Thelia\Model\AttributeTemplateQuery');
}
/**
@@ -702,19 +702,19 @@ abstract class AttributeQuery extends ModelCriteria
}
/**
- * Filter the query by a related Category object
- * using the attribute_category table as cross reference
+ * Filter the query by a related Template object
+ * using the attribute_template table as cross reference
*
- * @param Category $category the related object to use as filter
+ * @param Template $template the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAttributeQuery The current query, for fluid interface
*/
- public function filterByCategory($category, $comparison = Criteria::EQUAL)
+ public function filterByTemplate($template, $comparison = Criteria::EQUAL)
{
return $this
- ->useAttributeCategoryQuery()
- ->filterByCategory($category, $comparison)
+ ->useAttributeTemplateQuery()
+ ->filterByTemplate($template, $comparison)
->endUse();
}
diff --git a/core/lib/Thelia/Model/Base/AttributeTemplate.php b/core/lib/Thelia/Model/Base/AttributeTemplate.php
new file mode 100644
index 000000000..cedc85431
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/AttributeTemplate.php
@@ -0,0 +1,1495 @@
+modifiedColumns);
+ }
+
+ /**
+ * Has specified column been modified?
+ *
+ * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
+ * @return boolean True if $col has been modified.
+ */
+ public function isColumnModified($col)
+ {
+ return in_array($col, $this->modifiedColumns);
+ }
+
+ /**
+ * Get the columns that have been modified in this object.
+ * @return array A unique list of the modified column names for this object.
+ */
+ public function getModifiedColumns()
+ {
+ return array_unique($this->modifiedColumns);
+ }
+
+ /**
+ * Returns whether the object has ever been saved. This will
+ * be false, if the object was retrieved from storage or was created
+ * and then saved.
+ *
+ * @return true, if the object has never been persisted.
+ */
+ public function isNew()
+ {
+ return $this->new;
+ }
+
+ /**
+ * Setter for the isNew attribute. This method will be called
+ * by Propel-generated children and objects.
+ *
+ * @param boolean $b the state of the object.
+ */
+ public function setNew($b)
+ {
+ $this->new = (Boolean) $b;
+ }
+
+ /**
+ * Whether this object has been deleted.
+ * @return boolean The deleted state of this object.
+ */
+ public function isDeleted()
+ {
+ return $this->deleted;
+ }
+
+ /**
+ * Specify whether this object has been deleted.
+ * @param boolean $b The deleted state of this object.
+ * @return void
+ */
+ public function setDeleted($b)
+ {
+ $this->deleted = (Boolean) $b;
+ }
+
+ /**
+ * Sets the modified state for the object to be false.
+ * @param string $col If supplied, only the specified column is reset.
+ * @return void
+ */
+ public function resetModified($col = null)
+ {
+ if (null !== $col) {
+ while (false !== ($offset = array_search($col, $this->modifiedColumns))) {
+ array_splice($this->modifiedColumns, $offset, 1);
+ }
+ } else {
+ $this->modifiedColumns = array();
+ }
+ }
+
+ /**
+ * Compares this with another AttributeTemplate instance. If
+ * obj is an instance of AttributeTemplate, delegates to
+ * equals(AttributeTemplate). Otherwise, returns false.
+ *
+ * @param obj The object to compare to.
+ * @return Whether equal to the object specified.
+ */
+ public function equals($obj)
+ {
+ $thisclazz = get_class($this);
+ if (!is_object($obj) || !($obj instanceof $thisclazz)) {
+ return false;
+ }
+
+ if ($this === $obj) {
+ return true;
+ }
+
+ if (null === $this->getPrimaryKey()
+ || null === $obj->getPrimaryKey()) {
+ return false;
+ }
+
+ return $this->getPrimaryKey() === $obj->getPrimaryKey();
+ }
+
+ /**
+ * If the primary key is not null, return the hashcode of the
+ * primary key. Otherwise, return the hash code of the object.
+ *
+ * @return int Hashcode
+ */
+ public function hashCode()
+ {
+ if (null !== $this->getPrimaryKey()) {
+ return crc32(serialize($this->getPrimaryKey()));
+ }
+
+ return crc32(serialize(clone $this));
+ }
+
+ /**
+ * Get the associative array of the virtual columns in this object
+ *
+ * @param string $name The virtual column name
+ *
+ * @return array
+ */
+ public function getVirtualColumns()
+ {
+ return $this->virtualColumns;
+ }
+
+ /**
+ * Checks the existence of a virtual column in this object
+ *
+ * @return boolean
+ */
+ public function hasVirtualColumn($name)
+ {
+ return array_key_exists($name, $this->virtualColumns);
+ }
+
+ /**
+ * Get the value of a virtual column in this object
+ *
+ * @return mixed
+ */
+ public function getVirtualColumn($name)
+ {
+ if (!$this->hasVirtualColumn($name)) {
+ throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
+ }
+
+ return $this->virtualColumns[$name];
+ }
+
+ /**
+ * Set the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @param mixed $value The value to give to the virtual column
+ *
+ * @return AttributeTemplate The current object, for fluid interface
+ */
+ public function setVirtualColumn($name, $value)
+ {
+ $this->virtualColumns[$name] = $value;
+
+ return $this;
+ }
+
+ /**
+ * Logs a message using Propel::log().
+ *
+ * @param string $msg
+ * @param int $priority One of the Propel::LOG_* logging levels
+ * @return boolean
+ */
+ protected function log($msg, $priority = Propel::LOG_INFO)
+ {
+ return Propel::log(get_class($this) . ': ' . $msg, $priority);
+ }
+
+ /**
+ * Populate the current object from a string, using a given parser format
+ *
+ * $book = new Book();
+ * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance,
+ * or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param string $data The source data to import from
+ *
+ * @return AttributeTemplate The current object, for fluid interface
+ */
+ public function importFrom($parser, $data)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME);
+ }
+
+ /**
+ * Export the current object properties to a string, using a given parser format
+ *
+ * $book = BookQuery::create()->findPk(9012);
+ * echo $book->exportTo('JSON');
+ * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
+ * @return string The exported data
+ */
+ public function exportTo($parser, $includeLazyLoadColumns = true)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
+ }
+
+ /**
+ * Clean up internal collections prior to serializing
+ * Avoids recursive loops that turn into segmentation faults when serializing
+ */
+ public function __sleep()
+ {
+ $this->clearAllReferences();
+
+ return array_keys(get_object_vars($this));
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [attribute_id] column value.
+ *
+ * @return int
+ */
+ public function getAttributeId()
+ {
+
+ return $this->attribute_id;
+ }
+
+ /**
+ * Get the [template_id] column value.
+ *
+ * @return int
+ */
+ public function getTemplateId()
+ {
+
+ return $this->template_id;
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [created_at] column value.
+ *
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the raw \DateTime object will be returned.
+ *
+ * @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
+ *
+ * @throws PropelException - if unable to parse/validate the date/time value.
+ */
+ public function getCreatedAt($format = NULL)
+ {
+ if ($format === null) {
+ return $this->created_at;
+ } else {
+ return $this->created_at !== null ? $this->created_at->format($format) : null;
+ }
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [updated_at] column value.
+ *
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the raw \DateTime object will be returned.
+ *
+ * @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
+ *
+ * @throws PropelException - if unable to parse/validate the date/time value.
+ */
+ public function getUpdatedAt($format = NULL)
+ {
+ if ($format === null) {
+ return $this->updated_at;
+ } else {
+ return $this->updated_at !== null ? $this->updated_at->format($format) : null;
+ }
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\AttributeTemplate The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = AttributeTemplateTableMap::ID;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [attribute_id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\AttributeTemplate The current object (for fluent API support)
+ */
+ public function setAttributeId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->attribute_id !== $v) {
+ $this->attribute_id = $v;
+ $this->modifiedColumns[] = AttributeTemplateTableMap::ATTRIBUTE_ID;
+ }
+
+ if ($this->aAttribute !== null && $this->aAttribute->getId() !== $v) {
+ $this->aAttribute = null;
+ }
+
+
+ return $this;
+ } // setAttributeId()
+
+ /**
+ * Set the value of [template_id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\AttributeTemplate The current object (for fluent API support)
+ */
+ public function setTemplateId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->template_id !== $v) {
+ $this->template_id = $v;
+ $this->modifiedColumns[] = AttributeTemplateTableMap::TEMPLATE_ID;
+ }
+
+ if ($this->aTemplate !== null && $this->aTemplate->getId() !== $v) {
+ $this->aTemplate = null;
+ }
+
+
+ return $this;
+ } // setTemplateId()
+
+ /**
+ * Sets the value of [created_at] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or \DateTime value.
+ * Empty strings are treated as NULL.
+ * @return \Thelia\Model\AttributeTemplate The current object (for fluent API support)
+ */
+ public function setCreatedAt($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, '\DateTime');
+ if ($this->created_at !== null || $dt !== null) {
+ if ($dt !== $this->created_at) {
+ $this->created_at = $dt;
+ $this->modifiedColumns[] = AttributeTemplateTableMap::CREATED_AT;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setCreatedAt()
+
+ /**
+ * Sets the value of [updated_at] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or \DateTime value.
+ * Empty strings are treated as NULL.
+ * @return \Thelia\Model\AttributeTemplate The current object (for fluent API support)
+ */
+ public function setUpdatedAt($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, '\DateTime');
+ if ($this->updated_at !== null || $dt !== null) {
+ if ($dt !== $this->updated_at) {
+ $this->updated_at = $dt;
+ $this->modifiedColumns[] = AttributeTemplateTableMap::UPDATED_AT;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setUpdatedAt()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by DataFetcher->fetch().
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
+ One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ *
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
+ {
+ try {
+
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : AttributeTemplateTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AttributeTemplateTableMap::translateFieldName('AttributeId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->attribute_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AttributeTemplateTableMap::translateFieldName('TemplateId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->template_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AttributeTemplateTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ if ($col === '0000-00-00 00:00:00') {
+ $col = null;
+ }
+ $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : AttributeTemplateTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ if ($col === '0000-00-00 00:00:00') {
+ $col = null;
+ }
+ $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 5; // 5 = AttributeTemplateTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \Thelia\Model\AttributeTemplate object", 0, $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+ if ($this->aAttribute !== null && $this->attribute_id !== $this->aAttribute->getId()) {
+ $this->aAttribute = null;
+ }
+ if ($this->aTemplate !== null && $this->template_id !== $this->aTemplate->getId()) {
+ $this->aTemplate = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(AttributeTemplateTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildAttributeTemplateQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
+ $row = $dataFetcher->fetch();
+ $dataFetcher->close();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aAttribute = null;
+ $this->aTemplate = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see AttributeTemplate::setDeleted()
+ * @see AttributeTemplate::isDeleted()
+ */
+ public function delete(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(AttributeTemplateTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildAttributeTemplateQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(AttributeTemplateTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ // timestampable behavior
+ if (!$this->isColumnModified(AttributeTemplateTableMap::CREATED_AT)) {
+ $this->setCreatedAt(time());
+ }
+ if (!$this->isColumnModified(AttributeTemplateTableMap::UPDATED_AT)) {
+ $this->setUpdatedAt(time());
+ }
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ // timestampable behavior
+ if ($this->isModified() && !$this->isColumnModified(AttributeTemplateTableMap::UPDATED_AT)) {
+ $this->setUpdatedAt(time());
+ }
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ AttributeTemplateTableMap::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(ConnectionInterface $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aAttribute !== null) {
+ if ($this->aAttribute->isModified() || $this->aAttribute->isNew()) {
+ $affectedRows += $this->aAttribute->save($con);
+ }
+ $this->setAttribute($this->aAttribute);
+ }
+
+ if ($this->aTemplate !== null) {
+ if ($this->aTemplate->isModified() || $this->aTemplate->isNew()) {
+ $affectedRows += $this->aTemplate->save($con);
+ }
+ $this->setTemplate($this->aTemplate);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(ConnectionInterface $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = AttributeTemplateTableMap::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . AttributeTemplateTableMap::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(AttributeTemplateTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = 'ID';
+ }
+ if ($this->isColumnModified(AttributeTemplateTableMap::ATTRIBUTE_ID)) {
+ $modifiedColumns[':p' . $index++] = 'ATTRIBUTE_ID';
+ }
+ if ($this->isColumnModified(AttributeTemplateTableMap::TEMPLATE_ID)) {
+ $modifiedColumns[':p' . $index++] = 'TEMPLATE_ID';
+ }
+ if ($this->isColumnModified(AttributeTemplateTableMap::CREATED_AT)) {
+ $modifiedColumns[':p' . $index++] = 'CREATED_AT';
+ }
+ if ($this->isColumnModified(AttributeTemplateTableMap::UPDATED_AT)) {
+ $modifiedColumns[':p' . $index++] = 'UPDATED_AT';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO attribute_template (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case 'ID':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case 'ATTRIBUTE_ID':
+ $stmt->bindValue($identifier, $this->attribute_id, PDO::PARAM_INT);
+ break;
+ case 'TEMPLATE_ID':
+ $stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT);
+ break;
+ case 'CREATED_AT':
+ $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
+ break;
+ case 'UPDATED_AT':
+ $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
+ }
+
+ try {
+ $pk = $con->lastInsertId();
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get autoincrement id.', 0, $e);
+ }
+ $this->setId($pk);
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @return Integer Number of updated rows
+ * @see doSave()
+ */
+ protected function doUpdate(ConnectionInterface $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+
+ return $selectCriteria->doUpdate($valuesCriteria, $con);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = AttributeTemplateTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getAttributeId();
+ break;
+ case 2:
+ return $this->getTemplateId();
+ break;
+ case 3:
+ return $this->getCreatedAt();
+ break;
+ case 4:
+ return $this->getUpdatedAt();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['AttributeTemplate'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['AttributeTemplate'][$this->getPrimaryKey()] = true;
+ $keys = AttributeTemplateTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getAttributeId(),
+ $keys[2] => $this->getTemplateId(),
+ $keys[3] => $this->getCreatedAt(),
+ $keys[4] => $this->getUpdatedAt(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach($virtualColumns as $key => $virtualColumn)
+ {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aAttribute) {
+ $result['Attribute'] = $this->aAttribute->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->aTemplate) {
+ $result['Template'] = $this->aTemplate->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return void
+ */
+ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = AttributeTemplateTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setAttributeId($value);
+ break;
+ case 2:
+ $this->setTemplateId($value);
+ break;
+ case 3:
+ $this->setCreatedAt($value);
+ break;
+ case 4:
+ $this->setUpdatedAt($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * The default key type is the column's TableMap::TYPE_PHPNAME.
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
+ {
+ $keys = AttributeTemplateTableMap::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setAttributeId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTemplateId($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(AttributeTemplateTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(AttributeTemplateTableMap::ID)) $criteria->add(AttributeTemplateTableMap::ID, $this->id);
+ if ($this->isColumnModified(AttributeTemplateTableMap::ATTRIBUTE_ID)) $criteria->add(AttributeTemplateTableMap::ATTRIBUTE_ID, $this->attribute_id);
+ if ($this->isColumnModified(AttributeTemplateTableMap::TEMPLATE_ID)) $criteria->add(AttributeTemplateTableMap::TEMPLATE_ID, $this->template_id);
+ if ($this->isColumnModified(AttributeTemplateTableMap::CREATED_AT)) $criteria->add(AttributeTemplateTableMap::CREATED_AT, $this->created_at);
+ if ($this->isColumnModified(AttributeTemplateTableMap::UPDATED_AT)) $criteria->add(AttributeTemplateTableMap::UPDATED_AT, $this->updated_at);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(AttributeTemplateTableMap::DATABASE_NAME);
+ $criteria->add(AttributeTemplateTableMap::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return null === $this->getId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of \Thelia\Model\AttributeTemplate (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setAttributeId($this->getAttributeId());
+ $copyObj->setTemplateId($this->getTemplateId());
+ $copyObj->setCreatedAt($this->getCreatedAt());
+ $copyObj->setUpdatedAt($this->getUpdatedAt());
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return \Thelia\Model\AttributeTemplate Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Declares an association between this object and a ChildAttribute object.
+ *
+ * @param ChildAttribute $v
+ * @return \Thelia\Model\AttributeTemplate The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setAttribute(ChildAttribute $v = null)
+ {
+ if ($v === null) {
+ $this->setAttributeId(NULL);
+ } else {
+ $this->setAttributeId($v->getId());
+ }
+
+ $this->aAttribute = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildAttribute object, it will not be re-added.
+ if ($v !== null) {
+ $v->addAttributeTemplate($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildAttribute object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildAttribute The associated ChildAttribute object.
+ * @throws PropelException
+ */
+ public function getAttribute(ConnectionInterface $con = null)
+ {
+ if ($this->aAttribute === null && ($this->attribute_id !== null)) {
+ $this->aAttribute = ChildAttributeQuery::create()->findPk($this->attribute_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aAttribute->addAttributeTemplates($this);
+ */
+ }
+
+ return $this->aAttribute;
+ }
+
+ /**
+ * Declares an association between this object and a ChildTemplate object.
+ *
+ * @param ChildTemplate $v
+ * @return \Thelia\Model\AttributeTemplate The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setTemplate(ChildTemplate $v = null)
+ {
+ if ($v === null) {
+ $this->setTemplateId(NULL);
+ } else {
+ $this->setTemplateId($v->getId());
+ }
+
+ $this->aTemplate = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildTemplate object, it will not be re-added.
+ if ($v !== null) {
+ $v->addAttributeTemplate($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildTemplate object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildTemplate The associated ChildTemplate object.
+ * @throws PropelException
+ */
+ public function getTemplate(ConnectionInterface $con = null)
+ {
+ if ($this->aTemplate === null && ($this->template_id !== null)) {
+ $this->aTemplate = ChildTemplateQuery::create()->findPk($this->template_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aTemplate->addAttributeTemplates($this);
+ */
+ }
+
+ return $this->aTemplate;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->attribute_id = null;
+ $this->template_id = null;
+ $this->created_at = null;
+ $this->updated_at = null;
+ $this->alreadyInSave = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aAttribute = null;
+ $this->aTemplate = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(AttributeTemplateTableMap::DEFAULT_STRING_FORMAT);
+ }
+
+ // timestampable behavior
+
+ /**
+ * Mark the current object so that the update date doesn't get updated during next save
+ *
+ * @return ChildAttributeTemplate The current object (for fluent API support)
+ */
+ public function keepUpdateDateUnchanged()
+ {
+ $this->modifiedColumns[] = AttributeTemplateTableMap::UPDATED_AT;
+
+ return $this;
+ }
+
+ /**
+ * Code to be run before persisting the object
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preSave(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after persisting the object
+ * @param ConnectionInterface $con
+ */
+ public function postSave(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before inserting to database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preInsert(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after inserting to database
+ * @param ConnectionInterface $con
+ */
+ public function postInsert(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before updating the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preUpdate(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after updating the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postUpdate(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before deleting the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preDelete(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after deleting the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postDelete(ConnectionInterface $con = null)
+ {
+
+ }
+
+
+ /**
+ * Derived method to catches calls to undefined methods.
+ *
+ * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
+ * Allows to define default __call() behavior if you overwrite __call()
+ *
+ * @param string $name
+ * @param mixed $params
+ *
+ * @return array|string
+ */
+ public function __call($name, $params)
+ {
+ if (0 === strpos($name, 'get')) {
+ $virtualColumn = substr($name, 3);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+
+ $virtualColumn = lcfirst($virtualColumn);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+
+ if (0 === strpos($name, 'from')) {
+ $format = substr($name, 4);
+
+ return $this->importFrom($format, reset($params));
+ }
+
+ if (0 === strpos($name, 'to')) {
+ $format = substr($name, 2);
+ $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
+
+ return $this->exportTo($format, $includeLazyLoadColumns);
+ }
+
+ throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
+ }
+
+}
diff --git a/core/lib/Thelia/Model/Base/AttributeTemplateQuery.php b/core/lib/Thelia/Model/Base/AttributeTemplateQuery.php
new file mode 100644
index 000000000..bd895360b
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/AttributeTemplateQuery.php
@@ -0,0 +1,759 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildAttributeTemplate|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = AttributeTemplateTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(AttributeTemplateTableMap::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 ChildAttributeTemplate A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT ID, ATTRIBUTE_ID, TEMPLATE_ID, CREATED_AT, UPDATED_AT FROM attribute_template 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 ChildAttributeTemplate();
+ $obj->hydrate($row);
+ AttributeTemplateTableMap::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 ChildAttributeTemplate|array|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $dataFetcher = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $dataFetcher = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return ChildAttributeTemplateQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(AttributeTemplateTableMap::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 ChildAttributeTemplateQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(AttributeTemplateTableMap::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildAttributeTemplateQuery 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(AttributeTemplateTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(AttributeTemplateTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(AttributeTemplateTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the attribute_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByAttributeId(1234); // WHERE attribute_id = 1234
+ * $query->filterByAttributeId(array(12, 34)); // WHERE attribute_id IN (12, 34)
+ * $query->filterByAttributeId(array('min' => 12)); // WHERE attribute_id > 12
+ *
+ *
+ * @see filterByAttribute()
+ *
+ * @param mixed $attributeId 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 ChildAttributeTemplateQuery The current query, for fluid interface
+ */
+ public function filterByAttributeId($attributeId = null, $comparison = null)
+ {
+ if (is_array($attributeId)) {
+ $useMinMax = false;
+ if (isset($attributeId['min'])) {
+ $this->addUsingAlias(AttributeTemplateTableMap::ATTRIBUTE_ID, $attributeId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($attributeId['max'])) {
+ $this->addUsingAlias(AttributeTemplateTableMap::ATTRIBUTE_ID, $attributeId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(AttributeTemplateTableMap::ATTRIBUTE_ID, $attributeId, $comparison);
+ }
+
+ /**
+ * Filter the query on the template_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByTemplateId(1234); // WHERE template_id = 1234
+ * $query->filterByTemplateId(array(12, 34)); // WHERE template_id IN (12, 34)
+ * $query->filterByTemplateId(array('min' => 12)); // WHERE template_id > 12
+ *
+ *
+ * @see filterByTemplate()
+ *
+ * @param mixed $templateId 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 ChildAttributeTemplateQuery The current query, for fluid interface
+ */
+ public function filterByTemplateId($templateId = null, $comparison = null)
+ {
+ if (is_array($templateId)) {
+ $useMinMax = false;
+ if (isset($templateId['min'])) {
+ $this->addUsingAlias(AttributeTemplateTableMap::TEMPLATE_ID, $templateId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($templateId['max'])) {
+ $this->addUsingAlias(AttributeTemplateTableMap::TEMPLATE_ID, $templateId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(AttributeTemplateTableMap::TEMPLATE_ID, $templateId, $comparison);
+ }
+
+ /**
+ * Filter the query on the created_at column
+ *
+ * Example usage:
+ *
+ * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
+ * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
+ * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
+ *
+ *
+ * @param mixed $createdAt The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildAttributeTemplateQuery 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(AttributeTemplateTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($createdAt['max'])) {
+ $this->addUsingAlias(AttributeTemplateTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(AttributeTemplateTableMap::CREATED_AT, $createdAt, $comparison);
+ }
+
+ /**
+ * Filter the query on the updated_at column
+ *
+ * Example usage:
+ *
+ * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
+ * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
+ * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
+ *
+ *
+ * @param mixed $updatedAt The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildAttributeTemplateQuery 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(AttributeTemplateTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($updatedAt['max'])) {
+ $this->addUsingAlias(AttributeTemplateTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(AttributeTemplateTableMap::UPDATED_AT, $updatedAt, $comparison);
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\Attribute object
+ *
+ * @param \Thelia\Model\Attribute|ObjectCollection $attribute The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildAttributeTemplateQuery The current query, for fluid interface
+ */
+ public function filterByAttribute($attribute, $comparison = null)
+ {
+ if ($attribute instanceof \Thelia\Model\Attribute) {
+ return $this
+ ->addUsingAlias(AttributeTemplateTableMap::ATTRIBUTE_ID, $attribute->getId(), $comparison);
+ } elseif ($attribute instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(AttributeTemplateTableMap::ATTRIBUTE_ID, $attribute->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByAttribute() only accepts arguments of type \Thelia\Model\Attribute or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Attribute relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildAttributeTemplateQuery The current query, for fluid interface
+ */
+ public function joinAttribute($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Attribute');
+
+ // 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, 'Attribute');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Attribute relation Attribute 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\AttributeQuery A secondary query class using the current class as primary query
+ */
+ public function useAttributeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinAttribute($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Attribute', '\Thelia\Model\AttributeQuery');
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\Template object
+ *
+ * @param \Thelia\Model\Template|ObjectCollection $template The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildAttributeTemplateQuery The current query, for fluid interface
+ */
+ public function filterByTemplate($template, $comparison = null)
+ {
+ if ($template instanceof \Thelia\Model\Template) {
+ return $this
+ ->addUsingAlias(AttributeTemplateTableMap::TEMPLATE_ID, $template->getId(), $comparison);
+ } elseif ($template instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(AttributeTemplateTableMap::TEMPLATE_ID, $template->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByTemplate() only accepts arguments of type \Thelia\Model\Template or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Template relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildAttributeTemplateQuery The current query, for fluid interface
+ */
+ public function joinTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Template');
+
+ // 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, 'Template');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Template relation Template 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\TemplateQuery A secondary query class using the current class as primary query
+ */
+ public function useTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinTemplate($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Template', '\Thelia\Model\TemplateQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildAttributeTemplate $attributeTemplate Object to remove from the list of results
+ *
+ * @return ChildAttributeTemplateQuery The current query, for fluid interface
+ */
+ public function prune($attributeTemplate = null)
+ {
+ if ($attributeTemplate) {
+ $this->addUsingAlias(AttributeTemplateTableMap::ID, $attributeTemplate->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the attribute_template 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(AttributeTemplateTableMap::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).
+ AttributeTemplateTableMap::clearInstancePool();
+ AttributeTemplateTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildAttributeTemplate or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildAttributeTemplate 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(AttributeTemplateTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(AttributeTemplateTableMap::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();
+
+
+ AttributeTemplateTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ AttributeTemplateTableMap::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 ChildAttributeTemplateQuery The current query, for fluid interface
+ */
+ public function recentlyUpdated($nbDays = 7)
+ {
+ return $this->addUsingAlias(AttributeTemplateTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ }
+
+ /**
+ * Filter by the latest created
+ *
+ * @param int $nbDays Maximum age of in days
+ *
+ * @return ChildAttributeTemplateQuery The current query, for fluid interface
+ */
+ public function recentlyCreated($nbDays = 7)
+ {
+ return $this->addUsingAlias(AttributeTemplateTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ }
+
+ /**
+ * Order by update date desc
+ *
+ * @return ChildAttributeTemplateQuery The current query, for fluid interface
+ */
+ public function lastUpdatedFirst()
+ {
+ return $this->addDescendingOrderByColumn(AttributeTemplateTableMap::UPDATED_AT);
+ }
+
+ /**
+ * Order by update date asc
+ *
+ * @return ChildAttributeTemplateQuery The current query, for fluid interface
+ */
+ public function firstUpdatedFirst()
+ {
+ return $this->addAscendingOrderByColumn(AttributeTemplateTableMap::UPDATED_AT);
+ }
+
+ /**
+ * Order by create date desc
+ *
+ * @return ChildAttributeTemplateQuery The current query, for fluid interface
+ */
+ public function lastCreatedFirst()
+ {
+ return $this->addDescendingOrderByColumn(AttributeTemplateTableMap::CREATED_AT);
+ }
+
+ /**
+ * Order by create date asc
+ *
+ * @return ChildAttributeTemplateQuery The current query, for fluid interface
+ */
+ public function firstCreatedFirst()
+ {
+ return $this->addAscendingOrderByColumn(AttributeTemplateTableMap::CREATED_AT);
+ }
+
+} // AttributeTemplateQuery
diff --git a/core/lib/Thelia/Model/Base/Category.php b/core/lib/Thelia/Model/Base/Category.php
index ee56670a1..6dc9b727a 100644
--- a/core/lib/Thelia/Model/Base/Category.php
+++ b/core/lib/Thelia/Model/Base/Category.php
@@ -17,10 +17,6 @@ use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime;
-use Thelia\Model\Attribute as ChildAttribute;
-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;
@@ -33,10 +29,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\Feature as ChildFeature;
-use Thelia\Model\FeatureCategory as ChildFeatureCategory;
-use Thelia\Model\FeatureCategoryQuery as ChildFeatureCategoryQuery;
-use Thelia\Model\FeatureQuery as ChildFeatureQuery;
use Thelia\Model\Product as ChildProduct;
use Thelia\Model\ProductCategory as ChildProductCategory;
use Thelia\Model\ProductCategoryQuery as ChildProductCategoryQuery;
@@ -139,18 +131,6 @@ abstract class Category implements ActiveRecordInterface
protected $collProductCategories;
protected $collProductCategoriesPartial;
- /**
- * @var ObjectCollection|ChildFeatureCategory[] Collection to store aggregation of ChildFeatureCategory objects.
- */
- protected $collFeatureCategories;
- protected $collFeatureCategoriesPartial;
-
- /**
- * @var ObjectCollection|ChildAttributeCategory[] Collection to store aggregation of ChildAttributeCategory objects.
- */
- protected $collAttributeCategories;
- protected $collAttributeCategoriesPartial;
-
/**
* @var ObjectCollection|ChildCategoryImage[] Collection to store aggregation of ChildCategoryImage objects.
*/
@@ -186,16 +166,6 @@ abstract class Category implements ActiveRecordInterface
*/
protected $collProducts;
- /**
- * @var ChildFeature[] Collection to store aggregation of ChildFeature objects.
- */
- protected $collFeatures;
-
- /**
- * @var ChildAttribute[] Collection to store aggregation of ChildAttribute objects.
- */
- protected $collAttributes;
-
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -232,36 +202,12 @@ abstract class Category implements ActiveRecordInterface
*/
protected $productsScheduledForDeletion = null;
- /**
- * An array of objects scheduled for deletion.
- * @var ObjectCollection
- */
- protected $featuresScheduledForDeletion = null;
-
- /**
- * An array of objects scheduled for deletion.
- * @var ObjectCollection
- */
- protected $attributesScheduledForDeletion = null;
-
/**
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $productCategoriesScheduledForDeletion = null;
- /**
- * An array of objects scheduled for deletion.
- * @var ObjectCollection
- */
- protected $featureCategoriesScheduledForDeletion = null;
-
- /**
- * An array of objects scheduled for deletion.
- * @var ObjectCollection
- */
- protected $attributeCategoriesScheduledForDeletion = null;
-
/**
* An array of objects scheduled for deletion.
* @var ObjectCollection
@@ -1021,10 +967,6 @@ abstract class Category implements ActiveRecordInterface
$this->collProductCategories = null;
- $this->collFeatureCategories = null;
-
- $this->collAttributeCategories = null;
-
$this->collCategoryImages = null;
$this->collCategoryDocuments = null;
@@ -1036,8 +978,6 @@ abstract class Category implements ActiveRecordInterface
$this->collCategoryVersions = null;
$this->collProducts = null;
- $this->collFeatures = null;
- $this->collAttributes = null;
} // if (deep)
}
@@ -1210,60 +1150,6 @@ abstract class Category implements ActiveRecordInterface
}
}
- if ($this->featuresScheduledForDeletion !== null) {
- if (!$this->featuresScheduledForDeletion->isEmpty()) {
- $pks = array();
- $pk = $this->getPrimaryKey();
- foreach ($this->featuresScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
- $pks[] = array($pk, $remotePk);
- }
-
- FeatureCategoryQuery::create()
- ->filterByPrimaryKeys($pks)
- ->delete($con);
- $this->featuresScheduledForDeletion = null;
- }
-
- foreach ($this->getFeatures() as $feature) {
- if ($feature->isModified()) {
- $feature->save($con);
- }
- }
- } elseif ($this->collFeatures) {
- foreach ($this->collFeatures as $feature) {
- if ($feature->isModified()) {
- $feature->save($con);
- }
- }
- }
-
- if ($this->attributesScheduledForDeletion !== null) {
- if (!$this->attributesScheduledForDeletion->isEmpty()) {
- $pks = array();
- $pk = $this->getPrimaryKey();
- foreach ($this->attributesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
- $pks[] = array($pk, $remotePk);
- }
-
- AttributeCategoryQuery::create()
- ->filterByPrimaryKeys($pks)
- ->delete($con);
- $this->attributesScheduledForDeletion = null;
- }
-
- foreach ($this->getAttributes() as $attribute) {
- if ($attribute->isModified()) {
- $attribute->save($con);
- }
- }
- } elseif ($this->collAttributes) {
- foreach ($this->collAttributes as $attribute) {
- if ($attribute->isModified()) {
- $attribute->save($con);
- }
- }
- }
-
if ($this->productCategoriesScheduledForDeletion !== null) {
if (!$this->productCategoriesScheduledForDeletion->isEmpty()) {
\Thelia\Model\ProductCategoryQuery::create()
@@ -1281,40 +1167,6 @@ abstract class Category implements ActiveRecordInterface
}
}
- if ($this->featureCategoriesScheduledForDeletion !== null) {
- if (!$this->featureCategoriesScheduledForDeletion->isEmpty()) {
- \Thelia\Model\FeatureCategoryQuery::create()
- ->filterByPrimaryKeys($this->featureCategoriesScheduledForDeletion->getPrimaryKeys(false))
- ->delete($con);
- $this->featureCategoriesScheduledForDeletion = null;
- }
- }
-
- if ($this->collFeatureCategories !== null) {
- foreach ($this->collFeatureCategories as $referrerFK) {
- if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
- if ($this->attributeCategoriesScheduledForDeletion !== null) {
- if (!$this->attributeCategoriesScheduledForDeletion->isEmpty()) {
- \Thelia\Model\AttributeCategoryQuery::create()
- ->filterByPrimaryKeys($this->attributeCategoriesScheduledForDeletion->getPrimaryKeys(false))
- ->delete($con);
- $this->attributeCategoriesScheduledForDeletion = null;
- }
- }
-
- if ($this->collAttributeCategories !== null) {
- foreach ($this->collAttributeCategories as $referrerFK) {
- if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
if ($this->categoryImagesScheduledForDeletion !== null) {
if (!$this->categoryImagesScheduledForDeletion->isEmpty()) {
\Thelia\Model\CategoryImageQuery::create()
@@ -1629,12 +1481,6 @@ abstract class Category implements ActiveRecordInterface
if (null !== $this->collProductCategories) {
$result['ProductCategories'] = $this->collProductCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
- if (null !== $this->collFeatureCategories) {
- $result['FeatureCategories'] = $this->collFeatureCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
- }
- if (null !== $this->collAttributeCategories) {
- $result['AttributeCategories'] = $this->collAttributeCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
- }
if (null !== $this->collCategoryImages) {
$result['CategoryImages'] = $this->collCategoryImages->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
@@ -1847,18 +1693,6 @@ abstract class Category implements ActiveRecordInterface
}
}
- foreach ($this->getFeatureCategories() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addFeatureCategory($relObj->copy($deepCopy));
- }
- }
-
- foreach ($this->getAttributeCategories() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addAttributeCategory($relObj->copy($deepCopy));
- }
- }
-
foreach ($this->getCategoryImages() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCategoryImage($relObj->copy($deepCopy));
@@ -1933,12 +1767,6 @@ abstract class Category implements ActiveRecordInterface
if ('ProductCategory' == $relationName) {
return $this->initProductCategories();
}
- if ('FeatureCategory' == $relationName) {
- return $this->initFeatureCategories();
- }
- if ('AttributeCategory' == $relationName) {
- return $this->initAttributeCategories();
- }
if ('CategoryImage' == $relationName) {
return $this->initCategoryImages();
}
@@ -2202,492 +2030,6 @@ abstract class Category implements ActiveRecordInterface
return $this->getProductCategories($query, $con);
}
- /**
- * Clears out the collFeatureCategories 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 addFeatureCategories()
- */
- public function clearFeatureCategories()
- {
- $this->collFeatureCategories = null; // important to set this to NULL since that means it is uninitialized
- }
-
- /**
- * Reset is the collFeatureCategories collection loaded partially.
- */
- public function resetPartialFeatureCategories($v = true)
- {
- $this->collFeatureCategoriesPartial = $v;
- }
-
- /**
- * Initializes the collFeatureCategories collection.
- *
- * By default this just sets the collFeatureCategories collection to an empty array (like clearcollFeatureCategories());
- * 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 initFeatureCategories($overrideExisting = true)
- {
- if (null !== $this->collFeatureCategories && !$overrideExisting) {
- return;
- }
- $this->collFeatureCategories = new ObjectCollection();
- $this->collFeatureCategories->setModel('\Thelia\Model\FeatureCategory');
- }
-
- /**
- * Gets an array of ChildFeatureCategory 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|ChildFeatureCategory[] List of ChildFeatureCategory objects
- * @throws PropelException
- */
- public function getFeatureCategories($criteria = null, ConnectionInterface $con = null)
- {
- $partial = $this->collFeatureCategoriesPartial && !$this->isNew();
- if (null === $this->collFeatureCategories || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collFeatureCategories) {
- // return empty collection
- $this->initFeatureCategories();
- } else {
- $collFeatureCategories = ChildFeatureCategoryQuery::create(null, $criteria)
- ->filterByCategory($this)
- ->find($con);
-
- if (null !== $criteria) {
- if (false !== $this->collFeatureCategoriesPartial && count($collFeatureCategories)) {
- $this->initFeatureCategories(false);
-
- foreach ($collFeatureCategories as $obj) {
- if (false == $this->collFeatureCategories->contains($obj)) {
- $this->collFeatureCategories->append($obj);
- }
- }
-
- $this->collFeatureCategoriesPartial = true;
- }
-
- $collFeatureCategories->getInternalIterator()->rewind();
-
- return $collFeatureCategories;
- }
-
- if ($partial && $this->collFeatureCategories) {
- foreach ($this->collFeatureCategories as $obj) {
- if ($obj->isNew()) {
- $collFeatureCategories[] = $obj;
- }
- }
- }
-
- $this->collFeatureCategories = $collFeatureCategories;
- $this->collFeatureCategoriesPartial = false;
- }
- }
-
- return $this->collFeatureCategories;
- }
-
- /**
- * Sets a collection of FeatureCategory 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 $featureCategories A Propel collection.
- * @param ConnectionInterface $con Optional connection object
- * @return ChildCategory The current object (for fluent API support)
- */
- public function setFeatureCategories(Collection $featureCategories, ConnectionInterface $con = null)
- {
- $featureCategoriesToDelete = $this->getFeatureCategories(new Criteria(), $con)->diff($featureCategories);
-
-
- $this->featureCategoriesScheduledForDeletion = $featureCategoriesToDelete;
-
- foreach ($featureCategoriesToDelete as $featureCategoryRemoved) {
- $featureCategoryRemoved->setCategory(null);
- }
-
- $this->collFeatureCategories = null;
- foreach ($featureCategories as $featureCategory) {
- $this->addFeatureCategory($featureCategory);
- }
-
- $this->collFeatureCategories = $featureCategories;
- $this->collFeatureCategoriesPartial = false;
-
- return $this;
- }
-
- /**
- * Returns the number of related FeatureCategory objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param ConnectionInterface $con
- * @return int Count of related FeatureCategory objects.
- * @throws PropelException
- */
- public function countFeatureCategories(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
- {
- $partial = $this->collFeatureCategoriesPartial && !$this->isNew();
- if (null === $this->collFeatureCategories || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collFeatureCategories) {
- return 0;
- }
-
- if ($partial && !$criteria) {
- return count($this->getFeatureCategories());
- }
-
- $query = ChildFeatureCategoryQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByCategory($this)
- ->count($con);
- }
-
- return count($this->collFeatureCategories);
- }
-
- /**
- * Method called to associate a ChildFeatureCategory object to this object
- * through the ChildFeatureCategory foreign key attribute.
- *
- * @param ChildFeatureCategory $l ChildFeatureCategory
- * @return \Thelia\Model\Category The current object (for fluent API support)
- */
- public function addFeatureCategory(ChildFeatureCategory $l)
- {
- if ($this->collFeatureCategories === null) {
- $this->initFeatureCategories();
- $this->collFeatureCategoriesPartial = true;
- }
-
- if (!in_array($l, $this->collFeatureCategories->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
- $this->doAddFeatureCategory($l);
- }
-
- return $this;
- }
-
- /**
- * @param FeatureCategory $featureCategory The featureCategory object to add.
- */
- protected function doAddFeatureCategory($featureCategory)
- {
- $this->collFeatureCategories[]= $featureCategory;
- $featureCategory->setCategory($this);
- }
-
- /**
- * @param FeatureCategory $featureCategory The featureCategory object to remove.
- * @return ChildCategory The current object (for fluent API support)
- */
- public function removeFeatureCategory($featureCategory)
- {
- if ($this->getFeatureCategories()->contains($featureCategory)) {
- $this->collFeatureCategories->remove($this->collFeatureCategories->search($featureCategory));
- if (null === $this->featureCategoriesScheduledForDeletion) {
- $this->featureCategoriesScheduledForDeletion = clone $this->collFeatureCategories;
- $this->featureCategoriesScheduledForDeletion->clear();
- }
- $this->featureCategoriesScheduledForDeletion[]= clone $featureCategory;
- $featureCategory->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 FeatureCategories 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|ChildFeatureCategory[] List of ChildFeatureCategory objects
- */
- public function getFeatureCategoriesJoinFeature($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
- {
- $query = ChildFeatureCategoryQuery::create(null, $criteria);
- $query->joinWith('Feature', $joinBehavior);
-
- return $this->getFeatureCategories($query, $con);
- }
-
- /**
- * Clears out the collAttributeCategories 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 addAttributeCategories()
- */
- public function clearAttributeCategories()
- {
- $this->collAttributeCategories = null; // important to set this to NULL since that means it is uninitialized
- }
-
- /**
- * Reset is the collAttributeCategories collection loaded partially.
- */
- public function resetPartialAttributeCategories($v = true)
- {
- $this->collAttributeCategoriesPartial = $v;
- }
-
- /**
- * Initializes the collAttributeCategories collection.
- *
- * By default this just sets the collAttributeCategories collection to an empty array (like clearcollAttributeCategories());
- * 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 initAttributeCategories($overrideExisting = true)
- {
- if (null !== $this->collAttributeCategories && !$overrideExisting) {
- return;
- }
- $this->collAttributeCategories = new ObjectCollection();
- $this->collAttributeCategories->setModel('\Thelia\Model\AttributeCategory');
- }
-
- /**
- * Gets an array of ChildAttributeCategory 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|ChildAttributeCategory[] List of ChildAttributeCategory objects
- * @throws PropelException
- */
- public function getAttributeCategories($criteria = null, ConnectionInterface $con = null)
- {
- $partial = $this->collAttributeCategoriesPartial && !$this->isNew();
- if (null === $this->collAttributeCategories || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collAttributeCategories) {
- // return empty collection
- $this->initAttributeCategories();
- } else {
- $collAttributeCategories = ChildAttributeCategoryQuery::create(null, $criteria)
- ->filterByCategory($this)
- ->find($con);
-
- if (null !== $criteria) {
- if (false !== $this->collAttributeCategoriesPartial && count($collAttributeCategories)) {
- $this->initAttributeCategories(false);
-
- foreach ($collAttributeCategories as $obj) {
- if (false == $this->collAttributeCategories->contains($obj)) {
- $this->collAttributeCategories->append($obj);
- }
- }
-
- $this->collAttributeCategoriesPartial = true;
- }
-
- $collAttributeCategories->getInternalIterator()->rewind();
-
- return $collAttributeCategories;
- }
-
- if ($partial && $this->collAttributeCategories) {
- foreach ($this->collAttributeCategories as $obj) {
- if ($obj->isNew()) {
- $collAttributeCategories[] = $obj;
- }
- }
- }
-
- $this->collAttributeCategories = $collAttributeCategories;
- $this->collAttributeCategoriesPartial = false;
- }
- }
-
- return $this->collAttributeCategories;
- }
-
- /**
- * Sets a collection of AttributeCategory 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 $attributeCategories A Propel collection.
- * @param ConnectionInterface $con Optional connection object
- * @return ChildCategory The current object (for fluent API support)
- */
- public function setAttributeCategories(Collection $attributeCategories, ConnectionInterface $con = null)
- {
- $attributeCategoriesToDelete = $this->getAttributeCategories(new Criteria(), $con)->diff($attributeCategories);
-
-
- $this->attributeCategoriesScheduledForDeletion = $attributeCategoriesToDelete;
-
- foreach ($attributeCategoriesToDelete as $attributeCategoryRemoved) {
- $attributeCategoryRemoved->setCategory(null);
- }
-
- $this->collAttributeCategories = null;
- foreach ($attributeCategories as $attributeCategory) {
- $this->addAttributeCategory($attributeCategory);
- }
-
- $this->collAttributeCategories = $attributeCategories;
- $this->collAttributeCategoriesPartial = false;
-
- return $this;
- }
-
- /**
- * Returns the number of related AttributeCategory objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param ConnectionInterface $con
- * @return int Count of related AttributeCategory objects.
- * @throws PropelException
- */
- public function countAttributeCategories(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
- {
- $partial = $this->collAttributeCategoriesPartial && !$this->isNew();
- if (null === $this->collAttributeCategories || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collAttributeCategories) {
- return 0;
- }
-
- if ($partial && !$criteria) {
- return count($this->getAttributeCategories());
- }
-
- $query = ChildAttributeCategoryQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByCategory($this)
- ->count($con);
- }
-
- return count($this->collAttributeCategories);
- }
-
- /**
- * Method called to associate a ChildAttributeCategory object to this object
- * through the ChildAttributeCategory foreign key attribute.
- *
- * @param ChildAttributeCategory $l ChildAttributeCategory
- * @return \Thelia\Model\Category The current object (for fluent API support)
- */
- public function addAttributeCategory(ChildAttributeCategory $l)
- {
- if ($this->collAttributeCategories === null) {
- $this->initAttributeCategories();
- $this->collAttributeCategoriesPartial = true;
- }
-
- if (!in_array($l, $this->collAttributeCategories->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
- $this->doAddAttributeCategory($l);
- }
-
- return $this;
- }
-
- /**
- * @param AttributeCategory $attributeCategory The attributeCategory object to add.
- */
- protected function doAddAttributeCategory($attributeCategory)
- {
- $this->collAttributeCategories[]= $attributeCategory;
- $attributeCategory->setCategory($this);
- }
-
- /**
- * @param AttributeCategory $attributeCategory The attributeCategory object to remove.
- * @return ChildCategory The current object (for fluent API support)
- */
- public function removeAttributeCategory($attributeCategory)
- {
- if ($this->getAttributeCategories()->contains($attributeCategory)) {
- $this->collAttributeCategories->remove($this->collAttributeCategories->search($attributeCategory));
- if (null === $this->attributeCategoriesScheduledForDeletion) {
- $this->attributeCategoriesScheduledForDeletion = clone $this->collAttributeCategories;
- $this->attributeCategoriesScheduledForDeletion->clear();
- }
- $this->attributeCategoriesScheduledForDeletion[]= clone $attributeCategory;
- $attributeCategory->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 AttributeCategories 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|ChildAttributeCategory[] List of ChildAttributeCategory objects
- */
- public function getAttributeCategoriesJoinAttribute($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
- {
- $query = ChildAttributeCategoryQuery::create(null, $criteria);
- $query->joinWith('Attribute', $joinBehavior);
-
- return $this->getAttributeCategories($query, $con);
- }
-
/**
* Clears out the collCategoryImages collection
*
@@ -3996,372 +3338,6 @@ abstract class Category implements ActiveRecordInterface
return $this;
}
- /**
- * Clears out the collFeatures 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 addFeatures()
- */
- public function clearFeatures()
- {
- $this->collFeatures = null; // important to set this to NULL since that means it is uninitialized
- $this->collFeaturesPartial = null;
- }
-
- /**
- * Initializes the collFeatures collection.
- *
- * By default this just sets the collFeatures collection to an empty collection (like clearFeatures());
- * 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.
- *
- * @return void
- */
- public function initFeatures()
- {
- $this->collFeatures = new ObjectCollection();
- $this->collFeatures->setModel('\Thelia\Model\Feature');
- }
-
- /**
- * Gets a collection of ChildFeature objects related by a many-to-many relationship
- * to the current object by way of the feature_category cross-reference table.
- *
- * 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 query object to filter the query
- * @param ConnectionInterface $con Optional connection object
- *
- * @return ObjectCollection|ChildFeature[] List of ChildFeature objects
- */
- public function getFeatures($criteria = null, ConnectionInterface $con = null)
- {
- if (null === $this->collFeatures || null !== $criteria) {
- if ($this->isNew() && null === $this->collFeatures) {
- // return empty collection
- $this->initFeatures();
- } else {
- $collFeatures = ChildFeatureQuery::create(null, $criteria)
- ->filterByCategory($this)
- ->find($con);
- if (null !== $criteria) {
- return $collFeatures;
- }
- $this->collFeatures = $collFeatures;
- }
- }
-
- return $this->collFeatures;
- }
-
- /**
- * Sets a collection of Feature objects related by a many-to-many relationship
- * to the current object by way of the feature_category cross-reference table.
- * 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 $features A Propel collection.
- * @param ConnectionInterface $con Optional connection object
- * @return ChildCategory The current object (for fluent API support)
- */
- public function setFeatures(Collection $features, ConnectionInterface $con = null)
- {
- $this->clearFeatures();
- $currentFeatures = $this->getFeatures();
-
- $this->featuresScheduledForDeletion = $currentFeatures->diff($features);
-
- foreach ($features as $feature) {
- if (!$currentFeatures->contains($feature)) {
- $this->doAddFeature($feature);
- }
- }
-
- $this->collFeatures = $features;
-
- return $this;
- }
-
- /**
- * Gets the number of ChildFeature objects related by a many-to-many relationship
- * to the current object by way of the feature_category cross-reference table.
- *
- * @param Criteria $criteria Optional query object to filter the query
- * @param boolean $distinct Set to true to force count distinct
- * @param ConnectionInterface $con Optional connection object
- *
- * @return int the number of related ChildFeature objects
- */
- public function countFeatures($criteria = null, $distinct = false, ConnectionInterface $con = null)
- {
- if (null === $this->collFeatures || null !== $criteria) {
- if ($this->isNew() && null === $this->collFeatures) {
- return 0;
- } else {
- $query = ChildFeatureQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByCategory($this)
- ->count($con);
- }
- } else {
- return count($this->collFeatures);
- }
- }
-
- /**
- * Associate a ChildFeature object to this object
- * through the feature_category cross reference table.
- *
- * @param ChildFeature $feature The ChildFeatureCategory object to relate
- * @return ChildCategory The current object (for fluent API support)
- */
- public function addFeature(ChildFeature $feature)
- {
- if ($this->collFeatures === null) {
- $this->initFeatures();
- }
-
- if (!$this->collFeatures->contains($feature)) { // only add it if the **same** object is not already associated
- $this->doAddFeature($feature);
- $this->collFeatures[] = $feature;
- }
-
- return $this;
- }
-
- /**
- * @param Feature $feature The feature object to add.
- */
- protected function doAddFeature($feature)
- {
- $featureCategory = new ChildFeatureCategory();
- $featureCategory->setFeature($feature);
- $this->addFeatureCategory($featureCategory);
- // set the back reference to this object directly as using provided method either results
- // in endless loop or in multiple relations
- if (!$feature->getCategories()->contains($this)) {
- $foreignCollection = $feature->getCategories();
- $foreignCollection[] = $this;
- }
- }
-
- /**
- * Remove a ChildFeature object to this object
- * through the feature_category cross reference table.
- *
- * @param ChildFeature $feature The ChildFeatureCategory object to relate
- * @return ChildCategory The current object (for fluent API support)
- */
- public function removeFeature(ChildFeature $feature)
- {
- if ($this->getFeatures()->contains($feature)) {
- $this->collFeatures->remove($this->collFeatures->search($feature));
-
- if (null === $this->featuresScheduledForDeletion) {
- $this->featuresScheduledForDeletion = clone $this->collFeatures;
- $this->featuresScheduledForDeletion->clear();
- }
-
- $this->featuresScheduledForDeletion[] = $feature;
- }
-
- return $this;
- }
-
- /**
- * Clears out the collAttributes 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 addAttributes()
- */
- public function clearAttributes()
- {
- $this->collAttributes = null; // important to set this to NULL since that means it is uninitialized
- $this->collAttributesPartial = null;
- }
-
- /**
- * Initializes the collAttributes collection.
- *
- * By default this just sets the collAttributes collection to an empty collection (like clearAttributes());
- * 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.
- *
- * @return void
- */
- public function initAttributes()
- {
- $this->collAttributes = new ObjectCollection();
- $this->collAttributes->setModel('\Thelia\Model\Attribute');
- }
-
- /**
- * Gets a collection of ChildAttribute objects related by a many-to-many relationship
- * to the current object by way of the attribute_category cross-reference table.
- *
- * 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 query object to filter the query
- * @param ConnectionInterface $con Optional connection object
- *
- * @return ObjectCollection|ChildAttribute[] List of ChildAttribute objects
- */
- public function getAttributes($criteria = null, ConnectionInterface $con = null)
- {
- if (null === $this->collAttributes || null !== $criteria) {
- if ($this->isNew() && null === $this->collAttributes) {
- // return empty collection
- $this->initAttributes();
- } else {
- $collAttributes = ChildAttributeQuery::create(null, $criteria)
- ->filterByCategory($this)
- ->find($con);
- if (null !== $criteria) {
- return $collAttributes;
- }
- $this->collAttributes = $collAttributes;
- }
- }
-
- return $this->collAttributes;
- }
-
- /**
- * Sets a collection of Attribute objects related by a many-to-many relationship
- * to the current object by way of the attribute_category cross-reference table.
- * 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 $attributes A Propel collection.
- * @param ConnectionInterface $con Optional connection object
- * @return ChildCategory The current object (for fluent API support)
- */
- public function setAttributes(Collection $attributes, ConnectionInterface $con = null)
- {
- $this->clearAttributes();
- $currentAttributes = $this->getAttributes();
-
- $this->attributesScheduledForDeletion = $currentAttributes->diff($attributes);
-
- foreach ($attributes as $attribute) {
- if (!$currentAttributes->contains($attribute)) {
- $this->doAddAttribute($attribute);
- }
- }
-
- $this->collAttributes = $attributes;
-
- return $this;
- }
-
- /**
- * Gets the number of ChildAttribute objects related by a many-to-many relationship
- * to the current object by way of the attribute_category cross-reference table.
- *
- * @param Criteria $criteria Optional query object to filter the query
- * @param boolean $distinct Set to true to force count distinct
- * @param ConnectionInterface $con Optional connection object
- *
- * @return int the number of related ChildAttribute objects
- */
- public function countAttributes($criteria = null, $distinct = false, ConnectionInterface $con = null)
- {
- if (null === $this->collAttributes || null !== $criteria) {
- if ($this->isNew() && null === $this->collAttributes) {
- return 0;
- } else {
- $query = ChildAttributeQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByCategory($this)
- ->count($con);
- }
- } else {
- return count($this->collAttributes);
- }
- }
-
- /**
- * Associate a ChildAttribute object to this object
- * through the attribute_category cross reference table.
- *
- * @param ChildAttribute $attribute The ChildAttributeCategory object to relate
- * @return ChildCategory The current object (for fluent API support)
- */
- public function addAttribute(ChildAttribute $attribute)
- {
- if ($this->collAttributes === null) {
- $this->initAttributes();
- }
-
- if (!$this->collAttributes->contains($attribute)) { // only add it if the **same** object is not already associated
- $this->doAddAttribute($attribute);
- $this->collAttributes[] = $attribute;
- }
-
- return $this;
- }
-
- /**
- * @param Attribute $attribute The attribute object to add.
- */
- protected function doAddAttribute($attribute)
- {
- $attributeCategory = new ChildAttributeCategory();
- $attributeCategory->setAttribute($attribute);
- $this->addAttributeCategory($attributeCategory);
- // set the back reference to this object directly as using provided method either results
- // in endless loop or in multiple relations
- if (!$attribute->getCategories()->contains($this)) {
- $foreignCollection = $attribute->getCategories();
- $foreignCollection[] = $this;
- }
- }
-
- /**
- * Remove a ChildAttribute object to this object
- * through the attribute_category cross reference table.
- *
- * @param ChildAttribute $attribute The ChildAttributeCategory object to relate
- * @return ChildCategory The current object (for fluent API support)
- */
- public function removeAttribute(ChildAttribute $attribute)
- {
- if ($this->getAttributes()->contains($attribute)) {
- $this->collAttributes->remove($this->collAttributes->search($attribute));
-
- if (null === $this->attributesScheduledForDeletion) {
- $this->attributesScheduledForDeletion = clone $this->collAttributes;
- $this->attributesScheduledForDeletion->clear();
- }
-
- $this->attributesScheduledForDeletion[] = $attribute;
- }
-
- return $this;
- }
-
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -4401,16 +3377,6 @@ abstract class Category implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
- if ($this->collFeatureCategories) {
- foreach ($this->collFeatureCategories as $o) {
- $o->clearAllReferences($deep);
- }
- }
- if ($this->collAttributeCategories) {
- foreach ($this->collAttributeCategories as $o) {
- $o->clearAllReferences($deep);
- }
- }
if ($this->collCategoryImages) {
foreach ($this->collCategoryImages as $o) {
$o->clearAllReferences($deep);
@@ -4441,16 +3407,6 @@ abstract class Category implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
- if ($this->collFeatures) {
- foreach ($this->collFeatures as $o) {
- $o->clearAllReferences($deep);
- }
- }
- if ($this->collAttributes) {
- foreach ($this->collAttributes as $o) {
- $o->clearAllReferences($deep);
- }
- }
} // if ($deep)
// i18n behavior
@@ -4461,14 +3417,6 @@ abstract class Category implements ActiveRecordInterface
$this->collProductCategories->clearIterator();
}
$this->collProductCategories = null;
- if ($this->collFeatureCategories instanceof Collection) {
- $this->collFeatureCategories->clearIterator();
- }
- $this->collFeatureCategories = null;
- if ($this->collAttributeCategories instanceof Collection) {
- $this->collAttributeCategories->clearIterator();
- }
- $this->collAttributeCategories = null;
if ($this->collCategoryImages instanceof Collection) {
$this->collCategoryImages->clearIterator();
}
@@ -4493,14 +3441,6 @@ abstract class Category implements ActiveRecordInterface
$this->collProducts->clearIterator();
}
$this->collProducts = null;
- if ($this->collFeatures instanceof Collection) {
- $this->collFeatures->clearIterator();
- }
- $this->collFeatures = null;
- if ($this->collAttributes instanceof Collection) {
- $this->collAttributes->clearIterator();
- }
- $this->collAttributes = null;
}
/**
diff --git a/core/lib/Thelia/Model/Base/CategoryQuery.php b/core/lib/Thelia/Model/Base/CategoryQuery.php
index 7f0fb8f1c..4ef552094 100644
--- a/core/lib/Thelia/Model/Base/CategoryQuery.php
+++ b/core/lib/Thelia/Model/Base/CategoryQuery.php
@@ -50,14 +50,6 @@ use Thelia\Model\Map\CategoryTableMap;
* @method ChildCategoryQuery rightJoinProductCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductCategory relation
* @method ChildCategoryQuery innerJoinProductCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductCategory relation
*
- * @method ChildCategoryQuery leftJoinFeatureCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureCategory relation
- * @method ChildCategoryQuery rightJoinFeatureCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureCategory relation
- * @method ChildCategoryQuery innerJoinFeatureCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureCategory relation
- *
- * @method ChildCategoryQuery leftJoinAttributeCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeCategory relation
- * @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 leftJoinCategoryImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryImage relation
* @method ChildCategoryQuery rightJoinCategoryImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryImage relation
* @method ChildCategoryQuery innerJoinCategoryImage($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryImage relation
@@ -720,152 +712,6 @@ abstract class CategoryQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'ProductCategory', '\Thelia\Model\ProductCategoryQuery');
}
- /**
- * Filter the query by a related \Thelia\Model\FeatureCategory object
- *
- * @param \Thelia\Model\FeatureCategory|ObjectCollection $featureCategory 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 filterByFeatureCategory($featureCategory, $comparison = null)
- {
- if ($featureCategory instanceof \Thelia\Model\FeatureCategory) {
- return $this
- ->addUsingAlias(CategoryTableMap::ID, $featureCategory->getCategoryId(), $comparison);
- } elseif ($featureCategory instanceof ObjectCollection) {
- return $this
- ->useFeatureCategoryQuery()
- ->filterByPrimaryKeys($featureCategory->getPrimaryKeys())
- ->endUse();
- } else {
- throw new PropelException('filterByFeatureCategory() only accepts arguments of type \Thelia\Model\FeatureCategory or Collection');
- }
- }
-
- /**
- * Adds a JOIN clause to the query using the FeatureCategory 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 joinFeatureCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('FeatureCategory');
-
- // 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, 'FeatureCategory');
- }
-
- return $this;
- }
-
- /**
- * Use the FeatureCategory relation FeatureCategory 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\FeatureCategoryQuery A secondary query class using the current class as primary query
- */
- public function useFeatureCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinFeatureCategory($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'FeatureCategory', '\Thelia\Model\FeatureCategoryQuery');
- }
-
- /**
- * Filter the query by a related \Thelia\Model\AttributeCategory object
- *
- * @param \Thelia\Model\AttributeCategory|ObjectCollection $attributeCategory 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 filterByAttributeCategory($attributeCategory, $comparison = null)
- {
- if ($attributeCategory instanceof \Thelia\Model\AttributeCategory) {
- return $this
- ->addUsingAlias(CategoryTableMap::ID, $attributeCategory->getCategoryId(), $comparison);
- } elseif ($attributeCategory instanceof ObjectCollection) {
- return $this
- ->useAttributeCategoryQuery()
- ->filterByPrimaryKeys($attributeCategory->getPrimaryKeys())
- ->endUse();
- } else {
- throw new PropelException('filterByAttributeCategory() only accepts arguments of type \Thelia\Model\AttributeCategory or Collection');
- }
- }
-
- /**
- * Adds a JOIN clause to the query using the AttributeCategory 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 joinAttributeCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('AttributeCategory');
-
- // 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, 'AttributeCategory');
- }
-
- return $this;
- }
-
- /**
- * Use the AttributeCategory relation AttributeCategory 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\AttributeCategoryQuery A secondary query class using the current class as primary query
- */
- public function useAttributeCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinAttributeCategory($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'AttributeCategory', '\Thelia\Model\AttributeCategoryQuery');
- }
-
/**
* Filter the query by a related \Thelia\Model\CategoryImage object
*
@@ -1248,40 +1094,6 @@ abstract class CategoryQuery extends ModelCriteria
->endUse();
}
- /**
- * Filter the query by a related Feature object
- * using the feature_category table as cross reference
- *
- * @param Feature $feature 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 filterByFeature($feature, $comparison = Criteria::EQUAL)
- {
- return $this
- ->useFeatureCategoryQuery()
- ->filterByFeature($feature, $comparison)
- ->endUse();
- }
-
- /**
- * Filter the query by a related Attribute object
- * using the attribute_category table as cross reference
- *
- * @param Attribute $attribute 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 filterByAttribute($attribute, $comparison = Criteria::EQUAL)
- {
- return $this
- ->useAttributeCategoryQuery()
- ->filterByAttribute($attribute, $comparison)
- ->endUse();
- }
-
/**
* Exclude object from result
*
diff --git a/core/lib/Thelia/Model/Base/Customer.php b/core/lib/Thelia/Model/Base/Customer.php
index 3d87f3e28..06553ecfe 100644
--- a/core/lib/Thelia/Model/Base/Customer.php
+++ b/core/lib/Thelia/Model/Base/Customer.php
@@ -135,6 +135,18 @@ abstract class Customer implements ActiveRecordInterface
*/
protected $discount;
+ /**
+ * The value for the remember_me_token field.
+ * @var string
+ */
+ protected $remember_me_token;
+
+ /**
+ * The value for the remember_me_serial field.
+ * @var string
+ */
+ protected $remember_me_serial;
+
/**
* The value for the created_at field.
* @var string
@@ -582,6 +594,28 @@ abstract class Customer implements ActiveRecordInterface
return $this->discount;
}
+ /**
+ * Get the [remember_me_token] column value.
+ *
+ * @return string
+ */
+ public function getRememberMeToken()
+ {
+
+ return $this->remember_me_token;
+ }
+
+ /**
+ * Get the [remember_me_serial] column value.
+ *
+ * @return string
+ */
+ public function getRememberMeSerial()
+ {
+
+ return $this->remember_me_serial;
+ }
+
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -878,6 +912,48 @@ abstract class Customer implements ActiveRecordInterface
return $this;
} // setDiscount()
+ /**
+ * Set the value of [remember_me_token] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\Customer The current object (for fluent API support)
+ */
+ public function setRememberMeToken($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->remember_me_token !== $v) {
+ $this->remember_me_token = $v;
+ $this->modifiedColumns[] = CustomerTableMap::REMEMBER_ME_TOKEN;
+ }
+
+
+ return $this;
+ } // setRememberMeToken()
+
+ /**
+ * Set the value of [remember_me_serial] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\Customer The current object (for fluent API support)
+ */
+ public function setRememberMeSerial($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->remember_me_serial !== $v) {
+ $this->remember_me_serial = $v;
+ $this->modifiedColumns[] = CustomerTableMap::REMEMBER_ME_SERIAL;
+ }
+
+
+ return $this;
+ } // setRememberMeSerial()
+
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -993,13 +1069,19 @@ abstract class Customer implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CustomerTableMap::translateFieldName('Discount', TableMap::TYPE_PHPNAME, $indexType)];
$this->discount = (null !== $col) ? (double) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CustomerTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CustomerTableMap::translateFieldName('RememberMeToken', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->remember_me_token = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CustomerTableMap::translateFieldName('RememberMeSerial', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->remember_me_serial = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CustomerTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CustomerTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CustomerTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -1012,7 +1094,7 @@ abstract class Customer implements ActiveRecordInterface
$this->ensureConsistency();
}
- return $startcol + 14; // 14 = CustomerTableMap::NUM_HYDRATE_COLUMNS.
+ return $startcol + 16; // 16 = CustomerTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Customer object", 0, $e);
@@ -1342,6 +1424,12 @@ abstract class Customer implements ActiveRecordInterface
if ($this->isColumnModified(CustomerTableMap::DISCOUNT)) {
$modifiedColumns[':p' . $index++] = 'DISCOUNT';
}
+ if ($this->isColumnModified(CustomerTableMap::REMEMBER_ME_TOKEN)) {
+ $modifiedColumns[':p' . $index++] = 'REMEMBER_ME_TOKEN';
+ }
+ if ($this->isColumnModified(CustomerTableMap::REMEMBER_ME_SERIAL)) {
+ $modifiedColumns[':p' . $index++] = 'REMEMBER_ME_SERIAL';
+ }
if ($this->isColumnModified(CustomerTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -1395,6 +1483,12 @@ abstract class Customer implements ActiveRecordInterface
case 'DISCOUNT':
$stmt->bindValue($identifier, $this->discount, PDO::PARAM_STR);
break;
+ case 'REMEMBER_ME_TOKEN':
+ $stmt->bindValue($identifier, $this->remember_me_token, PDO::PARAM_STR);
+ break;
+ case 'REMEMBER_ME_SERIAL':
+ $stmt->bindValue($identifier, $this->remember_me_serial, PDO::PARAM_STR);
+ break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
@@ -1500,9 +1594,15 @@ abstract class Customer implements ActiveRecordInterface
return $this->getDiscount();
break;
case 12:
- return $this->getCreatedAt();
+ return $this->getRememberMeToken();
break;
case 13:
+ return $this->getRememberMeSerial();
+ break;
+ case 14:
+ return $this->getCreatedAt();
+ break;
+ case 15:
return $this->getUpdatedAt();
break;
default:
@@ -1546,8 +1646,10 @@ abstract class Customer implements ActiveRecordInterface
$keys[9] => $this->getLang(),
$keys[10] => $this->getSponsor(),
$keys[11] => $this->getDiscount(),
- $keys[12] => $this->getCreatedAt(),
- $keys[13] => $this->getUpdatedAt(),
+ $keys[12] => $this->getRememberMeToken(),
+ $keys[13] => $this->getRememberMeSerial(),
+ $keys[14] => $this->getCreatedAt(),
+ $keys[15] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn)
@@ -1639,9 +1741,15 @@ abstract class Customer implements ActiveRecordInterface
$this->setDiscount($value);
break;
case 12:
- $this->setCreatedAt($value);
+ $this->setRememberMeToken($value);
break;
case 13:
+ $this->setRememberMeSerial($value);
+ break;
+ case 14:
+ $this->setCreatedAt($value);
+ break;
+ case 15:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1680,8 +1788,10 @@ abstract class Customer implements ActiveRecordInterface
if (array_key_exists($keys[9], $arr)) $this->setLang($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setSponsor($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setDiscount($arr[$keys[11]]);
- if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]);
- if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]);
+ if (array_key_exists($keys[12], $arr)) $this->setRememberMeToken($arr[$keys[12]]);
+ if (array_key_exists($keys[13], $arr)) $this->setRememberMeSerial($arr[$keys[13]]);
+ if (array_key_exists($keys[14], $arr)) $this->setCreatedAt($arr[$keys[14]]);
+ if (array_key_exists($keys[15], $arr)) $this->setUpdatedAt($arr[$keys[15]]);
}
/**
@@ -1705,6 +1815,8 @@ abstract class Customer implements ActiveRecordInterface
if ($this->isColumnModified(CustomerTableMap::LANG)) $criteria->add(CustomerTableMap::LANG, $this->lang);
if ($this->isColumnModified(CustomerTableMap::SPONSOR)) $criteria->add(CustomerTableMap::SPONSOR, $this->sponsor);
if ($this->isColumnModified(CustomerTableMap::DISCOUNT)) $criteria->add(CustomerTableMap::DISCOUNT, $this->discount);
+ if ($this->isColumnModified(CustomerTableMap::REMEMBER_ME_TOKEN)) $criteria->add(CustomerTableMap::REMEMBER_ME_TOKEN, $this->remember_me_token);
+ if ($this->isColumnModified(CustomerTableMap::REMEMBER_ME_SERIAL)) $criteria->add(CustomerTableMap::REMEMBER_ME_SERIAL, $this->remember_me_serial);
if ($this->isColumnModified(CustomerTableMap::CREATED_AT)) $criteria->add(CustomerTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(CustomerTableMap::UPDATED_AT)) $criteria->add(CustomerTableMap::UPDATED_AT, $this->updated_at);
@@ -1781,6 +1893,8 @@ abstract class Customer implements ActiveRecordInterface
$copyObj->setLang($this->getLang());
$copyObj->setSponsor($this->getSponsor());
$copyObj->setDiscount($this->getDiscount());
+ $copyObj->setRememberMeToken($this->getRememberMeToken());
+ $copyObj->setRememberMeSerial($this->getRememberMeSerial());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
@@ -2806,6 +2920,8 @@ abstract class Customer implements ActiveRecordInterface
$this->lang = null;
$this->sponsor = null;
$this->discount = null;
+ $this->remember_me_token = null;
+ $this->remember_me_serial = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;
diff --git a/core/lib/Thelia/Model/Base/CustomerQuery.php b/core/lib/Thelia/Model/Base/CustomerQuery.php
index f02e76c24..897bb5ee9 100644
--- a/core/lib/Thelia/Model/Base/CustomerQuery.php
+++ b/core/lib/Thelia/Model/Base/CustomerQuery.php
@@ -33,6 +33,8 @@ use Thelia\Model\Map\CustomerTableMap;
* @method ChildCustomerQuery orderByLang($order = Criteria::ASC) Order by the lang column
* @method ChildCustomerQuery orderBySponsor($order = Criteria::ASC) Order by the sponsor column
* @method ChildCustomerQuery orderByDiscount($order = Criteria::ASC) Order by the discount column
+ * @method ChildCustomerQuery orderByRememberMeToken($order = Criteria::ASC) Order by the remember_me_token column
+ * @method ChildCustomerQuery orderByRememberMeSerial($order = Criteria::ASC) Order by the remember_me_serial column
* @method ChildCustomerQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCustomerQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
@@ -48,6 +50,8 @@ use Thelia\Model\Map\CustomerTableMap;
* @method ChildCustomerQuery groupByLang() Group by the lang column
* @method ChildCustomerQuery groupBySponsor() Group by the sponsor column
* @method ChildCustomerQuery groupByDiscount() Group by the discount column
+ * @method ChildCustomerQuery groupByRememberMeToken() Group by the remember_me_token column
+ * @method ChildCustomerQuery groupByRememberMeSerial() Group by the remember_me_serial column
* @method ChildCustomerQuery groupByCreatedAt() Group by the created_at column
* @method ChildCustomerQuery groupByUpdatedAt() Group by the updated_at column
*
@@ -86,6 +90,8 @@ use Thelia\Model\Map\CustomerTableMap;
* @method ChildCustomer findOneByLang(string $lang) Return the first ChildCustomer filtered by the lang column
* @method ChildCustomer findOneBySponsor(string $sponsor) Return the first ChildCustomer filtered by the sponsor column
* @method ChildCustomer findOneByDiscount(double $discount) Return the first ChildCustomer filtered by the discount column
+ * @method ChildCustomer findOneByRememberMeToken(string $remember_me_token) Return the first ChildCustomer filtered by the remember_me_token column
+ * @method ChildCustomer findOneByRememberMeSerial(string $remember_me_serial) Return the first ChildCustomer filtered by the remember_me_serial column
* @method ChildCustomer findOneByCreatedAt(string $created_at) Return the first ChildCustomer filtered by the created_at column
* @method ChildCustomer findOneByUpdatedAt(string $updated_at) Return the first ChildCustomer filtered by the updated_at column
*
@@ -101,6 +107,8 @@ use Thelia\Model\Map\CustomerTableMap;
* @method array findByLang(string $lang) Return ChildCustomer objects filtered by the lang column
* @method array findBySponsor(string $sponsor) Return ChildCustomer objects filtered by the sponsor column
* @method array findByDiscount(double $discount) Return ChildCustomer objects filtered by the discount column
+ * @method array findByRememberMeToken(string $remember_me_token) Return ChildCustomer objects filtered by the remember_me_token column
+ * @method array findByRememberMeSerial(string $remember_me_serial) Return ChildCustomer objects filtered by the remember_me_serial column
* @method array findByCreatedAt(string $created_at) Return ChildCustomer objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCustomer objects filtered by the updated_at column
*
@@ -191,7 +199,7 @@ abstract class CustomerQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
- $sql = 'SELECT ID, REF, TITLE_ID, FIRSTNAME, LASTNAME, EMAIL, PASSWORD, ALGO, RESELLER, LANG, SPONSOR, DISCOUNT, CREATED_AT, UPDATED_AT FROM customer WHERE ID = :p0';
+ $sql = 'SELECT ID, REF, TITLE_ID, FIRSTNAME, LASTNAME, EMAIL, PASSWORD, ALGO, RESELLER, LANG, SPONSOR, DISCOUNT, REMEMBER_ME_TOKEN, REMEMBER_ME_SERIAL, CREATED_AT, UPDATED_AT FROM customer WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -678,6 +686,64 @@ abstract class CustomerQuery extends ModelCriteria
return $this->addUsingAlias(CustomerTableMap::DISCOUNT, $discount, $comparison);
}
+ /**
+ * Filter the query on the remember_me_token column
+ *
+ * Example usage:
+ *
+ * $query->filterByRememberMeToken('fooValue'); // WHERE remember_me_token = 'fooValue'
+ * $query->filterByRememberMeToken('%fooValue%'); // WHERE remember_me_token LIKE '%fooValue%'
+ *
+ *
+ * @param string $rememberMeToken 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 ChildCustomerQuery The current query, for fluid interface
+ */
+ public function filterByRememberMeToken($rememberMeToken = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($rememberMeToken)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $rememberMeToken)) {
+ $rememberMeToken = str_replace('*', '%', $rememberMeToken);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CustomerTableMap::REMEMBER_ME_TOKEN, $rememberMeToken, $comparison);
+ }
+
+ /**
+ * Filter the query on the remember_me_serial column
+ *
+ * Example usage:
+ *
+ * $query->filterByRememberMeSerial('fooValue'); // WHERE remember_me_serial = 'fooValue'
+ * $query->filterByRememberMeSerial('%fooValue%'); // WHERE remember_me_serial LIKE '%fooValue%'
+ *
+ *
+ * @param string $rememberMeSerial 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 ChildCustomerQuery The current query, for fluid interface
+ */
+ public function filterByRememberMeSerial($rememberMeSerial = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($rememberMeSerial)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $rememberMeSerial)) {
+ $rememberMeSerial = str_replace('*', '%', $rememberMeSerial);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CustomerTableMap::REMEMBER_ME_SERIAL, $rememberMeSerial, $comparison);
+ }
+
/**
* Filter the query on the created_at column
*
diff --git a/core/lib/Thelia/Model/Base/Feature.php b/core/lib/Thelia/Model/Base/Feature.php
index 2860a4155..c9b6c5ed4 100644
--- a/core/lib/Thelia/Model/Base/Feature.php
+++ b/core/lib/Thelia/Model/Base/Feature.php
@@ -17,18 +17,18 @@ use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime;
-use Thelia\Model\Category as ChildCategory;
-use Thelia\Model\CategoryQuery as ChildCategoryQuery;
use Thelia\Model\Feature as ChildFeature;
use Thelia\Model\FeatureAv as ChildFeatureAv;
use Thelia\Model\FeatureAvQuery as ChildFeatureAvQuery;
-use Thelia\Model\FeatureCategory as ChildFeatureCategory;
-use Thelia\Model\FeatureCategoryQuery as ChildFeatureCategoryQuery;
use Thelia\Model\FeatureI18n as ChildFeatureI18n;
use Thelia\Model\FeatureI18nQuery as ChildFeatureI18nQuery;
use Thelia\Model\FeatureProduct as ChildFeatureProduct;
use Thelia\Model\FeatureProductQuery as ChildFeatureProductQuery;
use Thelia\Model\FeatureQuery as ChildFeatureQuery;
+use Thelia\Model\FeatureTemplate as ChildFeatureTemplate;
+use Thelia\Model\FeatureTemplateQuery as ChildFeatureTemplateQuery;
+use Thelia\Model\Template as ChildTemplate;
+use Thelia\Model\TemplateQuery as ChildTemplateQuery;
use Thelia\Model\Map\FeatureTableMap;
abstract class Feature implements ActiveRecordInterface
@@ -109,10 +109,10 @@ abstract class Feature implements ActiveRecordInterface
protected $collFeatureProductsPartial;
/**
- * @var ObjectCollection|ChildFeatureCategory[] Collection to store aggregation of ChildFeatureCategory objects.
+ * @var ObjectCollection|ChildFeatureTemplate[] Collection to store aggregation of ChildFeatureTemplate objects.
*/
- protected $collFeatureCategories;
- protected $collFeatureCategoriesPartial;
+ protected $collFeatureTemplates;
+ protected $collFeatureTemplatesPartial;
/**
* @var ObjectCollection|ChildFeatureI18n[] Collection to store aggregation of ChildFeatureI18n objects.
@@ -121,9 +121,9 @@ abstract class Feature implements ActiveRecordInterface
protected $collFeatureI18nsPartial;
/**
- * @var ChildCategory[] Collection to store aggregation of ChildCategory objects.
+ * @var ChildTemplate[] Collection to store aggregation of ChildTemplate objects.
*/
- protected $collCategories;
+ protected $collTemplates;
/**
* Flag to prevent endless save loop, if this object is referenced
@@ -151,7 +151,7 @@ abstract class Feature implements ActiveRecordInterface
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
- protected $categoriesScheduledForDeletion = null;
+ protected $templatesScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
@@ -169,7 +169,7 @@ abstract class Feature implements ActiveRecordInterface
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
- protected $featureCategoriesScheduledForDeletion = null;
+ protected $featureTemplatesScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
@@ -756,11 +756,11 @@ abstract class Feature implements ActiveRecordInterface
$this->collFeatureProducts = null;
- $this->collFeatureCategories = null;
+ $this->collFeatureTemplates = null;
$this->collFeatureI18ns = null;
- $this->collCategories = null;
+ $this->collTemplates = null;
} // if (deep)
}
@@ -894,29 +894,29 @@ abstract class Feature implements ActiveRecordInterface
$this->resetModified();
}
- if ($this->categoriesScheduledForDeletion !== null) {
- if (!$this->categoriesScheduledForDeletion->isEmpty()) {
+ if ($this->templatesScheduledForDeletion !== null) {
+ if (!$this->templatesScheduledForDeletion->isEmpty()) {
$pks = array();
$pk = $this->getPrimaryKey();
- foreach ($this->categoriesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
- $pks[] = array($remotePk, $pk);
+ foreach ($this->templatesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
+ $pks[] = array($pk, $remotePk);
}
- FeatureCategoryQuery::create()
+ FeatureTemplateQuery::create()
->filterByPrimaryKeys($pks)
->delete($con);
- $this->categoriesScheduledForDeletion = null;
+ $this->templatesScheduledForDeletion = null;
}
- foreach ($this->getCategories() as $category) {
- if ($category->isModified()) {
- $category->save($con);
+ foreach ($this->getTemplates() as $template) {
+ if ($template->isModified()) {
+ $template->save($con);
}
}
- } elseif ($this->collCategories) {
- foreach ($this->collCategories as $category) {
- if ($category->isModified()) {
- $category->save($con);
+ } elseif ($this->collTemplates) {
+ foreach ($this->collTemplates as $template) {
+ if ($template->isModified()) {
+ $template->save($con);
}
}
}
@@ -955,17 +955,17 @@ abstract class Feature implements ActiveRecordInterface
}
}
- if ($this->featureCategoriesScheduledForDeletion !== null) {
- if (!$this->featureCategoriesScheduledForDeletion->isEmpty()) {
- \Thelia\Model\FeatureCategoryQuery::create()
- ->filterByPrimaryKeys($this->featureCategoriesScheduledForDeletion->getPrimaryKeys(false))
+ if ($this->featureTemplatesScheduledForDeletion !== null) {
+ if (!$this->featureTemplatesScheduledForDeletion->isEmpty()) {
+ \Thelia\Model\FeatureTemplateQuery::create()
+ ->filterByPrimaryKeys($this->featureTemplatesScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
- $this->featureCategoriesScheduledForDeletion = null;
+ $this->featureTemplatesScheduledForDeletion = null;
}
}
- if ($this->collFeatureCategories !== null) {
- foreach ($this->collFeatureCategories as $referrerFK) {
+ if ($this->collFeatureTemplates !== null) {
+ foreach ($this->collFeatureTemplates as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
@@ -1181,8 +1181,8 @@ abstract class Feature implements ActiveRecordInterface
if (null !== $this->collFeatureProducts) {
$result['FeatureProducts'] = $this->collFeatureProducts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
- if (null !== $this->collFeatureCategories) {
- $result['FeatureCategories'] = $this->collFeatureCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ if (null !== $this->collFeatureTemplates) {
+ $result['FeatureTemplates'] = $this->collFeatureTemplates->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collFeatureI18ns) {
$result['FeatureI18ns'] = $this->collFeatureI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
@@ -1366,9 +1366,9 @@ abstract class Feature implements ActiveRecordInterface
}
}
- foreach ($this->getFeatureCategories() as $relObj) {
+ foreach ($this->getFeatureTemplates() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addFeatureCategory($relObj->copy($deepCopy));
+ $copyObj->addFeatureTemplate($relObj->copy($deepCopy));
}
}
@@ -1425,8 +1425,8 @@ abstract class Feature implements ActiveRecordInterface
if ('FeatureProduct' == $relationName) {
return $this->initFeatureProducts();
}
- if ('FeatureCategory' == $relationName) {
- return $this->initFeatureCategories();
+ if ('FeatureTemplate' == $relationName) {
+ return $this->initFeatureTemplates();
}
if ('FeatureI18n' == $relationName) {
return $this->initFeatureI18ns();
@@ -1920,31 +1920,31 @@ abstract class Feature implements ActiveRecordInterface
}
/**
- * Clears out the collFeatureCategories collection
+ * Clears out the collFeatureTemplates 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 addFeatureCategories()
+ * @see addFeatureTemplates()
*/
- public function clearFeatureCategories()
+ public function clearFeatureTemplates()
{
- $this->collFeatureCategories = null; // important to set this to NULL since that means it is uninitialized
+ $this->collFeatureTemplates = null; // important to set this to NULL since that means it is uninitialized
}
/**
- * Reset is the collFeatureCategories collection loaded partially.
+ * Reset is the collFeatureTemplates collection loaded partially.
*/
- public function resetPartialFeatureCategories($v = true)
+ public function resetPartialFeatureTemplates($v = true)
{
- $this->collFeatureCategoriesPartial = $v;
+ $this->collFeatureTemplatesPartial = $v;
}
/**
- * Initializes the collFeatureCategories collection.
+ * Initializes the collFeatureTemplates collection.
*
- * By default this just sets the collFeatureCategories collection to an empty array (like clearcollFeatureCategories());
+ * By default this just sets the collFeatureTemplates collection to an empty array (like clearcollFeatureTemplates());
* 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.
*
@@ -1953,17 +1953,17 @@ abstract class Feature implements ActiveRecordInterface
*
* @return void
*/
- public function initFeatureCategories($overrideExisting = true)
+ public function initFeatureTemplates($overrideExisting = true)
{
- if (null !== $this->collFeatureCategories && !$overrideExisting) {
+ if (null !== $this->collFeatureTemplates && !$overrideExisting) {
return;
}
- $this->collFeatureCategories = new ObjectCollection();
- $this->collFeatureCategories->setModel('\Thelia\Model\FeatureCategory');
+ $this->collFeatureTemplates = new ObjectCollection();
+ $this->collFeatureTemplates->setModel('\Thelia\Model\FeatureTemplate');
}
/**
- * Gets an array of ChildFeatureCategory objects which contain a foreign key that references this object.
+ * Gets an array of ChildFeatureTemplate 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.
@@ -1973,109 +1973,109 @@ abstract class Feature implements ActiveRecordInterface
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
- * @return Collection|ChildFeatureCategory[] List of ChildFeatureCategory objects
+ * @return Collection|ChildFeatureTemplate[] List of ChildFeatureTemplate objects
* @throws PropelException
*/
- public function getFeatureCategories($criteria = null, ConnectionInterface $con = null)
+ public function getFeatureTemplates($criteria = null, ConnectionInterface $con = null)
{
- $partial = $this->collFeatureCategoriesPartial && !$this->isNew();
- if (null === $this->collFeatureCategories || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collFeatureCategories) {
+ $partial = $this->collFeatureTemplatesPartial && !$this->isNew();
+ if (null === $this->collFeatureTemplates || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collFeatureTemplates) {
// return empty collection
- $this->initFeatureCategories();
+ $this->initFeatureTemplates();
} else {
- $collFeatureCategories = ChildFeatureCategoryQuery::create(null, $criteria)
+ $collFeatureTemplates = ChildFeatureTemplateQuery::create(null, $criteria)
->filterByFeature($this)
->find($con);
if (null !== $criteria) {
- if (false !== $this->collFeatureCategoriesPartial && count($collFeatureCategories)) {
- $this->initFeatureCategories(false);
+ if (false !== $this->collFeatureTemplatesPartial && count($collFeatureTemplates)) {
+ $this->initFeatureTemplates(false);
- foreach ($collFeatureCategories as $obj) {
- if (false == $this->collFeatureCategories->contains($obj)) {
- $this->collFeatureCategories->append($obj);
+ foreach ($collFeatureTemplates as $obj) {
+ if (false == $this->collFeatureTemplates->contains($obj)) {
+ $this->collFeatureTemplates->append($obj);
}
}
- $this->collFeatureCategoriesPartial = true;
+ $this->collFeatureTemplatesPartial = true;
}
- $collFeatureCategories->getInternalIterator()->rewind();
+ $collFeatureTemplates->getInternalIterator()->rewind();
- return $collFeatureCategories;
+ return $collFeatureTemplates;
}
- if ($partial && $this->collFeatureCategories) {
- foreach ($this->collFeatureCategories as $obj) {
+ if ($partial && $this->collFeatureTemplates) {
+ foreach ($this->collFeatureTemplates as $obj) {
if ($obj->isNew()) {
- $collFeatureCategories[] = $obj;
+ $collFeatureTemplates[] = $obj;
}
}
}
- $this->collFeatureCategories = $collFeatureCategories;
- $this->collFeatureCategoriesPartial = false;
+ $this->collFeatureTemplates = $collFeatureTemplates;
+ $this->collFeatureTemplatesPartial = false;
}
}
- return $this->collFeatureCategories;
+ return $this->collFeatureTemplates;
}
/**
- * Sets a collection of FeatureCategory objects related by a one-to-many relationship
+ * Sets a collection of FeatureTemplate 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 $featureCategories A Propel collection.
+ * @param Collection $featureTemplates A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildFeature The current object (for fluent API support)
*/
- public function setFeatureCategories(Collection $featureCategories, ConnectionInterface $con = null)
+ public function setFeatureTemplates(Collection $featureTemplates, ConnectionInterface $con = null)
{
- $featureCategoriesToDelete = $this->getFeatureCategories(new Criteria(), $con)->diff($featureCategories);
+ $featureTemplatesToDelete = $this->getFeatureTemplates(new Criteria(), $con)->diff($featureTemplates);
- $this->featureCategoriesScheduledForDeletion = $featureCategoriesToDelete;
+ $this->featureTemplatesScheduledForDeletion = $featureTemplatesToDelete;
- foreach ($featureCategoriesToDelete as $featureCategoryRemoved) {
- $featureCategoryRemoved->setFeature(null);
+ foreach ($featureTemplatesToDelete as $featureTemplateRemoved) {
+ $featureTemplateRemoved->setFeature(null);
}
- $this->collFeatureCategories = null;
- foreach ($featureCategories as $featureCategory) {
- $this->addFeatureCategory($featureCategory);
+ $this->collFeatureTemplates = null;
+ foreach ($featureTemplates as $featureTemplate) {
+ $this->addFeatureTemplate($featureTemplate);
}
- $this->collFeatureCategories = $featureCategories;
- $this->collFeatureCategoriesPartial = false;
+ $this->collFeatureTemplates = $featureTemplates;
+ $this->collFeatureTemplatesPartial = false;
return $this;
}
/**
- * Returns the number of related FeatureCategory objects.
+ * Returns the number of related FeatureTemplate objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param ConnectionInterface $con
- * @return int Count of related FeatureCategory objects.
+ * @return int Count of related FeatureTemplate objects.
* @throws PropelException
*/
- public function countFeatureCategories(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
+ public function countFeatureTemplates(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
- $partial = $this->collFeatureCategoriesPartial && !$this->isNew();
- if (null === $this->collFeatureCategories || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collFeatureCategories) {
+ $partial = $this->collFeatureTemplatesPartial && !$this->isNew();
+ if (null === $this->collFeatureTemplates || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collFeatureTemplates) {
return 0;
}
if ($partial && !$criteria) {
- return count($this->getFeatureCategories());
+ return count($this->getFeatureTemplates());
}
- $query = ChildFeatureCategoryQuery::create(null, $criteria);
+ $query = ChildFeatureTemplateQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -2085,53 +2085,53 @@ abstract class Feature implements ActiveRecordInterface
->count($con);
}
- return count($this->collFeatureCategories);
+ return count($this->collFeatureTemplates);
}
/**
- * Method called to associate a ChildFeatureCategory object to this object
- * through the ChildFeatureCategory foreign key attribute.
+ * Method called to associate a ChildFeatureTemplate object to this object
+ * through the ChildFeatureTemplate foreign key attribute.
*
- * @param ChildFeatureCategory $l ChildFeatureCategory
+ * @param ChildFeatureTemplate $l ChildFeatureTemplate
* @return \Thelia\Model\Feature The current object (for fluent API support)
*/
- public function addFeatureCategory(ChildFeatureCategory $l)
+ public function addFeatureTemplate(ChildFeatureTemplate $l)
{
- if ($this->collFeatureCategories === null) {
- $this->initFeatureCategories();
- $this->collFeatureCategoriesPartial = true;
+ if ($this->collFeatureTemplates === null) {
+ $this->initFeatureTemplates();
+ $this->collFeatureTemplatesPartial = true;
}
- if (!in_array($l, $this->collFeatureCategories->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
- $this->doAddFeatureCategory($l);
+ if (!in_array($l, $this->collFeatureTemplates->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddFeatureTemplate($l);
}
return $this;
}
/**
- * @param FeatureCategory $featureCategory The featureCategory object to add.
+ * @param FeatureTemplate $featureTemplate The featureTemplate object to add.
*/
- protected function doAddFeatureCategory($featureCategory)
+ protected function doAddFeatureTemplate($featureTemplate)
{
- $this->collFeatureCategories[]= $featureCategory;
- $featureCategory->setFeature($this);
+ $this->collFeatureTemplates[]= $featureTemplate;
+ $featureTemplate->setFeature($this);
}
/**
- * @param FeatureCategory $featureCategory The featureCategory object to remove.
+ * @param FeatureTemplate $featureTemplate The featureTemplate object to remove.
* @return ChildFeature The current object (for fluent API support)
*/
- public function removeFeatureCategory($featureCategory)
+ public function removeFeatureTemplate($featureTemplate)
{
- if ($this->getFeatureCategories()->contains($featureCategory)) {
- $this->collFeatureCategories->remove($this->collFeatureCategories->search($featureCategory));
- if (null === $this->featureCategoriesScheduledForDeletion) {
- $this->featureCategoriesScheduledForDeletion = clone $this->collFeatureCategories;
- $this->featureCategoriesScheduledForDeletion->clear();
+ if ($this->getFeatureTemplates()->contains($featureTemplate)) {
+ $this->collFeatureTemplates->remove($this->collFeatureTemplates->search($featureTemplate));
+ if (null === $this->featureTemplatesScheduledForDeletion) {
+ $this->featureTemplatesScheduledForDeletion = clone $this->collFeatureTemplates;
+ $this->featureTemplatesScheduledForDeletion->clear();
}
- $this->featureCategoriesScheduledForDeletion[]= clone $featureCategory;
- $featureCategory->setFeature(null);
+ $this->featureTemplatesScheduledForDeletion[]= clone $featureTemplate;
+ $featureTemplate->setFeature(null);
}
return $this;
@@ -2143,7 +2143,7 @@ abstract class Feature implements ActiveRecordInterface
* an identical criteria, it returns the collection.
* Otherwise if this Feature is new, it will return
* an empty collection; or if this Feature has previously
- * been saved, it will retrieve related FeatureCategories from storage.
+ * been saved, it will retrieve related FeatureTemplates from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
@@ -2152,14 +2152,14 @@ abstract class Feature implements ActiveRecordInterface
* @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|ChildFeatureCategory[] List of ChildFeatureCategory objects
+ * @return Collection|ChildFeatureTemplate[] List of ChildFeatureTemplate objects
*/
- public function getFeatureCategoriesJoinCategory($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ public function getFeatureTemplatesJoinTemplate($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
- $query = ChildFeatureCategoryQuery::create(null, $criteria);
- $query->joinWith('Category', $joinBehavior);
+ $query = ChildFeatureTemplateQuery::create(null, $criteria);
+ $query->joinWith('Template', $joinBehavior);
- return $this->getFeatureCategories($query, $con);
+ return $this->getFeatureTemplates($query, $con);
}
/**
@@ -2388,38 +2388,38 @@ abstract class Feature implements ActiveRecordInterface
}
/**
- * Clears out the collCategories collection
+ * Clears out the collTemplates 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 addCategories()
+ * @see addTemplates()
*/
- public function clearCategories()
+ public function clearTemplates()
{
- $this->collCategories = null; // important to set this to NULL since that means it is uninitialized
- $this->collCategoriesPartial = null;
+ $this->collTemplates = null; // important to set this to NULL since that means it is uninitialized
+ $this->collTemplatesPartial = null;
}
/**
- * Initializes the collCategories collection.
+ * Initializes the collTemplates collection.
*
- * By default this just sets the collCategories collection to an empty collection (like clearCategories());
+ * By default this just sets the collTemplates collection to an empty collection (like clearTemplates());
* 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.
*
* @return void
*/
- public function initCategories()
+ public function initTemplates()
{
- $this->collCategories = new ObjectCollection();
- $this->collCategories->setModel('\Thelia\Model\Category');
+ $this->collTemplates = new ObjectCollection();
+ $this->collTemplates->setModel('\Thelia\Model\Template');
}
/**
- * Gets a collection of ChildCategory objects related by a many-to-many relationship
- * to the current object by way of the feature_category cross-reference table.
+ * Gets a collection of ChildTemplate objects related by a many-to-many relationship
+ * to the current object by way of the feature_template cross-reference table.
*
* 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.
@@ -2430,73 +2430,73 @@ abstract class Feature implements ActiveRecordInterface
* @param Criteria $criteria Optional query object to filter the query
* @param ConnectionInterface $con Optional connection object
*
- * @return ObjectCollection|ChildCategory[] List of ChildCategory objects
+ * @return ObjectCollection|ChildTemplate[] List of ChildTemplate objects
*/
- public function getCategories($criteria = null, ConnectionInterface $con = null)
+ public function getTemplates($criteria = null, ConnectionInterface $con = null)
{
- if (null === $this->collCategories || null !== $criteria) {
- if ($this->isNew() && null === $this->collCategories) {
+ if (null === $this->collTemplates || null !== $criteria) {
+ if ($this->isNew() && null === $this->collTemplates) {
// return empty collection
- $this->initCategories();
+ $this->initTemplates();
} else {
- $collCategories = ChildCategoryQuery::create(null, $criteria)
+ $collTemplates = ChildTemplateQuery::create(null, $criteria)
->filterByFeature($this)
->find($con);
if (null !== $criteria) {
- return $collCategories;
+ return $collTemplates;
}
- $this->collCategories = $collCategories;
+ $this->collTemplates = $collTemplates;
}
}
- return $this->collCategories;
+ return $this->collTemplates;
}
/**
- * Sets a collection of Category objects related by a many-to-many relationship
- * to the current object by way of the feature_category cross-reference table.
+ * Sets a collection of Template objects related by a many-to-many relationship
+ * to the current object by way of the feature_template cross-reference table.
* 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 $categories A Propel collection.
+ * @param Collection $templates A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildFeature The current object (for fluent API support)
*/
- public function setCategories(Collection $categories, ConnectionInterface $con = null)
+ public function setTemplates(Collection $templates, ConnectionInterface $con = null)
{
- $this->clearCategories();
- $currentCategories = $this->getCategories();
+ $this->clearTemplates();
+ $currentTemplates = $this->getTemplates();
- $this->categoriesScheduledForDeletion = $currentCategories->diff($categories);
+ $this->templatesScheduledForDeletion = $currentTemplates->diff($templates);
- foreach ($categories as $category) {
- if (!$currentCategories->contains($category)) {
- $this->doAddCategory($category);
+ foreach ($templates as $template) {
+ if (!$currentTemplates->contains($template)) {
+ $this->doAddTemplate($template);
}
}
- $this->collCategories = $categories;
+ $this->collTemplates = $templates;
return $this;
}
/**
- * Gets the number of ChildCategory objects related by a many-to-many relationship
- * to the current object by way of the feature_category cross-reference table.
+ * Gets the number of ChildTemplate objects related by a many-to-many relationship
+ * to the current object by way of the feature_template cross-reference table.
*
* @param Criteria $criteria Optional query object to filter the query
* @param boolean $distinct Set to true to force count distinct
* @param ConnectionInterface $con Optional connection object
*
- * @return int the number of related ChildCategory objects
+ * @return int the number of related ChildTemplate objects
*/
- public function countCategories($criteria = null, $distinct = false, ConnectionInterface $con = null)
+ public function countTemplates($criteria = null, $distinct = false, ConnectionInterface $con = null)
{
- if (null === $this->collCategories || null !== $criteria) {
- if ($this->isNew() && null === $this->collCategories) {
+ if (null === $this->collTemplates || null !== $criteria) {
+ if ($this->isNew() && null === $this->collTemplates) {
return 0;
} else {
- $query = ChildCategoryQuery::create(null, $criteria);
+ $query = ChildTemplateQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -2506,65 +2506,65 @@ abstract class Feature implements ActiveRecordInterface
->count($con);
}
} else {
- return count($this->collCategories);
+ return count($this->collTemplates);
}
}
/**
- * Associate a ChildCategory object to this object
- * through the feature_category cross reference table.
+ * Associate a ChildTemplate object to this object
+ * through the feature_template cross reference table.
*
- * @param ChildCategory $category The ChildFeatureCategory object to relate
+ * @param ChildTemplate $template The ChildFeatureTemplate object to relate
* @return ChildFeature The current object (for fluent API support)
*/
- public function addCategory(ChildCategory $category)
+ public function addTemplate(ChildTemplate $template)
{
- if ($this->collCategories === null) {
- $this->initCategories();
+ if ($this->collTemplates === null) {
+ $this->initTemplates();
}
- if (!$this->collCategories->contains($category)) { // only add it if the **same** object is not already associated
- $this->doAddCategory($category);
- $this->collCategories[] = $category;
+ if (!$this->collTemplates->contains($template)) { // only add it if the **same** object is not already associated
+ $this->doAddTemplate($template);
+ $this->collTemplates[] = $template;
}
return $this;
}
/**
- * @param Category $category The category object to add.
+ * @param Template $template The template object to add.
*/
- protected function doAddCategory($category)
+ protected function doAddTemplate($template)
{
- $featureCategory = new ChildFeatureCategory();
- $featureCategory->setCategory($category);
- $this->addFeatureCategory($featureCategory);
+ $featureTemplate = new ChildFeatureTemplate();
+ $featureTemplate->setTemplate($template);
+ $this->addFeatureTemplate($featureTemplate);
// set the back reference to this object directly as using provided method either results
// in endless loop or in multiple relations
- if (!$category->getFeatures()->contains($this)) {
- $foreignCollection = $category->getFeatures();
+ if (!$template->getFeatures()->contains($this)) {
+ $foreignCollection = $template->getFeatures();
$foreignCollection[] = $this;
}
}
/**
- * Remove a ChildCategory object to this object
- * through the feature_category cross reference table.
+ * Remove a ChildTemplate object to this object
+ * through the feature_template cross reference table.
*
- * @param ChildCategory $category The ChildFeatureCategory object to relate
+ * @param ChildTemplate $template The ChildFeatureTemplate object to relate
* @return ChildFeature The current object (for fluent API support)
*/
- public function removeCategory(ChildCategory $category)
+ public function removeTemplate(ChildTemplate $template)
{
- if ($this->getCategories()->contains($category)) {
- $this->collCategories->remove($this->collCategories->search($category));
+ if ($this->getTemplates()->contains($template)) {
+ $this->collTemplates->remove($this->collTemplates->search($template));
- if (null === $this->categoriesScheduledForDeletion) {
- $this->categoriesScheduledForDeletion = clone $this->collCategories;
- $this->categoriesScheduledForDeletion->clear();
+ if (null === $this->templatesScheduledForDeletion) {
+ $this->templatesScheduledForDeletion = clone $this->collTemplates;
+ $this->templatesScheduledForDeletion->clear();
}
- $this->categoriesScheduledForDeletion[] = $category;
+ $this->templatesScheduledForDeletion[] = $template;
}
return $this;
@@ -2610,8 +2610,8 @@ abstract class Feature implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
- if ($this->collFeatureCategories) {
- foreach ($this->collFeatureCategories as $o) {
+ if ($this->collFeatureTemplates) {
+ foreach ($this->collFeatureTemplates as $o) {
$o->clearAllReferences($deep);
}
}
@@ -2620,8 +2620,8 @@ abstract class Feature implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
- if ($this->collCategories) {
- foreach ($this->collCategories as $o) {
+ if ($this->collTemplates) {
+ foreach ($this->collTemplates as $o) {
$o->clearAllReferences($deep);
}
}
@@ -2639,18 +2639,18 @@ abstract class Feature implements ActiveRecordInterface
$this->collFeatureProducts->clearIterator();
}
$this->collFeatureProducts = null;
- if ($this->collFeatureCategories instanceof Collection) {
- $this->collFeatureCategories->clearIterator();
+ if ($this->collFeatureTemplates instanceof Collection) {
+ $this->collFeatureTemplates->clearIterator();
}
- $this->collFeatureCategories = null;
+ $this->collFeatureTemplates = null;
if ($this->collFeatureI18ns instanceof Collection) {
$this->collFeatureI18ns->clearIterator();
}
$this->collFeatureI18ns = null;
- if ($this->collCategories instanceof Collection) {
- $this->collCategories->clearIterator();
+ if ($this->collTemplates instanceof Collection) {
+ $this->collTemplates->clearIterator();
}
- $this->collCategories = null;
+ $this->collTemplates = null;
}
/**
diff --git a/core/lib/Thelia/Model/Base/FeatureQuery.php b/core/lib/Thelia/Model/Base/FeatureQuery.php
index 9b00e812e..097646c87 100644
--- a/core/lib/Thelia/Model/Base/FeatureQuery.php
+++ b/core/lib/Thelia/Model/Base/FeatureQuery.php
@@ -46,9 +46,9 @@ use Thelia\Model\Map\FeatureTableMap;
* @method ChildFeatureQuery rightJoinFeatureProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureProduct relation
* @method ChildFeatureQuery innerJoinFeatureProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureProduct relation
*
- * @method ChildFeatureQuery leftJoinFeatureCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureCategory relation
- * @method ChildFeatureQuery rightJoinFeatureCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureCategory relation
- * @method ChildFeatureQuery innerJoinFeatureCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureCategory relation
+ * @method ChildFeatureQuery leftJoinFeatureTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureTemplate relation
+ * @method ChildFeatureQuery rightJoinFeatureTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureTemplate relation
+ * @method ChildFeatureQuery innerJoinFeatureTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureTemplate relation
*
* @method ChildFeatureQuery leftJoinFeatureI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureI18n relation
* @method ChildFeatureQuery rightJoinFeatureI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureI18n relation
@@ -601,40 +601,40 @@ abstract class FeatureQuery extends ModelCriteria
}
/**
- * Filter the query by a related \Thelia\Model\FeatureCategory object
+ * Filter the query by a related \Thelia\Model\FeatureTemplate object
*
- * @param \Thelia\Model\FeatureCategory|ObjectCollection $featureCategory the related object to use as filter
+ * @param \Thelia\Model\FeatureTemplate|ObjectCollection $featureTemplate the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildFeatureQuery The current query, for fluid interface
*/
- public function filterByFeatureCategory($featureCategory, $comparison = null)
+ public function filterByFeatureTemplate($featureTemplate, $comparison = null)
{
- if ($featureCategory instanceof \Thelia\Model\FeatureCategory) {
+ if ($featureTemplate instanceof \Thelia\Model\FeatureTemplate) {
return $this
- ->addUsingAlias(FeatureTableMap::ID, $featureCategory->getFeatureId(), $comparison);
- } elseif ($featureCategory instanceof ObjectCollection) {
+ ->addUsingAlias(FeatureTableMap::ID, $featureTemplate->getFeatureId(), $comparison);
+ } elseif ($featureTemplate instanceof ObjectCollection) {
return $this
- ->useFeatureCategoryQuery()
- ->filterByPrimaryKeys($featureCategory->getPrimaryKeys())
+ ->useFeatureTemplateQuery()
+ ->filterByPrimaryKeys($featureTemplate->getPrimaryKeys())
->endUse();
} else {
- throw new PropelException('filterByFeatureCategory() only accepts arguments of type \Thelia\Model\FeatureCategory or Collection');
+ throw new PropelException('filterByFeatureTemplate() only accepts arguments of type \Thelia\Model\FeatureTemplate or Collection');
}
}
/**
- * Adds a JOIN clause to the query using the FeatureCategory relation
+ * Adds a JOIN clause to the query using the FeatureTemplate relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildFeatureQuery The current query, for fluid interface
*/
- public function joinFeatureCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function joinFeatureTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('FeatureCategory');
+ $relationMap = $tableMap->getRelation('FeatureTemplate');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -649,14 +649,14 @@ abstract class FeatureQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
- $this->addJoinObject($join, 'FeatureCategory');
+ $this->addJoinObject($join, 'FeatureTemplate');
}
return $this;
}
/**
- * Use the FeatureCategory relation FeatureCategory object
+ * Use the FeatureTemplate relation FeatureTemplate object
*
* @see useQuery()
*
@@ -664,13 +664,13 @@ abstract class FeatureQuery 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\FeatureCategoryQuery A secondary query class using the current class as primary query
+ * @return \Thelia\Model\FeatureTemplateQuery A secondary query class using the current class as primary query
*/
- public function useFeatureCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function useFeatureTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
- ->joinFeatureCategory($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'FeatureCategory', '\Thelia\Model\FeatureCategoryQuery');
+ ->joinFeatureTemplate($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'FeatureTemplate', '\Thelia\Model\FeatureTemplateQuery');
}
/**
@@ -747,19 +747,19 @@ abstract class FeatureQuery extends ModelCriteria
}
/**
- * Filter the query by a related Category object
- * using the feature_category table as cross reference
+ * Filter the query by a related Template object
+ * using the feature_template table as cross reference
*
- * @param Category $category the related object to use as filter
+ * @param Template $template the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildFeatureQuery The current query, for fluid interface
*/
- public function filterByCategory($category, $comparison = Criteria::EQUAL)
+ public function filterByTemplate($template, $comparison = Criteria::EQUAL)
{
return $this
- ->useFeatureCategoryQuery()
- ->filterByCategory($category, $comparison)
+ ->useFeatureTemplateQuery()
+ ->filterByTemplate($template, $comparison)
->endUse();
}
diff --git a/core/lib/Thelia/Model/Base/FeatureTemplate.php b/core/lib/Thelia/Model/Base/FeatureTemplate.php
new file mode 100644
index 000000000..bbccd9251
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/FeatureTemplate.php
@@ -0,0 +1,1495 @@
+modifiedColumns);
+ }
+
+ /**
+ * Has specified column been modified?
+ *
+ * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
+ * @return boolean True if $col has been modified.
+ */
+ public function isColumnModified($col)
+ {
+ return in_array($col, $this->modifiedColumns);
+ }
+
+ /**
+ * Get the columns that have been modified in this object.
+ * @return array A unique list of the modified column names for this object.
+ */
+ public function getModifiedColumns()
+ {
+ return array_unique($this->modifiedColumns);
+ }
+
+ /**
+ * Returns whether the object has ever been saved. This will
+ * be false, if the object was retrieved from storage or was created
+ * and then saved.
+ *
+ * @return true, if the object has never been persisted.
+ */
+ public function isNew()
+ {
+ return $this->new;
+ }
+
+ /**
+ * Setter for the isNew attribute. This method will be called
+ * by Propel-generated children and objects.
+ *
+ * @param boolean $b the state of the object.
+ */
+ public function setNew($b)
+ {
+ $this->new = (Boolean) $b;
+ }
+
+ /**
+ * Whether this object has been deleted.
+ * @return boolean The deleted state of this object.
+ */
+ public function isDeleted()
+ {
+ return $this->deleted;
+ }
+
+ /**
+ * Specify whether this object has been deleted.
+ * @param boolean $b The deleted state of this object.
+ * @return void
+ */
+ public function setDeleted($b)
+ {
+ $this->deleted = (Boolean) $b;
+ }
+
+ /**
+ * Sets the modified state for the object to be false.
+ * @param string $col If supplied, only the specified column is reset.
+ * @return void
+ */
+ public function resetModified($col = null)
+ {
+ if (null !== $col) {
+ while (false !== ($offset = array_search($col, $this->modifiedColumns))) {
+ array_splice($this->modifiedColumns, $offset, 1);
+ }
+ } else {
+ $this->modifiedColumns = array();
+ }
+ }
+
+ /**
+ * Compares this with another FeatureTemplate instance. If
+ * obj is an instance of FeatureTemplate, delegates to
+ * equals(FeatureTemplate). Otherwise, returns false.
+ *
+ * @param obj The object to compare to.
+ * @return Whether equal to the object specified.
+ */
+ public function equals($obj)
+ {
+ $thisclazz = get_class($this);
+ if (!is_object($obj) || !($obj instanceof $thisclazz)) {
+ return false;
+ }
+
+ if ($this === $obj) {
+ return true;
+ }
+
+ if (null === $this->getPrimaryKey()
+ || null === $obj->getPrimaryKey()) {
+ return false;
+ }
+
+ return $this->getPrimaryKey() === $obj->getPrimaryKey();
+ }
+
+ /**
+ * If the primary key is not null, return the hashcode of the
+ * primary key. Otherwise, return the hash code of the object.
+ *
+ * @return int Hashcode
+ */
+ public function hashCode()
+ {
+ if (null !== $this->getPrimaryKey()) {
+ return crc32(serialize($this->getPrimaryKey()));
+ }
+
+ return crc32(serialize(clone $this));
+ }
+
+ /**
+ * Get the associative array of the virtual columns in this object
+ *
+ * @param string $name The virtual column name
+ *
+ * @return array
+ */
+ public function getVirtualColumns()
+ {
+ return $this->virtualColumns;
+ }
+
+ /**
+ * Checks the existence of a virtual column in this object
+ *
+ * @return boolean
+ */
+ public function hasVirtualColumn($name)
+ {
+ return array_key_exists($name, $this->virtualColumns);
+ }
+
+ /**
+ * Get the value of a virtual column in this object
+ *
+ * @return mixed
+ */
+ public function getVirtualColumn($name)
+ {
+ if (!$this->hasVirtualColumn($name)) {
+ throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
+ }
+
+ return $this->virtualColumns[$name];
+ }
+
+ /**
+ * Set the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @param mixed $value The value to give to the virtual column
+ *
+ * @return FeatureTemplate The current object, for fluid interface
+ */
+ public function setVirtualColumn($name, $value)
+ {
+ $this->virtualColumns[$name] = $value;
+
+ return $this;
+ }
+
+ /**
+ * Logs a message using Propel::log().
+ *
+ * @param string $msg
+ * @param int $priority One of the Propel::LOG_* logging levels
+ * @return boolean
+ */
+ protected function log($msg, $priority = Propel::LOG_INFO)
+ {
+ return Propel::log(get_class($this) . ': ' . $msg, $priority);
+ }
+
+ /**
+ * Populate the current object from a string, using a given parser format
+ *
+ * $book = new Book();
+ * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance,
+ * or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param string $data The source data to import from
+ *
+ * @return FeatureTemplate The current object, for fluid interface
+ */
+ public function importFrom($parser, $data)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME);
+ }
+
+ /**
+ * Export the current object properties to a string, using a given parser format
+ *
+ * $book = BookQuery::create()->findPk(9012);
+ * echo $book->exportTo('JSON');
+ * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
+ * @return string The exported data
+ */
+ public function exportTo($parser, $includeLazyLoadColumns = true)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
+ }
+
+ /**
+ * Clean up internal collections prior to serializing
+ * Avoids recursive loops that turn into segmentation faults when serializing
+ */
+ public function __sleep()
+ {
+ $this->clearAllReferences();
+
+ return array_keys(get_object_vars($this));
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [feature_id] column value.
+ *
+ * @return int
+ */
+ public function getFeatureId()
+ {
+
+ return $this->feature_id;
+ }
+
+ /**
+ * Get the [template_id] column value.
+ *
+ * @return int
+ */
+ public function getTemplateId()
+ {
+
+ return $this->template_id;
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [created_at] column value.
+ *
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the raw \DateTime object will be returned.
+ *
+ * @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
+ *
+ * @throws PropelException - if unable to parse/validate the date/time value.
+ */
+ public function getCreatedAt($format = NULL)
+ {
+ if ($format === null) {
+ return $this->created_at;
+ } else {
+ return $this->created_at !== null ? $this->created_at->format($format) : null;
+ }
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [updated_at] column value.
+ *
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the raw \DateTime object will be returned.
+ *
+ * @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
+ *
+ * @throws PropelException - if unable to parse/validate the date/time value.
+ */
+ public function getUpdatedAt($format = NULL)
+ {
+ if ($format === null) {
+ return $this->updated_at;
+ } else {
+ return $this->updated_at !== null ? $this->updated_at->format($format) : null;
+ }
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\FeatureTemplate The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = FeatureTemplateTableMap::ID;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [feature_id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\FeatureTemplate The current object (for fluent API support)
+ */
+ public function setFeatureId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->feature_id !== $v) {
+ $this->feature_id = $v;
+ $this->modifiedColumns[] = FeatureTemplateTableMap::FEATURE_ID;
+ }
+
+ if ($this->aFeature !== null && $this->aFeature->getId() !== $v) {
+ $this->aFeature = null;
+ }
+
+
+ return $this;
+ } // setFeatureId()
+
+ /**
+ * Set the value of [template_id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\FeatureTemplate The current object (for fluent API support)
+ */
+ public function setTemplateId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->template_id !== $v) {
+ $this->template_id = $v;
+ $this->modifiedColumns[] = FeatureTemplateTableMap::TEMPLATE_ID;
+ }
+
+ if ($this->aTemplate !== null && $this->aTemplate->getId() !== $v) {
+ $this->aTemplate = null;
+ }
+
+
+ return $this;
+ } // setTemplateId()
+
+ /**
+ * Sets the value of [created_at] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or \DateTime value.
+ * Empty strings are treated as NULL.
+ * @return \Thelia\Model\FeatureTemplate The current object (for fluent API support)
+ */
+ public function setCreatedAt($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, '\DateTime');
+ if ($this->created_at !== null || $dt !== null) {
+ if ($dt !== $this->created_at) {
+ $this->created_at = $dt;
+ $this->modifiedColumns[] = FeatureTemplateTableMap::CREATED_AT;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setCreatedAt()
+
+ /**
+ * Sets the value of [updated_at] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or \DateTime value.
+ * Empty strings are treated as NULL.
+ * @return \Thelia\Model\FeatureTemplate The current object (for fluent API support)
+ */
+ public function setUpdatedAt($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, '\DateTime');
+ if ($this->updated_at !== null || $dt !== null) {
+ if ($dt !== $this->updated_at) {
+ $this->updated_at = $dt;
+ $this->modifiedColumns[] = FeatureTemplateTableMap::UPDATED_AT;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setUpdatedAt()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by DataFetcher->fetch().
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
+ One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ *
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
+ {
+ try {
+
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : FeatureTemplateTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : FeatureTemplateTableMap::translateFieldName('FeatureId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->feature_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : FeatureTemplateTableMap::translateFieldName('TemplateId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->template_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : FeatureTemplateTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ if ($col === '0000-00-00 00:00:00') {
+ $col = null;
+ }
+ $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : FeatureTemplateTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ if ($col === '0000-00-00 00:00:00') {
+ $col = null;
+ }
+ $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 5; // 5 = FeatureTemplateTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \Thelia\Model\FeatureTemplate object", 0, $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+ if ($this->aFeature !== null && $this->feature_id !== $this->aFeature->getId()) {
+ $this->aFeature = null;
+ }
+ if ($this->aTemplate !== null && $this->template_id !== $this->aTemplate->getId()) {
+ $this->aTemplate = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(FeatureTemplateTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildFeatureTemplateQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
+ $row = $dataFetcher->fetch();
+ $dataFetcher->close();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aFeature = null;
+ $this->aTemplate = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see FeatureTemplate::setDeleted()
+ * @see FeatureTemplate::isDeleted()
+ */
+ public function delete(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(FeatureTemplateTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildFeatureTemplateQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(FeatureTemplateTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ // timestampable behavior
+ if (!$this->isColumnModified(FeatureTemplateTableMap::CREATED_AT)) {
+ $this->setCreatedAt(time());
+ }
+ if (!$this->isColumnModified(FeatureTemplateTableMap::UPDATED_AT)) {
+ $this->setUpdatedAt(time());
+ }
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ // timestampable behavior
+ if ($this->isModified() && !$this->isColumnModified(FeatureTemplateTableMap::UPDATED_AT)) {
+ $this->setUpdatedAt(time());
+ }
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ FeatureTemplateTableMap::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(ConnectionInterface $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aFeature !== null) {
+ if ($this->aFeature->isModified() || $this->aFeature->isNew()) {
+ $affectedRows += $this->aFeature->save($con);
+ }
+ $this->setFeature($this->aFeature);
+ }
+
+ if ($this->aTemplate !== null) {
+ if ($this->aTemplate->isModified() || $this->aTemplate->isNew()) {
+ $affectedRows += $this->aTemplate->save($con);
+ }
+ $this->setTemplate($this->aTemplate);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(ConnectionInterface $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = FeatureTemplateTableMap::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . FeatureTemplateTableMap::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(FeatureTemplateTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = 'ID';
+ }
+ if ($this->isColumnModified(FeatureTemplateTableMap::FEATURE_ID)) {
+ $modifiedColumns[':p' . $index++] = 'FEATURE_ID';
+ }
+ if ($this->isColumnModified(FeatureTemplateTableMap::TEMPLATE_ID)) {
+ $modifiedColumns[':p' . $index++] = 'TEMPLATE_ID';
+ }
+ if ($this->isColumnModified(FeatureTemplateTableMap::CREATED_AT)) {
+ $modifiedColumns[':p' . $index++] = 'CREATED_AT';
+ }
+ if ($this->isColumnModified(FeatureTemplateTableMap::UPDATED_AT)) {
+ $modifiedColumns[':p' . $index++] = 'UPDATED_AT';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO feature_template (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case 'ID':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case 'FEATURE_ID':
+ $stmt->bindValue($identifier, $this->feature_id, PDO::PARAM_INT);
+ break;
+ case 'TEMPLATE_ID':
+ $stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT);
+ break;
+ case 'CREATED_AT':
+ $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
+ break;
+ case 'UPDATED_AT':
+ $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
+ }
+
+ try {
+ $pk = $con->lastInsertId();
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get autoincrement id.', 0, $e);
+ }
+ $this->setId($pk);
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @return Integer Number of updated rows
+ * @see doSave()
+ */
+ protected function doUpdate(ConnectionInterface $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+
+ return $selectCriteria->doUpdate($valuesCriteria, $con);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = FeatureTemplateTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getFeatureId();
+ break;
+ case 2:
+ return $this->getTemplateId();
+ break;
+ case 3:
+ return $this->getCreatedAt();
+ break;
+ case 4:
+ return $this->getUpdatedAt();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['FeatureTemplate'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['FeatureTemplate'][$this->getPrimaryKey()] = true;
+ $keys = FeatureTemplateTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getFeatureId(),
+ $keys[2] => $this->getTemplateId(),
+ $keys[3] => $this->getCreatedAt(),
+ $keys[4] => $this->getUpdatedAt(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach($virtualColumns as $key => $virtualColumn)
+ {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aFeature) {
+ $result['Feature'] = $this->aFeature->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->aTemplate) {
+ $result['Template'] = $this->aTemplate->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return void
+ */
+ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = FeatureTemplateTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setFeatureId($value);
+ break;
+ case 2:
+ $this->setTemplateId($value);
+ break;
+ case 3:
+ $this->setCreatedAt($value);
+ break;
+ case 4:
+ $this->setUpdatedAt($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * The default key type is the column's TableMap::TYPE_PHPNAME.
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
+ {
+ $keys = FeatureTemplateTableMap::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setFeatureId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTemplateId($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(FeatureTemplateTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(FeatureTemplateTableMap::ID)) $criteria->add(FeatureTemplateTableMap::ID, $this->id);
+ if ($this->isColumnModified(FeatureTemplateTableMap::FEATURE_ID)) $criteria->add(FeatureTemplateTableMap::FEATURE_ID, $this->feature_id);
+ if ($this->isColumnModified(FeatureTemplateTableMap::TEMPLATE_ID)) $criteria->add(FeatureTemplateTableMap::TEMPLATE_ID, $this->template_id);
+ if ($this->isColumnModified(FeatureTemplateTableMap::CREATED_AT)) $criteria->add(FeatureTemplateTableMap::CREATED_AT, $this->created_at);
+ if ($this->isColumnModified(FeatureTemplateTableMap::UPDATED_AT)) $criteria->add(FeatureTemplateTableMap::UPDATED_AT, $this->updated_at);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(FeatureTemplateTableMap::DATABASE_NAME);
+ $criteria->add(FeatureTemplateTableMap::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return null === $this->getId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of \Thelia\Model\FeatureTemplate (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setFeatureId($this->getFeatureId());
+ $copyObj->setTemplateId($this->getTemplateId());
+ $copyObj->setCreatedAt($this->getCreatedAt());
+ $copyObj->setUpdatedAt($this->getUpdatedAt());
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return \Thelia\Model\FeatureTemplate Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Declares an association between this object and a ChildFeature object.
+ *
+ * @param ChildFeature $v
+ * @return \Thelia\Model\FeatureTemplate The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setFeature(ChildFeature $v = null)
+ {
+ if ($v === null) {
+ $this->setFeatureId(NULL);
+ } else {
+ $this->setFeatureId($v->getId());
+ }
+
+ $this->aFeature = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildFeature object, it will not be re-added.
+ if ($v !== null) {
+ $v->addFeatureTemplate($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildFeature object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildFeature The associated ChildFeature object.
+ * @throws PropelException
+ */
+ public function getFeature(ConnectionInterface $con = null)
+ {
+ if ($this->aFeature === null && ($this->feature_id !== null)) {
+ $this->aFeature = ChildFeatureQuery::create()->findPk($this->feature_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aFeature->addFeatureTemplates($this);
+ */
+ }
+
+ return $this->aFeature;
+ }
+
+ /**
+ * Declares an association between this object and a ChildTemplate object.
+ *
+ * @param ChildTemplate $v
+ * @return \Thelia\Model\FeatureTemplate The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setTemplate(ChildTemplate $v = null)
+ {
+ if ($v === null) {
+ $this->setTemplateId(NULL);
+ } else {
+ $this->setTemplateId($v->getId());
+ }
+
+ $this->aTemplate = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildTemplate object, it will not be re-added.
+ if ($v !== null) {
+ $v->addFeatureTemplate($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildTemplate object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildTemplate The associated ChildTemplate object.
+ * @throws PropelException
+ */
+ public function getTemplate(ConnectionInterface $con = null)
+ {
+ if ($this->aTemplate === null && ($this->template_id !== null)) {
+ $this->aTemplate = ChildTemplateQuery::create()->findPk($this->template_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aTemplate->addFeatureTemplates($this);
+ */
+ }
+
+ return $this->aTemplate;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->feature_id = null;
+ $this->template_id = null;
+ $this->created_at = null;
+ $this->updated_at = null;
+ $this->alreadyInSave = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aFeature = null;
+ $this->aTemplate = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(FeatureTemplateTableMap::DEFAULT_STRING_FORMAT);
+ }
+
+ // timestampable behavior
+
+ /**
+ * Mark the current object so that the update date doesn't get updated during next save
+ *
+ * @return ChildFeatureTemplate The current object (for fluent API support)
+ */
+ public function keepUpdateDateUnchanged()
+ {
+ $this->modifiedColumns[] = FeatureTemplateTableMap::UPDATED_AT;
+
+ return $this;
+ }
+
+ /**
+ * Code to be run before persisting the object
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preSave(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after persisting the object
+ * @param ConnectionInterface $con
+ */
+ public function postSave(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before inserting to database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preInsert(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after inserting to database
+ * @param ConnectionInterface $con
+ */
+ public function postInsert(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before updating the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preUpdate(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after updating the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postUpdate(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before deleting the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preDelete(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after deleting the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postDelete(ConnectionInterface $con = null)
+ {
+
+ }
+
+
+ /**
+ * Derived method to catches calls to undefined methods.
+ *
+ * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
+ * Allows to define default __call() behavior if you overwrite __call()
+ *
+ * @param string $name
+ * @param mixed $params
+ *
+ * @return array|string
+ */
+ public function __call($name, $params)
+ {
+ if (0 === strpos($name, 'get')) {
+ $virtualColumn = substr($name, 3);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+
+ $virtualColumn = lcfirst($virtualColumn);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+
+ if (0 === strpos($name, 'from')) {
+ $format = substr($name, 4);
+
+ return $this->importFrom($format, reset($params));
+ }
+
+ if (0 === strpos($name, 'to')) {
+ $format = substr($name, 2);
+ $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
+
+ return $this->exportTo($format, $includeLazyLoadColumns);
+ }
+
+ throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
+ }
+
+}
diff --git a/core/lib/Thelia/Model/Base/FeatureTemplateQuery.php b/core/lib/Thelia/Model/Base/FeatureTemplateQuery.php
new file mode 100644
index 000000000..c99c1305f
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/FeatureTemplateQuery.php
@@ -0,0 +1,759 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildFeatureTemplate|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = FeatureTemplateTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(FeatureTemplateTableMap::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 ChildFeatureTemplate A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT ID, FEATURE_ID, TEMPLATE_ID, CREATED_AT, UPDATED_AT FROM feature_template 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 ChildFeatureTemplate();
+ $obj->hydrate($row);
+ FeatureTemplateTableMap::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 ChildFeatureTemplate|array|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $dataFetcher = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $dataFetcher = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return ChildFeatureTemplateQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(FeatureTemplateTableMap::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 ChildFeatureTemplateQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(FeatureTemplateTableMap::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildFeatureTemplateQuery 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(FeatureTemplateTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(FeatureTemplateTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(FeatureTemplateTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the feature_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByFeatureId(1234); // WHERE feature_id = 1234
+ * $query->filterByFeatureId(array(12, 34)); // WHERE feature_id IN (12, 34)
+ * $query->filterByFeatureId(array('min' => 12)); // WHERE feature_id > 12
+ *
+ *
+ * @see filterByFeature()
+ *
+ * @param mixed $featureId 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 ChildFeatureTemplateQuery The current query, for fluid interface
+ */
+ public function filterByFeatureId($featureId = null, $comparison = null)
+ {
+ if (is_array($featureId)) {
+ $useMinMax = false;
+ if (isset($featureId['min'])) {
+ $this->addUsingAlias(FeatureTemplateTableMap::FEATURE_ID, $featureId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($featureId['max'])) {
+ $this->addUsingAlias(FeatureTemplateTableMap::FEATURE_ID, $featureId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(FeatureTemplateTableMap::FEATURE_ID, $featureId, $comparison);
+ }
+
+ /**
+ * Filter the query on the template_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByTemplateId(1234); // WHERE template_id = 1234
+ * $query->filterByTemplateId(array(12, 34)); // WHERE template_id IN (12, 34)
+ * $query->filterByTemplateId(array('min' => 12)); // WHERE template_id > 12
+ *
+ *
+ * @see filterByTemplate()
+ *
+ * @param mixed $templateId 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 ChildFeatureTemplateQuery The current query, for fluid interface
+ */
+ public function filterByTemplateId($templateId = null, $comparison = null)
+ {
+ if (is_array($templateId)) {
+ $useMinMax = false;
+ if (isset($templateId['min'])) {
+ $this->addUsingAlias(FeatureTemplateTableMap::TEMPLATE_ID, $templateId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($templateId['max'])) {
+ $this->addUsingAlias(FeatureTemplateTableMap::TEMPLATE_ID, $templateId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(FeatureTemplateTableMap::TEMPLATE_ID, $templateId, $comparison);
+ }
+
+ /**
+ * Filter the query on the created_at column
+ *
+ * Example usage:
+ *
+ * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
+ * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
+ * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
+ *
+ *
+ * @param mixed $createdAt The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildFeatureTemplateQuery 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(FeatureTemplateTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($createdAt['max'])) {
+ $this->addUsingAlias(FeatureTemplateTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(FeatureTemplateTableMap::CREATED_AT, $createdAt, $comparison);
+ }
+
+ /**
+ * Filter the query on the updated_at column
+ *
+ * Example usage:
+ *
+ * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
+ * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
+ * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
+ *
+ *
+ * @param mixed $updatedAt The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildFeatureTemplateQuery 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(FeatureTemplateTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($updatedAt['max'])) {
+ $this->addUsingAlias(FeatureTemplateTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(FeatureTemplateTableMap::UPDATED_AT, $updatedAt, $comparison);
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\Feature object
+ *
+ * @param \Thelia\Model\Feature|ObjectCollection $feature The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildFeatureTemplateQuery The current query, for fluid interface
+ */
+ public function filterByFeature($feature, $comparison = null)
+ {
+ if ($feature instanceof \Thelia\Model\Feature) {
+ return $this
+ ->addUsingAlias(FeatureTemplateTableMap::FEATURE_ID, $feature->getId(), $comparison);
+ } elseif ($feature instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(FeatureTemplateTableMap::FEATURE_ID, $feature->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByFeature() only accepts arguments of type \Thelia\Model\Feature or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Feature relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildFeatureTemplateQuery The current query, for fluid interface
+ */
+ public function joinFeature($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Feature');
+
+ // 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, 'Feature');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Feature relation Feature 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\FeatureQuery A secondary query class using the current class as primary query
+ */
+ public function useFeatureQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinFeature($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Feature', '\Thelia\Model\FeatureQuery');
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\Template object
+ *
+ * @param \Thelia\Model\Template|ObjectCollection $template The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildFeatureTemplateQuery The current query, for fluid interface
+ */
+ public function filterByTemplate($template, $comparison = null)
+ {
+ if ($template instanceof \Thelia\Model\Template) {
+ return $this
+ ->addUsingAlias(FeatureTemplateTableMap::TEMPLATE_ID, $template->getId(), $comparison);
+ } elseif ($template instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(FeatureTemplateTableMap::TEMPLATE_ID, $template->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByTemplate() only accepts arguments of type \Thelia\Model\Template or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Template relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildFeatureTemplateQuery The current query, for fluid interface
+ */
+ public function joinTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Template');
+
+ // 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, 'Template');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Template relation Template 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\TemplateQuery A secondary query class using the current class as primary query
+ */
+ public function useTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinTemplate($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Template', '\Thelia\Model\TemplateQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildFeatureTemplate $featureTemplate Object to remove from the list of results
+ *
+ * @return ChildFeatureTemplateQuery The current query, for fluid interface
+ */
+ public function prune($featureTemplate = null)
+ {
+ if ($featureTemplate) {
+ $this->addUsingAlias(FeatureTemplateTableMap::ID, $featureTemplate->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the feature_template 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(FeatureTemplateTableMap::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).
+ FeatureTemplateTableMap::clearInstancePool();
+ FeatureTemplateTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildFeatureTemplate or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildFeatureTemplate 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(FeatureTemplateTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(FeatureTemplateTableMap::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();
+
+
+ FeatureTemplateTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ FeatureTemplateTableMap::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 ChildFeatureTemplateQuery The current query, for fluid interface
+ */
+ public function recentlyUpdated($nbDays = 7)
+ {
+ return $this->addUsingAlias(FeatureTemplateTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ }
+
+ /**
+ * Filter by the latest created
+ *
+ * @param int $nbDays Maximum age of in days
+ *
+ * @return ChildFeatureTemplateQuery The current query, for fluid interface
+ */
+ public function recentlyCreated($nbDays = 7)
+ {
+ return $this->addUsingAlias(FeatureTemplateTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ }
+
+ /**
+ * Order by update date desc
+ *
+ * @return ChildFeatureTemplateQuery The current query, for fluid interface
+ */
+ public function lastUpdatedFirst()
+ {
+ return $this->addDescendingOrderByColumn(FeatureTemplateTableMap::UPDATED_AT);
+ }
+
+ /**
+ * Order by update date asc
+ *
+ * @return ChildFeatureTemplateQuery The current query, for fluid interface
+ */
+ public function firstUpdatedFirst()
+ {
+ return $this->addAscendingOrderByColumn(FeatureTemplateTableMap::UPDATED_AT);
+ }
+
+ /**
+ * Order by create date desc
+ *
+ * @return ChildFeatureTemplateQuery The current query, for fluid interface
+ */
+ public function lastCreatedFirst()
+ {
+ return $this->addDescendingOrderByColumn(FeatureTemplateTableMap::CREATED_AT);
+ }
+
+ /**
+ * Order by create date asc
+ *
+ * @return ChildFeatureTemplateQuery The current query, for fluid interface
+ */
+ public function firstCreatedFirst()
+ {
+ return $this->addAscendingOrderByColumn(FeatureTemplateTableMap::CREATED_AT);
+ }
+
+} // FeatureTemplateQuery
diff --git a/core/lib/Thelia/Model/Base/Product.php b/core/lib/Thelia/Model/Base/Product.php
index f7457d47b..9ec203fec 100644
--- a/core/lib/Thelia/Model/Base/Product.php
+++ b/core/lib/Thelia/Model/Base/Product.php
@@ -43,6 +43,8 @@ use Thelia\Model\ProductVersion as ChildProductVersion;
use Thelia\Model\ProductVersionQuery as ChildProductVersionQuery;
use Thelia\Model\TaxRule as ChildTaxRule;
use Thelia\Model\TaxRuleQuery as ChildTaxRuleQuery;
+use Thelia\Model\Template as ChildTemplate;
+use Thelia\Model\TemplateQuery as ChildTemplateQuery;
use Thelia\Model\Map\ProductTableMap;
use Thelia\Model\Map\ProductVersionTableMap;
@@ -111,6 +113,12 @@ abstract class Product implements ActiveRecordInterface
*/
protected $position;
+ /**
+ * The value for the template_id field.
+ * @var int
+ */
+ protected $template_id;
+
/**
* The value for the created_at field.
* @var string
@@ -147,6 +155,11 @@ abstract class Product implements ActiveRecordInterface
*/
protected $aTaxRule;
+ /**
+ * @var Template
+ */
+ protected $aTemplate;
+
/**
* @var ObjectCollection|ChildProductCategory[] Collection to store aggregation of ChildProductCategory objects.
*/
@@ -665,6 +678,17 @@ abstract class Product implements ActiveRecordInterface
return $this->position;
}
+ /**
+ * Get the [template_id] column value.
+ *
+ * @return int
+ */
+ public function getTemplateId()
+ {
+
+ return $this->template_id;
+ }
+
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -856,6 +880,31 @@ abstract class Product implements ActiveRecordInterface
return $this;
} // setPosition()
+ /**
+ * Set the value of [template_id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\Product The current object (for fluent API support)
+ */
+ public function setTemplateId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->template_id !== $v) {
+ $this->template_id = $v;
+ $this->modifiedColumns[] = ProductTableMap::TEMPLATE_ID;
+ }
+
+ if ($this->aTemplate !== null && $this->aTemplate->getId() !== $v) {
+ $this->aTemplate = null;
+ }
+
+
+ return $this;
+ } // setTemplateId()
+
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -1021,28 +1070,31 @@ abstract class Product implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
$this->position = (null !== $col) ? (int) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductTableMap::translateFieldName('TemplateId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->template_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
$this->version = (null !== $col) ? (int) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : ProductTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
$this->version_created_by = (null !== $col) ? (string) $col : null;
$this->resetModified();
@@ -1052,7 +1104,7 @@ abstract class Product implements ActiveRecordInterface
$this->ensureConsistency();
}
- return $startcol + 10; // 10 = ProductTableMap::NUM_HYDRATE_COLUMNS.
+ return $startcol + 11; // 11 = ProductTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Product object", 0, $e);
@@ -1077,6 +1129,9 @@ abstract class Product implements ActiveRecordInterface
if ($this->aTaxRule !== null && $this->tax_rule_id !== $this->aTaxRule->getId()) {
$this->aTaxRule = null;
}
+ if ($this->aTemplate !== null && $this->template_id !== $this->aTemplate->getId()) {
+ $this->aTemplate = null;
+ }
} // ensureConsistency
/**
@@ -1117,6 +1172,7 @@ abstract class Product implements ActiveRecordInterface
if ($deep) { // also de-associate any related objects?
$this->aTaxRule = null;
+ $this->aTemplate = null;
$this->collProductCategories = null;
$this->collFeatureProducts = null;
@@ -1288,6 +1344,13 @@ abstract class Product implements ActiveRecordInterface
$this->setTaxRule($this->aTaxRule);
}
+ if ($this->aTemplate !== null) {
+ if ($this->aTemplate->isModified() || $this->aTemplate->isNew()) {
+ $affectedRows += $this->aTemplate->save($con);
+ }
+ $this->setTemplate($this->aTemplate);
+ }
+
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
@@ -1608,6 +1671,9 @@ abstract class Product implements ActiveRecordInterface
if ($this->isColumnModified(ProductTableMap::POSITION)) {
$modifiedColumns[':p' . $index++] = 'POSITION';
}
+ if ($this->isColumnModified(ProductTableMap::TEMPLATE_ID)) {
+ $modifiedColumns[':p' . $index++] = 'TEMPLATE_ID';
+ }
if ($this->isColumnModified(ProductTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -1649,6 +1715,9 @@ abstract class Product implements ActiveRecordInterface
case 'POSITION':
$stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
break;
+ case 'TEMPLATE_ID':
+ $stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT);
+ break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
@@ -1742,18 +1811,21 @@ abstract class Product implements ActiveRecordInterface
return $this->getPosition();
break;
case 5:
- return $this->getCreatedAt();
+ return $this->getTemplateId();
break;
case 6:
- return $this->getUpdatedAt();
+ return $this->getCreatedAt();
break;
case 7:
- return $this->getVersion();
+ return $this->getUpdatedAt();
break;
case 8:
- return $this->getVersionCreatedAt();
+ return $this->getVersion();
break;
case 9:
+ return $this->getVersionCreatedAt();
+ break;
+ case 10:
return $this->getVersionCreatedBy();
break;
default:
@@ -1790,11 +1862,12 @@ abstract class Product implements ActiveRecordInterface
$keys[2] => $this->getRef(),
$keys[3] => $this->getVisible(),
$keys[4] => $this->getPosition(),
- $keys[5] => $this->getCreatedAt(),
- $keys[6] => $this->getUpdatedAt(),
- $keys[7] => $this->getVersion(),
- $keys[8] => $this->getVersionCreatedAt(),
- $keys[9] => $this->getVersionCreatedBy(),
+ $keys[5] => $this->getTemplateId(),
+ $keys[6] => $this->getCreatedAt(),
+ $keys[7] => $this->getUpdatedAt(),
+ $keys[8] => $this->getVersion(),
+ $keys[9] => $this->getVersionCreatedAt(),
+ $keys[10] => $this->getVersionCreatedBy(),
);
$virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn)
@@ -1806,6 +1879,9 @@ abstract class Product implements ActiveRecordInterface
if (null !== $this->aTaxRule) {
$result['TaxRule'] = $this->aTaxRule->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
+ if (null !== $this->aTemplate) {
+ $result['Template'] = $this->aTemplate->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
if (null !== $this->collProductCategories) {
$result['ProductCategories'] = $this->collProductCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
@@ -1889,18 +1965,21 @@ abstract class Product implements ActiveRecordInterface
$this->setPosition($value);
break;
case 5:
- $this->setCreatedAt($value);
+ $this->setTemplateId($value);
break;
case 6:
- $this->setUpdatedAt($value);
+ $this->setCreatedAt($value);
break;
case 7:
- $this->setVersion($value);
+ $this->setUpdatedAt($value);
break;
case 8:
- $this->setVersionCreatedAt($value);
+ $this->setVersion($value);
break;
case 9:
+ $this->setVersionCreatedAt($value);
+ break;
+ case 10:
$this->setVersionCreatedBy($value);
break;
} // switch()
@@ -1932,11 +2011,12 @@ abstract class Product implements ActiveRecordInterface
if (array_key_exists($keys[2], $arr)) $this->setRef($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setVisible($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
- if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
- if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
- if (array_key_exists($keys[7], $arr)) $this->setVersion($arr[$keys[7]]);
- if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedAt($arr[$keys[8]]);
- if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedBy($arr[$keys[9]]);
+ if (array_key_exists($keys[5], $arr)) $this->setTemplateId($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setVersion($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedAt($arr[$keys[9]]);
+ if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedBy($arr[$keys[10]]);
}
/**
@@ -1953,6 +2033,7 @@ abstract class Product implements ActiveRecordInterface
if ($this->isColumnModified(ProductTableMap::REF)) $criteria->add(ProductTableMap::REF, $this->ref);
if ($this->isColumnModified(ProductTableMap::VISIBLE)) $criteria->add(ProductTableMap::VISIBLE, $this->visible);
if ($this->isColumnModified(ProductTableMap::POSITION)) $criteria->add(ProductTableMap::POSITION, $this->position);
+ if ($this->isColumnModified(ProductTableMap::TEMPLATE_ID)) $criteria->add(ProductTableMap::TEMPLATE_ID, $this->template_id);
if ($this->isColumnModified(ProductTableMap::CREATED_AT)) $criteria->add(ProductTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(ProductTableMap::UPDATED_AT)) $criteria->add(ProductTableMap::UPDATED_AT, $this->updated_at);
if ($this->isColumnModified(ProductTableMap::VERSION)) $criteria->add(ProductTableMap::VERSION, $this->version);
@@ -2025,6 +2106,7 @@ abstract class Product implements ActiveRecordInterface
$copyObj->setRef($this->getRef());
$copyObj->setVisible($this->getVisible());
$copyObj->setPosition($this->getPosition());
+ $copyObj->setTemplateId($this->getTemplateId());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
$copyObj->setVersion($this->getVersion());
@@ -2183,6 +2265,57 @@ abstract class Product implements ActiveRecordInterface
return $this->aTaxRule;
}
+ /**
+ * Declares an association between this object and a ChildTemplate object.
+ *
+ * @param ChildTemplate $v
+ * @return \Thelia\Model\Product The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setTemplate(ChildTemplate $v = null)
+ {
+ if ($v === null) {
+ $this->setTemplateId(NULL);
+ } else {
+ $this->setTemplateId($v->getId());
+ }
+
+ $this->aTemplate = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildTemplate object, it will not be re-added.
+ if ($v !== null) {
+ $v->addProduct($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildTemplate object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildTemplate The associated ChildTemplate object.
+ * @throws PropelException
+ */
+ public function getTemplate(ConnectionInterface $con = null)
+ {
+ if ($this->aTemplate === null && ($this->template_id !== null)) {
+ $this->aTemplate = ChildTemplateQuery::create()->findPk($this->template_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aTemplate->addProducts($this);
+ */
+ }
+
+ return $this->aTemplate;
+ }
+
/**
* Initializes a collection based on the name of a relation.
@@ -5349,6 +5482,7 @@ abstract class Product implements ActiveRecordInterface
$this->ref = null;
$this->visible = null;
$this->position = null;
+ $this->template_id = null;
$this->created_at = null;
$this->updated_at = null;
$this->version = null;
@@ -5507,6 +5641,7 @@ abstract class Product implements ActiveRecordInterface
}
$this->collProductsRelatedByProductId = null;
$this->aTaxRule = null;
+ $this->aTemplate = null;
}
/**
@@ -5781,6 +5916,7 @@ abstract class Product implements ActiveRecordInterface
$version->setRef($this->getRef());
$version->setVisible($this->getVisible());
$version->setPosition($this->getPosition());
+ $version->setTemplateId($this->getTemplateId());
$version->setCreatedAt($this->getCreatedAt());
$version->setUpdatedAt($this->getUpdatedAt());
$version->setVersion($this->getVersion());
@@ -5828,6 +5964,7 @@ abstract class Product implements ActiveRecordInterface
$this->setRef($version->getRef());
$this->setVisible($version->getVisible());
$this->setPosition($version->getPosition());
+ $this->setTemplateId($version->getTemplateId());
$this->setCreatedAt($version->getCreatedAt());
$this->setUpdatedAt($version->getUpdatedAt());
$this->setVersion($version->getVersion());
diff --git a/core/lib/Thelia/Model/Base/ProductQuery.php b/core/lib/Thelia/Model/Base/ProductQuery.php
index 75f05dfcf..9b1710f03 100644
--- a/core/lib/Thelia/Model/Base/ProductQuery.php
+++ b/core/lib/Thelia/Model/Base/ProductQuery.php
@@ -27,6 +27,7 @@ use Thelia\Model\Map\ProductTableMap;
* @method ChildProductQuery orderByRef($order = Criteria::ASC) Order by the ref column
* @method ChildProductQuery orderByVisible($order = Criteria::ASC) Order by the visible column
* @method ChildProductQuery orderByPosition($order = Criteria::ASC) Order by the position column
+ * @method ChildProductQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column
* @method ChildProductQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildProductQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* @method ChildProductQuery orderByVersion($order = Criteria::ASC) Order by the version column
@@ -38,6 +39,7 @@ use Thelia\Model\Map\ProductTableMap;
* @method ChildProductQuery groupByRef() Group by the ref column
* @method ChildProductQuery groupByVisible() Group by the visible column
* @method ChildProductQuery groupByPosition() Group by the position column
+ * @method ChildProductQuery groupByTemplateId() Group by the template_id column
* @method ChildProductQuery groupByCreatedAt() Group by the created_at column
* @method ChildProductQuery groupByUpdatedAt() Group by the updated_at column
* @method ChildProductQuery groupByVersion() Group by the version column
@@ -52,6 +54,10 @@ use Thelia\Model\Map\ProductTableMap;
* @method ChildProductQuery rightJoinTaxRule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TaxRule relation
* @method ChildProductQuery innerJoinTaxRule($relationAlias = null) Adds a INNER JOIN clause to the query using the TaxRule relation
*
+ * @method ChildProductQuery leftJoinTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the Template relation
+ * @method ChildProductQuery rightJoinTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Template relation
+ * @method ChildProductQuery innerJoinTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the Template relation
+ *
* @method ChildProductQuery leftJoinProductCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductCategory relation
* @method ChildProductQuery rightJoinProductCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductCategory relation
* @method ChildProductQuery innerJoinProductCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductCategory relation
@@ -104,6 +110,7 @@ use Thelia\Model\Map\ProductTableMap;
* @method ChildProduct findOneByRef(string $ref) Return the first ChildProduct filtered by the ref column
* @method ChildProduct findOneByVisible(int $visible) Return the first ChildProduct filtered by the visible column
* @method ChildProduct findOneByPosition(int $position) Return the first ChildProduct filtered by the position column
+ * @method ChildProduct findOneByTemplateId(int $template_id) Return the first ChildProduct filtered by the template_id column
* @method ChildProduct findOneByCreatedAt(string $created_at) Return the first ChildProduct filtered by the created_at column
* @method ChildProduct findOneByUpdatedAt(string $updated_at) Return the first ChildProduct filtered by the updated_at column
* @method ChildProduct findOneByVersion(int $version) Return the first ChildProduct filtered by the version column
@@ -115,6 +122,7 @@ use Thelia\Model\Map\ProductTableMap;
* @method array findByRef(string $ref) Return ChildProduct objects filtered by the ref column
* @method array findByVisible(int $visible) Return ChildProduct objects filtered by the visible column
* @method array findByPosition(int $position) Return ChildProduct objects filtered by the position column
+ * @method array findByTemplateId(int $template_id) Return ChildProduct objects filtered by the template_id column
* @method array findByCreatedAt(string $created_at) Return ChildProduct objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildProduct objects filtered by the updated_at column
* @method array findByVersion(int $version) Return ChildProduct objects filtered by the version column
@@ -215,7 +223,7 @@ abstract class ProductQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
- $sql = 'SELECT ID, TAX_RULE_ID, REF, VISIBLE, POSITION, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM product WHERE ID = :p0';
+ $sql = 'SELECT ID, TAX_RULE_ID, REF, VISIBLE, POSITION, TEMPLATE_ID, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM product WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -499,6 +507,49 @@ abstract class ProductQuery extends ModelCriteria
return $this->addUsingAlias(ProductTableMap::POSITION, $position, $comparison);
}
+ /**
+ * Filter the query on the template_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByTemplateId(1234); // WHERE template_id = 1234
+ * $query->filterByTemplateId(array(12, 34)); // WHERE template_id IN (12, 34)
+ * $query->filterByTemplateId(array('min' => 12)); // WHERE template_id > 12
+ *
+ *
+ * @see filterByTemplate()
+ *
+ * @param mixed $templateId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildProductQuery The current query, for fluid interface
+ */
+ public function filterByTemplateId($templateId = null, $comparison = null)
+ {
+ if (is_array($templateId)) {
+ $useMinMax = false;
+ if (isset($templateId['min'])) {
+ $this->addUsingAlias(ProductTableMap::TEMPLATE_ID, $templateId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($templateId['max'])) {
+ $this->addUsingAlias(ProductTableMap::TEMPLATE_ID, $templateId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ProductTableMap::TEMPLATE_ID, $templateId, $comparison);
+ }
+
/**
* Filter the query on the created_at column
*
@@ -773,6 +824,81 @@ abstract class ProductQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'TaxRule', '\Thelia\Model\TaxRuleQuery');
}
+ /**
+ * Filter the query by a related \Thelia\Model\Template object
+ *
+ * @param \Thelia\Model\Template|ObjectCollection $template The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildProductQuery The current query, for fluid interface
+ */
+ public function filterByTemplate($template, $comparison = null)
+ {
+ if ($template instanceof \Thelia\Model\Template) {
+ return $this
+ ->addUsingAlias(ProductTableMap::TEMPLATE_ID, $template->getId(), $comparison);
+ } elseif ($template instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ProductTableMap::TEMPLATE_ID, $template->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByTemplate() only accepts arguments of type \Thelia\Model\Template or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Template 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 joinTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Template');
+
+ // 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, 'Template');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Template relation Template 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\TemplateQuery A secondary query class using the current class as primary query
+ */
+ public function useTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinTemplate($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Template', '\Thelia\Model\TemplateQuery');
+ }
+
/**
* Filter the query by a related \Thelia\Model\ProductCategory object
*
diff --git a/core/lib/Thelia/Model/Base/ProductVersion.php b/core/lib/Thelia/Model/Base/ProductVersion.php
index 071dfc742..a5d22e498 100644
--- a/core/lib/Thelia/Model/Base/ProductVersion.php
+++ b/core/lib/Thelia/Model/Base/ProductVersion.php
@@ -86,6 +86,12 @@ abstract class ProductVersion implements ActiveRecordInterface
*/
protected $position;
+ /**
+ * The value for the template_id field.
+ * @var int
+ */
+ protected $template_id;
+
/**
* The value for the created_at field.
* @var string
@@ -453,6 +459,17 @@ abstract class ProductVersion implements ActiveRecordInterface
return $this->position;
}
+ /**
+ * Get the [template_id] column value.
+ *
+ * @return int
+ */
+ public function getTemplateId()
+ {
+
+ return $this->template_id;
+ }
+
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -644,6 +661,27 @@ abstract class ProductVersion implements ActiveRecordInterface
return $this;
} // setPosition()
+ /**
+ * Set the value of [template_id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\ProductVersion The current object (for fluent API support)
+ */
+ public function setTemplateId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->template_id !== $v) {
+ $this->template_id = $v;
+ $this->modifiedColumns[] = ProductVersionTableMap::TEMPLATE_ID;
+ }
+
+
+ return $this;
+ } // setTemplateId()
+
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -809,28 +847,31 @@ abstract class ProductVersion implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductVersionTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
$this->position = (null !== $col) ? (int) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductVersionTableMap::translateFieldName('TemplateId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->template_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
$this->version = (null !== $col) ? (int) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
$this->version_created_by = (null !== $col) ? (string) $col : null;
$this->resetModified();
@@ -840,7 +881,7 @@ abstract class ProductVersion implements ActiveRecordInterface
$this->ensureConsistency();
}
- return $startcol + 10; // 10 = ProductVersionTableMap::NUM_HYDRATE_COLUMNS.
+ return $startcol + 11; // 11 = ProductVersionTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ProductVersion object", 0, $e);
@@ -1076,6 +1117,9 @@ abstract class ProductVersion implements ActiveRecordInterface
if ($this->isColumnModified(ProductVersionTableMap::POSITION)) {
$modifiedColumns[':p' . $index++] = 'POSITION';
}
+ if ($this->isColumnModified(ProductVersionTableMap::TEMPLATE_ID)) {
+ $modifiedColumns[':p' . $index++] = 'TEMPLATE_ID';
+ }
if ($this->isColumnModified(ProductVersionTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -1117,6 +1161,9 @@ abstract class ProductVersion implements ActiveRecordInterface
case 'POSITION':
$stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
break;
+ case 'TEMPLATE_ID':
+ $stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT);
+ break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
@@ -1203,18 +1250,21 @@ abstract class ProductVersion implements ActiveRecordInterface
return $this->getPosition();
break;
case 5:
- return $this->getCreatedAt();
+ return $this->getTemplateId();
break;
case 6:
- return $this->getUpdatedAt();
+ return $this->getCreatedAt();
break;
case 7:
- return $this->getVersion();
+ return $this->getUpdatedAt();
break;
case 8:
- return $this->getVersionCreatedAt();
+ return $this->getVersion();
break;
case 9:
+ return $this->getVersionCreatedAt();
+ break;
+ case 10:
return $this->getVersionCreatedBy();
break;
default:
@@ -1251,11 +1301,12 @@ abstract class ProductVersion implements ActiveRecordInterface
$keys[2] => $this->getRef(),
$keys[3] => $this->getVisible(),
$keys[4] => $this->getPosition(),
- $keys[5] => $this->getCreatedAt(),
- $keys[6] => $this->getUpdatedAt(),
- $keys[7] => $this->getVersion(),
- $keys[8] => $this->getVersionCreatedAt(),
- $keys[9] => $this->getVersionCreatedBy(),
+ $keys[5] => $this->getTemplateId(),
+ $keys[6] => $this->getCreatedAt(),
+ $keys[7] => $this->getUpdatedAt(),
+ $keys[8] => $this->getVersion(),
+ $keys[9] => $this->getVersionCreatedAt(),
+ $keys[10] => $this->getVersionCreatedBy(),
);
$virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn)
@@ -1317,18 +1368,21 @@ abstract class ProductVersion implements ActiveRecordInterface
$this->setPosition($value);
break;
case 5:
- $this->setCreatedAt($value);
+ $this->setTemplateId($value);
break;
case 6:
- $this->setUpdatedAt($value);
+ $this->setCreatedAt($value);
break;
case 7:
- $this->setVersion($value);
+ $this->setUpdatedAt($value);
break;
case 8:
- $this->setVersionCreatedAt($value);
+ $this->setVersion($value);
break;
case 9:
+ $this->setVersionCreatedAt($value);
+ break;
+ case 10:
$this->setVersionCreatedBy($value);
break;
} // switch()
@@ -1360,11 +1414,12 @@ abstract class ProductVersion implements ActiveRecordInterface
if (array_key_exists($keys[2], $arr)) $this->setRef($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setVisible($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
- if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
- if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
- if (array_key_exists($keys[7], $arr)) $this->setVersion($arr[$keys[7]]);
- if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedAt($arr[$keys[8]]);
- if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedBy($arr[$keys[9]]);
+ if (array_key_exists($keys[5], $arr)) $this->setTemplateId($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setVersion($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedAt($arr[$keys[9]]);
+ if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedBy($arr[$keys[10]]);
}
/**
@@ -1381,6 +1436,7 @@ abstract class ProductVersion implements ActiveRecordInterface
if ($this->isColumnModified(ProductVersionTableMap::REF)) $criteria->add(ProductVersionTableMap::REF, $this->ref);
if ($this->isColumnModified(ProductVersionTableMap::VISIBLE)) $criteria->add(ProductVersionTableMap::VISIBLE, $this->visible);
if ($this->isColumnModified(ProductVersionTableMap::POSITION)) $criteria->add(ProductVersionTableMap::POSITION, $this->position);
+ if ($this->isColumnModified(ProductVersionTableMap::TEMPLATE_ID)) $criteria->add(ProductVersionTableMap::TEMPLATE_ID, $this->template_id);
if ($this->isColumnModified(ProductVersionTableMap::CREATED_AT)) $criteria->add(ProductVersionTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(ProductVersionTableMap::UPDATED_AT)) $criteria->add(ProductVersionTableMap::UPDATED_AT, $this->updated_at);
if ($this->isColumnModified(ProductVersionTableMap::VERSION)) $criteria->add(ProductVersionTableMap::VERSION, $this->version);
@@ -1461,6 +1517,7 @@ abstract class ProductVersion implements ActiveRecordInterface
$copyObj->setRef($this->getRef());
$copyObj->setVisible($this->getVisible());
$copyObj->setPosition($this->getPosition());
+ $copyObj->setTemplateId($this->getTemplateId());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
$copyObj->setVersion($this->getVersion());
@@ -1554,6 +1611,7 @@ abstract class ProductVersion implements ActiveRecordInterface
$this->ref = null;
$this->visible = null;
$this->position = null;
+ $this->template_id = null;
$this->created_at = null;
$this->updated_at = null;
$this->version = null;
diff --git a/core/lib/Thelia/Model/Base/ProductVersionQuery.php b/core/lib/Thelia/Model/Base/ProductVersionQuery.php
index 1b43f7e66..b659becb9 100644
--- a/core/lib/Thelia/Model/Base/ProductVersionQuery.php
+++ b/core/lib/Thelia/Model/Base/ProductVersionQuery.php
@@ -26,6 +26,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
* @method ChildProductVersionQuery orderByRef($order = Criteria::ASC) Order by the ref column
* @method ChildProductVersionQuery orderByVisible($order = Criteria::ASC) Order by the visible column
* @method ChildProductVersionQuery orderByPosition($order = Criteria::ASC) Order by the position column
+ * @method ChildProductVersionQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column
* @method ChildProductVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildProductVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* @method ChildProductVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
@@ -37,6 +38,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
* @method ChildProductVersionQuery groupByRef() Group by the ref column
* @method ChildProductVersionQuery groupByVisible() Group by the visible column
* @method ChildProductVersionQuery groupByPosition() Group by the position column
+ * @method ChildProductVersionQuery groupByTemplateId() Group by the template_id column
* @method ChildProductVersionQuery groupByCreatedAt() Group by the created_at column
* @method ChildProductVersionQuery groupByUpdatedAt() Group by the updated_at column
* @method ChildProductVersionQuery groupByVersion() Group by the version column
@@ -59,6 +61,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
* @method ChildProductVersion findOneByRef(string $ref) Return the first ChildProductVersion filtered by the ref column
* @method ChildProductVersion findOneByVisible(int $visible) Return the first ChildProductVersion filtered by the visible column
* @method ChildProductVersion findOneByPosition(int $position) Return the first ChildProductVersion filtered by the position column
+ * @method ChildProductVersion findOneByTemplateId(int $template_id) Return the first ChildProductVersion filtered by the template_id column
* @method ChildProductVersion findOneByCreatedAt(string $created_at) Return the first ChildProductVersion filtered by the created_at column
* @method ChildProductVersion findOneByUpdatedAt(string $updated_at) Return the first ChildProductVersion filtered by the updated_at column
* @method ChildProductVersion findOneByVersion(int $version) Return the first ChildProductVersion filtered by the version column
@@ -70,6 +73,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
* @method array findByRef(string $ref) Return ChildProductVersion objects filtered by the ref column
* @method array findByVisible(int $visible) Return ChildProductVersion objects filtered by the visible column
* @method array findByPosition(int $position) Return ChildProductVersion objects filtered by the position column
+ * @method array findByTemplateId(int $template_id) Return ChildProductVersion objects filtered by the template_id column
* @method array findByCreatedAt(string $created_at) Return ChildProductVersion objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildProductVersion objects filtered by the updated_at column
* @method array findByVersion(int $version) Return ChildProductVersion objects filtered by the version column
@@ -163,7 +167,7 @@ abstract class ProductVersionQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
- $sql = 'SELECT ID, TAX_RULE_ID, REF, VISIBLE, POSITION, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM product_version WHERE ID = :p0 AND VERSION = :p1';
+ $sql = 'SELECT ID, TAX_RULE_ID, REF, VISIBLE, POSITION, TEMPLATE_ID, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM product_version WHERE ID = :p0 AND VERSION = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -459,6 +463,47 @@ abstract class ProductVersionQuery extends ModelCriteria
return $this->addUsingAlias(ProductVersionTableMap::POSITION, $position, $comparison);
}
+ /**
+ * Filter the query on the template_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByTemplateId(1234); // WHERE template_id = 1234
+ * $query->filterByTemplateId(array(12, 34)); // WHERE template_id IN (12, 34)
+ * $query->filterByTemplateId(array('min' => 12)); // WHERE template_id > 12
+ *
+ *
+ * @param mixed $templateId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildProductVersionQuery The current query, for fluid interface
+ */
+ public function filterByTemplateId($templateId = null, $comparison = null)
+ {
+ if (is_array($templateId)) {
+ $useMinMax = false;
+ if (isset($templateId['min'])) {
+ $this->addUsingAlias(ProductVersionTableMap::TEMPLATE_ID, $templateId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($templateId['max'])) {
+ $this->addUsingAlias(ProductVersionTableMap::TEMPLATE_ID, $templateId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ProductVersionTableMap::TEMPLATE_ID, $templateId, $comparison);
+ }
+
/**
* Filter the query on the created_at column
*
diff --git a/core/lib/Thelia/Model/Base/TaxRule.php b/core/lib/Thelia/Model/Base/TaxRule.php
index 61f21d4e1..9edb7b2fc 100644
--- a/core/lib/Thelia/Model/Base/TaxRule.php
+++ b/core/lib/Thelia/Model/Base/TaxRule.php
@@ -1434,6 +1434,31 @@ abstract class TaxRule implements ActiveRecordInterface
return $this;
}
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this TaxRule is new, it will return
+ * an empty collection; or if this TaxRule has previously
+ * been saved, it will retrieve related Products from storage.
+ *
+ * This method is protected by default in order to keep the public
+ * api reasonable. You can provide public methods for those you
+ * actually need in TaxRule.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return Collection|ChildProduct[] List of ChildProduct objects
+ */
+ public function getProductsJoinTemplate($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ {
+ $query = ChildProductQuery::create(null, $criteria);
+ $query->joinWith('Template', $joinBehavior);
+
+ return $this->getProducts($query, $con);
+ }
+
/**
* Clears out the collTaxRuleCountries collection
*
diff --git a/core/lib/Thelia/Model/Base/Template.php b/core/lib/Thelia/Model/Base/Template.php
new file mode 100644
index 000000000..77efa7ba0
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/Template.php
@@ -0,0 +1,3019 @@
+modifiedColumns);
+ }
+
+ /**
+ * Has specified column been modified?
+ *
+ * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
+ * @return boolean True if $col has been modified.
+ */
+ public function isColumnModified($col)
+ {
+ return in_array($col, $this->modifiedColumns);
+ }
+
+ /**
+ * Get the columns that have been modified in this object.
+ * @return array A unique list of the modified column names for this object.
+ */
+ public function getModifiedColumns()
+ {
+ return array_unique($this->modifiedColumns);
+ }
+
+ /**
+ * Returns whether the object has ever been saved. This will
+ * be false, if the object was retrieved from storage or was created
+ * and then saved.
+ *
+ * @return true, if the object has never been persisted.
+ */
+ public function isNew()
+ {
+ return $this->new;
+ }
+
+ /**
+ * Setter for the isNew attribute. This method will be called
+ * by Propel-generated children and objects.
+ *
+ * @param boolean $b the state of the object.
+ */
+ public function setNew($b)
+ {
+ $this->new = (Boolean) $b;
+ }
+
+ /**
+ * Whether this object has been deleted.
+ * @return boolean The deleted state of this object.
+ */
+ public function isDeleted()
+ {
+ return $this->deleted;
+ }
+
+ /**
+ * Specify whether this object has been deleted.
+ * @param boolean $b The deleted state of this object.
+ * @return void
+ */
+ public function setDeleted($b)
+ {
+ $this->deleted = (Boolean) $b;
+ }
+
+ /**
+ * Sets the modified state for the object to be false.
+ * @param string $col If supplied, only the specified column is reset.
+ * @return void
+ */
+ public function resetModified($col = null)
+ {
+ if (null !== $col) {
+ while (false !== ($offset = array_search($col, $this->modifiedColumns))) {
+ array_splice($this->modifiedColumns, $offset, 1);
+ }
+ } else {
+ $this->modifiedColumns = array();
+ }
+ }
+
+ /**
+ * Compares this with another Template instance. If
+ * obj is an instance of Template, delegates to
+ * equals(Template). Otherwise, returns false.
+ *
+ * @param obj The object to compare to.
+ * @return Whether equal to the object specified.
+ */
+ public function equals($obj)
+ {
+ $thisclazz = get_class($this);
+ if (!is_object($obj) || !($obj instanceof $thisclazz)) {
+ return false;
+ }
+
+ if ($this === $obj) {
+ return true;
+ }
+
+ if (null === $this->getPrimaryKey()
+ || null === $obj->getPrimaryKey()) {
+ return false;
+ }
+
+ return $this->getPrimaryKey() === $obj->getPrimaryKey();
+ }
+
+ /**
+ * If the primary key is not null, return the hashcode of the
+ * primary key. Otherwise, return the hash code of the object.
+ *
+ * @return int Hashcode
+ */
+ public function hashCode()
+ {
+ if (null !== $this->getPrimaryKey()) {
+ return crc32(serialize($this->getPrimaryKey()));
+ }
+
+ return crc32(serialize(clone $this));
+ }
+
+ /**
+ * Get the associative array of the virtual columns in this object
+ *
+ * @param string $name The virtual column name
+ *
+ * @return array
+ */
+ public function getVirtualColumns()
+ {
+ return $this->virtualColumns;
+ }
+
+ /**
+ * Checks the existence of a virtual column in this object
+ *
+ * @return boolean
+ */
+ public function hasVirtualColumn($name)
+ {
+ return array_key_exists($name, $this->virtualColumns);
+ }
+
+ /**
+ * Get the value of a virtual column in this object
+ *
+ * @return mixed
+ */
+ public function getVirtualColumn($name)
+ {
+ if (!$this->hasVirtualColumn($name)) {
+ throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
+ }
+
+ return $this->virtualColumns[$name];
+ }
+
+ /**
+ * Set the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @param mixed $value The value to give to the virtual column
+ *
+ * @return Template The current object, for fluid interface
+ */
+ public function setVirtualColumn($name, $value)
+ {
+ $this->virtualColumns[$name] = $value;
+
+ return $this;
+ }
+
+ /**
+ * Logs a message using Propel::log().
+ *
+ * @param string $msg
+ * @param int $priority One of the Propel::LOG_* logging levels
+ * @return boolean
+ */
+ protected function log($msg, $priority = Propel::LOG_INFO)
+ {
+ return Propel::log(get_class($this) . ': ' . $msg, $priority);
+ }
+
+ /**
+ * Populate the current object from a string, using a given parser format
+ *
+ * $book = new Book();
+ * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance,
+ * or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param string $data The source data to import from
+ *
+ * @return Template The current object, for fluid interface
+ */
+ public function importFrom($parser, $data)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME);
+ }
+
+ /**
+ * Export the current object properties to a string, using a given parser format
+ *
+ * $book = BookQuery::create()->findPk(9012);
+ * echo $book->exportTo('JSON');
+ * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
+ * @return string The exported data
+ */
+ public function exportTo($parser, $includeLazyLoadColumns = true)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
+ }
+
+ /**
+ * Clean up internal collections prior to serializing
+ * Avoids recursive loops that turn into segmentation faults when serializing
+ */
+ public function __sleep()
+ {
+ $this->clearAllReferences();
+
+ return array_keys(get_object_vars($this));
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [created_at] column value.
+ *
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the raw \DateTime object will be returned.
+ *
+ * @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
+ *
+ * @throws PropelException - if unable to parse/validate the date/time value.
+ */
+ public function getCreatedAt($format = NULL)
+ {
+ if ($format === null) {
+ return $this->created_at;
+ } else {
+ return $this->created_at !== null ? $this->created_at->format($format) : null;
+ }
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [updated_at] column value.
+ *
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the raw \DateTime object will be returned.
+ *
+ * @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
+ *
+ * @throws PropelException - if unable to parse/validate the date/time value.
+ */
+ public function getUpdatedAt($format = NULL)
+ {
+ if ($format === null) {
+ return $this->updated_at;
+ } else {
+ return $this->updated_at !== null ? $this->updated_at->format($format) : null;
+ }
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\Template The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = TemplateTableMap::ID;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Sets the value of [created_at] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or \DateTime value.
+ * Empty strings are treated as NULL.
+ * @return \Thelia\Model\Template The current object (for fluent API support)
+ */
+ public function setCreatedAt($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, '\DateTime');
+ if ($this->created_at !== null || $dt !== null) {
+ if ($dt !== $this->created_at) {
+ $this->created_at = $dt;
+ $this->modifiedColumns[] = TemplateTableMap::CREATED_AT;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setCreatedAt()
+
+ /**
+ * Sets the value of [updated_at] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or \DateTime value.
+ * Empty strings are treated as NULL.
+ * @return \Thelia\Model\Template The current object (for fluent API support)
+ */
+ public function setUpdatedAt($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, '\DateTime');
+ if ($this->updated_at !== null || $dt !== null) {
+ if ($dt !== $this->updated_at) {
+ $this->updated_at = $dt;
+ $this->modifiedColumns[] = TemplateTableMap::UPDATED_AT;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setUpdatedAt()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by DataFetcher->fetch().
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
+ One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ *
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
+ {
+ try {
+
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : TemplateTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : TemplateTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ if ($col === '0000-00-00 00:00:00') {
+ $col = null;
+ }
+ $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : TemplateTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ if ($col === '0000-00-00 00:00:00') {
+ $col = null;
+ }
+ $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 3; // 3 = TemplateTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \Thelia\Model\Template object", 0, $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(TemplateTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildTemplateQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
+ $row = $dataFetcher->fetch();
+ $dataFetcher->close();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->collProducts = null;
+
+ $this->collFeatureTemplates = null;
+
+ $this->collAttributeTemplates = null;
+
+ $this->collTemplateI18ns = null;
+
+ $this->collFeatures = null;
+ $this->collAttributes = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see Template::setDeleted()
+ * @see Template::isDeleted()
+ */
+ public function delete(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(TemplateTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildTemplateQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(TemplateTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ // timestampable behavior
+ if (!$this->isColumnModified(TemplateTableMap::CREATED_AT)) {
+ $this->setCreatedAt(time());
+ }
+ if (!$this->isColumnModified(TemplateTableMap::UPDATED_AT)) {
+ $this->setUpdatedAt(time());
+ }
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ // timestampable behavior
+ if ($this->isModified() && !$this->isColumnModified(TemplateTableMap::UPDATED_AT)) {
+ $this->setUpdatedAt(time());
+ }
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ TemplateTableMap::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(ConnectionInterface $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->featuresScheduledForDeletion !== null) {
+ if (!$this->featuresScheduledForDeletion->isEmpty()) {
+ $pks = array();
+ $pk = $this->getPrimaryKey();
+ foreach ($this->featuresScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
+ $pks[] = array($remotePk, $pk);
+ }
+
+ FeatureTemplateQuery::create()
+ ->filterByPrimaryKeys($pks)
+ ->delete($con);
+ $this->featuresScheduledForDeletion = null;
+ }
+
+ foreach ($this->getFeatures() as $feature) {
+ if ($feature->isModified()) {
+ $feature->save($con);
+ }
+ }
+ } elseif ($this->collFeatures) {
+ foreach ($this->collFeatures as $feature) {
+ if ($feature->isModified()) {
+ $feature->save($con);
+ }
+ }
+ }
+
+ if ($this->attributesScheduledForDeletion !== null) {
+ if (!$this->attributesScheduledForDeletion->isEmpty()) {
+ $pks = array();
+ $pk = $this->getPrimaryKey();
+ foreach ($this->attributesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
+ $pks[] = array($remotePk, $pk);
+ }
+
+ AttributeTemplateQuery::create()
+ ->filterByPrimaryKeys($pks)
+ ->delete($con);
+ $this->attributesScheduledForDeletion = null;
+ }
+
+ foreach ($this->getAttributes() as $attribute) {
+ if ($attribute->isModified()) {
+ $attribute->save($con);
+ }
+ }
+ } elseif ($this->collAttributes) {
+ foreach ($this->collAttributes as $attribute) {
+ if ($attribute->isModified()) {
+ $attribute->save($con);
+ }
+ }
+ }
+
+ if ($this->productsScheduledForDeletion !== null) {
+ if (!$this->productsScheduledForDeletion->isEmpty()) {
+ \Thelia\Model\ProductQuery::create()
+ ->filterByPrimaryKeys($this->productsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->productsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collProducts !== null) {
+ foreach ($this->collProducts as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->featureTemplatesScheduledForDeletion !== null) {
+ if (!$this->featureTemplatesScheduledForDeletion->isEmpty()) {
+ \Thelia\Model\FeatureTemplateQuery::create()
+ ->filterByPrimaryKeys($this->featureTemplatesScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->featureTemplatesScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collFeatureTemplates !== null) {
+ foreach ($this->collFeatureTemplates as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->attributeTemplatesScheduledForDeletion !== null) {
+ if (!$this->attributeTemplatesScheduledForDeletion->isEmpty()) {
+ \Thelia\Model\AttributeTemplateQuery::create()
+ ->filterByPrimaryKeys($this->attributeTemplatesScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->attributeTemplatesScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collAttributeTemplates !== null) {
+ foreach ($this->collAttributeTemplates as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->templateI18nsScheduledForDeletion !== null) {
+ if (!$this->templateI18nsScheduledForDeletion->isEmpty()) {
+ \Thelia\Model\TemplateI18nQuery::create()
+ ->filterByPrimaryKeys($this->templateI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->templateI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collTemplateI18ns !== null) {
+ foreach ($this->collTemplateI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(ConnectionInterface $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = TemplateTableMap::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . TemplateTableMap::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(TemplateTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = 'ID';
+ }
+ if ($this->isColumnModified(TemplateTableMap::CREATED_AT)) {
+ $modifiedColumns[':p' . $index++] = 'CREATED_AT';
+ }
+ if ($this->isColumnModified(TemplateTableMap::UPDATED_AT)) {
+ $modifiedColumns[':p' . $index++] = 'UPDATED_AT';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO template (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case 'ID':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case 'CREATED_AT':
+ $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
+ break;
+ case 'UPDATED_AT':
+ $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
+ }
+
+ try {
+ $pk = $con->lastInsertId();
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get autoincrement id.', 0, $e);
+ }
+ $this->setId($pk);
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @return Integer Number of updated rows
+ * @see doSave()
+ */
+ protected function doUpdate(ConnectionInterface $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+
+ return $selectCriteria->doUpdate($valuesCriteria, $con);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = TemplateTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getCreatedAt();
+ break;
+ case 2:
+ return $this->getUpdatedAt();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['Template'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['Template'][$this->getPrimaryKey()] = true;
+ $keys = TemplateTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getCreatedAt(),
+ $keys[2] => $this->getUpdatedAt(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach($virtualColumns as $key => $virtualColumn)
+ {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->collProducts) {
+ $result['Products'] = $this->collProducts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collFeatureTemplates) {
+ $result['FeatureTemplates'] = $this->collFeatureTemplates->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collAttributeTemplates) {
+ $result['AttributeTemplates'] = $this->collAttributeTemplates->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collTemplateI18ns) {
+ $result['TemplateI18ns'] = $this->collTemplateI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return void
+ */
+ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = TemplateTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setCreatedAt($value);
+ break;
+ case 2:
+ $this->setUpdatedAt($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * The default key type is the column's TableMap::TYPE_PHPNAME.
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
+ {
+ $keys = TemplateTableMap::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setCreatedAt($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setUpdatedAt($arr[$keys[2]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(TemplateTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(TemplateTableMap::ID)) $criteria->add(TemplateTableMap::ID, $this->id);
+ if ($this->isColumnModified(TemplateTableMap::CREATED_AT)) $criteria->add(TemplateTableMap::CREATED_AT, $this->created_at);
+ if ($this->isColumnModified(TemplateTableMap::UPDATED_AT)) $criteria->add(TemplateTableMap::UPDATED_AT, $this->updated_at);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(TemplateTableMap::DATABASE_NAME);
+ $criteria->add(TemplateTableMap::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return null === $this->getId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of \Thelia\Model\Template (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setCreatedAt($this->getCreatedAt());
+ $copyObj->setUpdatedAt($this->getUpdatedAt());
+
+ if ($deepCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+
+ foreach ($this->getProducts() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addProduct($relObj->copy($deepCopy));
+ }
+ }
+
+ foreach ($this->getFeatureTemplates() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addFeatureTemplate($relObj->copy($deepCopy));
+ }
+ }
+
+ foreach ($this->getAttributeTemplates() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addAttributeTemplate($relObj->copy($deepCopy));
+ }
+ }
+
+ foreach ($this->getTemplateI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addTemplateI18n($relObj->copy($deepCopy));
+ }
+ }
+
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return \Thelia\Model\Template Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('Product' == $relationName) {
+ return $this->initProducts();
+ }
+ if ('FeatureTemplate' == $relationName) {
+ return $this->initFeatureTemplates();
+ }
+ if ('AttributeTemplate' == $relationName) {
+ return $this->initAttributeTemplates();
+ }
+ if ('TemplateI18n' == $relationName) {
+ return $this->initTemplateI18ns();
+ }
+ }
+
+ /**
+ * Clears out the collProducts collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addProducts()
+ */
+ public function clearProducts()
+ {
+ $this->collProducts = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Reset is the collProducts collection loaded partially.
+ */
+ public function resetPartialProducts($v = true)
+ {
+ $this->collProductsPartial = $v;
+ }
+
+ /**
+ * Initializes the collProducts collection.
+ *
+ * By default this just sets the collProducts collection to an empty array (like clearcollProducts());
+ * however, you may wish to override this method in your stub class to provide setting appropriate
+ * to your application -- for example, setting the initial array to the values stored in database.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initProducts($overrideExisting = true)
+ {
+ if (null !== $this->collProducts && !$overrideExisting) {
+ return;
+ }
+ $this->collProducts = new ObjectCollection();
+ $this->collProducts->setModel('\Thelia\Model\Product');
+ }
+
+ /**
+ * Gets an array of ChildProduct objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this ChildTemplate is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @return Collection|ChildProduct[] List of ChildProduct objects
+ * @throws PropelException
+ */
+ public function getProducts($criteria = null, ConnectionInterface $con = null)
+ {
+ $partial = $this->collProductsPartial && !$this->isNew();
+ if (null === $this->collProducts || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collProducts) {
+ // return empty collection
+ $this->initProducts();
+ } else {
+ $collProducts = ChildProductQuery::create(null, $criteria)
+ ->filterByTemplate($this)
+ ->find($con);
+
+ if (null !== $criteria) {
+ if (false !== $this->collProductsPartial && count($collProducts)) {
+ $this->initProducts(false);
+
+ foreach ($collProducts as $obj) {
+ if (false == $this->collProducts->contains($obj)) {
+ $this->collProducts->append($obj);
+ }
+ }
+
+ $this->collProductsPartial = true;
+ }
+
+ $collProducts->getInternalIterator()->rewind();
+
+ return $collProducts;
+ }
+
+ if ($partial && $this->collProducts) {
+ foreach ($this->collProducts as $obj) {
+ if ($obj->isNew()) {
+ $collProducts[] = $obj;
+ }
+ }
+ }
+
+ $this->collProducts = $collProducts;
+ $this->collProductsPartial = false;
+ }
+ }
+
+ return $this->collProducts;
+ }
+
+ /**
+ * Sets a collection of Product objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param Collection $products A Propel collection.
+ * @param ConnectionInterface $con Optional connection object
+ * @return ChildTemplate The current object (for fluent API support)
+ */
+ public function setProducts(Collection $products, ConnectionInterface $con = null)
+ {
+ $productsToDelete = $this->getProducts(new Criteria(), $con)->diff($products);
+
+
+ $this->productsScheduledForDeletion = $productsToDelete;
+
+ foreach ($productsToDelete as $productRemoved) {
+ $productRemoved->setTemplate(null);
+ }
+
+ $this->collProducts = null;
+ foreach ($products as $product) {
+ $this->addProduct($product);
+ }
+
+ $this->collProducts = $products;
+ $this->collProductsPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related Product objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param ConnectionInterface $con
+ * @return int Count of related Product objects.
+ * @throws PropelException
+ */
+ public function countProducts(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
+ {
+ $partial = $this->collProductsPartial && !$this->isNew();
+ if (null === $this->collProducts || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collProducts) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getProducts());
+ }
+
+ $query = ChildProductQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByTemplate($this)
+ ->count($con);
+ }
+
+ return count($this->collProducts);
+ }
+
+ /**
+ * Method called to associate a ChildProduct object to this object
+ * through the ChildProduct foreign key attribute.
+ *
+ * @param ChildProduct $l ChildProduct
+ * @return \Thelia\Model\Template The current object (for fluent API support)
+ */
+ public function addProduct(ChildProduct $l)
+ {
+ if ($this->collProducts === null) {
+ $this->initProducts();
+ $this->collProductsPartial = true;
+ }
+
+ if (!in_array($l, $this->collProducts->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddProduct($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param Product $product The product object to add.
+ */
+ protected function doAddProduct($product)
+ {
+ $this->collProducts[]= $product;
+ $product->setTemplate($this);
+ }
+
+ /**
+ * @param Product $product The product object to remove.
+ * @return ChildTemplate The current object (for fluent API support)
+ */
+ public function removeProduct($product)
+ {
+ if ($this->getProducts()->contains($product)) {
+ $this->collProducts->remove($this->collProducts->search($product));
+ if (null === $this->productsScheduledForDeletion) {
+ $this->productsScheduledForDeletion = clone $this->collProducts;
+ $this->productsScheduledForDeletion->clear();
+ }
+ $this->productsScheduledForDeletion[]= clone $product;
+ $product->setTemplate(null);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this Template is new, it will return
+ * an empty collection; or if this Template has previously
+ * been saved, it will retrieve related Products from storage.
+ *
+ * This method is protected by default in order to keep the public
+ * api reasonable. You can provide public methods for those you
+ * actually need in Template.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return Collection|ChildProduct[] List of ChildProduct objects
+ */
+ public function getProductsJoinTaxRule($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ {
+ $query = ChildProductQuery::create(null, $criteria);
+ $query->joinWith('TaxRule', $joinBehavior);
+
+ return $this->getProducts($query, $con);
+ }
+
+ /**
+ * Clears out the collFeatureTemplates 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 addFeatureTemplates()
+ */
+ public function clearFeatureTemplates()
+ {
+ $this->collFeatureTemplates = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Reset is the collFeatureTemplates collection loaded partially.
+ */
+ public function resetPartialFeatureTemplates($v = true)
+ {
+ $this->collFeatureTemplatesPartial = $v;
+ }
+
+ /**
+ * Initializes the collFeatureTemplates collection.
+ *
+ * By default this just sets the collFeatureTemplates collection to an empty array (like clearcollFeatureTemplates());
+ * 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 initFeatureTemplates($overrideExisting = true)
+ {
+ if (null !== $this->collFeatureTemplates && !$overrideExisting) {
+ return;
+ }
+ $this->collFeatureTemplates = new ObjectCollection();
+ $this->collFeatureTemplates->setModel('\Thelia\Model\FeatureTemplate');
+ }
+
+ /**
+ * Gets an array of ChildFeatureTemplate 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 ChildTemplate 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|ChildFeatureTemplate[] List of ChildFeatureTemplate objects
+ * @throws PropelException
+ */
+ public function getFeatureTemplates($criteria = null, ConnectionInterface $con = null)
+ {
+ $partial = $this->collFeatureTemplatesPartial && !$this->isNew();
+ if (null === $this->collFeatureTemplates || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collFeatureTemplates) {
+ // return empty collection
+ $this->initFeatureTemplates();
+ } else {
+ $collFeatureTemplates = ChildFeatureTemplateQuery::create(null, $criteria)
+ ->filterByTemplate($this)
+ ->find($con);
+
+ if (null !== $criteria) {
+ if (false !== $this->collFeatureTemplatesPartial && count($collFeatureTemplates)) {
+ $this->initFeatureTemplates(false);
+
+ foreach ($collFeatureTemplates as $obj) {
+ if (false == $this->collFeatureTemplates->contains($obj)) {
+ $this->collFeatureTemplates->append($obj);
+ }
+ }
+
+ $this->collFeatureTemplatesPartial = true;
+ }
+
+ $collFeatureTemplates->getInternalIterator()->rewind();
+
+ return $collFeatureTemplates;
+ }
+
+ if ($partial && $this->collFeatureTemplates) {
+ foreach ($this->collFeatureTemplates as $obj) {
+ if ($obj->isNew()) {
+ $collFeatureTemplates[] = $obj;
+ }
+ }
+ }
+
+ $this->collFeatureTemplates = $collFeatureTemplates;
+ $this->collFeatureTemplatesPartial = false;
+ }
+ }
+
+ return $this->collFeatureTemplates;
+ }
+
+ /**
+ * Sets a collection of FeatureTemplate 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 $featureTemplates A Propel collection.
+ * @param ConnectionInterface $con Optional connection object
+ * @return ChildTemplate The current object (for fluent API support)
+ */
+ public function setFeatureTemplates(Collection $featureTemplates, ConnectionInterface $con = null)
+ {
+ $featureTemplatesToDelete = $this->getFeatureTemplates(new Criteria(), $con)->diff($featureTemplates);
+
+
+ $this->featureTemplatesScheduledForDeletion = $featureTemplatesToDelete;
+
+ foreach ($featureTemplatesToDelete as $featureTemplateRemoved) {
+ $featureTemplateRemoved->setTemplate(null);
+ }
+
+ $this->collFeatureTemplates = null;
+ foreach ($featureTemplates as $featureTemplate) {
+ $this->addFeatureTemplate($featureTemplate);
+ }
+
+ $this->collFeatureTemplates = $featureTemplates;
+ $this->collFeatureTemplatesPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related FeatureTemplate objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param ConnectionInterface $con
+ * @return int Count of related FeatureTemplate objects.
+ * @throws PropelException
+ */
+ public function countFeatureTemplates(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
+ {
+ $partial = $this->collFeatureTemplatesPartial && !$this->isNew();
+ if (null === $this->collFeatureTemplates || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collFeatureTemplates) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getFeatureTemplates());
+ }
+
+ $query = ChildFeatureTemplateQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByTemplate($this)
+ ->count($con);
+ }
+
+ return count($this->collFeatureTemplates);
+ }
+
+ /**
+ * Method called to associate a ChildFeatureTemplate object to this object
+ * through the ChildFeatureTemplate foreign key attribute.
+ *
+ * @param ChildFeatureTemplate $l ChildFeatureTemplate
+ * @return \Thelia\Model\Template The current object (for fluent API support)
+ */
+ public function addFeatureTemplate(ChildFeatureTemplate $l)
+ {
+ if ($this->collFeatureTemplates === null) {
+ $this->initFeatureTemplates();
+ $this->collFeatureTemplatesPartial = true;
+ }
+
+ if (!in_array($l, $this->collFeatureTemplates->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddFeatureTemplate($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param FeatureTemplate $featureTemplate The featureTemplate object to add.
+ */
+ protected function doAddFeatureTemplate($featureTemplate)
+ {
+ $this->collFeatureTemplates[]= $featureTemplate;
+ $featureTemplate->setTemplate($this);
+ }
+
+ /**
+ * @param FeatureTemplate $featureTemplate The featureTemplate object to remove.
+ * @return ChildTemplate The current object (for fluent API support)
+ */
+ public function removeFeatureTemplate($featureTemplate)
+ {
+ if ($this->getFeatureTemplates()->contains($featureTemplate)) {
+ $this->collFeatureTemplates->remove($this->collFeatureTemplates->search($featureTemplate));
+ if (null === $this->featureTemplatesScheduledForDeletion) {
+ $this->featureTemplatesScheduledForDeletion = clone $this->collFeatureTemplates;
+ $this->featureTemplatesScheduledForDeletion->clear();
+ }
+ $this->featureTemplatesScheduledForDeletion[]= clone $featureTemplate;
+ $featureTemplate->setTemplate(null);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this Template is new, it will return
+ * an empty collection; or if this Template has previously
+ * been saved, it will retrieve related FeatureTemplates from storage.
+ *
+ * This method is protected by default in order to keep the public
+ * api reasonable. You can provide public methods for those you
+ * actually need in Template.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return Collection|ChildFeatureTemplate[] List of ChildFeatureTemplate objects
+ */
+ public function getFeatureTemplatesJoinFeature($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ {
+ $query = ChildFeatureTemplateQuery::create(null, $criteria);
+ $query->joinWith('Feature', $joinBehavior);
+
+ return $this->getFeatureTemplates($query, $con);
+ }
+
+ /**
+ * Clears out the collAttributeTemplates 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 addAttributeTemplates()
+ */
+ public function clearAttributeTemplates()
+ {
+ $this->collAttributeTemplates = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Reset is the collAttributeTemplates collection loaded partially.
+ */
+ public function resetPartialAttributeTemplates($v = true)
+ {
+ $this->collAttributeTemplatesPartial = $v;
+ }
+
+ /**
+ * Initializes the collAttributeTemplates collection.
+ *
+ * By default this just sets the collAttributeTemplates collection to an empty array (like clearcollAttributeTemplates());
+ * 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 initAttributeTemplates($overrideExisting = true)
+ {
+ if (null !== $this->collAttributeTemplates && !$overrideExisting) {
+ return;
+ }
+ $this->collAttributeTemplates = new ObjectCollection();
+ $this->collAttributeTemplates->setModel('\Thelia\Model\AttributeTemplate');
+ }
+
+ /**
+ * Gets an array of ChildAttributeTemplate 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 ChildTemplate 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|ChildAttributeTemplate[] List of ChildAttributeTemplate objects
+ * @throws PropelException
+ */
+ public function getAttributeTemplates($criteria = null, ConnectionInterface $con = null)
+ {
+ $partial = $this->collAttributeTemplatesPartial && !$this->isNew();
+ if (null === $this->collAttributeTemplates || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collAttributeTemplates) {
+ // return empty collection
+ $this->initAttributeTemplates();
+ } else {
+ $collAttributeTemplates = ChildAttributeTemplateQuery::create(null, $criteria)
+ ->filterByTemplate($this)
+ ->find($con);
+
+ if (null !== $criteria) {
+ if (false !== $this->collAttributeTemplatesPartial && count($collAttributeTemplates)) {
+ $this->initAttributeTemplates(false);
+
+ foreach ($collAttributeTemplates as $obj) {
+ if (false == $this->collAttributeTemplates->contains($obj)) {
+ $this->collAttributeTemplates->append($obj);
+ }
+ }
+
+ $this->collAttributeTemplatesPartial = true;
+ }
+
+ $collAttributeTemplates->getInternalIterator()->rewind();
+
+ return $collAttributeTemplates;
+ }
+
+ if ($partial && $this->collAttributeTemplates) {
+ foreach ($this->collAttributeTemplates as $obj) {
+ if ($obj->isNew()) {
+ $collAttributeTemplates[] = $obj;
+ }
+ }
+ }
+
+ $this->collAttributeTemplates = $collAttributeTemplates;
+ $this->collAttributeTemplatesPartial = false;
+ }
+ }
+
+ return $this->collAttributeTemplates;
+ }
+
+ /**
+ * Sets a collection of AttributeTemplate 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 $attributeTemplates A Propel collection.
+ * @param ConnectionInterface $con Optional connection object
+ * @return ChildTemplate The current object (for fluent API support)
+ */
+ public function setAttributeTemplates(Collection $attributeTemplates, ConnectionInterface $con = null)
+ {
+ $attributeTemplatesToDelete = $this->getAttributeTemplates(new Criteria(), $con)->diff($attributeTemplates);
+
+
+ $this->attributeTemplatesScheduledForDeletion = $attributeTemplatesToDelete;
+
+ foreach ($attributeTemplatesToDelete as $attributeTemplateRemoved) {
+ $attributeTemplateRemoved->setTemplate(null);
+ }
+
+ $this->collAttributeTemplates = null;
+ foreach ($attributeTemplates as $attributeTemplate) {
+ $this->addAttributeTemplate($attributeTemplate);
+ }
+
+ $this->collAttributeTemplates = $attributeTemplates;
+ $this->collAttributeTemplatesPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related AttributeTemplate objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param ConnectionInterface $con
+ * @return int Count of related AttributeTemplate objects.
+ * @throws PropelException
+ */
+ public function countAttributeTemplates(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
+ {
+ $partial = $this->collAttributeTemplatesPartial && !$this->isNew();
+ if (null === $this->collAttributeTemplates || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collAttributeTemplates) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getAttributeTemplates());
+ }
+
+ $query = ChildAttributeTemplateQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByTemplate($this)
+ ->count($con);
+ }
+
+ return count($this->collAttributeTemplates);
+ }
+
+ /**
+ * Method called to associate a ChildAttributeTemplate object to this object
+ * through the ChildAttributeTemplate foreign key attribute.
+ *
+ * @param ChildAttributeTemplate $l ChildAttributeTemplate
+ * @return \Thelia\Model\Template The current object (for fluent API support)
+ */
+ public function addAttributeTemplate(ChildAttributeTemplate $l)
+ {
+ if ($this->collAttributeTemplates === null) {
+ $this->initAttributeTemplates();
+ $this->collAttributeTemplatesPartial = true;
+ }
+
+ if (!in_array($l, $this->collAttributeTemplates->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddAttributeTemplate($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param AttributeTemplate $attributeTemplate The attributeTemplate object to add.
+ */
+ protected function doAddAttributeTemplate($attributeTemplate)
+ {
+ $this->collAttributeTemplates[]= $attributeTemplate;
+ $attributeTemplate->setTemplate($this);
+ }
+
+ /**
+ * @param AttributeTemplate $attributeTemplate The attributeTemplate object to remove.
+ * @return ChildTemplate The current object (for fluent API support)
+ */
+ public function removeAttributeTemplate($attributeTemplate)
+ {
+ if ($this->getAttributeTemplates()->contains($attributeTemplate)) {
+ $this->collAttributeTemplates->remove($this->collAttributeTemplates->search($attributeTemplate));
+ if (null === $this->attributeTemplatesScheduledForDeletion) {
+ $this->attributeTemplatesScheduledForDeletion = clone $this->collAttributeTemplates;
+ $this->attributeTemplatesScheduledForDeletion->clear();
+ }
+ $this->attributeTemplatesScheduledForDeletion[]= clone $attributeTemplate;
+ $attributeTemplate->setTemplate(null);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this Template is new, it will return
+ * an empty collection; or if this Template has previously
+ * been saved, it will retrieve related AttributeTemplates from storage.
+ *
+ * This method is protected by default in order to keep the public
+ * api reasonable. You can provide public methods for those you
+ * actually need in Template.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return Collection|ChildAttributeTemplate[] List of ChildAttributeTemplate objects
+ */
+ public function getAttributeTemplatesJoinAttribute($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ {
+ $query = ChildAttributeTemplateQuery::create(null, $criteria);
+ $query->joinWith('Attribute', $joinBehavior);
+
+ return $this->getAttributeTemplates($query, $con);
+ }
+
+ /**
+ * Clears out the collTemplateI18ns 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 addTemplateI18ns()
+ */
+ public function clearTemplateI18ns()
+ {
+ $this->collTemplateI18ns = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Reset is the collTemplateI18ns collection loaded partially.
+ */
+ public function resetPartialTemplateI18ns($v = true)
+ {
+ $this->collTemplateI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collTemplateI18ns collection.
+ *
+ * By default this just sets the collTemplateI18ns collection to an empty array (like clearcollTemplateI18ns());
+ * 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 initTemplateI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collTemplateI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collTemplateI18ns = new ObjectCollection();
+ $this->collTemplateI18ns->setModel('\Thelia\Model\TemplateI18n');
+ }
+
+ /**
+ * Gets an array of ChildTemplateI18n 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 ChildTemplate 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|ChildTemplateI18n[] List of ChildTemplateI18n objects
+ * @throws PropelException
+ */
+ public function getTemplateI18ns($criteria = null, ConnectionInterface $con = null)
+ {
+ $partial = $this->collTemplateI18nsPartial && !$this->isNew();
+ if (null === $this->collTemplateI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collTemplateI18ns) {
+ // return empty collection
+ $this->initTemplateI18ns();
+ } else {
+ $collTemplateI18ns = ChildTemplateI18nQuery::create(null, $criteria)
+ ->filterByTemplate($this)
+ ->find($con);
+
+ if (null !== $criteria) {
+ if (false !== $this->collTemplateI18nsPartial && count($collTemplateI18ns)) {
+ $this->initTemplateI18ns(false);
+
+ foreach ($collTemplateI18ns as $obj) {
+ if (false == $this->collTemplateI18ns->contains($obj)) {
+ $this->collTemplateI18ns->append($obj);
+ }
+ }
+
+ $this->collTemplateI18nsPartial = true;
+ }
+
+ $collTemplateI18ns->getInternalIterator()->rewind();
+
+ return $collTemplateI18ns;
+ }
+
+ if ($partial && $this->collTemplateI18ns) {
+ foreach ($this->collTemplateI18ns as $obj) {
+ if ($obj->isNew()) {
+ $collTemplateI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collTemplateI18ns = $collTemplateI18ns;
+ $this->collTemplateI18nsPartial = false;
+ }
+ }
+
+ return $this->collTemplateI18ns;
+ }
+
+ /**
+ * Sets a collection of TemplateI18n 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 $templateI18ns A Propel collection.
+ * @param ConnectionInterface $con Optional connection object
+ * @return ChildTemplate The current object (for fluent API support)
+ */
+ public function setTemplateI18ns(Collection $templateI18ns, ConnectionInterface $con = null)
+ {
+ $templateI18nsToDelete = $this->getTemplateI18ns(new Criteria(), $con)->diff($templateI18ns);
+
+
+ //since at least one column in the foreign key is at the same time a PK
+ //we can not just set a PK to NULL in the lines below. We have to store
+ //a backup of all values, so we are able to manipulate these items based on the onDelete value later.
+ $this->templateI18nsScheduledForDeletion = clone $templateI18nsToDelete;
+
+ foreach ($templateI18nsToDelete as $templateI18nRemoved) {
+ $templateI18nRemoved->setTemplate(null);
+ }
+
+ $this->collTemplateI18ns = null;
+ foreach ($templateI18ns as $templateI18n) {
+ $this->addTemplateI18n($templateI18n);
+ }
+
+ $this->collTemplateI18ns = $templateI18ns;
+ $this->collTemplateI18nsPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related TemplateI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param ConnectionInterface $con
+ * @return int Count of related TemplateI18n objects.
+ * @throws PropelException
+ */
+ public function countTemplateI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
+ {
+ $partial = $this->collTemplateI18nsPartial && !$this->isNew();
+ if (null === $this->collTemplateI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collTemplateI18ns) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getTemplateI18ns());
+ }
+
+ $query = ChildTemplateI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByTemplate($this)
+ ->count($con);
+ }
+
+ return count($this->collTemplateI18ns);
+ }
+
+ /**
+ * Method called to associate a ChildTemplateI18n object to this object
+ * through the ChildTemplateI18n foreign key attribute.
+ *
+ * @param ChildTemplateI18n $l ChildTemplateI18n
+ * @return \Thelia\Model\Template The current object (for fluent API support)
+ */
+ public function addTemplateI18n(ChildTemplateI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collTemplateI18ns === null) {
+ $this->initTemplateI18ns();
+ $this->collTemplateI18nsPartial = true;
+ }
+
+ if (!in_array($l, $this->collTemplateI18ns->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddTemplateI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param TemplateI18n $templateI18n The templateI18n object to add.
+ */
+ protected function doAddTemplateI18n($templateI18n)
+ {
+ $this->collTemplateI18ns[]= $templateI18n;
+ $templateI18n->setTemplate($this);
+ }
+
+ /**
+ * @param TemplateI18n $templateI18n The templateI18n object to remove.
+ * @return ChildTemplate The current object (for fluent API support)
+ */
+ public function removeTemplateI18n($templateI18n)
+ {
+ if ($this->getTemplateI18ns()->contains($templateI18n)) {
+ $this->collTemplateI18ns->remove($this->collTemplateI18ns->search($templateI18n));
+ if (null === $this->templateI18nsScheduledForDeletion) {
+ $this->templateI18nsScheduledForDeletion = clone $this->collTemplateI18ns;
+ $this->templateI18nsScheduledForDeletion->clear();
+ }
+ $this->templateI18nsScheduledForDeletion[]= clone $templateI18n;
+ $templateI18n->setTemplate(null);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Clears out the collFeatures 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 addFeatures()
+ */
+ public function clearFeatures()
+ {
+ $this->collFeatures = null; // important to set this to NULL since that means it is uninitialized
+ $this->collFeaturesPartial = null;
+ }
+
+ /**
+ * Initializes the collFeatures collection.
+ *
+ * By default this just sets the collFeatures collection to an empty collection (like clearFeatures());
+ * 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.
+ *
+ * @return void
+ */
+ public function initFeatures()
+ {
+ $this->collFeatures = new ObjectCollection();
+ $this->collFeatures->setModel('\Thelia\Model\Feature');
+ }
+
+ /**
+ * Gets a collection of ChildFeature objects related by a many-to-many relationship
+ * to the current object by way of the feature_template cross-reference table.
+ *
+ * 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 ChildTemplate is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria Optional query object to filter the query
+ * @param ConnectionInterface $con Optional connection object
+ *
+ * @return ObjectCollection|ChildFeature[] List of ChildFeature objects
+ */
+ public function getFeatures($criteria = null, ConnectionInterface $con = null)
+ {
+ if (null === $this->collFeatures || null !== $criteria) {
+ if ($this->isNew() && null === $this->collFeatures) {
+ // return empty collection
+ $this->initFeatures();
+ } else {
+ $collFeatures = ChildFeatureQuery::create(null, $criteria)
+ ->filterByTemplate($this)
+ ->find($con);
+ if (null !== $criteria) {
+ return $collFeatures;
+ }
+ $this->collFeatures = $collFeatures;
+ }
+ }
+
+ return $this->collFeatures;
+ }
+
+ /**
+ * Sets a collection of Feature objects related by a many-to-many relationship
+ * to the current object by way of the feature_template cross-reference table.
+ * 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 $features A Propel collection.
+ * @param ConnectionInterface $con Optional connection object
+ * @return ChildTemplate The current object (for fluent API support)
+ */
+ public function setFeatures(Collection $features, ConnectionInterface $con = null)
+ {
+ $this->clearFeatures();
+ $currentFeatures = $this->getFeatures();
+
+ $this->featuresScheduledForDeletion = $currentFeatures->diff($features);
+
+ foreach ($features as $feature) {
+ if (!$currentFeatures->contains($feature)) {
+ $this->doAddFeature($feature);
+ }
+ }
+
+ $this->collFeatures = $features;
+
+ return $this;
+ }
+
+ /**
+ * Gets the number of ChildFeature objects related by a many-to-many relationship
+ * to the current object by way of the feature_template cross-reference table.
+ *
+ * @param Criteria $criteria Optional query object to filter the query
+ * @param boolean $distinct Set to true to force count distinct
+ * @param ConnectionInterface $con Optional connection object
+ *
+ * @return int the number of related ChildFeature objects
+ */
+ public function countFeatures($criteria = null, $distinct = false, ConnectionInterface $con = null)
+ {
+ if (null === $this->collFeatures || null !== $criteria) {
+ if ($this->isNew() && null === $this->collFeatures) {
+ return 0;
+ } else {
+ $query = ChildFeatureQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByTemplate($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collFeatures);
+ }
+ }
+
+ /**
+ * Associate a ChildFeature object to this object
+ * through the feature_template cross reference table.
+ *
+ * @param ChildFeature $feature The ChildFeatureTemplate object to relate
+ * @return ChildTemplate The current object (for fluent API support)
+ */
+ public function addFeature(ChildFeature $feature)
+ {
+ if ($this->collFeatures === null) {
+ $this->initFeatures();
+ }
+
+ if (!$this->collFeatures->contains($feature)) { // only add it if the **same** object is not already associated
+ $this->doAddFeature($feature);
+ $this->collFeatures[] = $feature;
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param Feature $feature The feature object to add.
+ */
+ protected function doAddFeature($feature)
+ {
+ $featureTemplate = new ChildFeatureTemplate();
+ $featureTemplate->setFeature($feature);
+ $this->addFeatureTemplate($featureTemplate);
+ // set the back reference to this object directly as using provided method either results
+ // in endless loop or in multiple relations
+ if (!$feature->getTemplates()->contains($this)) {
+ $foreignCollection = $feature->getTemplates();
+ $foreignCollection[] = $this;
+ }
+ }
+
+ /**
+ * Remove a ChildFeature object to this object
+ * through the feature_template cross reference table.
+ *
+ * @param ChildFeature $feature The ChildFeatureTemplate object to relate
+ * @return ChildTemplate The current object (for fluent API support)
+ */
+ public function removeFeature(ChildFeature $feature)
+ {
+ if ($this->getFeatures()->contains($feature)) {
+ $this->collFeatures->remove($this->collFeatures->search($feature));
+
+ if (null === $this->featuresScheduledForDeletion) {
+ $this->featuresScheduledForDeletion = clone $this->collFeatures;
+ $this->featuresScheduledForDeletion->clear();
+ }
+
+ $this->featuresScheduledForDeletion[] = $feature;
+ }
+
+ return $this;
+ }
+
+ /**
+ * Clears out the collAttributes 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 addAttributes()
+ */
+ public function clearAttributes()
+ {
+ $this->collAttributes = null; // important to set this to NULL since that means it is uninitialized
+ $this->collAttributesPartial = null;
+ }
+
+ /**
+ * Initializes the collAttributes collection.
+ *
+ * By default this just sets the collAttributes collection to an empty collection (like clearAttributes());
+ * 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.
+ *
+ * @return void
+ */
+ public function initAttributes()
+ {
+ $this->collAttributes = new ObjectCollection();
+ $this->collAttributes->setModel('\Thelia\Model\Attribute');
+ }
+
+ /**
+ * Gets a collection of ChildAttribute objects related by a many-to-many relationship
+ * to the current object by way of the attribute_template cross-reference table.
+ *
+ * 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 ChildTemplate is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria Optional query object to filter the query
+ * @param ConnectionInterface $con Optional connection object
+ *
+ * @return ObjectCollection|ChildAttribute[] List of ChildAttribute objects
+ */
+ public function getAttributes($criteria = null, ConnectionInterface $con = null)
+ {
+ if (null === $this->collAttributes || null !== $criteria) {
+ if ($this->isNew() && null === $this->collAttributes) {
+ // return empty collection
+ $this->initAttributes();
+ } else {
+ $collAttributes = ChildAttributeQuery::create(null, $criteria)
+ ->filterByTemplate($this)
+ ->find($con);
+ if (null !== $criteria) {
+ return $collAttributes;
+ }
+ $this->collAttributes = $collAttributes;
+ }
+ }
+
+ return $this->collAttributes;
+ }
+
+ /**
+ * Sets a collection of Attribute objects related by a many-to-many relationship
+ * to the current object by way of the attribute_template cross-reference table.
+ * 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 $attributes A Propel collection.
+ * @param ConnectionInterface $con Optional connection object
+ * @return ChildTemplate The current object (for fluent API support)
+ */
+ public function setAttributes(Collection $attributes, ConnectionInterface $con = null)
+ {
+ $this->clearAttributes();
+ $currentAttributes = $this->getAttributes();
+
+ $this->attributesScheduledForDeletion = $currentAttributes->diff($attributes);
+
+ foreach ($attributes as $attribute) {
+ if (!$currentAttributes->contains($attribute)) {
+ $this->doAddAttribute($attribute);
+ }
+ }
+
+ $this->collAttributes = $attributes;
+
+ return $this;
+ }
+
+ /**
+ * Gets the number of ChildAttribute objects related by a many-to-many relationship
+ * to the current object by way of the attribute_template cross-reference table.
+ *
+ * @param Criteria $criteria Optional query object to filter the query
+ * @param boolean $distinct Set to true to force count distinct
+ * @param ConnectionInterface $con Optional connection object
+ *
+ * @return int the number of related ChildAttribute objects
+ */
+ public function countAttributes($criteria = null, $distinct = false, ConnectionInterface $con = null)
+ {
+ if (null === $this->collAttributes || null !== $criteria) {
+ if ($this->isNew() && null === $this->collAttributes) {
+ return 0;
+ } else {
+ $query = ChildAttributeQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByTemplate($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collAttributes);
+ }
+ }
+
+ /**
+ * Associate a ChildAttribute object to this object
+ * through the attribute_template cross reference table.
+ *
+ * @param ChildAttribute $attribute The ChildAttributeTemplate object to relate
+ * @return ChildTemplate The current object (for fluent API support)
+ */
+ public function addAttribute(ChildAttribute $attribute)
+ {
+ if ($this->collAttributes === null) {
+ $this->initAttributes();
+ }
+
+ if (!$this->collAttributes->contains($attribute)) { // only add it if the **same** object is not already associated
+ $this->doAddAttribute($attribute);
+ $this->collAttributes[] = $attribute;
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param Attribute $attribute The attribute object to add.
+ */
+ protected function doAddAttribute($attribute)
+ {
+ $attributeTemplate = new ChildAttributeTemplate();
+ $attributeTemplate->setAttribute($attribute);
+ $this->addAttributeTemplate($attributeTemplate);
+ // set the back reference to this object directly as using provided method either results
+ // in endless loop or in multiple relations
+ if (!$attribute->getTemplates()->contains($this)) {
+ $foreignCollection = $attribute->getTemplates();
+ $foreignCollection[] = $this;
+ }
+ }
+
+ /**
+ * Remove a ChildAttribute object to this object
+ * through the attribute_template cross reference table.
+ *
+ * @param ChildAttribute $attribute The ChildAttributeTemplate object to relate
+ * @return ChildTemplate The current object (for fluent API support)
+ */
+ public function removeAttribute(ChildAttribute $attribute)
+ {
+ if ($this->getAttributes()->contains($attribute)) {
+ $this->collAttributes->remove($this->collAttributes->search($attribute));
+
+ if (null === $this->attributesScheduledForDeletion) {
+ $this->attributesScheduledForDeletion = clone $this->collAttributes;
+ $this->attributesScheduledForDeletion->clear();
+ }
+
+ $this->attributesScheduledForDeletion[] = $attribute;
+ }
+
+ return $this;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->created_at = null;
+ $this->updated_at = null;
+ $this->alreadyInSave = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ if ($this->collProducts) {
+ foreach ($this->collProducts as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collFeatureTemplates) {
+ foreach ($this->collFeatureTemplates as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collAttributeTemplates) {
+ foreach ($this->collAttributeTemplates as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collTemplateI18ns) {
+ foreach ($this->collTemplateI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collFeatures) {
+ foreach ($this->collFeatures as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collAttributes) {
+ foreach ($this->collAttributes as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ } // if ($deep)
+
+ // i18n behavior
+ $this->currentLocale = 'en_US';
+ $this->currentTranslations = null;
+
+ if ($this->collProducts instanceof Collection) {
+ $this->collProducts->clearIterator();
+ }
+ $this->collProducts = null;
+ if ($this->collFeatureTemplates instanceof Collection) {
+ $this->collFeatureTemplates->clearIterator();
+ }
+ $this->collFeatureTemplates = null;
+ if ($this->collAttributeTemplates instanceof Collection) {
+ $this->collAttributeTemplates->clearIterator();
+ }
+ $this->collAttributeTemplates = null;
+ if ($this->collTemplateI18ns instanceof Collection) {
+ $this->collTemplateI18ns->clearIterator();
+ }
+ $this->collTemplateI18ns = null;
+ if ($this->collFeatures instanceof Collection) {
+ $this->collFeatures->clearIterator();
+ }
+ $this->collFeatures = null;
+ if ($this->collAttributes instanceof Collection) {
+ $this->collAttributes->clearIterator();
+ }
+ $this->collAttributes = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(TemplateTableMap::DEFAULT_STRING_FORMAT);
+ }
+
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return ChildTemplate The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_US')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildTemplateI18n */
+ public function getTranslation($locale = 'en_US', ConnectionInterface $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collTemplateI18ns) {
+ foreach ($this->collTemplateI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new ChildTemplateI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = ChildTemplateI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addTemplateI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildTemplate The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null)
+ {
+ if (!$this->isNew()) {
+ ChildTemplateI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collTemplateI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collTemplateI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildTemplateI18n */
+ public function getCurrentTranslation(ConnectionInterface $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [name] column value.
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->getCurrentTranslation()->getName();
+ }
+
+
+ /**
+ * Set the value of [name] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\TemplateI18n The current object (for fluent API support)
+ */
+ public function setName($v)
+ { $this->getCurrentTranslation()->setName($v);
+
+ return $this;
+ }
+
+ // timestampable behavior
+
+ /**
+ * Mark the current object so that the update date doesn't get updated during next save
+ *
+ * @return ChildTemplate The current object (for fluent API support)
+ */
+ public function keepUpdateDateUnchanged()
+ {
+ $this->modifiedColumns[] = TemplateTableMap::UPDATED_AT;
+
+ return $this;
+ }
+
+ /**
+ * Code to be run before persisting the object
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preSave(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after persisting the object
+ * @param ConnectionInterface $con
+ */
+ public function postSave(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before inserting to database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preInsert(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after inserting to database
+ * @param ConnectionInterface $con
+ */
+ public function postInsert(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before updating the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preUpdate(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after updating the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postUpdate(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before deleting the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preDelete(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after deleting the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postDelete(ConnectionInterface $con = null)
+ {
+
+ }
+
+
+ /**
+ * Derived method to catches calls to undefined methods.
+ *
+ * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
+ * Allows to define default __call() behavior if you overwrite __call()
+ *
+ * @param string $name
+ * @param mixed $params
+ *
+ * @return array|string
+ */
+ public function __call($name, $params)
+ {
+ if (0 === strpos($name, 'get')) {
+ $virtualColumn = substr($name, 3);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+
+ $virtualColumn = lcfirst($virtualColumn);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+
+ if (0 === strpos($name, 'from')) {
+ $format = substr($name, 4);
+
+ return $this->importFrom($format, reset($params));
+ }
+
+ if (0 === strpos($name, 'to')) {
+ $format = substr($name, 2);
+ $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
+
+ return $this->exportTo($format, $includeLazyLoadColumns);
+ }
+
+ throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
+ }
+
+}
diff --git a/core/lib/Thelia/Model/Base/TemplateI18n.php b/core/lib/Thelia/Model/Base/TemplateI18n.php
new file mode 100644
index 000000000..7c61c6983
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/TemplateI18n.php
@@ -0,0 +1,1265 @@
+locale = 'en_US';
+ }
+
+ /**
+ * Initializes internal state of Thelia\Model\Base\TemplateI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Returns whether the object has been modified.
+ *
+ * @return boolean True if the object has been modified.
+ */
+ public function isModified()
+ {
+ return !empty($this->modifiedColumns);
+ }
+
+ /**
+ * Has specified column been modified?
+ *
+ * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
+ * @return boolean True if $col has been modified.
+ */
+ public function isColumnModified($col)
+ {
+ return in_array($col, $this->modifiedColumns);
+ }
+
+ /**
+ * Get the columns that have been modified in this object.
+ * @return array A unique list of the modified column names for this object.
+ */
+ public function getModifiedColumns()
+ {
+ return array_unique($this->modifiedColumns);
+ }
+
+ /**
+ * Returns whether the object has ever been saved. This will
+ * be false, if the object was retrieved from storage or was created
+ * and then saved.
+ *
+ * @return true, if the object has never been persisted.
+ */
+ public function isNew()
+ {
+ return $this->new;
+ }
+
+ /**
+ * Setter for the isNew attribute. This method will be called
+ * by Propel-generated children and objects.
+ *
+ * @param boolean $b the state of the object.
+ */
+ public function setNew($b)
+ {
+ $this->new = (Boolean) $b;
+ }
+
+ /**
+ * Whether this object has been deleted.
+ * @return boolean The deleted state of this object.
+ */
+ public function isDeleted()
+ {
+ return $this->deleted;
+ }
+
+ /**
+ * Specify whether this object has been deleted.
+ * @param boolean $b The deleted state of this object.
+ * @return void
+ */
+ public function setDeleted($b)
+ {
+ $this->deleted = (Boolean) $b;
+ }
+
+ /**
+ * Sets the modified state for the object to be false.
+ * @param string $col If supplied, only the specified column is reset.
+ * @return void
+ */
+ public function resetModified($col = null)
+ {
+ if (null !== $col) {
+ while (false !== ($offset = array_search($col, $this->modifiedColumns))) {
+ array_splice($this->modifiedColumns, $offset, 1);
+ }
+ } else {
+ $this->modifiedColumns = array();
+ }
+ }
+
+ /**
+ * Compares this with another TemplateI18n instance. If
+ * obj is an instance of TemplateI18n, delegates to
+ * equals(TemplateI18n). Otherwise, returns false.
+ *
+ * @param obj The object to compare to.
+ * @return Whether equal to the object specified.
+ */
+ public function equals($obj)
+ {
+ $thisclazz = get_class($this);
+ if (!is_object($obj) || !($obj instanceof $thisclazz)) {
+ return false;
+ }
+
+ if ($this === $obj) {
+ return true;
+ }
+
+ if (null === $this->getPrimaryKey()
+ || null === $obj->getPrimaryKey()) {
+ return false;
+ }
+
+ return $this->getPrimaryKey() === $obj->getPrimaryKey();
+ }
+
+ /**
+ * If the primary key is not null, return the hashcode of the
+ * primary key. Otherwise, return the hash code of the object.
+ *
+ * @return int Hashcode
+ */
+ public function hashCode()
+ {
+ if (null !== $this->getPrimaryKey()) {
+ return crc32(serialize($this->getPrimaryKey()));
+ }
+
+ return crc32(serialize(clone $this));
+ }
+
+ /**
+ * Get the associative array of the virtual columns in this object
+ *
+ * @param string $name The virtual column name
+ *
+ * @return array
+ */
+ public function getVirtualColumns()
+ {
+ return $this->virtualColumns;
+ }
+
+ /**
+ * Checks the existence of a virtual column in this object
+ *
+ * @return boolean
+ */
+ public function hasVirtualColumn($name)
+ {
+ return array_key_exists($name, $this->virtualColumns);
+ }
+
+ /**
+ * Get the value of a virtual column in this object
+ *
+ * @return mixed
+ */
+ public function getVirtualColumn($name)
+ {
+ if (!$this->hasVirtualColumn($name)) {
+ throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
+ }
+
+ return $this->virtualColumns[$name];
+ }
+
+ /**
+ * Set the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @param mixed $value The value to give to the virtual column
+ *
+ * @return TemplateI18n The current object, for fluid interface
+ */
+ public function setVirtualColumn($name, $value)
+ {
+ $this->virtualColumns[$name] = $value;
+
+ return $this;
+ }
+
+ /**
+ * Logs a message using Propel::log().
+ *
+ * @param string $msg
+ * @param int $priority One of the Propel::LOG_* logging levels
+ * @return boolean
+ */
+ protected function log($msg, $priority = Propel::LOG_INFO)
+ {
+ return Propel::log(get_class($this) . ': ' . $msg, $priority);
+ }
+
+ /**
+ * Populate the current object from a string, using a given parser format
+ *
+ * $book = new Book();
+ * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance,
+ * or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param string $data The source data to import from
+ *
+ * @return TemplateI18n The current object, for fluid interface
+ */
+ public function importFrom($parser, $data)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME);
+ }
+
+ /**
+ * Export the current object properties to a string, using a given parser format
+ *
+ * $book = BookQuery::create()->findPk(9012);
+ * echo $book->exportTo('JSON');
+ * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
+ * @return string The exported data
+ */
+ public function exportTo($parser, $includeLazyLoadColumns = true)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
+ }
+
+ /**
+ * Clean up internal collections prior to serializing
+ * Avoids recursive loops that turn into segmentation faults when serializing
+ */
+ public function __sleep()
+ {
+ $this->clearAllReferences();
+
+ return array_keys(get_object_vars($this));
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+
+ return $this->locale;
+ }
+
+ /**
+ * Get the [name] column value.
+ *
+ * @return string
+ */
+ public function getName()
+ {
+
+ return $this->name;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\TemplateI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = TemplateI18nTableMap::ID;
+ }
+
+ if ($this->aTemplate !== null && $this->aTemplate->getId() !== $v) {
+ $this->aTemplate = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\TemplateI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = TemplateI18nTableMap::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [name] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\TemplateI18n The current object (for fluent API support)
+ */
+ public function setName($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v) {
+ $this->name = $v;
+ $this->modifiedColumns[] = TemplateI18nTableMap::NAME;
+ }
+
+
+ return $this;
+ } // setName()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_US') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by DataFetcher->fetch().
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
+ One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ *
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
+ {
+ try {
+
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : TemplateI18nTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : TemplateI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->locale = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : TemplateI18nTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->name = (null !== $col) ? (string) $col : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 3; // 3 = TemplateI18nTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \Thelia\Model\TemplateI18n object", 0, $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+ if ($this->aTemplate !== null && $this->id !== $this->aTemplate->getId()) {
+ $this->aTemplate = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(TemplateI18nTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildTemplateI18nQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
+ $row = $dataFetcher->fetch();
+ $dataFetcher->close();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aTemplate = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see TemplateI18n::setDeleted()
+ * @see TemplateI18n::isDeleted()
+ */
+ public function delete(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(TemplateI18nTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildTemplateI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(TemplateI18nTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ TemplateI18nTableMap::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(ConnectionInterface $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aTemplate !== null) {
+ if ($this->aTemplate->isModified() || $this->aTemplate->isNew()) {
+ $affectedRows += $this->aTemplate->save($con);
+ }
+ $this->setTemplate($this->aTemplate);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(ConnectionInterface $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(TemplateI18nTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = 'ID';
+ }
+ if ($this->isColumnModified(TemplateI18nTableMap::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = 'LOCALE';
+ }
+ if ($this->isColumnModified(TemplateI18nTableMap::NAME)) {
+ $modifiedColumns[':p' . $index++] = 'NAME';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO template_i18n (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case 'ID':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case 'LOCALE':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case 'NAME':
+ $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @return Integer Number of updated rows
+ * @see doSave()
+ */
+ protected function doUpdate(ConnectionInterface $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+
+ return $selectCriteria->doUpdate($valuesCriteria, $con);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = TemplateI18nTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getName();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['TemplateI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['TemplateI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = TemplateI18nTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getName(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach($virtualColumns as $key => $virtualColumn)
+ {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aTemplate) {
+ $result['Template'] = $this->aTemplate->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return void
+ */
+ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = TemplateI18nTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setName($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * The default key type is the column's TableMap::TYPE_PHPNAME.
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
+ {
+ $keys = TemplateI18nTableMap::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setName($arr[$keys[2]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(TemplateI18nTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(TemplateI18nTableMap::ID)) $criteria->add(TemplateI18nTableMap::ID, $this->id);
+ if ($this->isColumnModified(TemplateI18nTableMap::LOCALE)) $criteria->add(TemplateI18nTableMap::LOCALE, $this->locale);
+ if ($this->isColumnModified(TemplateI18nTableMap::NAME)) $criteria->add(TemplateI18nTableMap::NAME, $this->name);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(TemplateI18nTableMap::DATABASE_NAME);
+ $criteria->add(TemplateI18nTableMap::ID, $this->id);
+ $criteria->add(TemplateI18nTableMap::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the composite primary key for this object.
+ * The array elements will be in same order as specified in XML.
+ * @return array
+ */
+ public function getPrimaryKey()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of \Thelia\Model\TemplateI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setName($this->getName());
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return \Thelia\Model\TemplateI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Declares an association between this object and a ChildTemplate object.
+ *
+ * @param ChildTemplate $v
+ * @return \Thelia\Model\TemplateI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setTemplate(ChildTemplate $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aTemplate = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildTemplate object, it will not be re-added.
+ if ($v !== null) {
+ $v->addTemplateI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildTemplate object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildTemplate The associated ChildTemplate object.
+ * @throws PropelException
+ */
+ public function getTemplate(ConnectionInterface $con = null)
+ {
+ if ($this->aTemplate === null && ($this->id !== null)) {
+ $this->aTemplate = ChildTemplateQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aTemplate->addTemplateI18ns($this);
+ */
+ }
+
+ return $this->aTemplate;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->name = null;
+ $this->alreadyInSave = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aTemplate = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(TemplateI18nTableMap::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * Code to be run before persisting the object
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preSave(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after persisting the object
+ * @param ConnectionInterface $con
+ */
+ public function postSave(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before inserting to database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preInsert(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after inserting to database
+ * @param ConnectionInterface $con
+ */
+ public function postInsert(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before updating the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preUpdate(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after updating the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postUpdate(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before deleting the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preDelete(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after deleting the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postDelete(ConnectionInterface $con = null)
+ {
+
+ }
+
+
+ /**
+ * Derived method to catches calls to undefined methods.
+ *
+ * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
+ * Allows to define default __call() behavior if you overwrite __call()
+ *
+ * @param string $name
+ * @param mixed $params
+ *
+ * @return array|string
+ */
+ public function __call($name, $params)
+ {
+ if (0 === strpos($name, 'get')) {
+ $virtualColumn = substr($name, 3);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+
+ $virtualColumn = lcfirst($virtualColumn);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+
+ if (0 === strpos($name, 'from')) {
+ $format = substr($name, 4);
+
+ return $this->importFrom($format, reset($params));
+ }
+
+ if (0 === strpos($name, 'to')) {
+ $format = substr($name, 2);
+ $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
+
+ return $this->exportTo($format, $includeLazyLoadColumns);
+ }
+
+ throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
+ }
+
+}
diff --git a/core/lib/Thelia/Model/Base/TemplateI18nQuery.php b/core/lib/Thelia/Model/Base/TemplateI18nQuery.php
new file mode 100644
index 000000000..12e7b7d1f
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/TemplateI18nQuery.php
@@ -0,0 +1,508 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array[$id, $locale] $key Primary key to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildTemplateI18n|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = TemplateI18nTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(TemplateI18nTableMap::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 ChildTemplateI18n A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT ID, LOCALE, NAME FROM template_i18n WHERE ID = :p0 AND LOCALE = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
+ $obj = new ChildTemplateI18n();
+ $obj->hydrate($row);
+ TemplateI18nTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con A connection object
+ *
+ * @return ChildTemplateI18n|array|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $dataFetcher = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $dataFetcher = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return ChildTemplateI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(TemplateI18nTableMap::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(TemplateI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return ChildTemplateI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(TemplateI18nTableMap::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(TemplateI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByTemplate()
+ *
+ * @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 ChildTemplateI18nQuery 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(TemplateI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(TemplateI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(TemplateI18nTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildTemplateI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(TemplateI18nTableMap::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the name column
+ *
+ * Example usage:
+ *
+ * $query->filterByName('fooValue'); // WHERE name = 'fooValue'
+ * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
+ *
+ *
+ * @param string $name 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 ChildTemplateI18nQuery The current query, for fluid interface
+ */
+ public function filterByName($name = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($name)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $name)) {
+ $name = str_replace('*', '%', $name);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(TemplateI18nTableMap::NAME, $name, $comparison);
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\Template object
+ *
+ * @param \Thelia\Model\Template|ObjectCollection $template The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildTemplateI18nQuery The current query, for fluid interface
+ */
+ public function filterByTemplate($template, $comparison = null)
+ {
+ if ($template instanceof \Thelia\Model\Template) {
+ return $this
+ ->addUsingAlias(TemplateI18nTableMap::ID, $template->getId(), $comparison);
+ } elseif ($template instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(TemplateI18nTableMap::ID, $template->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByTemplate() only accepts arguments of type \Thelia\Model\Template or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Template relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildTemplateI18nQuery The current query, for fluid interface
+ */
+ public function joinTemplate($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Template');
+
+ // 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, 'Template');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Template relation Template 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\TemplateQuery A secondary query class using the current class as primary query
+ */
+ public function useTemplateQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinTemplate($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Template', '\Thelia\Model\TemplateQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildTemplateI18n $templateI18n Object to remove from the list of results
+ *
+ * @return ChildTemplateI18nQuery The current query, for fluid interface
+ */
+ public function prune($templateI18n = null)
+ {
+ if ($templateI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(TemplateI18nTableMap::ID), $templateI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(TemplateI18nTableMap::LOCALE), $templateI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the template_i18n table.
+ *
+ * @param ConnectionInterface $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public function doDeleteAll(ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(TemplateI18nTableMap::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).
+ TemplateI18nTableMap::clearInstancePool();
+ TemplateI18nTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildTemplateI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildTemplateI18n 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(TemplateI18nTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(TemplateI18nTableMap::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();
+
+
+ TemplateI18nTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ TemplateI18nTableMap::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+} // TemplateI18nQuery
diff --git a/core/lib/Thelia/Model/Base/TemplateQuery.php b/core/lib/Thelia/Model/Base/TemplateQuery.php
new file mode 100644
index 000000000..506d7d943
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/TemplateQuery.php
@@ -0,0 +1,907 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildTemplate|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = TemplateTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(TemplateTableMap::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 ChildTemplate A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT ID, CREATED_AT, UPDATED_AT FROM template 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 ChildTemplate();
+ $obj->hydrate($row);
+ TemplateTableMap::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 ChildTemplate|array|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $dataFetcher = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $dataFetcher = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(TemplateTableMap::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 ChildTemplateQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(TemplateTableMap::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildTemplateQuery 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(TemplateTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(TemplateTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(TemplateTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the created_at column
+ *
+ * Example usage:
+ *
+ * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
+ * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
+ * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
+ *
+ *
+ * @param mixed $createdAt The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildTemplateQuery 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(TemplateTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($createdAt['max'])) {
+ $this->addUsingAlias(TemplateTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(TemplateTableMap::CREATED_AT, $createdAt, $comparison);
+ }
+
+ /**
+ * Filter the query on the updated_at column
+ *
+ * Example usage:
+ *
+ * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
+ * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
+ * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
+ *
+ *
+ * @param mixed $updatedAt The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildTemplateQuery 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(TemplateTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($updatedAt['max'])) {
+ $this->addUsingAlias(TemplateTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(TemplateTableMap::UPDATED_AT, $updatedAt, $comparison);
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\Product object
+ *
+ * @param \Thelia\Model\Product|ObjectCollection $product the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function filterByProduct($product, $comparison = null)
+ {
+ if ($product instanceof \Thelia\Model\Product) {
+ return $this
+ ->addUsingAlias(TemplateTableMap::ID, $product->getTemplateId(), $comparison);
+ } elseif ($product instanceof ObjectCollection) {
+ return $this
+ ->useProductQuery()
+ ->filterByPrimaryKeys($product->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByProduct() only accepts arguments of type \Thelia\Model\Product or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Product relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_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::INNER_JOIN)
+ {
+ return $this
+ ->joinProduct($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery');
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\FeatureTemplate object
+ *
+ * @param \Thelia\Model\FeatureTemplate|ObjectCollection $featureTemplate the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function filterByFeatureTemplate($featureTemplate, $comparison = null)
+ {
+ if ($featureTemplate instanceof \Thelia\Model\FeatureTemplate) {
+ return $this
+ ->addUsingAlias(TemplateTableMap::ID, $featureTemplate->getTemplateId(), $comparison);
+ } elseif ($featureTemplate instanceof ObjectCollection) {
+ return $this
+ ->useFeatureTemplateQuery()
+ ->filterByPrimaryKeys($featureTemplate->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByFeatureTemplate() only accepts arguments of type \Thelia\Model\FeatureTemplate or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the FeatureTemplate relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function joinFeatureTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('FeatureTemplate');
+
+ // 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, 'FeatureTemplate');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the FeatureTemplate relation FeatureTemplate 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\FeatureTemplateQuery A secondary query class using the current class as primary query
+ */
+ public function useFeatureTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinFeatureTemplate($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'FeatureTemplate', '\Thelia\Model\FeatureTemplateQuery');
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\AttributeTemplate object
+ *
+ * @param \Thelia\Model\AttributeTemplate|ObjectCollection $attributeTemplate the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function filterByAttributeTemplate($attributeTemplate, $comparison = null)
+ {
+ if ($attributeTemplate instanceof \Thelia\Model\AttributeTemplate) {
+ return $this
+ ->addUsingAlias(TemplateTableMap::ID, $attributeTemplate->getTemplateId(), $comparison);
+ } elseif ($attributeTemplate instanceof ObjectCollection) {
+ return $this
+ ->useAttributeTemplateQuery()
+ ->filterByPrimaryKeys($attributeTemplate->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByAttributeTemplate() only accepts arguments of type \Thelia\Model\AttributeTemplate or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the AttributeTemplate relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function joinAttributeTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('AttributeTemplate');
+
+ // 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, 'AttributeTemplate');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the AttributeTemplate relation AttributeTemplate 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\AttributeTemplateQuery A secondary query class using the current class as primary query
+ */
+ public function useAttributeTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinAttributeTemplate($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'AttributeTemplate', '\Thelia\Model\AttributeTemplateQuery');
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\TemplateI18n object
+ *
+ * @param \Thelia\Model\TemplateI18n|ObjectCollection $templateI18n the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function filterByTemplateI18n($templateI18n, $comparison = null)
+ {
+ if ($templateI18n instanceof \Thelia\Model\TemplateI18n) {
+ return $this
+ ->addUsingAlias(TemplateTableMap::ID, $templateI18n->getId(), $comparison);
+ } elseif ($templateI18n instanceof ObjectCollection) {
+ return $this
+ ->useTemplateI18nQuery()
+ ->filterByPrimaryKeys($templateI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByTemplateI18n() only accepts arguments of type \Thelia\Model\TemplateI18n or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the TemplateI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function joinTemplateI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('TemplateI18n');
+
+ // 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, 'TemplateI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the TemplateI18n relation TemplateI18n 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\TemplateI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useTemplateI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinTemplateI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'TemplateI18n', '\Thelia\Model\TemplateI18nQuery');
+ }
+
+ /**
+ * Filter the query by a related Feature object
+ * using the feature_template table as cross reference
+ *
+ * @param Feature $feature the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function filterByFeature($feature, $comparison = Criteria::EQUAL)
+ {
+ return $this
+ ->useFeatureTemplateQuery()
+ ->filterByFeature($feature, $comparison)
+ ->endUse();
+ }
+
+ /**
+ * Filter the query by a related Attribute object
+ * using the attribute_template table as cross reference
+ *
+ * @param Attribute $attribute the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function filterByAttribute($attribute, $comparison = Criteria::EQUAL)
+ {
+ return $this
+ ->useAttributeTemplateQuery()
+ ->filterByAttribute($attribute, $comparison)
+ ->endUse();
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildTemplate $template Object to remove from the list of results
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function prune($template = null)
+ {
+ if ($template) {
+ $this->addUsingAlias(TemplateTableMap::ID, $template->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the template 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(TemplateTableMap::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).
+ TemplateTableMap::clearInstancePool();
+ TemplateTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildTemplate or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildTemplate 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(TemplateTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(TemplateTableMap::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();
+
+
+ TemplateTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ TemplateTableMap::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'TemplateI18n';
+
+ return $this
+ ->joinTemplateI18n($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 ChildTemplateQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('TemplateI18n');
+ $this->with['TemplateI18n']->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 ChildTemplateI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'TemplateI18n', '\Thelia\Model\TemplateI18nQuery');
+ }
+
+ // timestampable behavior
+
+ /**
+ * Filter by the latest updated
+ *
+ * @param int $nbDays Maximum age of the latest update in days
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function recentlyUpdated($nbDays = 7)
+ {
+ return $this->addUsingAlias(TemplateTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ }
+
+ /**
+ * Filter by the latest created
+ *
+ * @param int $nbDays Maximum age of in days
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function recentlyCreated($nbDays = 7)
+ {
+ return $this->addUsingAlias(TemplateTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ }
+
+ /**
+ * Order by update date desc
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function lastUpdatedFirst()
+ {
+ return $this->addDescendingOrderByColumn(TemplateTableMap::UPDATED_AT);
+ }
+
+ /**
+ * Order by update date asc
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function firstUpdatedFirst()
+ {
+ return $this->addAscendingOrderByColumn(TemplateTableMap::UPDATED_AT);
+ }
+
+ /**
+ * Order by create date desc
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function lastCreatedFirst()
+ {
+ return $this->addDescendingOrderByColumn(TemplateTableMap::CREATED_AT);
+ }
+
+ /**
+ * Order by create date asc
+ *
+ * @return ChildTemplateQuery The current query, for fluid interface
+ */
+ public function firstCreatedFirst()
+ {
+ return $this->addAscendingOrderByColumn(TemplateTableMap::CREATED_AT);
+ }
+
+} // TemplateQuery
diff --git a/core/lib/Thelia/Model/Customer.php b/core/lib/Thelia/Model/Customer.php
index f839d5f5b..820928224 100755
--- a/core/lib/Thelia/Model/Customer.php
+++ b/core/lib/Thelia/Model/Customer.php
@@ -205,11 +205,42 @@ class Customer extends BaseCustomer implements UserInterface
return array(new Role('CUSTOMER'));
}
+ /**
+ * {@inheritDoc}
+ */
+ public function getToken() {
+ return $this->getRememberMeToken();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function setToken($token) {
+ $this->setRememberMeToken($token)->save();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getSerial() {
+ return $this->getRememberMeSerial();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function setSerial($serial) {
+ $this->setRememberMeSerial($serial)->save();
+ }
+
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
+ // Set the serial number (for auto-login)
+ $this->setRememberMeSerial(uniqid());
+
$this->setRef($this->generateRef());
$this->dispatchEvent(TheliaEvents::BEFORE_CREATECUSTOMER, new CustomerEvent($this));
diff --git a/core/lib/Thelia/Model/FeatureTemplate.php b/core/lib/Thelia/Model/FeatureTemplate.php
new file mode 100644
index 000000000..47a33027a
--- /dev/null
+++ b/core/lib/Thelia/Model/FeatureTemplate.php
@@ -0,0 +1,10 @@
+ array('Id', 'Firstname', 'Lastname', 'Login', 'Password', 'Algo', 'Salt', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(AdminTableMap::ID, AdminTableMap::FIRSTNAME, AdminTableMap::LASTNAME, AdminTableMap::LOGIN, AdminTableMap::PASSWORD, AdminTableMap::ALGO, AdminTableMap::SALT, AdminTableMap::CREATED_AT, AdminTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'FIRSTNAME', 'LASTNAME', 'LOGIN', 'PASSWORD', 'ALGO', 'SALT', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
+ self::TYPE_PHPNAME => array('Id', 'Firstname', 'Lastname', 'Login', 'Password', 'Algo', 'Salt', 'RememberMeToken', 'RememberMeSerial', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'rememberMeToken', 'rememberMeSerial', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(AdminTableMap::ID, AdminTableMap::FIRSTNAME, AdminTableMap::LASTNAME, AdminTableMap::LOGIN, AdminTableMap::PASSWORD, AdminTableMap::ALGO, AdminTableMap::SALT, AdminTableMap::REMEMBER_ME_TOKEN, AdminTableMap::REMEMBER_ME_SERIAL, AdminTableMap::CREATED_AT, AdminTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'FIRSTNAME', 'LASTNAME', 'LOGIN', 'PASSWORD', 'ALGO', 'SALT', 'REMEMBER_ME_TOKEN', 'REMEMBER_ME_SERIAL', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'remember_me_token', 'remember_me_serial', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
);
/**
@@ -141,12 +151,12 @@ class AdminTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'Firstname' => 1, 'Lastname' => 2, 'Login' => 3, 'Password' => 4, 'Algo' => 5, 'Salt' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'createdAt' => 7, 'updatedAt' => 8, ),
- self::TYPE_COLNAME => array(AdminTableMap::ID => 0, AdminTableMap::FIRSTNAME => 1, AdminTableMap::LASTNAME => 2, AdminTableMap::LOGIN => 3, AdminTableMap::PASSWORD => 4, AdminTableMap::ALGO => 5, AdminTableMap::SALT => 6, AdminTableMap::CREATED_AT => 7, AdminTableMap::UPDATED_AT => 8, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'FIRSTNAME' => 1, 'LASTNAME' => 2, 'LOGIN' => 3, 'PASSWORD' => 4, 'ALGO' => 5, 'SALT' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'created_at' => 7, 'updated_at' => 8, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'Firstname' => 1, 'Lastname' => 2, 'Login' => 3, 'Password' => 4, 'Algo' => 5, 'Salt' => 6, 'RememberMeToken' => 7, 'RememberMeSerial' => 8, 'CreatedAt' => 9, 'UpdatedAt' => 10, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'rememberMeToken' => 7, 'rememberMeSerial' => 8, 'createdAt' => 9, 'updatedAt' => 10, ),
+ self::TYPE_COLNAME => array(AdminTableMap::ID => 0, AdminTableMap::FIRSTNAME => 1, AdminTableMap::LASTNAME => 2, AdminTableMap::LOGIN => 3, AdminTableMap::PASSWORD => 4, AdminTableMap::ALGO => 5, AdminTableMap::SALT => 6, AdminTableMap::REMEMBER_ME_TOKEN => 7, AdminTableMap::REMEMBER_ME_SERIAL => 8, AdminTableMap::CREATED_AT => 9, AdminTableMap::UPDATED_AT => 10, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'FIRSTNAME' => 1, 'LASTNAME' => 2, 'LOGIN' => 3, 'PASSWORD' => 4, 'ALGO' => 5, 'SALT' => 6, 'REMEMBER_ME_TOKEN' => 7, 'REMEMBER_ME_SERIAL' => 8, 'CREATED_AT' => 9, 'UPDATED_AT' => 10, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'remember_me_token' => 7, 'remember_me_serial' => 8, 'created_at' => 9, 'updated_at' => 10, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
);
/**
@@ -172,6 +182,8 @@ class AdminTableMap extends TableMap
$this->addColumn('PASSWORD', 'Password', 'VARCHAR', true, 128, null);
$this->addColumn('ALGO', 'Algo', 'VARCHAR', false, 128, null);
$this->addColumn('SALT', 'Salt', 'VARCHAR', false, 128, null);
+ $this->addColumn('REMEMBER_ME_TOKEN', 'RememberMeToken', 'VARCHAR', false, 255, null);
+ $this->addColumn('REMEMBER_ME_SERIAL', 'RememberMeSerial', 'VARCHAR', false, 255, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -352,6 +364,8 @@ class AdminTableMap extends TableMap
$criteria->addSelectColumn(AdminTableMap::PASSWORD);
$criteria->addSelectColumn(AdminTableMap::ALGO);
$criteria->addSelectColumn(AdminTableMap::SALT);
+ $criteria->addSelectColumn(AdminTableMap::REMEMBER_ME_TOKEN);
+ $criteria->addSelectColumn(AdminTableMap::REMEMBER_ME_SERIAL);
$criteria->addSelectColumn(AdminTableMap::CREATED_AT);
$criteria->addSelectColumn(AdminTableMap::UPDATED_AT);
} else {
@@ -362,6 +376,8 @@ class AdminTableMap extends TableMap
$criteria->addSelectColumn($alias . '.PASSWORD');
$criteria->addSelectColumn($alias . '.ALGO');
$criteria->addSelectColumn($alias . '.SALT');
+ $criteria->addSelectColumn($alias . '.REMEMBER_ME_TOKEN');
+ $criteria->addSelectColumn($alias . '.REMEMBER_ME_SERIAL');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
diff --git a/core/lib/Thelia/Model/Map/AttributeTableMap.php b/core/lib/Thelia/Model/Map/AttributeTableMap.php
index 773e13cab..245dc08d3 100644
--- a/core/lib/Thelia/Model/Map/AttributeTableMap.php
+++ b/core/lib/Thelia/Model/Map/AttributeTableMap.php
@@ -162,9 +162,9 @@ class AttributeTableMap extends TableMap
{
$this->addRelation('AttributeAv', '\\Thelia\\Model\\AttributeAv', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT', 'AttributeAvs');
$this->addRelation('AttributeCombination', '\\Thelia\\Model\\AttributeCombination', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT', 'AttributeCombinations');
- $this->addRelation('AttributeCategory', '\\Thelia\\Model\\AttributeCategory', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT', 'AttributeCategories');
+ $this->addRelation('AttributeTemplate', '\\Thelia\\Model\\AttributeTemplate', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT', 'AttributeTemplates');
$this->addRelation('AttributeI18n', '\\Thelia\\Model\\AttributeI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'AttributeI18ns');
- $this->addRelation('Category', '\\Thelia\\Model\\Category', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Categories');
+ $this->addRelation('Template', '\\Thelia\\Model\\Template', RelationMap::MANY_TO_MANY, array(), null, null, 'Templates');
} // buildRelations()
/**
@@ -189,7 +189,7 @@ class AttributeTableMap extends TableMap
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AttributeAvTableMap::clearInstancePool();
AttributeCombinationTableMap::clearInstancePool();
- AttributeCategoryTableMap::clearInstancePool();
+ AttributeTemplateTableMap::clearInstancePool();
AttributeI18nTableMap::clearInstancePool();
}
diff --git a/core/lib/Thelia/Model/Map/AttributeTemplateTableMap.php b/core/lib/Thelia/Model/Map/AttributeTemplateTableMap.php
new file mode 100644
index 000000000..04d3a9a4a
--- /dev/null
+++ b/core/lib/Thelia/Model/Map/AttributeTemplateTableMap.php
@@ -0,0 +1,449 @@
+ array('Id', 'AttributeId', 'TemplateId', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'attributeId', 'templateId', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(AttributeTemplateTableMap::ID, AttributeTemplateTableMap::ATTRIBUTE_ID, AttributeTemplateTableMap::TEMPLATE_ID, AttributeTemplateTableMap::CREATED_AT, AttributeTemplateTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'ATTRIBUTE_ID', 'TEMPLATE_ID', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'attribute_id', 'template_id', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ self::TYPE_PHPNAME => array('Id' => 0, 'AttributeId' => 1, 'TemplateId' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'attributeId' => 1, 'templateId' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
+ self::TYPE_COLNAME => array(AttributeTemplateTableMap::ID => 0, AttributeTemplateTableMap::ATTRIBUTE_ID => 1, AttributeTemplateTableMap::TEMPLATE_ID => 2, AttributeTemplateTableMap::CREATED_AT => 3, AttributeTemplateTableMap::UPDATED_AT => 4, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'ATTRIBUTE_ID' => 1, 'TEMPLATE_ID' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'attribute_id' => 1, 'template_id' => 2, 'created_at' => 3, 'updated_at' => 4, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, )
+ );
+
+ /**
+ * Initialize the table attributes and columns
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('attribute_template');
+ $this->setPhpName('AttributeTemplate');
+ $this->setClassName('\\Thelia\\Model\\AttributeTemplate');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(true);
+ $this->setIsCrossRef(true);
+ // columns
+ $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
+ $this->addForeignKey('ATTRIBUTE_ID', 'AttributeId', 'INTEGER', 'attribute', 'ID', true, null, null);
+ $this->addForeignKey('TEMPLATE_ID', 'TemplateId', 'INTEGER', 'template', 'ID', true, null, null);
+ $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
+ $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Attribute', '\\Thelia\\Model\\Attribute', RelationMap::MANY_TO_ONE, array('attribute_id' => 'id', ), 'CASCADE', 'RESTRICT');
+ $this->addRelation('Template', '\\Thelia\\Model\\Template', RelationMap::MANY_TO_ONE, array('template_id' => 'id', ), null, null);
+ } // 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 ? AttributeTemplateTableMap::CLASS_DEFAULT : AttributeTemplateTableMap::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 (AttributeTemplate object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = AttributeTemplateTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = AttributeTemplateTableMap::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 + AttributeTemplateTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = AttributeTemplateTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ AttributeTemplateTableMap::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 = AttributeTemplateTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = AttributeTemplateTableMap::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;
+ AttributeTemplateTableMap::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(AttributeTemplateTableMap::ID);
+ $criteria->addSelectColumn(AttributeTemplateTableMap::ATTRIBUTE_ID);
+ $criteria->addSelectColumn(AttributeTemplateTableMap::TEMPLATE_ID);
+ $criteria->addSelectColumn(AttributeTemplateTableMap::CREATED_AT);
+ $criteria->addSelectColumn(AttributeTemplateTableMap::UPDATED_AT);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.ATTRIBUTE_ID');
+ $criteria->addSelectColumn($alias . '.TEMPLATE_ID');
+ $criteria->addSelectColumn($alias . '.CREATED_AT');
+ $criteria->addSelectColumn($alias . '.UPDATED_AT');
+ }
+ }
+
+ /**
+ * Returns the TableMap related to this object.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getServiceContainer()->getDatabaseMap(AttributeTemplateTableMap::DATABASE_NAME)->getTable(AttributeTemplateTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(AttributeTemplateTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(AttributeTemplateTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new AttributeTemplateTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a AttributeTemplate or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or AttributeTemplate 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(AttributeTemplateTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \Thelia\Model\AttributeTemplate) { // 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(AttributeTemplateTableMap::DATABASE_NAME);
+ $criteria->add(AttributeTemplateTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = AttributeTemplateQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { AttributeTemplateTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { AttributeTemplateTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the attribute_template 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 AttributeTemplateQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a AttributeTemplate or Criteria object.
+ *
+ * @param mixed $criteria Criteria or AttributeTemplate 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(AttributeTemplateTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from AttributeTemplate object
+ }
+
+ if ($criteria->containsKey(AttributeTemplateTableMap::ID) && $criteria->keyContainsValue(AttributeTemplateTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.AttributeTemplateTableMap::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $query = AttributeTemplateQuery::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;
+ }
+
+} // AttributeTemplateTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+AttributeTemplateTableMap::buildTableMap();
diff --git a/core/lib/Thelia/Model/Map/CategoryTableMap.php b/core/lib/Thelia/Model/Map/CategoryTableMap.php
index 6a2d052a1..cd0ca3799 100644
--- a/core/lib/Thelia/Model/Map/CategoryTableMap.php
+++ b/core/lib/Thelia/Model/Map/CategoryTableMap.php
@@ -191,16 +191,12 @@ class CategoryTableMap extends TableMap
public function buildRelations()
{
$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('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');
- $this->addRelation('Feature', '\\Thelia\\Model\\Feature', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Features');
- $this->addRelation('Attribute', '\\Thelia\\Model\\Attribute', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Attributes');
} // buildRelations()
/**
@@ -225,8 +221,6 @@ class CategoryTableMap 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.
ProductCategoryTableMap::clearInstancePool();
- FeatureCategoryTableMap::clearInstancePool();
- AttributeCategoryTableMap::clearInstancePool();
CategoryImageTableMap::clearInstancePool();
CategoryDocumentTableMap::clearInstancePool();
CategoryAssociatedContentTableMap::clearInstancePool();
diff --git a/core/lib/Thelia/Model/Map/CustomerTableMap.php b/core/lib/Thelia/Model/Map/CustomerTableMap.php
index b23f4d6b0..32ccf07ee 100644
--- a/core/lib/Thelia/Model/Map/CustomerTableMap.php
+++ b/core/lib/Thelia/Model/Map/CustomerTableMap.php
@@ -57,7 +57,7 @@ class CustomerTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 14;
+ const NUM_COLUMNS = 16;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class CustomerTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 14;
+ const NUM_HYDRATE_COLUMNS = 16;
/**
* the column name for the ID field
@@ -129,6 +129,16 @@ class CustomerTableMap extends TableMap
*/
const DISCOUNT = 'customer.DISCOUNT';
+ /**
+ * the column name for the REMEMBER_ME_TOKEN field
+ */
+ const REMEMBER_ME_TOKEN = 'customer.REMEMBER_ME_TOKEN';
+
+ /**
+ * the column name for the REMEMBER_ME_SERIAL field
+ */
+ const REMEMBER_ME_SERIAL = 'customer.REMEMBER_ME_SERIAL';
+
/**
* the column name for the CREATED_AT field
*/
@@ -151,12 +161,12 @@ class CustomerTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'Ref', 'TitleId', 'Firstname', 'Lastname', 'Email', 'Password', 'Algo', 'Reseller', 'Lang', 'Sponsor', 'Discount', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'ref', 'titleId', 'firstname', 'lastname', 'email', 'password', 'algo', 'reseller', 'lang', 'sponsor', 'discount', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(CustomerTableMap::ID, CustomerTableMap::REF, CustomerTableMap::TITLE_ID, CustomerTableMap::FIRSTNAME, CustomerTableMap::LASTNAME, CustomerTableMap::EMAIL, CustomerTableMap::PASSWORD, CustomerTableMap::ALGO, CustomerTableMap::RESELLER, CustomerTableMap::LANG, CustomerTableMap::SPONSOR, CustomerTableMap::DISCOUNT, CustomerTableMap::CREATED_AT, CustomerTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'REF', 'TITLE_ID', 'FIRSTNAME', 'LASTNAME', 'EMAIL', 'PASSWORD', 'ALGO', 'RESELLER', 'LANG', 'SPONSOR', 'DISCOUNT', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'ref', 'title_id', 'firstname', 'lastname', 'email', 'password', 'algo', 'reseller', 'lang', 'sponsor', 'discount', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
+ self::TYPE_PHPNAME => array('Id', 'Ref', 'TitleId', 'Firstname', 'Lastname', 'Email', 'Password', 'Algo', 'Reseller', 'Lang', 'Sponsor', 'Discount', 'RememberMeToken', 'RememberMeSerial', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'ref', 'titleId', 'firstname', 'lastname', 'email', 'password', 'algo', 'reseller', 'lang', 'sponsor', 'discount', 'rememberMeToken', 'rememberMeSerial', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(CustomerTableMap::ID, CustomerTableMap::REF, CustomerTableMap::TITLE_ID, CustomerTableMap::FIRSTNAME, CustomerTableMap::LASTNAME, CustomerTableMap::EMAIL, CustomerTableMap::PASSWORD, CustomerTableMap::ALGO, CustomerTableMap::RESELLER, CustomerTableMap::LANG, CustomerTableMap::SPONSOR, CustomerTableMap::DISCOUNT, CustomerTableMap::REMEMBER_ME_TOKEN, CustomerTableMap::REMEMBER_ME_SERIAL, CustomerTableMap::CREATED_AT, CustomerTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'REF', 'TITLE_ID', 'FIRSTNAME', 'LASTNAME', 'EMAIL', 'PASSWORD', 'ALGO', 'RESELLER', 'LANG', 'SPONSOR', 'DISCOUNT', 'REMEMBER_ME_TOKEN', 'REMEMBER_ME_SERIAL', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'ref', 'title_id', 'firstname', 'lastname', 'email', 'password', 'algo', 'reseller', 'lang', 'sponsor', 'discount', 'remember_me_token', 'remember_me_serial', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
);
/**
@@ -166,12 +176,12 @@ class CustomerTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'Ref' => 1, 'TitleId' => 2, 'Firstname' => 3, 'Lastname' => 4, 'Email' => 5, 'Password' => 6, 'Algo' => 7, 'Reseller' => 8, 'Lang' => 9, 'Sponsor' => 10, 'Discount' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'ref' => 1, 'titleId' => 2, 'firstname' => 3, 'lastname' => 4, 'email' => 5, 'password' => 6, 'algo' => 7, 'reseller' => 8, 'lang' => 9, 'sponsor' => 10, 'discount' => 11, 'createdAt' => 12, 'updatedAt' => 13, ),
- self::TYPE_COLNAME => array(CustomerTableMap::ID => 0, CustomerTableMap::REF => 1, CustomerTableMap::TITLE_ID => 2, CustomerTableMap::FIRSTNAME => 3, CustomerTableMap::LASTNAME => 4, CustomerTableMap::EMAIL => 5, CustomerTableMap::PASSWORD => 6, CustomerTableMap::ALGO => 7, CustomerTableMap::RESELLER => 8, CustomerTableMap::LANG => 9, CustomerTableMap::SPONSOR => 10, CustomerTableMap::DISCOUNT => 11, CustomerTableMap::CREATED_AT => 12, CustomerTableMap::UPDATED_AT => 13, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'REF' => 1, 'TITLE_ID' => 2, 'FIRSTNAME' => 3, 'LASTNAME' => 4, 'EMAIL' => 5, 'PASSWORD' => 6, 'ALGO' => 7, 'RESELLER' => 8, 'LANG' => 9, 'SPONSOR' => 10, 'DISCOUNT' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'ref' => 1, 'title_id' => 2, 'firstname' => 3, 'lastname' => 4, 'email' => 5, 'password' => 6, 'algo' => 7, 'reseller' => 8, 'lang' => 9, 'sponsor' => 10, 'discount' => 11, 'created_at' => 12, 'updated_at' => 13, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'Ref' => 1, 'TitleId' => 2, 'Firstname' => 3, 'Lastname' => 4, 'Email' => 5, 'Password' => 6, 'Algo' => 7, 'Reseller' => 8, 'Lang' => 9, 'Sponsor' => 10, 'Discount' => 11, 'RememberMeToken' => 12, 'RememberMeSerial' => 13, 'CreatedAt' => 14, 'UpdatedAt' => 15, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'ref' => 1, 'titleId' => 2, 'firstname' => 3, 'lastname' => 4, 'email' => 5, 'password' => 6, 'algo' => 7, 'reseller' => 8, 'lang' => 9, 'sponsor' => 10, 'discount' => 11, 'rememberMeToken' => 12, 'rememberMeSerial' => 13, 'createdAt' => 14, 'updatedAt' => 15, ),
+ self::TYPE_COLNAME => array(CustomerTableMap::ID => 0, CustomerTableMap::REF => 1, CustomerTableMap::TITLE_ID => 2, CustomerTableMap::FIRSTNAME => 3, CustomerTableMap::LASTNAME => 4, CustomerTableMap::EMAIL => 5, CustomerTableMap::PASSWORD => 6, CustomerTableMap::ALGO => 7, CustomerTableMap::RESELLER => 8, CustomerTableMap::LANG => 9, CustomerTableMap::SPONSOR => 10, CustomerTableMap::DISCOUNT => 11, CustomerTableMap::REMEMBER_ME_TOKEN => 12, CustomerTableMap::REMEMBER_ME_SERIAL => 13, CustomerTableMap::CREATED_AT => 14, CustomerTableMap::UPDATED_AT => 15, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'REF' => 1, 'TITLE_ID' => 2, 'FIRSTNAME' => 3, 'LASTNAME' => 4, 'EMAIL' => 5, 'PASSWORD' => 6, 'ALGO' => 7, 'RESELLER' => 8, 'LANG' => 9, 'SPONSOR' => 10, 'DISCOUNT' => 11, 'REMEMBER_ME_TOKEN' => 12, 'REMEMBER_ME_SERIAL' => 13, 'CREATED_AT' => 14, 'UPDATED_AT' => 15, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'ref' => 1, 'title_id' => 2, 'firstname' => 3, 'lastname' => 4, 'email' => 5, 'password' => 6, 'algo' => 7, 'reseller' => 8, 'lang' => 9, 'sponsor' => 10, 'discount' => 11, 'remember_me_token' => 12, 'remember_me_serial' => 13, 'created_at' => 14, 'updated_at' => 15, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
);
/**
@@ -202,6 +212,8 @@ class CustomerTableMap extends TableMap
$this->addColumn('LANG', 'Lang', 'VARCHAR', false, 10, null);
$this->addColumn('SPONSOR', 'Sponsor', 'VARCHAR', false, 50, null);
$this->addColumn('DISCOUNT', 'Discount', 'FLOAT', false, null, null);
+ $this->addColumn('REMEMBER_ME_TOKEN', 'RememberMeToken', 'VARCHAR', false, 255, null);
+ $this->addColumn('REMEMBER_ME_SERIAL', 'RememberMeSerial', 'VARCHAR', false, 255, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -390,6 +402,8 @@ class CustomerTableMap extends TableMap
$criteria->addSelectColumn(CustomerTableMap::LANG);
$criteria->addSelectColumn(CustomerTableMap::SPONSOR);
$criteria->addSelectColumn(CustomerTableMap::DISCOUNT);
+ $criteria->addSelectColumn(CustomerTableMap::REMEMBER_ME_TOKEN);
+ $criteria->addSelectColumn(CustomerTableMap::REMEMBER_ME_SERIAL);
$criteria->addSelectColumn(CustomerTableMap::CREATED_AT);
$criteria->addSelectColumn(CustomerTableMap::UPDATED_AT);
} else {
@@ -405,6 +419,8 @@ class CustomerTableMap extends TableMap
$criteria->addSelectColumn($alias . '.LANG');
$criteria->addSelectColumn($alias . '.SPONSOR');
$criteria->addSelectColumn($alias . '.DISCOUNT');
+ $criteria->addSelectColumn($alias . '.REMEMBER_ME_TOKEN');
+ $criteria->addSelectColumn($alias . '.REMEMBER_ME_SERIAL');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
diff --git a/core/lib/Thelia/Model/Map/FeatureTableMap.php b/core/lib/Thelia/Model/Map/FeatureTableMap.php
index 76c2fe724..067a242a3 100644
--- a/core/lib/Thelia/Model/Map/FeatureTableMap.php
+++ b/core/lib/Thelia/Model/Map/FeatureTableMap.php
@@ -168,9 +168,9 @@ class FeatureTableMap extends TableMap
{
$this->addRelation('FeatureAv', '\\Thelia\\Model\\FeatureAv', RelationMap::ONE_TO_MANY, array('id' => 'feature_id', ), 'CASCADE', 'RESTRICT', 'FeatureAvs');
$this->addRelation('FeatureProduct', '\\Thelia\\Model\\FeatureProduct', RelationMap::ONE_TO_MANY, array('id' => 'feature_id', ), 'CASCADE', 'RESTRICT', 'FeatureProducts');
- $this->addRelation('FeatureCategory', '\\Thelia\\Model\\FeatureCategory', RelationMap::ONE_TO_MANY, array('id' => 'feature_id', ), 'CASCADE', 'RESTRICT', 'FeatureCategories');
+ $this->addRelation('FeatureTemplate', '\\Thelia\\Model\\FeatureTemplate', RelationMap::ONE_TO_MANY, array('id' => 'feature_id', ), 'CASCADE', 'RESTRICT', 'FeatureTemplates');
$this->addRelation('FeatureI18n', '\\Thelia\\Model\\FeatureI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'FeatureI18ns');
- $this->addRelation('Category', '\\Thelia\\Model\\Category', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Categories');
+ $this->addRelation('Template', '\\Thelia\\Model\\Template', RelationMap::MANY_TO_MANY, array(), null, null, 'Templates');
} // buildRelations()
/**
@@ -195,7 +195,7 @@ class FeatureTableMap extends TableMap
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
FeatureAvTableMap::clearInstancePool();
FeatureProductTableMap::clearInstancePool();
- FeatureCategoryTableMap::clearInstancePool();
+ FeatureTemplateTableMap::clearInstancePool();
FeatureI18nTableMap::clearInstancePool();
}
diff --git a/core/lib/Thelia/Model/Map/FeatureTemplateTableMap.php b/core/lib/Thelia/Model/Map/FeatureTemplateTableMap.php
new file mode 100644
index 000000000..abb1a98b7
--- /dev/null
+++ b/core/lib/Thelia/Model/Map/FeatureTemplateTableMap.php
@@ -0,0 +1,449 @@
+ array('Id', 'FeatureId', 'TemplateId', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'featureId', 'templateId', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(FeatureTemplateTableMap::ID, FeatureTemplateTableMap::FEATURE_ID, FeatureTemplateTableMap::TEMPLATE_ID, FeatureTemplateTableMap::CREATED_AT, FeatureTemplateTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'FEATURE_ID', 'TEMPLATE_ID', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'feature_id', 'template_id', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ self::TYPE_PHPNAME => array('Id' => 0, 'FeatureId' => 1, 'TemplateId' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'featureId' => 1, 'templateId' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
+ self::TYPE_COLNAME => array(FeatureTemplateTableMap::ID => 0, FeatureTemplateTableMap::FEATURE_ID => 1, FeatureTemplateTableMap::TEMPLATE_ID => 2, FeatureTemplateTableMap::CREATED_AT => 3, FeatureTemplateTableMap::UPDATED_AT => 4, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'FEATURE_ID' => 1, 'TEMPLATE_ID' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'feature_id' => 1, 'template_id' => 2, 'created_at' => 3, 'updated_at' => 4, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, )
+ );
+
+ /**
+ * Initialize the table attributes and columns
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('feature_template');
+ $this->setPhpName('FeatureTemplate');
+ $this->setClassName('\\Thelia\\Model\\FeatureTemplate');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(true);
+ $this->setIsCrossRef(true);
+ // columns
+ $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
+ $this->addForeignKey('FEATURE_ID', 'FeatureId', 'INTEGER', 'feature', 'ID', true, null, null);
+ $this->addForeignKey('TEMPLATE_ID', 'TemplateId', 'INTEGER', 'template', 'ID', true, null, null);
+ $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
+ $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Feature', '\\Thelia\\Model\\Feature', RelationMap::MANY_TO_ONE, array('feature_id' => 'id', ), 'CASCADE', 'RESTRICT');
+ $this->addRelation('Template', '\\Thelia\\Model\\Template', RelationMap::MANY_TO_ONE, array('template_id' => 'id', ), null, null);
+ } // 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 ? FeatureTemplateTableMap::CLASS_DEFAULT : FeatureTemplateTableMap::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 (FeatureTemplate object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = FeatureTemplateTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = FeatureTemplateTableMap::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 + FeatureTemplateTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = FeatureTemplateTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ FeatureTemplateTableMap::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 = FeatureTemplateTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = FeatureTemplateTableMap::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;
+ FeatureTemplateTableMap::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(FeatureTemplateTableMap::ID);
+ $criteria->addSelectColumn(FeatureTemplateTableMap::FEATURE_ID);
+ $criteria->addSelectColumn(FeatureTemplateTableMap::TEMPLATE_ID);
+ $criteria->addSelectColumn(FeatureTemplateTableMap::CREATED_AT);
+ $criteria->addSelectColumn(FeatureTemplateTableMap::UPDATED_AT);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.FEATURE_ID');
+ $criteria->addSelectColumn($alias . '.TEMPLATE_ID');
+ $criteria->addSelectColumn($alias . '.CREATED_AT');
+ $criteria->addSelectColumn($alias . '.UPDATED_AT');
+ }
+ }
+
+ /**
+ * Returns the TableMap related to this object.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getServiceContainer()->getDatabaseMap(FeatureTemplateTableMap::DATABASE_NAME)->getTable(FeatureTemplateTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(FeatureTemplateTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(FeatureTemplateTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new FeatureTemplateTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a FeatureTemplate or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or FeatureTemplate 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(FeatureTemplateTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \Thelia\Model\FeatureTemplate) { // 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(FeatureTemplateTableMap::DATABASE_NAME);
+ $criteria->add(FeatureTemplateTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = FeatureTemplateQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { FeatureTemplateTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { FeatureTemplateTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the feature_template 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 FeatureTemplateQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a FeatureTemplate or Criteria object.
+ *
+ * @param mixed $criteria Criteria or FeatureTemplate 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(FeatureTemplateTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from FeatureTemplate object
+ }
+
+ if ($criteria->containsKey(FeatureTemplateTableMap::ID) && $criteria->keyContainsValue(FeatureTemplateTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.FeatureTemplateTableMap::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $query = FeatureTemplateQuery::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;
+ }
+
+} // FeatureTemplateTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+FeatureTemplateTableMap::buildTableMap();
diff --git a/core/lib/Thelia/Model/Map/ProductTableMap.php b/core/lib/Thelia/Model/Map/ProductTableMap.php
index f69f6f702..17c4585f0 100644
--- a/core/lib/Thelia/Model/Map/ProductTableMap.php
+++ b/core/lib/Thelia/Model/Map/ProductTableMap.php
@@ -57,7 +57,7 @@ class ProductTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 10;
+ const NUM_COLUMNS = 11;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class ProductTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 10;
+ const NUM_HYDRATE_COLUMNS = 11;
/**
* the column name for the ID field
@@ -94,6 +94,11 @@ class ProductTableMap extends TableMap
*/
const POSITION = 'product.POSITION';
+ /**
+ * the column name for the TEMPLATE_ID field
+ */
+ const TEMPLATE_ID = 'product.TEMPLATE_ID';
+
/**
* the column name for the CREATED_AT field
*/
@@ -140,12 +145,12 @@ class ProductTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'Ref', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'ref', 'visible', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
- self::TYPE_COLNAME => array(ProductTableMap::ID, ProductTableMap::TAX_RULE_ID, ProductTableMap::REF, ProductTableMap::VISIBLE, ProductTableMap::POSITION, ProductTableMap::CREATED_AT, ProductTableMap::UPDATED_AT, ProductTableMap::VERSION, ProductTableMap::VERSION_CREATED_AT, ProductTableMap::VERSION_CREATED_BY, ),
- self::TYPE_RAW_COLNAME => array('ID', 'TAX_RULE_ID', 'REF', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
- self::TYPE_FIELDNAME => array('id', 'tax_rule_id', 'ref', 'visible', 'position', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
+ self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'Ref', 'Visible', 'Position', 'TemplateId', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'ref', 'visible', 'position', 'templateId', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
+ self::TYPE_COLNAME => array(ProductTableMap::ID, ProductTableMap::TAX_RULE_ID, ProductTableMap::REF, ProductTableMap::VISIBLE, ProductTableMap::POSITION, ProductTableMap::TEMPLATE_ID, ProductTableMap::CREATED_AT, ProductTableMap::UPDATED_AT, ProductTableMap::VERSION, ProductTableMap::VERSION_CREATED_AT, ProductTableMap::VERSION_CREATED_BY, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'TAX_RULE_ID', 'REF', 'VISIBLE', 'POSITION', 'TEMPLATE_ID', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
+ self::TYPE_FIELDNAME => array('id', 'tax_rule_id', 'ref', 'visible', 'position', 'template_id', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
);
/**
@@ -155,12 +160,12 @@ class ProductTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Visible' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, 'Version' => 7, 'VersionCreatedAt' => 8, 'VersionCreatedBy' => 9, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, 'version' => 7, 'versionCreatedAt' => 8, 'versionCreatedBy' => 9, ),
- self::TYPE_COLNAME => array(ProductTableMap::ID => 0, ProductTableMap::TAX_RULE_ID => 1, ProductTableMap::REF => 2, ProductTableMap::VISIBLE => 3, ProductTableMap::POSITION => 4, ProductTableMap::CREATED_AT => 5, ProductTableMap::UPDATED_AT => 6, ProductTableMap::VERSION => 7, ProductTableMap::VERSION_CREATED_AT => 8, ProductTableMap::VERSION_CREATED_BY => 9, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, 'VERSION' => 7, 'VERSION_CREATED_AT' => 8, 'VERSION_CREATED_BY' => 9, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, 'version' => 7, 'version_created_at' => 8, 'version_created_by' => 9, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Visible' => 3, 'Position' => 4, 'TemplateId' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, 'Version' => 8, 'VersionCreatedAt' => 9, 'VersionCreatedBy' => 10, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'templateId' => 5, 'createdAt' => 6, 'updatedAt' => 7, 'version' => 8, 'versionCreatedAt' => 9, 'versionCreatedBy' => 10, ),
+ self::TYPE_COLNAME => array(ProductTableMap::ID => 0, ProductTableMap::TAX_RULE_ID => 1, ProductTableMap::REF => 2, ProductTableMap::VISIBLE => 3, ProductTableMap::POSITION => 4, ProductTableMap::TEMPLATE_ID => 5, ProductTableMap::CREATED_AT => 6, ProductTableMap::UPDATED_AT => 7, ProductTableMap::VERSION => 8, ProductTableMap::VERSION_CREATED_AT => 9, ProductTableMap::VERSION_CREATED_BY => 10, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'TEMPLATE_ID' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, 'VERSION' => 8, 'VERSION_CREATED_AT' => 9, 'VERSION_CREATED_BY' => 10, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'template_id' => 5, 'created_at' => 6, 'updated_at' => 7, 'version' => 8, 'version_created_at' => 9, 'version_created_by' => 10, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
);
/**
@@ -184,6 +189,7 @@ class ProductTableMap extends TableMap
$this->addColumn('REF', 'Ref', 'VARCHAR', true, 255, null);
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0);
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
+ $this->addForeignKey('TEMPLATE_ID', 'TemplateId', 'INTEGER', 'template', 'ID', 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);
@@ -197,6 +203,7 @@ class ProductTableMap extends TableMap
public function buildRelations()
{
$this->addRelation('TaxRule', '\\Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('tax_rule_id' => 'id', ), 'SET NULL', 'RESTRICT');
+ $this->addRelation('Template', '\\Thelia\\Model\\Template', RelationMap::MANY_TO_ONE, array('template_id' => 'id', ), null, null);
$this->addRelation('ProductCategory', '\\Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductCategories');
$this->addRelation('FeatureProduct', '\\Thelia\\Model\\FeatureProduct', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'FeatureProducts');
$this->addRelation('ProductSaleElements', '\\Thelia\\Model\\ProductSaleElements', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductSaleElementss');
@@ -388,6 +395,7 @@ class ProductTableMap extends TableMap
$criteria->addSelectColumn(ProductTableMap::REF);
$criteria->addSelectColumn(ProductTableMap::VISIBLE);
$criteria->addSelectColumn(ProductTableMap::POSITION);
+ $criteria->addSelectColumn(ProductTableMap::TEMPLATE_ID);
$criteria->addSelectColumn(ProductTableMap::CREATED_AT);
$criteria->addSelectColumn(ProductTableMap::UPDATED_AT);
$criteria->addSelectColumn(ProductTableMap::VERSION);
@@ -399,6 +407,7 @@ class ProductTableMap extends TableMap
$criteria->addSelectColumn($alias . '.REF');
$criteria->addSelectColumn($alias . '.VISIBLE');
$criteria->addSelectColumn($alias . '.POSITION');
+ $criteria->addSelectColumn($alias . '.TEMPLATE_ID');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
$criteria->addSelectColumn($alias . '.VERSION');
diff --git a/core/lib/Thelia/Model/Map/ProductVersionTableMap.php b/core/lib/Thelia/Model/Map/ProductVersionTableMap.php
index d3e69b16f..4e84b4db8 100644
--- a/core/lib/Thelia/Model/Map/ProductVersionTableMap.php
+++ b/core/lib/Thelia/Model/Map/ProductVersionTableMap.php
@@ -57,7 +57,7 @@ class ProductVersionTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 10;
+ const NUM_COLUMNS = 11;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class ProductVersionTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 10;
+ const NUM_HYDRATE_COLUMNS = 11;
/**
* the column name for the ID field
@@ -94,6 +94,11 @@ class ProductVersionTableMap extends TableMap
*/
const POSITION = 'product_version.POSITION';
+ /**
+ * the column name for the TEMPLATE_ID field
+ */
+ const TEMPLATE_ID = 'product_version.TEMPLATE_ID';
+
/**
* the column name for the CREATED_AT field
*/
@@ -131,12 +136,12 @@ class ProductVersionTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'Ref', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'ref', 'visible', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
- self::TYPE_COLNAME => array(ProductVersionTableMap::ID, ProductVersionTableMap::TAX_RULE_ID, ProductVersionTableMap::REF, ProductVersionTableMap::VISIBLE, ProductVersionTableMap::POSITION, ProductVersionTableMap::CREATED_AT, ProductVersionTableMap::UPDATED_AT, ProductVersionTableMap::VERSION, ProductVersionTableMap::VERSION_CREATED_AT, ProductVersionTableMap::VERSION_CREATED_BY, ),
- self::TYPE_RAW_COLNAME => array('ID', 'TAX_RULE_ID', 'REF', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
- self::TYPE_FIELDNAME => array('id', 'tax_rule_id', 'ref', 'visible', 'position', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
+ self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'Ref', 'Visible', 'Position', 'TemplateId', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'ref', 'visible', 'position', 'templateId', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
+ self::TYPE_COLNAME => array(ProductVersionTableMap::ID, ProductVersionTableMap::TAX_RULE_ID, ProductVersionTableMap::REF, ProductVersionTableMap::VISIBLE, ProductVersionTableMap::POSITION, ProductVersionTableMap::TEMPLATE_ID, ProductVersionTableMap::CREATED_AT, ProductVersionTableMap::UPDATED_AT, ProductVersionTableMap::VERSION, ProductVersionTableMap::VERSION_CREATED_AT, ProductVersionTableMap::VERSION_CREATED_BY, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'TAX_RULE_ID', 'REF', 'VISIBLE', 'POSITION', 'TEMPLATE_ID', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
+ self::TYPE_FIELDNAME => array('id', 'tax_rule_id', 'ref', 'visible', 'position', 'template_id', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
);
/**
@@ -146,12 +151,12 @@ class ProductVersionTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Visible' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, 'Version' => 7, 'VersionCreatedAt' => 8, 'VersionCreatedBy' => 9, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, 'version' => 7, 'versionCreatedAt' => 8, 'versionCreatedBy' => 9, ),
- self::TYPE_COLNAME => array(ProductVersionTableMap::ID => 0, ProductVersionTableMap::TAX_RULE_ID => 1, ProductVersionTableMap::REF => 2, ProductVersionTableMap::VISIBLE => 3, ProductVersionTableMap::POSITION => 4, ProductVersionTableMap::CREATED_AT => 5, ProductVersionTableMap::UPDATED_AT => 6, ProductVersionTableMap::VERSION => 7, ProductVersionTableMap::VERSION_CREATED_AT => 8, ProductVersionTableMap::VERSION_CREATED_BY => 9, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, 'VERSION' => 7, 'VERSION_CREATED_AT' => 8, 'VERSION_CREATED_BY' => 9, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, 'version' => 7, 'version_created_at' => 8, 'version_created_by' => 9, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Visible' => 3, 'Position' => 4, 'TemplateId' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, 'Version' => 8, 'VersionCreatedAt' => 9, 'VersionCreatedBy' => 10, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'templateId' => 5, 'createdAt' => 6, 'updatedAt' => 7, 'version' => 8, 'versionCreatedAt' => 9, 'versionCreatedBy' => 10, ),
+ self::TYPE_COLNAME => array(ProductVersionTableMap::ID => 0, ProductVersionTableMap::TAX_RULE_ID => 1, ProductVersionTableMap::REF => 2, ProductVersionTableMap::VISIBLE => 3, ProductVersionTableMap::POSITION => 4, ProductVersionTableMap::TEMPLATE_ID => 5, ProductVersionTableMap::CREATED_AT => 6, ProductVersionTableMap::UPDATED_AT => 7, ProductVersionTableMap::VERSION => 8, ProductVersionTableMap::VERSION_CREATED_AT => 9, ProductVersionTableMap::VERSION_CREATED_BY => 10, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'TEMPLATE_ID' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, 'VERSION' => 8, 'VERSION_CREATED_AT' => 9, 'VERSION_CREATED_BY' => 10, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'template_id' => 5, 'created_at' => 6, 'updated_at' => 7, 'version' => 8, 'version_created_at' => 9, 'version_created_by' => 10, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
);
/**
@@ -175,6 +180,7 @@ class ProductVersionTableMap extends TableMap
$this->addColumn('REF', 'Ref', 'VARCHAR', true, 255, null);
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0);
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
+ $this->addColumn('TEMPLATE_ID', 'TemplateId', 'INTEGER', true, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
$this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0);
@@ -257,11 +263,11 @@ class ProductVersionTableMap extends TableMap
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
// If the PK cannot be derived from the row, return NULL.
- if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 7 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) {
+ if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 8 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
- return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 7 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]));
+ return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 8 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]));
}
/**
@@ -382,6 +388,7 @@ class ProductVersionTableMap extends TableMap
$criteria->addSelectColumn(ProductVersionTableMap::REF);
$criteria->addSelectColumn(ProductVersionTableMap::VISIBLE);
$criteria->addSelectColumn(ProductVersionTableMap::POSITION);
+ $criteria->addSelectColumn(ProductVersionTableMap::TEMPLATE_ID);
$criteria->addSelectColumn(ProductVersionTableMap::CREATED_AT);
$criteria->addSelectColumn(ProductVersionTableMap::UPDATED_AT);
$criteria->addSelectColumn(ProductVersionTableMap::VERSION);
@@ -393,6 +400,7 @@ class ProductVersionTableMap extends TableMap
$criteria->addSelectColumn($alias . '.REF');
$criteria->addSelectColumn($alias . '.VISIBLE');
$criteria->addSelectColumn($alias . '.POSITION');
+ $criteria->addSelectColumn($alias . '.TEMPLATE_ID');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
$criteria->addSelectColumn($alias . '.VERSION');
diff --git a/core/lib/Thelia/Model/Map/TemplateI18nTableMap.php b/core/lib/Thelia/Model/Map/TemplateI18nTableMap.php
new file mode 100644
index 000000000..8db2f4fcf
--- /dev/null
+++ b/core/lib/Thelia/Model/Map/TemplateI18nTableMap.php
@@ -0,0 +1,473 @@
+ array('Id', 'Locale', 'Name', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'name', ),
+ self::TYPE_COLNAME => array(TemplateI18nTableMap::ID, TemplateI18nTableMap::LOCALE, TemplateI18nTableMap::NAME, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'NAME', ),
+ self::TYPE_FIELDNAME => array('id', 'locale', 'name', ),
+ self::TYPE_NUM => array(0, 1, 2, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Name' => 2, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'name' => 2, ),
+ self::TYPE_COLNAME => array(TemplateI18nTableMap::ID => 0, TemplateI18nTableMap::LOCALE => 1, TemplateI18nTableMap::NAME => 2, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'NAME' => 2, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'name' => 2, ),
+ self::TYPE_NUM => array(0, 1, 2, )
+ );
+
+ /**
+ * Initialize the table attributes and columns
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('template_i18n');
+ $this->setPhpName('TemplateI18n');
+ $this->setClassName('\\Thelia\\Model\\TemplateI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'template', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
+ $this->addColumn('NAME', 'Name', 'VARCHAR', false, 255, null);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Template', '\\Thelia\\Model\\Template', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by find*()
+ * and findPk*() calls.
+ *
+ * @param \Thelia\Model\TemplateI18n $obj A \Thelia\Model\TemplateI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (null === $key) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ self::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A \Thelia\Model\TemplateI18n object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && null !== $value) {
+ if (is_object($value) && $value instanceof \Thelia\Model\TemplateI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key";
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } elseif ($value instanceof Criteria) {
+ self::$instances = [];
+
+ return;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\TemplateI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
+ throw $e;
+ }
+
+ unset(self::$instances[$key]);
+ }
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row resultset row.
+ * @param int $offset The 0-based offset for reading from the resultset row.
+ * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
+ */
+ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ // If the PK cannot be derived from the row, return NULL.
+ if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row resultset row.
+ * @param int $offset The 0-based offset for reading from the resultset row.
+ * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
+ *
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+
+ return $pks;
+ }
+
+ /**
+ * The class that the tableMap will make instances of.
+ *
+ * If $withPrefix is true, the returned path
+ * uses a dot-path notation which is translated into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @param boolean $withPrefix Whether or not to return the path with the class name
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass($withPrefix = true)
+ {
+ return $withPrefix ? TemplateI18nTableMap::CLASS_DEFAULT : TemplateI18nTableMap::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 (TemplateI18n object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = TemplateI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = TemplateI18nTableMap::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 + TemplateI18nTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = TemplateI18nTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ TemplateI18nTableMap::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 = TemplateI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = TemplateI18nTableMap::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;
+ TemplateI18nTableMap::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(TemplateI18nTableMap::ID);
+ $criteria->addSelectColumn(TemplateI18nTableMap::LOCALE);
+ $criteria->addSelectColumn(TemplateI18nTableMap::NAME);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.NAME');
+ }
+ }
+
+ /**
+ * 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(TemplateI18nTableMap::DATABASE_NAME)->getTable(TemplateI18nTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(TemplateI18nTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(TemplateI18nTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new TemplateI18nTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a TemplateI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or TemplateI18n 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(TemplateI18nTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \Thelia\Model\TemplateI18n) { // 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(TemplateI18nTableMap::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(TemplateI18nTableMap::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(TemplateI18nTableMap::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ }
+ }
+
+ $query = TemplateI18nQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { TemplateI18nTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { TemplateI18nTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the template_i18n table.
+ *
+ * @param ConnectionInterface $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public static function doDeleteAll(ConnectionInterface $con = null)
+ {
+ return TemplateI18nQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a TemplateI18n or Criteria object.
+ *
+ * @param mixed $criteria Criteria or TemplateI18n 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(TemplateI18nTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from TemplateI18n object
+ }
+
+
+ // Set the correct dbName
+ $query = TemplateI18nQuery::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;
+ }
+
+} // TemplateI18nTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+TemplateI18nTableMap::buildTableMap();
diff --git a/core/lib/Thelia/Model/Map/TemplateTableMap.php b/core/lib/Thelia/Model/Map/TemplateTableMap.php
new file mode 100644
index 000000000..f1509cbc7
--- /dev/null
+++ b/core/lib/Thelia/Model/Map/TemplateTableMap.php
@@ -0,0 +1,455 @@
+ array('Id', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(TemplateTableMap::ID, TemplateTableMap::CREATED_AT, TemplateTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ self::TYPE_PHPNAME => array('Id' => 0, 'CreatedAt' => 1, 'UpdatedAt' => 2, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'createdAt' => 1, 'updatedAt' => 2, ),
+ self::TYPE_COLNAME => array(TemplateTableMap::ID => 0, TemplateTableMap::CREATED_AT => 1, TemplateTableMap::UPDATED_AT => 2, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'CREATED_AT' => 1, 'UPDATED_AT' => 2, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'created_at' => 1, 'updated_at' => 2, ),
+ self::TYPE_NUM => array(0, 1, 2, )
+ );
+
+ /**
+ * Initialize the table attributes and columns
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('template');
+ $this->setPhpName('Template');
+ $this->setClassName('\\Thelia\\Model\\Template');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(true);
+ // columns
+ $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
+ $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
+ $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::ONE_TO_MANY, array('id' => 'template_id', ), null, null, 'Products');
+ $this->addRelation('FeatureTemplate', '\\Thelia\\Model\\FeatureTemplate', RelationMap::ONE_TO_MANY, array('id' => 'template_id', ), null, null, 'FeatureTemplates');
+ $this->addRelation('AttributeTemplate', '\\Thelia\\Model\\AttributeTemplate', RelationMap::ONE_TO_MANY, array('id' => 'template_id', ), null, null, 'AttributeTemplates');
+ $this->addRelation('TemplateI18n', '\\Thelia\\Model\\TemplateI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'TemplateI18ns');
+ $this->addRelation('Feature', '\\Thelia\\Model\\Feature', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Features');
+ $this->addRelation('Attribute', '\\Thelia\\Model\\Attribute', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Attributes');
+ } // buildRelations()
+
+ /**
+ *
+ * Gets the list of behaviors registered for this table
+ *
+ * @return array Associative array (name => parameters) of behaviors
+ */
+ public function getBehaviors()
+ {
+ return array(
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'name', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
+ 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
+ );
+ } // getBehaviors()
+ /**
+ * Method to invalidate the instance pool of all tables related to template * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ // Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ TemplateI18nTableMap::clearInstancePool();
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row resultset row.
+ * @param int $offset The 0-based offset for reading from the resultset row.
+ * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
+ */
+ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ // If the PK cannot be derived from the row, return NULL.
+ if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
+ return null;
+ }
+
+ return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row resultset row.
+ * @param int $offset The 0-based offset for reading from the resultset row.
+ * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
+ *
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+
+ return (int) $row[
+ $indexType == TableMap::TYPE_NUM
+ ? 0 + $offset
+ : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
+ ];
+ }
+
+ /**
+ * The class that the tableMap will make instances of.
+ *
+ * If $withPrefix is true, the returned path
+ * uses a dot-path notation which is translated into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @param boolean $withPrefix Whether or not to return the path with the class name
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass($withPrefix = true)
+ {
+ return $withPrefix ? TemplateTableMap::CLASS_DEFAULT : TemplateTableMap::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 (Template object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = TemplateTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = TemplateTableMap::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 + TemplateTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = TemplateTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ TemplateTableMap::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 = TemplateTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = TemplateTableMap::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;
+ TemplateTableMap::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(TemplateTableMap::ID);
+ $criteria->addSelectColumn(TemplateTableMap::CREATED_AT);
+ $criteria->addSelectColumn(TemplateTableMap::UPDATED_AT);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.CREATED_AT');
+ $criteria->addSelectColumn($alias . '.UPDATED_AT');
+ }
+ }
+
+ /**
+ * Returns the TableMap related to this object.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getServiceContainer()->getDatabaseMap(TemplateTableMap::DATABASE_NAME)->getTable(TemplateTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(TemplateTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(TemplateTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new TemplateTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a Template or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or Template 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(TemplateTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \Thelia\Model\Template) { // 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(TemplateTableMap::DATABASE_NAME);
+ $criteria->add(TemplateTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = TemplateQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { TemplateTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { TemplateTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the template 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 TemplateQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a Template or Criteria object.
+ *
+ * @param mixed $criteria Criteria or Template 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(TemplateTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from Template object
+ }
+
+ if ($criteria->containsKey(TemplateTableMap::ID) && $criteria->keyContainsValue(TemplateTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.TemplateTableMap::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $query = TemplateQuery::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;
+ }
+
+} // TemplateTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+TemplateTableMap::buildTableMap();
diff --git a/core/lib/Thelia/Model/Template.php b/core/lib/Thelia/Model/Template.php
new file mode 100644
index 000000000..881187573
--- /dev/null
+++ b/core/lib/Thelia/Model/Template.php
@@ -0,0 +1,68 @@
+dispatchEvent(TheliaEvents::BEFORE_CREATETEMPLATE, new TemplateEvent($this));
+
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function postInsert(ConnectionInterface $con = null)
+ {
+ $this->dispatchEvent(TheliaEvents::AFTER_CREATETEMPLATE, new TemplateEvent($this));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function preUpdate(ConnectionInterface $con = null)
+ {
+ $this->dispatchEvent(TheliaEvents::BEFORE_UPDATETEMPLATE, new TemplateEvent($this));
+
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function postUpdate(ConnectionInterface $con = null)
+ {
+ $this->dispatchEvent(TheliaEvents::AFTER_UPDATETEMPLATE, new TemplateEvent($this));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function preDelete(ConnectionInterface $con = null)
+ {
+ $this->dispatchEvent(TheliaEvents::BEFORE_DELETETEMPLATE, new TemplateEvent($this));
+
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function postDelete(ConnectionInterface $con = null)
+ {
+ $this->dispatchEvent(TheliaEvents::AFTER_DELETETEMPLATE, new TemplateEvent($this));
+ }
+
+}
diff --git a/core/lib/Thelia/Model/TemplateI18n.php b/core/lib/Thelia/Model/TemplateI18n.php
new file mode 100644
index 000000000..19e88f692
--- /dev/null
+++ b/core/lib/Thelia/Model/TemplateI18n.php
@@ -0,0 +1,10 @@
+send();
+
exit;
}
}
diff --git a/install/faker.php b/install/faker.php
index fdcf6212c..f15570e8a 100755
--- a/install/faker.php
+++ b/install/faker.php
@@ -240,6 +240,28 @@ try {
}
}
+ $template = new Thelia\Model\Template();
+ setI18n($faker, $template, array("Name" => 20));
+ $template->save();
+
+ foreach($attributeList as $attributeId => $attributeAvId) {
+ $at = new Thelia\Model\AttributeTemplate();
+
+ $at
+ ->setTemplate($template)
+ ->setAttributeId($attributeId)
+ ->save();
+ }
+
+ foreach($featureList as $featureId => $featureAvId) {
+ $ft = new Thelia\Model\FeatureTemplate();
+
+ $ft
+ ->setTemplate($template)
+ ->setFeatureId($featureId)
+ ->save();
+ }
+
//folders and contents
$contentIdList = array();
for($i=0; $i<4; $i++) {
@@ -296,12 +318,12 @@ try {
$subcategory = createCategory($faker, $category->getId(), $j, $categoryIdList, $contentIdList);
for($k=0; $k{intl l='Attributes'}
+Manage attributes included in this product templates
+ +{intl l='Features'}
+Manage features included in this product templates
+ +