Implemented "Remember Me" feature on admin. Started template management

This commit is contained in:
franck
2013-09-16 09:23:44 +02:00
parent 9cdf1a0376
commit 71c1cee66d
91 changed files with 16722 additions and 3088 deletions

View File

@@ -101,6 +101,18 @@ abstract class Admin implements ActiveRecordInterface
*/
protected $salt;
/**
* 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
@@ -475,6 +487,28 @@ abstract class Admin implements ActiveRecordInterface
return $this->salt;
}
/**
* 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.
*
@@ -662,6 +696,48 @@ abstract class Admin implements ActiveRecordInterface
return $this;
} // setSalt()
/**
* Set the value of [remember_me_token] column.
*
* @param string $v new value
* @return \Thelia\Model\Admin 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[] = AdminTableMap::REMEMBER_ME_TOKEN;
}
return $this;
} // setRememberMeToken()
/**
* Set the value of [remember_me_serial] column.
*
* @param string $v new value
* @return \Thelia\Model\Admin 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[] = AdminTableMap::REMEMBER_ME_SERIAL;
}
return $this;
} // setRememberMeSerial()
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -762,13 +838,19 @@ abstract class Admin implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : AdminTableMap::translateFieldName('Salt', TableMap::TYPE_PHPNAME, $indexType)];
$this->salt = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : AdminTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : AdminTableMap::translateFieldName('RememberMeToken', TableMap::TYPE_PHPNAME, $indexType)];
$this->remember_me_token = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : AdminTableMap::translateFieldName('RememberMeSerial', TableMap::TYPE_PHPNAME, $indexType)];
$this->remember_me_serial = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : AdminTableMap::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 ? 8 + $startcol : AdminTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : AdminTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -781,7 +863,7 @@ abstract class Admin implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 9; // 9 = AdminTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 11; // 11 = AdminTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Admin object", 0, $e);
@@ -1069,6 +1151,12 @@ abstract class Admin implements ActiveRecordInterface
if ($this->isColumnModified(AdminTableMap::SALT)) {
$modifiedColumns[':p' . $index++] = 'SALT';
}
if ($this->isColumnModified(AdminTableMap::REMEMBER_ME_TOKEN)) {
$modifiedColumns[':p' . $index++] = 'REMEMBER_ME_TOKEN';
}
if ($this->isColumnModified(AdminTableMap::REMEMBER_ME_SERIAL)) {
$modifiedColumns[':p' . $index++] = 'REMEMBER_ME_SERIAL';
}
if ($this->isColumnModified(AdminTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -1107,6 +1195,12 @@ abstract class Admin implements ActiveRecordInterface
case 'SALT':
$stmt->bindValue($identifier, $this->salt, 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;
@@ -1197,9 +1291,15 @@ abstract class Admin implements ActiveRecordInterface
return $this->getSalt();
break;
case 7:
return $this->getCreatedAt();
return $this->getRememberMeToken();
break;
case 8:
return $this->getRememberMeSerial();
break;
case 9:
return $this->getCreatedAt();
break;
case 10:
return $this->getUpdatedAt();
break;
default:
@@ -1238,8 +1338,10 @@ abstract class Admin implements ActiveRecordInterface
$keys[4] => $this->getPassword(),
$keys[5] => $this->getAlgo(),
$keys[6] => $this->getSalt(),
$keys[7] => $this->getCreatedAt(),
$keys[8] => $this->getUpdatedAt(),
$keys[7] => $this->getRememberMeToken(),
$keys[8] => $this->getRememberMeSerial(),
$keys[9] => $this->getCreatedAt(),
$keys[10] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn)
@@ -1307,9 +1409,15 @@ abstract class Admin implements ActiveRecordInterface
$this->setSalt($value);
break;
case 7:
$this->setCreatedAt($value);
$this->setRememberMeToken($value);
break;
case 8:
$this->setRememberMeSerial($value);
break;
case 9:
$this->setCreatedAt($value);
break;
case 10:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1343,8 +1451,10 @@ abstract class Admin implements ActiveRecordInterface
if (array_key_exists($keys[4], $arr)) $this->setPassword($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setAlgo($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setSalt($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]);
if (array_key_exists($keys[7], $arr)) $this->setRememberMeToken($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setRememberMeSerial($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setCreatedAt($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setUpdatedAt($arr[$keys[10]]);
}
/**
@@ -1363,6 +1473,8 @@ abstract class Admin implements ActiveRecordInterface
if ($this->isColumnModified(AdminTableMap::PASSWORD)) $criteria->add(AdminTableMap::PASSWORD, $this->password);
if ($this->isColumnModified(AdminTableMap::ALGO)) $criteria->add(AdminTableMap::ALGO, $this->algo);
if ($this->isColumnModified(AdminTableMap::SALT)) $criteria->add(AdminTableMap::SALT, $this->salt);
if ($this->isColumnModified(AdminTableMap::REMEMBER_ME_TOKEN)) $criteria->add(AdminTableMap::REMEMBER_ME_TOKEN, $this->remember_me_token);
if ($this->isColumnModified(AdminTableMap::REMEMBER_ME_SERIAL)) $criteria->add(AdminTableMap::REMEMBER_ME_SERIAL, $this->remember_me_serial);
if ($this->isColumnModified(AdminTableMap::CREATED_AT)) $criteria->add(AdminTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(AdminTableMap::UPDATED_AT)) $criteria->add(AdminTableMap::UPDATED_AT, $this->updated_at);
@@ -1434,6 +1546,8 @@ abstract class Admin implements ActiveRecordInterface
$copyObj->setPassword($this->getPassword());
$copyObj->setAlgo($this->getAlgo());
$copyObj->setSalt($this->getSalt());
$copyObj->setRememberMeToken($this->getRememberMeToken());
$copyObj->setRememberMeSerial($this->getRememberMeSerial());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
@@ -1935,6 +2049,8 @@ abstract class Admin implements ActiveRecordInterface
$this->password = null;
$this->algo = null;
$this->salt = null;
$this->remember_me_token = null;
$this->remember_me_serial = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;

View File

@@ -28,6 +28,8 @@ use Thelia\Model\Map\AdminTableMap;
* @method ChildAdminQuery orderByPassword($order = Criteria::ASC) Order by the password column
* @method ChildAdminQuery orderByAlgo($order = Criteria::ASC) Order by the algo column
* @method ChildAdminQuery orderBySalt($order = Criteria::ASC) Order by the salt column
* @method ChildAdminQuery orderByRememberMeToken($order = Criteria::ASC) Order by the remember_me_token column
* @method ChildAdminQuery orderByRememberMeSerial($order = Criteria::ASC) Order by the remember_me_serial column
* @method ChildAdminQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildAdminQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
@@ -38,6 +40,8 @@ use Thelia\Model\Map\AdminTableMap;
* @method ChildAdminQuery groupByPassword() Group by the password column
* @method ChildAdminQuery groupByAlgo() Group by the algo column
* @method ChildAdminQuery groupBySalt() Group by the salt column
* @method ChildAdminQuery groupByRememberMeToken() Group by the remember_me_token column
* @method ChildAdminQuery groupByRememberMeSerial() Group by the remember_me_serial column
* @method ChildAdminQuery groupByCreatedAt() Group by the created_at column
* @method ChildAdminQuery groupByUpdatedAt() Group by the updated_at column
*
@@ -59,6 +63,8 @@ use Thelia\Model\Map\AdminTableMap;
* @method ChildAdmin findOneByPassword(string $password) Return the first ChildAdmin filtered by the password column
* @method ChildAdmin findOneByAlgo(string $algo) Return the first ChildAdmin filtered by the algo column
* @method ChildAdmin findOneBySalt(string $salt) Return the first ChildAdmin filtered by the salt column
* @method ChildAdmin findOneByRememberMeToken(string $remember_me_token) Return the first ChildAdmin filtered by the remember_me_token column
* @method ChildAdmin findOneByRememberMeSerial(string $remember_me_serial) Return the first ChildAdmin filtered by the remember_me_serial column
* @method ChildAdmin findOneByCreatedAt(string $created_at) Return the first ChildAdmin filtered by the created_at column
* @method ChildAdmin findOneByUpdatedAt(string $updated_at) Return the first ChildAdmin filtered by the updated_at column
*
@@ -69,6 +75,8 @@ use Thelia\Model\Map\AdminTableMap;
* @method array findByPassword(string $password) Return ChildAdmin objects filtered by the password column
* @method array findByAlgo(string $algo) Return ChildAdmin objects filtered by the algo column
* @method array findBySalt(string $salt) Return ChildAdmin objects filtered by the salt column
* @method array findByRememberMeToken(string $remember_me_token) Return ChildAdmin objects filtered by the remember_me_token column
* @method array findByRememberMeSerial(string $remember_me_serial) Return ChildAdmin objects filtered by the remember_me_serial column
* @method array findByCreatedAt(string $created_at) Return ChildAdmin objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildAdmin objects filtered by the updated_at column
*
@@ -159,7 +167,7 @@ abstract class AdminQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, FIRSTNAME, LASTNAME, LOGIN, PASSWORD, ALGO, SALT, CREATED_AT, UPDATED_AT FROM admin WHERE ID = :p0';
$sql = 'SELECT ID, FIRSTNAME, LASTNAME, LOGIN, PASSWORD, ALGO, SALT, REMEMBER_ME_TOKEN, REMEMBER_ME_SERIAL, CREATED_AT, UPDATED_AT FROM admin WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -463,6 +471,64 @@ abstract class AdminQuery extends ModelCriteria
return $this->addUsingAlias(AdminTableMap::SALT, $salt, $comparison);
}
/**
* Filter the query on the remember_me_token column
*
* Example usage:
* <code>
* $query->filterByRememberMeToken('fooValue'); // WHERE remember_me_token = 'fooValue'
* $query->filterByRememberMeToken('%fooValue%'); // WHERE remember_me_token LIKE '%fooValue%'
* </code>
*
* @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:
* <code>
* $query->filterByRememberMeSerial('fooValue'); // WHERE remember_me_serial = 'fooValue'
* $query->filterByRememberMeSerial('%fooValue%'); // WHERE remember_me_serial LIKE '%fooValue%'
* </code>
*
* @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
*

View File

@@ -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;
}
/**

View File

@@ -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();
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,759 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\AttributeTemplate as ChildAttributeTemplate;
use Thelia\Model\AttributeTemplateQuery as ChildAttributeTemplateQuery;
use Thelia\Model\Map\AttributeTemplateTableMap;
/**
* Base class that represents a query for the 'attribute_template' table.
*
*
*
* @method ChildAttributeTemplateQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildAttributeTemplateQuery orderByAttributeId($order = Criteria::ASC) Order by the attribute_id column
* @method ChildAttributeTemplateQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column
* @method ChildAttributeTemplateQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildAttributeTemplateQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildAttributeTemplateQuery groupById() Group by the id column
* @method ChildAttributeTemplateQuery groupByAttributeId() Group by the attribute_id column
* @method ChildAttributeTemplateQuery groupByTemplateId() Group by the template_id column
* @method ChildAttributeTemplateQuery groupByCreatedAt() Group by the created_at column
* @method ChildAttributeTemplateQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildAttributeTemplateQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildAttributeTemplateQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildAttributeTemplateQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildAttributeTemplateQuery leftJoinAttribute($relationAlias = null) Adds a LEFT JOIN clause to the query using the Attribute relation
* @method ChildAttributeTemplateQuery rightJoinAttribute($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Attribute relation
* @method ChildAttributeTemplateQuery innerJoinAttribute($relationAlias = null) Adds a INNER JOIN clause to the query using the Attribute relation
*
* @method ChildAttributeTemplateQuery leftJoinTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the Template relation
* @method ChildAttributeTemplateQuery rightJoinTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Template relation
* @method ChildAttributeTemplateQuery innerJoinTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the Template relation
*
* @method ChildAttributeTemplate findOne(ConnectionInterface $con = null) Return the first ChildAttributeTemplate matching the query
* @method ChildAttributeTemplate findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAttributeTemplate matching the query, or a new ChildAttributeTemplate object populated from the query conditions when no match is found
*
* @method ChildAttributeTemplate findOneById(int $id) Return the first ChildAttributeTemplate filtered by the id column
* @method ChildAttributeTemplate findOneByAttributeId(int $attribute_id) Return the first ChildAttributeTemplate filtered by the attribute_id column
* @method ChildAttributeTemplate findOneByTemplateId(int $template_id) Return the first ChildAttributeTemplate filtered by the template_id column
* @method ChildAttributeTemplate findOneByCreatedAt(string $created_at) Return the first ChildAttributeTemplate filtered by the created_at column
* @method ChildAttributeTemplate findOneByUpdatedAt(string $updated_at) Return the first ChildAttributeTemplate filtered by the updated_at column
*
* @method array findById(int $id) Return ChildAttributeTemplate objects filtered by the id column
* @method array findByAttributeId(int $attribute_id) Return ChildAttributeTemplate objects filtered by the attribute_id column
* @method array findByTemplateId(int $template_id) Return ChildAttributeTemplate objects filtered by the template_id column
* @method array findByCreatedAt(string $created_at) Return ChildAttributeTemplate objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildAttributeTemplate objects filtered by the updated_at column
*
*/
abstract class AttributeTemplateQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\AttributeTemplateQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\AttributeTemplate', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildAttributeTemplateQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildAttributeTemplateQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\AttributeTemplateQuery) {
return $criteria;
}
$query = new \Thelia\Model\AttributeTemplateQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return 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
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return 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:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @param mixed $id The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return 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:
* <code>
* $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
* </code>
*
* @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:
* <code>
* $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
* </code>
*
* @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:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return 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:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return 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

File diff suppressed because it is too large Load Diff

View File

@@ -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
*

View File

@@ -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;

View File

@@ -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:
* <code>
* $query->filterByRememberMeToken('fooValue'); // WHERE remember_me_token = 'fooValue'
* $query->filterByRememberMeToken('%fooValue%'); // WHERE remember_me_token LIKE '%fooValue%'
* </code>
*
* @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:
* <code>
* $query->filterByRememberMeSerial('fooValue'); // WHERE remember_me_serial = 'fooValue'
* $query->filterByRememberMeSerial('%fooValue%'); // WHERE remember_me_serial LIKE '%fooValue%'
* </code>
*
* @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
*

View File

@@ -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;
}
/**

View File

@@ -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();
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,759 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\FeatureTemplate as ChildFeatureTemplate;
use Thelia\Model\FeatureTemplateQuery as ChildFeatureTemplateQuery;
use Thelia\Model\Map\FeatureTemplateTableMap;
/**
* Base class that represents a query for the 'feature_template' table.
*
*
*
* @method ChildFeatureTemplateQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildFeatureTemplateQuery orderByFeatureId($order = Criteria::ASC) Order by the feature_id column
* @method ChildFeatureTemplateQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column
* @method ChildFeatureTemplateQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildFeatureTemplateQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildFeatureTemplateQuery groupById() Group by the id column
* @method ChildFeatureTemplateQuery groupByFeatureId() Group by the feature_id column
* @method ChildFeatureTemplateQuery groupByTemplateId() Group by the template_id column
* @method ChildFeatureTemplateQuery groupByCreatedAt() Group by the created_at column
* @method ChildFeatureTemplateQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildFeatureTemplateQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildFeatureTemplateQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildFeatureTemplateQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildFeatureTemplateQuery leftJoinFeature($relationAlias = null) Adds a LEFT JOIN clause to the query using the Feature relation
* @method ChildFeatureTemplateQuery rightJoinFeature($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Feature relation
* @method ChildFeatureTemplateQuery innerJoinFeature($relationAlias = null) Adds a INNER JOIN clause to the query using the Feature relation
*
* @method ChildFeatureTemplateQuery leftJoinTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the Template relation
* @method ChildFeatureTemplateQuery rightJoinTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Template relation
* @method ChildFeatureTemplateQuery innerJoinTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the Template relation
*
* @method ChildFeatureTemplate findOne(ConnectionInterface $con = null) Return the first ChildFeatureTemplate matching the query
* @method ChildFeatureTemplate findOneOrCreate(ConnectionInterface $con = null) Return the first ChildFeatureTemplate matching the query, or a new ChildFeatureTemplate object populated from the query conditions when no match is found
*
* @method ChildFeatureTemplate findOneById(int $id) Return the first ChildFeatureTemplate filtered by the id column
* @method ChildFeatureTemplate findOneByFeatureId(int $feature_id) Return the first ChildFeatureTemplate filtered by the feature_id column
* @method ChildFeatureTemplate findOneByTemplateId(int $template_id) Return the first ChildFeatureTemplate filtered by the template_id column
* @method ChildFeatureTemplate findOneByCreatedAt(string $created_at) Return the first ChildFeatureTemplate filtered by the created_at column
* @method ChildFeatureTemplate findOneByUpdatedAt(string $updated_at) Return the first ChildFeatureTemplate filtered by the updated_at column
*
* @method array findById(int $id) Return ChildFeatureTemplate objects filtered by the id column
* @method array findByFeatureId(int $feature_id) Return ChildFeatureTemplate objects filtered by the feature_id column
* @method array findByTemplateId(int $template_id) Return ChildFeatureTemplate objects filtered by the template_id column
* @method array findByCreatedAt(string $created_at) Return ChildFeatureTemplate objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildFeatureTemplate objects filtered by the updated_at column
*
*/
abstract class FeatureTemplateQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\FeatureTemplateQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\FeatureTemplate', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildFeatureTemplateQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildFeatureTemplateQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\FeatureTemplateQuery) {
return $criteria;
}
$query = new \Thelia\Model\FeatureTemplateQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return 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
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return 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:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @param mixed $id The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return 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:
* <code>
* $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
* </code>
*
* @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:
* <code>
* $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
* </code>
*
* @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:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return 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:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return 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

View File

@@ -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());

View File

@@ -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:
* <code>
* $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
* </code>
*
* @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
*

View File

@@ -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;

View File

@@ -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:
* <code>
* $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
* </code>
*
* @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
*

View File

@@ -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
*

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,508 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\TemplateI18n as ChildTemplateI18n;
use Thelia\Model\TemplateI18nQuery as ChildTemplateI18nQuery;
use Thelia\Model\Map\TemplateI18nTableMap;
/**
* Base class that represents a query for the 'template_i18n' table.
*
*
*
* @method ChildTemplateI18nQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildTemplateI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildTemplateI18nQuery orderByName($order = Criteria::ASC) Order by the name column
*
* @method ChildTemplateI18nQuery groupById() Group by the id column
* @method ChildTemplateI18nQuery groupByLocale() Group by the locale column
* @method ChildTemplateI18nQuery groupByName() Group by the name column
*
* @method ChildTemplateI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildTemplateI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildTemplateI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildTemplateI18nQuery leftJoinTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the Template relation
* @method ChildTemplateI18nQuery rightJoinTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Template relation
* @method ChildTemplateI18nQuery innerJoinTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the Template relation
*
* @method ChildTemplateI18n findOne(ConnectionInterface $con = null) Return the first ChildTemplateI18n matching the query
* @method ChildTemplateI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildTemplateI18n matching the query, or a new ChildTemplateI18n object populated from the query conditions when no match is found
*
* @method ChildTemplateI18n findOneById(int $id) Return the first ChildTemplateI18n filtered by the id column
* @method ChildTemplateI18n findOneByLocale(string $locale) Return the first ChildTemplateI18n filtered by the locale column
* @method ChildTemplateI18n findOneByName(string $name) Return the first ChildTemplateI18n filtered by the name column
*
* @method array findById(int $id) Return ChildTemplateI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildTemplateI18n objects filtered by the locale column
* @method array findByName(string $name) Return ChildTemplateI18n objects filtered by the name column
*
*/
abstract class TemplateI18nQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\TemplateI18nQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\TemplateI18n', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildTemplateI18nQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildTemplateI18nQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\TemplateI18nQuery) {
return $criteria;
}
$query = new \Thelia\Model\TemplateI18nQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(array(12, 34), $con);
* </code>
*
* @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
* <code>
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return 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:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @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:
* <code>
* $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
* $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
* </code>
*
* @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:
* <code>
* $query->filterByName('fooValue'); // WHERE name = 'fooValue'
* $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
* </code>
*
* @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

View File

@@ -0,0 +1,907 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\Template as ChildTemplate;
use Thelia\Model\TemplateI18nQuery as ChildTemplateI18nQuery;
use Thelia\Model\TemplateQuery as ChildTemplateQuery;
use Thelia\Model\Map\TemplateTableMap;
/**
* Base class that represents a query for the 'template' table.
*
*
*
* @method ChildTemplateQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildTemplateQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildTemplateQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildTemplateQuery groupById() Group by the id column
* @method ChildTemplateQuery groupByCreatedAt() Group by the created_at column
* @method ChildTemplateQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildTemplateQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildTemplateQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildTemplateQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildTemplateQuery leftJoinProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the Product relation
* @method ChildTemplateQuery rightJoinProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Product relation
* @method ChildTemplateQuery innerJoinProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the Product relation
*
* @method ChildTemplateQuery leftJoinFeatureTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureTemplate relation
* @method ChildTemplateQuery rightJoinFeatureTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureTemplate relation
* @method ChildTemplateQuery innerJoinFeatureTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureTemplate relation
*
* @method ChildTemplateQuery leftJoinAttributeTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeTemplate relation
* @method ChildTemplateQuery rightJoinAttributeTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeTemplate relation
* @method ChildTemplateQuery innerJoinAttributeTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeTemplate relation
*
* @method ChildTemplateQuery leftJoinTemplateI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the TemplateI18n relation
* @method ChildTemplateQuery rightJoinTemplateI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TemplateI18n relation
* @method ChildTemplateQuery innerJoinTemplateI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the TemplateI18n relation
*
* @method ChildTemplate findOne(ConnectionInterface $con = null) Return the first ChildTemplate matching the query
* @method ChildTemplate findOneOrCreate(ConnectionInterface $con = null) Return the first ChildTemplate matching the query, or a new ChildTemplate object populated from the query conditions when no match is found
*
* @method ChildTemplate findOneById(int $id) Return the first ChildTemplate filtered by the id column
* @method ChildTemplate findOneByCreatedAt(string $created_at) Return the first ChildTemplate filtered by the created_at column
* @method ChildTemplate findOneByUpdatedAt(string $updated_at) Return the first ChildTemplate filtered by the updated_at column
*
* @method array findById(int $id) Return ChildTemplate objects filtered by the id column
* @method array findByCreatedAt(string $created_at) Return ChildTemplate objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildTemplate objects filtered by the updated_at column
*
*/
abstract class TemplateQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\TemplateQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\Template', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildTemplateQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildTemplateQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\TemplateQuery) {
return $criteria;
}
$query = new \Thelia\Model\TemplateQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return 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
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return 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:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @param mixed $id The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return 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:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return 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:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return 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