Merge with master

This commit is contained in:
touffies
2013-10-24 16:52:03 +02:00
741 changed files with 169402 additions and 4971 deletions

View File

@@ -10,6 +10,7 @@ use Thelia\Core\Security\Role\Role;
use Thelia\Model\Base\Admin as BaseAdmin;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Tools\ModelEventDispatcherTrait;
/**
* Skeleton subclass for representing a row from the 'admin' table.
@@ -24,6 +25,8 @@ use Propel\Runtime\Connection\ConnectionInterface;
*/
class Admin extends BaseAdmin implements UserInterface
{
use ModelEventDispatcherTrait;
public function getPermissions()
{
$profileId = $this->getProfileId();

View File

@@ -95,10 +95,18 @@ abstract class Country implements ActiveRecordInterface
/**
* The value for the by_default field.
* Note: this column has a database default value of: 0
* @var int
*/
protected $by_default;
/**
* The value for the shop_country field.
* Note: this column has a database default value of: false
* @var boolean
*/
protected $shop_country;
/**
* The value for the created_at field.
* @var string
@@ -174,11 +182,25 @@ abstract class Country implements ActiveRecordInterface
*/
protected $countryI18nsScheduledForDeletion = null;
/**
* Applies default values to this object.
* This method should be called from the object's constructor (or
* equivalent initialization method).
* @see __construct()
*/
public function applyDefaultValues()
{
$this->by_default = 0;
$this->shop_country = false;
}
/**
* Initializes internal state of Thelia\Model\Base\Country object.
* @see applyDefaults()
*/
public function __construct()
{
$this->applyDefaultValues();
}
/**
@@ -498,6 +520,17 @@ abstract class Country implements ActiveRecordInterface
return $this->by_default;
}
/**
* Get the [shop_country] column value.
*
* @return boolean
*/
public function getShopCountry()
{
return $this->shop_country;
}
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -668,6 +701,35 @@ abstract class Country implements ActiveRecordInterface
return $this;
} // setByDefault()
/**
* Sets the value of the [shop_country] column.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
*
* @param boolean|integer|string $v The new value
* @return \Thelia\Model\Country The current object (for fluent API support)
*/
public function setShopCountry($v)
{
if ($v !== null) {
if (is_string($v)) {
$v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
} else {
$v = (boolean) $v;
}
}
if ($this->shop_country !== $v) {
$this->shop_country = $v;
$this->modifiedColumns[] = CountryTableMap::SHOP_COUNTRY;
}
return $this;
} // setShopCountry()
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -720,6 +782,14 @@ abstract class Country implements ActiveRecordInterface
*/
public function hasOnlyDefaultValues()
{
if ($this->by_default !== 0) {
return false;
}
if ($this->shop_country !== false) {
return false;
}
// otherwise, everything was equal, so return TRUE
return true;
} // hasOnlyDefaultValues()
@@ -765,13 +835,16 @@ abstract class Country implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CountryTableMap::translateFieldName('ByDefault', TableMap::TYPE_PHPNAME, $indexType)];
$this->by_default = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CountryTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CountryTableMap::translateFieldName('ShopCountry', TableMap::TYPE_PHPNAME, $indexType)];
$this->shop_country = (null !== $col) ? (boolean) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CountryTableMap::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 ? 7 + $startcol : CountryTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CountryTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -784,7 +857,7 @@ abstract class Country implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 8; // 8 = CountryTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 9; // 9 = CountryTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Country object", 0, $e);
@@ -1095,6 +1168,9 @@ abstract class Country implements ActiveRecordInterface
if ($this->isColumnModified(CountryTableMap::BY_DEFAULT)) {
$modifiedColumns[':p' . $index++] = 'BY_DEFAULT';
}
if ($this->isColumnModified(CountryTableMap::SHOP_COUNTRY)) {
$modifiedColumns[':p' . $index++] = 'SHOP_COUNTRY';
}
if ($this->isColumnModified(CountryTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -1130,6 +1206,9 @@ abstract class Country implements ActiveRecordInterface
case 'BY_DEFAULT':
$stmt->bindValue($identifier, $this->by_default, PDO::PARAM_INT);
break;
case 'SHOP_COUNTRY':
$stmt->bindValue($identifier, (int) $this->shop_country, 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;
@@ -1217,9 +1296,12 @@ abstract class Country implements ActiveRecordInterface
return $this->getByDefault();
break;
case 6:
return $this->getCreatedAt();
return $this->getShopCountry();
break;
case 7:
return $this->getCreatedAt();
break;
case 8:
return $this->getUpdatedAt();
break;
default:
@@ -1257,8 +1339,9 @@ abstract class Country implements ActiveRecordInterface
$keys[3] => $this->getIsoalpha2(),
$keys[4] => $this->getIsoalpha3(),
$keys[5] => $this->getByDefault(),
$keys[6] => $this->getCreatedAt(),
$keys[7] => $this->getUpdatedAt(),
$keys[6] => $this->getShopCountry(),
$keys[7] => $this->getCreatedAt(),
$keys[8] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1331,9 +1414,12 @@ abstract class Country implements ActiveRecordInterface
$this->setByDefault($value);
break;
case 6:
$this->setCreatedAt($value);
$this->setShopCountry($value);
break;
case 7:
$this->setCreatedAt($value);
break;
case 8:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1366,8 +1452,9 @@ abstract class Country implements ActiveRecordInterface
if (array_key_exists($keys[3], $arr)) $this->setIsoalpha2($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setIsoalpha3($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setByDefault($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[6], $arr)) $this->setShopCountry($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]]);
}
/**
@@ -1385,6 +1472,7 @@ abstract class Country implements ActiveRecordInterface
if ($this->isColumnModified(CountryTableMap::ISOALPHA2)) $criteria->add(CountryTableMap::ISOALPHA2, $this->isoalpha2);
if ($this->isColumnModified(CountryTableMap::ISOALPHA3)) $criteria->add(CountryTableMap::ISOALPHA3, $this->isoalpha3);
if ($this->isColumnModified(CountryTableMap::BY_DEFAULT)) $criteria->add(CountryTableMap::BY_DEFAULT, $this->by_default);
if ($this->isColumnModified(CountryTableMap::SHOP_COUNTRY)) $criteria->add(CountryTableMap::SHOP_COUNTRY, $this->shop_country);
if ($this->isColumnModified(CountryTableMap::CREATED_AT)) $criteria->add(CountryTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(CountryTableMap::UPDATED_AT)) $criteria->add(CountryTableMap::UPDATED_AT, $this->updated_at);
@@ -1455,6 +1543,7 @@ abstract class Country implements ActiveRecordInterface
$copyObj->setIsoalpha2($this->getIsoalpha2());
$copyObj->setIsoalpha3($this->getIsoalpha3());
$copyObj->setByDefault($this->getByDefault());
$copyObj->setShopCountry($this->getShopCountry());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
@@ -2359,10 +2448,12 @@ abstract class Country implements ActiveRecordInterface
$this->isoalpha2 = null;
$this->isoalpha3 = null;
$this->by_default = null;
$this->shop_country = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;
$this->clearAllReferences();
$this->applyDefaultValues();
$this->resetModified();
$this->setNew(true);
$this->setDeleted(false);

View File

@@ -28,6 +28,7 @@ use Thelia\Model\Map\CountryTableMap;
* @method ChildCountryQuery orderByIsoalpha2($order = Criteria::ASC) Order by the isoalpha2 column
* @method ChildCountryQuery orderByIsoalpha3($order = Criteria::ASC) Order by the isoalpha3 column
* @method ChildCountryQuery orderByByDefault($order = Criteria::ASC) Order by the by_default column
* @method ChildCountryQuery orderByShopCountry($order = Criteria::ASC) Order by the shop_country column
* @method ChildCountryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCountryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
@@ -37,6 +38,7 @@ use Thelia\Model\Map\CountryTableMap;
* @method ChildCountryQuery groupByIsoalpha2() Group by the isoalpha2 column
* @method ChildCountryQuery groupByIsoalpha3() Group by the isoalpha3 column
* @method ChildCountryQuery groupByByDefault() Group by the by_default column
* @method ChildCountryQuery groupByShopCountry() Group by the shop_country column
* @method ChildCountryQuery groupByCreatedAt() Group by the created_at column
* @method ChildCountryQuery groupByUpdatedAt() Group by the updated_at column
*
@@ -69,6 +71,7 @@ use Thelia\Model\Map\CountryTableMap;
* @method ChildCountry findOneByIsoalpha2(string $isoalpha2) Return the first ChildCountry filtered by the isoalpha2 column
* @method ChildCountry findOneByIsoalpha3(string $isoalpha3) Return the first ChildCountry filtered by the isoalpha3 column
* @method ChildCountry findOneByByDefault(int $by_default) Return the first ChildCountry filtered by the by_default column
* @method ChildCountry findOneByShopCountry(boolean $shop_country) Return the first ChildCountry filtered by the shop_country column
* @method ChildCountry findOneByCreatedAt(string $created_at) Return the first ChildCountry filtered by the created_at column
* @method ChildCountry findOneByUpdatedAt(string $updated_at) Return the first ChildCountry filtered by the updated_at column
*
@@ -78,6 +81,7 @@ use Thelia\Model\Map\CountryTableMap;
* @method array findByIsoalpha2(string $isoalpha2) Return ChildCountry objects filtered by the isoalpha2 column
* @method array findByIsoalpha3(string $isoalpha3) Return ChildCountry objects filtered by the isoalpha3 column
* @method array findByByDefault(int $by_default) Return ChildCountry objects filtered by the by_default column
* @method array findByShopCountry(boolean $shop_country) Return ChildCountry objects filtered by the shop_country column
* @method array findByCreatedAt(string $created_at) Return ChildCountry objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCountry objects filtered by the updated_at column
*
@@ -168,7 +172,7 @@ abstract class CountryQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, AREA_ID, ISOCODE, ISOALPHA2, ISOALPHA3, BY_DEFAULT, CREATED_AT, UPDATED_AT FROM country WHERE ID = :p0';
$sql = 'SELECT ID, AREA_ID, ISOCODE, ISOALPHA2, ISOALPHA3, BY_DEFAULT, SHOP_COUNTRY, CREATED_AT, UPDATED_AT FROM country WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -469,6 +473,33 @@ abstract class CountryQuery extends ModelCriteria
return $this->addUsingAlias(CountryTableMap::BY_DEFAULT, $byDefault, $comparison);
}
/**
* Filter the query on the shop_country column
*
* Example usage:
* <code>
* $query->filterByShopCountry(true); // WHERE shop_country = true
* $query->filterByShopCountry('yes'); // WHERE shop_country = true
* </code>
*
* @param boolean|string $shopCountry The value to use as filter.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCountryQuery The current query, for fluid interface
*/
public function filterByShopCountry($shopCountry = null, $comparison = null)
{
if (is_string($shopCountry)) {
$shop_country = in_array(strtolower($shopCountry), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(CountryTableMap::SHOP_COUNTRY, $shopCountry, $comparison);
}
/**
* Filter the query on the created_at column
*

View File

@@ -1008,10 +1008,9 @@ abstract class Currency implements ActiveRecordInterface
if ($this->cartsScheduledForDeletion !== null) {
if (!$this->cartsScheduledForDeletion->isEmpty()) {
foreach ($this->cartsScheduledForDeletion as $cart) {
// need to save related object because we set the relation to null
$cart->save($con);
}
\Thelia\Model\CartQuery::create()
->filterByPrimaryKeys($this->cartsScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->cartsScheduledForDeletion = null;
}
}

View File

@@ -1350,10 +1350,9 @@ abstract class Customer implements ActiveRecordInterface
if ($this->cartsScheduledForDeletion !== null) {
if (!$this->cartsScheduledForDeletion->isEmpty()) {
foreach ($this->cartsScheduledForDeletion as $cart) {
// need to save related object because we set the relation to null
$cart->save($con);
}
\Thelia\Model\CartQuery::create()
->filterByPrimaryKeys($this->cartsScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->cartsScheduledForDeletion = null;
}
}

View File

@@ -2733,7 +2733,10 @@ abstract class Module implements ActiveRecordInterface
$profileModulesToDelete = $this->getProfileModules(new Criteria(), $con)->diff($profileModules);
$this->profileModulesScheduledForDeletion = $profileModulesToDelete;
//since at least one column in the foreign key is at the same time a PK
//we can not just set a PK to NULL in the lines below. We have to store
//a backup of all values, so we are able to manipulate these items based on the onDelete value later.
$this->profileModulesScheduledForDeletion = clone $profileModulesToDelete;
foreach ($profileModulesToDelete as $profileModuleRemoved) {
$profileModuleRemoved->setModule(null);
@@ -2826,7 +2829,7 @@ abstract class Module implements ActiveRecordInterface
$this->profileModulesScheduledForDeletion = clone $this->collProfileModules;
$this->profileModulesScheduledForDeletion->clear();
}
$this->profileModulesScheduledForDeletion[]= $profileModule;
$this->profileModulesScheduledForDeletion[]= clone $profileModule;
$profileModule->setModule(null);
}

View File

@@ -823,7 +823,7 @@ abstract class ModuleQuery extends ModelCriteria
*
* @return ChildModuleQuery The current query, for fluid interface
*/
public function joinProfileModule($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
public function joinProfileModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ProfileModule');
@@ -858,7 +858,7 @@ abstract class ModuleQuery extends ModelCriteria
*
* @return \Thelia\Model\ProfileModuleQuery A secondary query class using the current class as primary query
*/
public function useProfileModuleQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
public function useProfileModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinProfileModule($relationAlias, $joinType)

View File

@@ -2,7 +2,6 @@
namespace Thelia\Model\Base;
use \DateTime;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
@@ -15,8 +14,6 @@ use Propel\Runtime\Exception\BadMethodCallException;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\Newsletter as ChildNewsletter;
use Thelia\Model\NewsletterQuery as ChildNewsletterQuery;
use Thelia\Model\Map\NewsletterTableMap;
@@ -78,24 +75,6 @@ abstract class Newsletter implements ActiveRecordInterface
*/
protected $lastname;
/**
* The value for the locale field.
* @var string
*/
protected $locale;
/**
* The value for the created_at field.
* @var string
*/
protected $created_at;
/**
* The value for the updated_at field.
* @var string
*/
protected $updated_at;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -406,57 +385,6 @@ abstract class Newsletter implements ActiveRecordInterface
return $this->lastname;
}
/**
* Get the [locale] column value.
*
* @return string
*/
public function getLocale()
{
return $this->locale;
}
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw \DateTime object will be returned.
*
* @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
*
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getCreatedAt($format = NULL)
{
if ($format === null) {
return $this->created_at;
} else {
return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null;
}
}
/**
* Get the [optionally formatted] temporal [updated_at] column value.
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw \DateTime object will be returned.
*
* @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
*
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getUpdatedAt($format = NULL)
{
if ($format === null) {
return $this->updated_at;
} else {
return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null;
}
}
/**
* Set the value of [id] column.
*
@@ -541,69 +469,6 @@ abstract class Newsletter implements ActiveRecordInterface
return $this;
} // setLastname()
/**
* Set the value of [locale] column.
*
* @param string $v new value
* @return \Thelia\Model\Newsletter The current object (for fluent API support)
*/
public function setLocale($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->locale !== $v) {
$this->locale = $v;
$this->modifiedColumns[] = NewsletterTableMap::LOCALE;
}
return $this;
} // setLocale()
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
* @param mixed $v string, integer (timestamp), or \DateTime value.
* Empty strings are treated as NULL.
* @return \Thelia\Model\Newsletter The current object (for fluent API support)
*/
public function setCreatedAt($v)
{
$dt = PropelDateTime::newInstance($v, null, '\DateTime');
if ($this->created_at !== null || $dt !== null) {
if ($dt !== $this->created_at) {
$this->created_at = $dt;
$this->modifiedColumns[] = NewsletterTableMap::CREATED_AT;
}
} // if either are not null
return $this;
} // setCreatedAt()
/**
* Sets the value of [updated_at] column to a normalized version of the date/time value specified.
*
* @param mixed $v string, integer (timestamp), or \DateTime value.
* Empty strings are treated as NULL.
* @return \Thelia\Model\Newsletter The current object (for fluent API support)
*/
public function setUpdatedAt($v)
{
$dt = PropelDateTime::newInstance($v, null, '\DateTime');
if ($this->updated_at !== null || $dt !== null) {
if ($dt !== $this->updated_at) {
$this->updated_at = $dt;
$this->modifiedColumns[] = NewsletterTableMap::UPDATED_AT;
}
} // if either are not null
return $this;
} // setUpdatedAt()
/**
* Indicates whether the columns in this object are only set to default values.
*
@@ -652,21 +517,6 @@ abstract class Newsletter implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : NewsletterTableMap::translateFieldName('Lastname', TableMap::TYPE_PHPNAME, $indexType)];
$this->lastname = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : NewsletterTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)];
$this->locale = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : NewsletterTableMap::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 : NewsletterTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$this->resetModified();
$this->setNew(false);
@@ -675,7 +525,7 @@ abstract class Newsletter implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 7; // 7 = NewsletterTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 4; // 4 = NewsletterTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Newsletter object", 0, $e);
@@ -806,19 +656,8 @@ abstract class Newsletter implements ActiveRecordInterface
$ret = $this->preSave($con);
if ($isInsert) {
$ret = $ret && $this->preInsert($con);
// timestampable behavior
if (!$this->isColumnModified(NewsletterTableMap::CREATED_AT)) {
$this->setCreatedAt(time());
}
if (!$this->isColumnModified(NewsletterTableMap::UPDATED_AT)) {
$this->setUpdatedAt(time());
}
} else {
$ret = $ret && $this->preUpdate($con);
// timestampable behavior
if ($this->isModified() && !$this->isColumnModified(NewsletterTableMap::UPDATED_AT)) {
$this->setUpdatedAt(time());
}
}
if ($ret) {
$affectedRows = $this->doSave($con);
@@ -907,15 +746,6 @@ abstract class Newsletter implements ActiveRecordInterface
if ($this->isColumnModified(NewsletterTableMap::LASTNAME)) {
$modifiedColumns[':p' . $index++] = 'LASTNAME';
}
if ($this->isColumnModified(NewsletterTableMap::LOCALE)) {
$modifiedColumns[':p' . $index++] = 'LOCALE';
}
if ($this->isColumnModified(NewsletterTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
if ($this->isColumnModified(NewsletterTableMap::UPDATED_AT)) {
$modifiedColumns[':p' . $index++] = 'UPDATED_AT';
}
$sql = sprintf(
'INSERT INTO newsletter (%s) VALUES (%s)',
@@ -939,15 +769,6 @@ abstract class Newsletter implements ActiveRecordInterface
case 'LASTNAME':
$stmt->bindValue($identifier, $this->lastname, PDO::PARAM_STR);
break;
case 'LOCALE':
$stmt->bindValue($identifier, $this->locale, 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;
case 'UPDATED_AT':
$stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
}
}
$stmt->execute();
@@ -1022,15 +843,6 @@ abstract class Newsletter implements ActiveRecordInterface
case 3:
return $this->getLastname();
break;
case 4:
return $this->getLocale();
break;
case 5:
return $this->getCreatedAt();
break;
case 6:
return $this->getUpdatedAt();
break;
default:
return null;
break;
@@ -1063,9 +875,6 @@ abstract class Newsletter implements ActiveRecordInterface
$keys[1] => $this->getEmail(),
$keys[2] => $this->getFirstname(),
$keys[3] => $this->getLastname(),
$keys[4] => $this->getLocale(),
$keys[5] => $this->getCreatedAt(),
$keys[6] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1117,15 +926,6 @@ abstract class Newsletter implements ActiveRecordInterface
case 3:
$this->setLastname($value);
break;
case 4:
$this->setLocale($value);
break;
case 5:
$this->setCreatedAt($value);
break;
case 6:
$this->setUpdatedAt($value);
break;
} // switch()
}
@@ -1154,9 +954,6 @@ abstract class Newsletter implements ActiveRecordInterface
if (array_key_exists($keys[1], $arr)) $this->setEmail($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setFirstname($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setLastname($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setLocale($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]]);
}
/**
@@ -1172,9 +969,6 @@ abstract class Newsletter implements ActiveRecordInterface
if ($this->isColumnModified(NewsletterTableMap::EMAIL)) $criteria->add(NewsletterTableMap::EMAIL, $this->email);
if ($this->isColumnModified(NewsletterTableMap::FIRSTNAME)) $criteria->add(NewsletterTableMap::FIRSTNAME, $this->firstname);
if ($this->isColumnModified(NewsletterTableMap::LASTNAME)) $criteria->add(NewsletterTableMap::LASTNAME, $this->lastname);
if ($this->isColumnModified(NewsletterTableMap::LOCALE)) $criteria->add(NewsletterTableMap::LOCALE, $this->locale);
if ($this->isColumnModified(NewsletterTableMap::CREATED_AT)) $criteria->add(NewsletterTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(NewsletterTableMap::UPDATED_AT)) $criteria->add(NewsletterTableMap::UPDATED_AT, $this->updated_at);
return $criteria;
}
@@ -1241,9 +1035,6 @@ abstract class Newsletter implements ActiveRecordInterface
$copyObj->setEmail($this->getEmail());
$copyObj->setFirstname($this->getFirstname());
$copyObj->setLastname($this->getLastname());
$copyObj->setLocale($this->getLocale());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) {
$copyObj->setNew(true);
$copyObj->setId(NULL); // this is a auto-increment column, so set to default value
@@ -1281,9 +1072,6 @@ abstract class Newsletter implements ActiveRecordInterface
$this->email = null;
$this->firstname = null;
$this->lastname = null;
$this->locale = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;
$this->clearAllReferences();
$this->resetModified();
@@ -1317,20 +1105,6 @@ abstract class Newsletter implements ActiveRecordInterface
return (string) $this->exportTo(NewsletterTableMap::DEFAULT_STRING_FORMAT);
}
// timestampable behavior
/**
* Mark the current object so that the update date doesn't get updated during next save
*
* @return ChildNewsletter The current object (for fluent API support)
*/
public function keepUpdateDateUnchanged()
{
$this->modifiedColumns[] = NewsletterTableMap::UPDATED_AT;
return $this;
}
/**
* Code to be run before persisting the object
* @param ConnectionInterface $con

View File

@@ -22,17 +22,11 @@ use Thelia\Model\Map\NewsletterTableMap;
* @method ChildNewsletterQuery orderByEmail($order = Criteria::ASC) Order by the email column
* @method ChildNewsletterQuery orderByFirstname($order = Criteria::ASC) Order by the firstname column
* @method ChildNewsletterQuery orderByLastname($order = Criteria::ASC) Order by the lastname column
* @method ChildNewsletterQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildNewsletterQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildNewsletterQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildNewsletterQuery groupById() Group by the id column
* @method ChildNewsletterQuery groupByEmail() Group by the email column
* @method ChildNewsletterQuery groupByFirstname() Group by the firstname column
* @method ChildNewsletterQuery groupByLastname() Group by the lastname column
* @method ChildNewsletterQuery groupByLocale() Group by the locale column
* @method ChildNewsletterQuery groupByCreatedAt() Group by the created_at column
* @method ChildNewsletterQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildNewsletterQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildNewsletterQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@@ -45,17 +39,11 @@ use Thelia\Model\Map\NewsletterTableMap;
* @method ChildNewsletter findOneByEmail(string $email) Return the first ChildNewsletter filtered by the email column
* @method ChildNewsletter findOneByFirstname(string $firstname) Return the first ChildNewsletter filtered by the firstname column
* @method ChildNewsletter findOneByLastname(string $lastname) Return the first ChildNewsletter filtered by the lastname column
* @method ChildNewsletter findOneByLocale(string $locale) Return the first ChildNewsletter filtered by the locale column
* @method ChildNewsletter findOneByCreatedAt(string $created_at) Return the first ChildNewsletter filtered by the created_at column
* @method ChildNewsletter findOneByUpdatedAt(string $updated_at) Return the first ChildNewsletter filtered by the updated_at column
*
* @method array findById(int $id) Return ChildNewsletter objects filtered by the id column
* @method array findByEmail(string $email) Return ChildNewsletter objects filtered by the email column
* @method array findByFirstname(string $firstname) Return ChildNewsletter objects filtered by the firstname column
* @method array findByLastname(string $lastname) Return ChildNewsletter objects filtered by the lastname column
* @method array findByLocale(string $locale) Return ChildNewsletter objects filtered by the locale column
* @method array findByCreatedAt(string $created_at) Return ChildNewsletter objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildNewsletter objects filtered by the updated_at column
*
*/
abstract class NewsletterQuery extends ModelCriteria
@@ -144,7 +132,7 @@ abstract class NewsletterQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, EMAIL, FIRSTNAME, LASTNAME, LOCALE, CREATED_AT, UPDATED_AT FROM newsletter WHERE ID = :p0';
$sql = 'SELECT ID, EMAIL, FIRSTNAME, LASTNAME FROM newsletter WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -361,121 +349,6 @@ abstract class NewsletterQuery extends ModelCriteria
return $this->addUsingAlias(NewsletterTableMap::LASTNAME, $lastname, $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 ChildNewsletterQuery 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(NewsletterTableMap::LOCALE, $locale, $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 ChildNewsletterQuery 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(NewsletterTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(NewsletterTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(NewsletterTableMap::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 ChildNewsletterQuery 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(NewsletterTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(NewsletterTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(NewsletterTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Exclude object from result
*
@@ -567,70 +440,4 @@ abstract class NewsletterQuery extends ModelCriteria
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildNewsletterQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(NewsletterTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildNewsletterQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(NewsletterTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildNewsletterQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(NewsletterTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildNewsletterQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(NewsletterTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildNewsletterQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(NewsletterTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildNewsletterQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(NewsletterTableMap::CREATED_AT);
}
} // NewsletterQuery

View File

@@ -82,6 +82,13 @@ abstract class ProductPrice implements ActiveRecordInterface
*/
protected $promo_price;
/**
* The value for the from_default_currency field.
* Note: this column has a database default value of: false
* @var boolean
*/
protected $from_default_currency;
/**
* The value for the created_at field.
* @var string
@@ -112,11 +119,24 @@ abstract class ProductPrice implements ActiveRecordInterface
*/
protected $alreadyInSave = false;
/**
* Applies default values to this object.
* This method should be called from the object's constructor (or
* equivalent initialization method).
* @see __construct()
*/
public function applyDefaultValues()
{
$this->from_default_currency = false;
}
/**
* Initializes internal state of Thelia\Model\Base\ProductPrice object.
* @see applyDefaults()
*/
public function __construct()
{
$this->applyDefaultValues();
}
/**
@@ -414,6 +434,17 @@ abstract class ProductPrice implements ActiveRecordInterface
return $this->promo_price;
}
/**
* Get the [from_default_currency] column value.
*
* @return boolean
*/
public function getFromDefaultCurrency()
{
return $this->from_default_currency;
}
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -546,6 +577,35 @@ abstract class ProductPrice implements ActiveRecordInterface
return $this;
} // setPromoPrice()
/**
* Sets the value of the [from_default_currency] column.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
*
* @param boolean|integer|string $v The new value
* @return \Thelia\Model\ProductPrice The current object (for fluent API support)
*/
public function setFromDefaultCurrency($v)
{
if ($v !== null) {
if (is_string($v)) {
$v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
} else {
$v = (boolean) $v;
}
}
if ($this->from_default_currency !== $v) {
$this->from_default_currency = $v;
$this->modifiedColumns[] = ProductPriceTableMap::FROM_DEFAULT_CURRENCY;
}
return $this;
} // setFromDefaultCurrency()
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -598,6 +658,10 @@ abstract class ProductPrice implements ActiveRecordInterface
*/
public function hasOnlyDefaultValues()
{
if ($this->from_default_currency !== false) {
return false;
}
// otherwise, everything was equal, so return TRUE
return true;
} // hasOnlyDefaultValues()
@@ -637,13 +701,16 @@ abstract class ProductPrice implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProductPriceTableMap::translateFieldName('PromoPrice', TableMap::TYPE_PHPNAME, $indexType)];
$this->promo_price = (null !== $col) ? (double) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductPriceTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductPriceTableMap::translateFieldName('FromDefaultCurrency', TableMap::TYPE_PHPNAME, $indexType)];
$this->from_default_currency = (null !== $col) ? (boolean) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductPriceTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductPriceTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductPriceTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -656,7 +723,7 @@ abstract class ProductPrice implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 6; // 6 = ProductPriceTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 7; // 7 = ProductPriceTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ProductPrice object", 0, $e);
@@ -911,6 +978,9 @@ abstract class ProductPrice implements ActiveRecordInterface
if ($this->isColumnModified(ProductPriceTableMap::PROMO_PRICE)) {
$modifiedColumns[':p' . $index++] = 'PROMO_PRICE';
}
if ($this->isColumnModified(ProductPriceTableMap::FROM_DEFAULT_CURRENCY)) {
$modifiedColumns[':p' . $index++] = 'FROM_DEFAULT_CURRENCY';
}
if ($this->isColumnModified(ProductPriceTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -940,6 +1010,9 @@ abstract class ProductPrice implements ActiveRecordInterface
case 'PROMO_PRICE':
$stmt->bindValue($identifier, $this->promo_price, PDO::PARAM_STR);
break;
case 'FROM_DEFAULT_CURRENCY':
$stmt->bindValue($identifier, (int) $this->from_default_currency, 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;
@@ -1014,9 +1087,12 @@ abstract class ProductPrice implements ActiveRecordInterface
return $this->getPromoPrice();
break;
case 4:
return $this->getCreatedAt();
return $this->getFromDefaultCurrency();
break;
case 5:
return $this->getCreatedAt();
break;
case 6:
return $this->getUpdatedAt();
break;
default:
@@ -1052,8 +1128,9 @@ abstract class ProductPrice implements ActiveRecordInterface
$keys[1] => $this->getCurrencyId(),
$keys[2] => $this->getPrice(),
$keys[3] => $this->getPromoPrice(),
$keys[4] => $this->getCreatedAt(),
$keys[5] => $this->getUpdatedAt(),
$keys[4] => $this->getFromDefaultCurrency(),
$keys[5] => $this->getCreatedAt(),
$keys[6] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1114,9 +1191,12 @@ abstract class ProductPrice implements ActiveRecordInterface
$this->setPromoPrice($value);
break;
case 4:
$this->setCreatedAt($value);
$this->setFromDefaultCurrency($value);
break;
case 5:
$this->setCreatedAt($value);
break;
case 6:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1147,8 +1227,9 @@ abstract class ProductPrice implements ActiveRecordInterface
if (array_key_exists($keys[1], $arr)) $this->setCurrencyId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setPrice($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setPromoPrice($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
if (array_key_exists($keys[4], $arr)) $this->setFromDefaultCurrency($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]]);
}
/**
@@ -1164,6 +1245,7 @@ abstract class ProductPrice implements ActiveRecordInterface
if ($this->isColumnModified(ProductPriceTableMap::CURRENCY_ID)) $criteria->add(ProductPriceTableMap::CURRENCY_ID, $this->currency_id);
if ($this->isColumnModified(ProductPriceTableMap::PRICE)) $criteria->add(ProductPriceTableMap::PRICE, $this->price);
if ($this->isColumnModified(ProductPriceTableMap::PROMO_PRICE)) $criteria->add(ProductPriceTableMap::PROMO_PRICE, $this->promo_price);
if ($this->isColumnModified(ProductPriceTableMap::FROM_DEFAULT_CURRENCY)) $criteria->add(ProductPriceTableMap::FROM_DEFAULT_CURRENCY, $this->from_default_currency);
if ($this->isColumnModified(ProductPriceTableMap::CREATED_AT)) $criteria->add(ProductPriceTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(ProductPriceTableMap::UPDATED_AT)) $criteria->add(ProductPriceTableMap::UPDATED_AT, $this->updated_at);
@@ -1240,6 +1322,7 @@ abstract class ProductPrice implements ActiveRecordInterface
$copyObj->setCurrencyId($this->getCurrencyId());
$copyObj->setPrice($this->getPrice());
$copyObj->setPromoPrice($this->getPromoPrice());
$copyObj->setFromDefaultCurrency($this->getFromDefaultCurrency());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) {
@@ -1380,10 +1463,12 @@ abstract class ProductPrice implements ActiveRecordInterface
$this->currency_id = null;
$this->price = null;
$this->promo_price = null;
$this->from_default_currency = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;
$this->clearAllReferences();
$this->applyDefaultValues();
$this->resetModified();
$this->setNew(true);
$this->setDeleted(false);

View File

@@ -25,6 +25,7 @@ use Thelia\Model\Map\ProductPriceTableMap;
* @method ChildProductPriceQuery orderByCurrencyId($order = Criteria::ASC) Order by the currency_id column
* @method ChildProductPriceQuery orderByPrice($order = Criteria::ASC) Order by the price column
* @method ChildProductPriceQuery orderByPromoPrice($order = Criteria::ASC) Order by the promo_price column
* @method ChildProductPriceQuery orderByFromDefaultCurrency($order = Criteria::ASC) Order by the from_default_currency column
* @method ChildProductPriceQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildProductPriceQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
@@ -32,6 +33,7 @@ use Thelia\Model\Map\ProductPriceTableMap;
* @method ChildProductPriceQuery groupByCurrencyId() Group by the currency_id column
* @method ChildProductPriceQuery groupByPrice() Group by the price column
* @method ChildProductPriceQuery groupByPromoPrice() Group by the promo_price column
* @method ChildProductPriceQuery groupByFromDefaultCurrency() Group by the from_default_currency column
* @method ChildProductPriceQuery groupByCreatedAt() Group by the created_at column
* @method ChildProductPriceQuery groupByUpdatedAt() Group by the updated_at column
*
@@ -54,6 +56,7 @@ use Thelia\Model\Map\ProductPriceTableMap;
* @method ChildProductPrice findOneByCurrencyId(int $currency_id) Return the first ChildProductPrice filtered by the currency_id column
* @method ChildProductPrice findOneByPrice(double $price) Return the first ChildProductPrice filtered by the price column
* @method ChildProductPrice findOneByPromoPrice(double $promo_price) Return the first ChildProductPrice filtered by the promo_price column
* @method ChildProductPrice findOneByFromDefaultCurrency(boolean $from_default_currency) Return the first ChildProductPrice filtered by the from_default_currency column
* @method ChildProductPrice findOneByCreatedAt(string $created_at) Return the first ChildProductPrice filtered by the created_at column
* @method ChildProductPrice findOneByUpdatedAt(string $updated_at) Return the first ChildProductPrice filtered by the updated_at column
*
@@ -61,6 +64,7 @@ use Thelia\Model\Map\ProductPriceTableMap;
* @method array findByCurrencyId(int $currency_id) Return ChildProductPrice objects filtered by the currency_id column
* @method array findByPrice(double $price) Return ChildProductPrice objects filtered by the price column
* @method array findByPromoPrice(double $promo_price) Return ChildProductPrice objects filtered by the promo_price column
* @method array findByFromDefaultCurrency(boolean $from_default_currency) Return ChildProductPrice objects filtered by the from_default_currency column
* @method array findByCreatedAt(string $created_at) Return ChildProductPrice objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildProductPrice objects filtered by the updated_at column
*
@@ -151,7 +155,7 @@ abstract class ProductPriceQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT PRODUCT_SALE_ELEMENTS_ID, CURRENCY_ID, PRICE, PROMO_PRICE, CREATED_AT, UPDATED_AT FROM product_price WHERE PRODUCT_SALE_ELEMENTS_ID = :p0 AND CURRENCY_ID = :p1';
$sql = 'SELECT PRODUCT_SALE_ELEMENTS_ID, CURRENCY_ID, PRICE, PROMO_PRICE, FROM_DEFAULT_CURRENCY, CREATED_AT, UPDATED_AT FROM product_price WHERE PRODUCT_SALE_ELEMENTS_ID = :p0 AND CURRENCY_ID = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -420,6 +424,33 @@ abstract class ProductPriceQuery extends ModelCriteria
return $this->addUsingAlias(ProductPriceTableMap::PROMO_PRICE, $promoPrice, $comparison);
}
/**
* Filter the query on the from_default_currency column
*
* Example usage:
* <code>
* $query->filterByFromDefaultCurrency(true); // WHERE from_default_currency = true
* $query->filterByFromDefaultCurrency('yes'); // WHERE from_default_currency = true
* </code>
*
* @param boolean|string $fromDefaultCurrency The value to use as filter.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildProductPriceQuery The current query, for fluid interface
*/
public function filterByFromDefaultCurrency($fromDefaultCurrency = null, $comparison = null)
{
if (is_string($fromDefaultCurrency)) {
$from_default_currency = in_array(strtolower($fromDefaultCurrency), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(ProductPriceTableMap::FROM_DEFAULT_CURRENCY, $fromDefaultCurrency, $comparison);
}
/**
* Filter the query on the created_at column
*

View File

@@ -1944,7 +1944,10 @@ abstract class Profile implements ActiveRecordInterface
$profileModulesToDelete = $this->getProfileModules(new Criteria(), $con)->diff($profileModules);
$this->profileModulesScheduledForDeletion = $profileModulesToDelete;
//since at least one column in the foreign key is at the same time a PK
//we can not just set a PK to NULL in the lines below. We have to store
//a backup of all values, so we are able to manipulate these items based on the onDelete value later.
$this->profileModulesScheduledForDeletion = clone $profileModulesToDelete;
foreach ($profileModulesToDelete as $profileModuleRemoved) {
$profileModuleRemoved->setProfile(null);

View File

@@ -58,12 +58,6 @@ abstract class ProfileModule implements ActiveRecordInterface
*/
protected $virtualColumns = array();
/**
* The value for the id field.
* @var int
*/
protected $id;
/**
* The value for the profile_id field.
* @var int
@@ -384,17 +378,6 @@ abstract class ProfileModule implements ActiveRecordInterface
return array_keys(get_object_vars($this));
}
/**
* Get the [id] column value.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Get the [profile_id] column value.
*
@@ -468,27 +451,6 @@ abstract class ProfileModule implements ActiveRecordInterface
}
}
/**
* Set the value of [id] column.
*
* @param int $v new value
* @return \Thelia\Model\ProfileModule The current object (for fluent API support)
*/
public function setId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->id !== $v) {
$this->id = $v;
$this->modifiedColumns[] = ProfileModuleTableMap::ID;
}
return $this;
} // setId()
/**
* Set the value of [profile_id] column.
*
@@ -643,25 +605,22 @@ abstract class ProfileModule implements ActiveRecordInterface
try {
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ProfileModuleTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
$this->id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProfileModuleTableMap::translateFieldName('ProfileId', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ProfileModuleTableMap::translateFieldName('ProfileId', TableMap::TYPE_PHPNAME, $indexType)];
$this->profile_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProfileModuleTableMap::translateFieldName('ModuleId', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProfileModuleTableMap::translateFieldName('ModuleId', TableMap::TYPE_PHPNAME, $indexType)];
$this->module_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProfileModuleTableMap::translateFieldName('Access', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProfileModuleTableMap::translateFieldName('Access', TableMap::TYPE_PHPNAME, $indexType)];
$this->access = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProfileModuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProfileModuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProfileModuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProfileModuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -674,7 +633,7 @@ abstract class ProfileModule implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 6; // 6 = ProfileModuleTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 5; // 5 = ProfileModuleTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ProfileModule object", 0, $e);
@@ -915,15 +874,8 @@ abstract class ProfileModule implements ActiveRecordInterface
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = ProfileModuleTableMap::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . ProfileModuleTableMap::ID . ')');
}
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(ProfileModuleTableMap::ID)) {
$modifiedColumns[':p' . $index++] = 'ID';
}
if ($this->isColumnModified(ProfileModuleTableMap::PROFILE_ID)) {
$modifiedColumns[':p' . $index++] = 'PROFILE_ID';
}
@@ -950,9 +902,6 @@ abstract class ProfileModule implements ActiveRecordInterface
$stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) {
case 'ID':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break;
case 'PROFILE_ID':
$stmt->bindValue($identifier, $this->profile_id, PDO::PARAM_INT);
break;
@@ -976,13 +925,6 @@ abstract class ProfileModule implements ActiveRecordInterface
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
}
try {
$pk = $con->lastInsertId();
} catch (Exception $e) {
throw new PropelException('Unable to get autoincrement id.', 0, $e);
}
$this->setId($pk);
$this->setNew(false);
}
@@ -1031,21 +973,18 @@ abstract class ProfileModule implements ActiveRecordInterface
{
switch ($pos) {
case 0:
return $this->getId();
break;
case 1:
return $this->getProfileId();
break;
case 2:
case 1:
return $this->getModuleId();
break;
case 3:
case 2:
return $this->getAccess();
break;
case 4:
case 3:
return $this->getCreatedAt();
break;
case 5:
case 4:
return $this->getUpdatedAt();
break;
default:
@@ -1071,18 +1010,17 @@ abstract class ProfileModule implements ActiveRecordInterface
*/
public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{
if (isset($alreadyDumpedObjects['ProfileModule'][$this->getPrimaryKey()])) {
if (isset($alreadyDumpedObjects['ProfileModule'][serialize($this->getPrimaryKey())])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['ProfileModule'][$this->getPrimaryKey()] = true;
$alreadyDumpedObjects['ProfileModule'][serialize($this->getPrimaryKey())] = true;
$keys = ProfileModuleTableMap::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getId(),
$keys[1] => $this->getProfileId(),
$keys[2] => $this->getModuleId(),
$keys[3] => $this->getAccess(),
$keys[4] => $this->getCreatedAt(),
$keys[5] => $this->getUpdatedAt(),
$keys[0] => $this->getProfileId(),
$keys[1] => $this->getModuleId(),
$keys[2] => $this->getAccess(),
$keys[3] => $this->getCreatedAt(),
$keys[4] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1131,21 +1069,18 @@ abstract class ProfileModule implements ActiveRecordInterface
{
switch ($pos) {
case 0:
$this->setId($value);
break;
case 1:
$this->setProfileId($value);
break;
case 2:
case 1:
$this->setModuleId($value);
break;
case 3:
case 2:
$this->setAccess($value);
break;
case 4:
case 3:
$this->setCreatedAt($value);
break;
case 5:
case 4:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1172,12 +1107,11 @@ abstract class ProfileModule implements ActiveRecordInterface
{
$keys = ProfileModuleTableMap::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setProfileId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setModuleId($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setAccess($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
if (array_key_exists($keys[0], $arr)) $this->setProfileId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setModuleId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setAccess($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
}
/**
@@ -1189,7 +1123,6 @@ abstract class ProfileModule implements ActiveRecordInterface
{
$criteria = new Criteria(ProfileModuleTableMap::DATABASE_NAME);
if ($this->isColumnModified(ProfileModuleTableMap::ID)) $criteria->add(ProfileModuleTableMap::ID, $this->id);
if ($this->isColumnModified(ProfileModuleTableMap::PROFILE_ID)) $criteria->add(ProfileModuleTableMap::PROFILE_ID, $this->profile_id);
if ($this->isColumnModified(ProfileModuleTableMap::MODULE_ID)) $criteria->add(ProfileModuleTableMap::MODULE_ID, $this->module_id);
if ($this->isColumnModified(ProfileModuleTableMap::ACCESS)) $criteria->add(ProfileModuleTableMap::ACCESS, $this->access);
@@ -1210,29 +1143,36 @@ abstract class ProfileModule implements ActiveRecordInterface
public function buildPkeyCriteria()
{
$criteria = new Criteria(ProfileModuleTableMap::DATABASE_NAME);
$criteria->add(ProfileModuleTableMap::ID, $this->id);
$criteria->add(ProfileModuleTableMap::PROFILE_ID, $this->profile_id);
$criteria->add(ProfileModuleTableMap::MODULE_ID, $this->module_id);
return $criteria;
}
/**
* Returns the primary key for this object (row).
* @return int
* Returns the composite primary key for this object.
* The array elements will be in same order as specified in XML.
* @return array
*/
public function getPrimaryKey()
{
return $this->getId();
$pks = array();
$pks[0] = $this->getProfileId();
$pks[1] = $this->getModuleId();
return $pks;
}
/**
* Generic method to set the primary key (id column).
* Set the [composite] primary key.
*
* @param int $key Primary key.
* @param array $keys The elements of the composite key (order must match the order in XML file).
* @return void
*/
public function setPrimaryKey($key)
public function setPrimaryKey($keys)
{
$this->setId($key);
$this->setProfileId($keys[0]);
$this->setModuleId($keys[1]);
}
/**
@@ -1242,7 +1182,7 @@ abstract class ProfileModule implements ActiveRecordInterface
public function isPrimaryKeyNull()
{
return null === $this->getId();
return (null === $this->getProfileId()) && (null === $this->getModuleId());
}
/**
@@ -1265,7 +1205,6 @@ abstract class ProfileModule implements ActiveRecordInterface
$copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) {
$copyObj->setNew(true);
$copyObj->setId(NULL); // this is a auto-increment column, so set to default value
}
}
@@ -1398,7 +1337,6 @@ abstract class ProfileModule implements ActiveRecordInterface
*/
public function clear()
{
$this->id = null;
$this->profile_id = null;
$this->module_id = null;
$this->access = null;

View File

@@ -21,14 +21,12 @@ use Thelia\Model\Map\ProfileModuleTableMap;
*
*
*
* @method ChildProfileModuleQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildProfileModuleQuery orderByProfileId($order = Criteria::ASC) Order by the profile_id column
* @method ChildProfileModuleQuery orderByModuleId($order = Criteria::ASC) Order by the module_id column
* @method ChildProfileModuleQuery orderByAccess($order = Criteria::ASC) Order by the access column
* @method ChildProfileModuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildProfileModuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildProfileModuleQuery groupById() Group by the id column
* @method ChildProfileModuleQuery groupByProfileId() Group by the profile_id column
* @method ChildProfileModuleQuery groupByModuleId() Group by the module_id column
* @method ChildProfileModuleQuery groupByAccess() Group by the access column
@@ -50,14 +48,12 @@ use Thelia\Model\Map\ProfileModuleTableMap;
* @method ChildProfileModule findOne(ConnectionInterface $con = null) Return the first ChildProfileModule matching the query
* @method ChildProfileModule findOneOrCreate(ConnectionInterface $con = null) Return the first ChildProfileModule matching the query, or a new ChildProfileModule object populated from the query conditions when no match is found
*
* @method ChildProfileModule findOneById(int $id) Return the first ChildProfileModule filtered by the id column
* @method ChildProfileModule findOneByProfileId(int $profile_id) Return the first ChildProfileModule filtered by the profile_id column
* @method ChildProfileModule findOneByModuleId(int $module_id) Return the first ChildProfileModule filtered by the module_id column
* @method ChildProfileModule findOneByAccess(int $access) Return the first ChildProfileModule filtered by the access column
* @method ChildProfileModule findOneByCreatedAt(string $created_at) Return the first ChildProfileModule filtered by the created_at column
* @method ChildProfileModule findOneByUpdatedAt(string $updated_at) Return the first ChildProfileModule filtered by the updated_at column
*
* @method array findById(int $id) Return ChildProfileModule objects filtered by the id column
* @method array findByProfileId(int $profile_id) Return ChildProfileModule objects filtered by the profile_id column
* @method array findByModuleId(int $module_id) Return ChildProfileModule objects filtered by the module_id column
* @method array findByAccess(int $access) Return ChildProfileModule objects filtered by the access column
@@ -110,10 +106,10 @@ abstract class ProfileModuleQuery extends ModelCriteria
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* $obj = $c->findPk(array(12, 34), $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param array[$profile_id, $module_id] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildProfileModule|array|mixed the result, formatted by the current formatter
@@ -123,7 +119,7 @@ abstract class ProfileModuleQuery extends ModelCriteria
if ($key === null) {
return null;
}
if ((null !== ($obj = ProfileModuleTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
if ((null !== ($obj = ProfileModuleTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
@@ -151,10 +147,11 @@ abstract class ProfileModuleQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, PROFILE_ID, MODULE_ID, ACCESS, CREATED_AT, UPDATED_AT FROM profile_module WHERE ID = :p0';
$sql = 'SELECT PROFILE_ID, MODULE_ID, ACCESS, CREATED_AT, UPDATED_AT FROM profile_module WHERE PROFILE_ID = :p0 AND MODULE_ID = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
@@ -164,7 +161,7 @@ abstract class ProfileModuleQuery extends ModelCriteria
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildProfileModule();
$obj->hydrate($row);
ProfileModuleTableMap::addInstanceToPool($obj, (string) $key);
ProfileModuleTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
}
$stmt->closeCursor();
@@ -193,7 +190,7 @@ abstract class ProfileModuleQuery extends ModelCriteria
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* $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
@@ -223,8 +220,10 @@ abstract class ProfileModuleQuery extends ModelCriteria
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(ProfileModuleTableMap::PROFILE_ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(ProfileModuleTableMap::MODULE_ID, $key[1], Criteria::EQUAL);
return $this->addUsingAlias(ProfileModuleTableMap::ID, $key, Criteria::EQUAL);
return $this;
}
/**
@@ -236,49 +235,17 @@ abstract class ProfileModuleQuery extends ModelCriteria
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(ProfileModuleTableMap::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 ChildProfileModuleQuery 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(ProfileModuleTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(ProfileModuleTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
if (empty($keys)) {
return $this->add(null, '1<>1', Criteria::CUSTOM);
}
foreach ($keys as $key) {
$cton0 = $this->getNewCriterion(ProfileModuleTableMap::PROFILE_ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(ProfileModuleTableMap::MODULE_ID, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$this->addOr($cton0);
}
return $this->addUsingAlias(ProfileModuleTableMap::ID, $id, $comparison);
return $this;
}
/**
@@ -602,7 +569,7 @@ abstract class ProfileModuleQuery extends ModelCriteria
*
* @return ChildProfileModuleQuery The current query, for fluid interface
*/
public function joinModule($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
public function joinModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Module');
@@ -637,7 +604,7 @@ abstract class ProfileModuleQuery extends ModelCriteria
*
* @return \Thelia\Model\ModuleQuery A secondary query class using the current class as primary query
*/
public function useModuleQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
public function useModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinModule($relationAlias, $joinType)
@@ -654,7 +621,9 @@ abstract class ProfileModuleQuery extends ModelCriteria
public function prune($profileModule = null)
{
if ($profileModule) {
$this->addUsingAlias(ProfileModuleTableMap::ID, $profileModule->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond0', $this->getAliasedColName(ProfileModuleTableMap::PROFILE_ID), $profileModule->getProfileId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(ProfileModuleTableMap::MODULE_ID), $profileModule->getModuleId(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;

View File

@@ -58,12 +58,6 @@ abstract class ProfileResource implements ActiveRecordInterface
*/
protected $virtualColumns = array();
/**
* The value for the id field.
* @var int
*/
protected $id;
/**
* The value for the profile_id field.
* @var int
@@ -384,17 +378,6 @@ abstract class ProfileResource implements ActiveRecordInterface
return array_keys(get_object_vars($this));
}
/**
* Get the [id] column value.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Get the [profile_id] column value.
*
@@ -468,27 +451,6 @@ abstract class ProfileResource implements ActiveRecordInterface
}
}
/**
* Set the value of [id] column.
*
* @param int $v new value
* @return \Thelia\Model\ProfileResource The current object (for fluent API support)
*/
public function setId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->id !== $v) {
$this->id = $v;
$this->modifiedColumns[] = ProfileResourceTableMap::ID;
}
return $this;
} // setId()
/**
* Set the value of [profile_id] column.
*
@@ -643,25 +605,22 @@ abstract class ProfileResource implements ActiveRecordInterface
try {
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ProfileResourceTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
$this->id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProfileResourceTableMap::translateFieldName('ProfileId', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ProfileResourceTableMap::translateFieldName('ProfileId', TableMap::TYPE_PHPNAME, $indexType)];
$this->profile_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProfileResourceTableMap::translateFieldName('ResourceId', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProfileResourceTableMap::translateFieldName('ResourceId', TableMap::TYPE_PHPNAME, $indexType)];
$this->resource_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProfileResourceTableMap::translateFieldName('Access', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProfileResourceTableMap::translateFieldName('Access', TableMap::TYPE_PHPNAME, $indexType)];
$this->access = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProfileResourceTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProfileResourceTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProfileResourceTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProfileResourceTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -674,7 +633,7 @@ abstract class ProfileResource implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 6; // 6 = ProfileResourceTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 5; // 5 = ProfileResourceTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ProfileResource object", 0, $e);
@@ -915,15 +874,8 @@ abstract class ProfileResource implements ActiveRecordInterface
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = ProfileResourceTableMap::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . ProfileResourceTableMap::ID . ')');
}
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(ProfileResourceTableMap::ID)) {
$modifiedColumns[':p' . $index++] = 'ID';
}
if ($this->isColumnModified(ProfileResourceTableMap::PROFILE_ID)) {
$modifiedColumns[':p' . $index++] = 'PROFILE_ID';
}
@@ -950,9 +902,6 @@ abstract class ProfileResource implements ActiveRecordInterface
$stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) {
case 'ID':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break;
case 'PROFILE_ID':
$stmt->bindValue($identifier, $this->profile_id, PDO::PARAM_INT);
break;
@@ -976,13 +925,6 @@ abstract class ProfileResource implements ActiveRecordInterface
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
}
try {
$pk = $con->lastInsertId();
} catch (Exception $e) {
throw new PropelException('Unable to get autoincrement id.', 0, $e);
}
$this->setId($pk);
$this->setNew(false);
}
@@ -1031,21 +973,18 @@ abstract class ProfileResource implements ActiveRecordInterface
{
switch ($pos) {
case 0:
return $this->getId();
break;
case 1:
return $this->getProfileId();
break;
case 2:
case 1:
return $this->getResourceId();
break;
case 3:
case 2:
return $this->getAccess();
break;
case 4:
case 3:
return $this->getCreatedAt();
break;
case 5:
case 4:
return $this->getUpdatedAt();
break;
default:
@@ -1077,12 +1016,11 @@ abstract class ProfileResource implements ActiveRecordInterface
$alreadyDumpedObjects['ProfileResource'][serialize($this->getPrimaryKey())] = true;
$keys = ProfileResourceTableMap::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getId(),
$keys[1] => $this->getProfileId(),
$keys[2] => $this->getResourceId(),
$keys[3] => $this->getAccess(),
$keys[4] => $this->getCreatedAt(),
$keys[5] => $this->getUpdatedAt(),
$keys[0] => $this->getProfileId(),
$keys[1] => $this->getResourceId(),
$keys[2] => $this->getAccess(),
$keys[3] => $this->getCreatedAt(),
$keys[4] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1131,21 +1069,18 @@ abstract class ProfileResource implements ActiveRecordInterface
{
switch ($pos) {
case 0:
$this->setId($value);
break;
case 1:
$this->setProfileId($value);
break;
case 2:
case 1:
$this->setResourceId($value);
break;
case 3:
case 2:
$this->setAccess($value);
break;
case 4:
case 3:
$this->setCreatedAt($value);
break;
case 5:
case 4:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1172,12 +1107,11 @@ abstract class ProfileResource implements ActiveRecordInterface
{
$keys = ProfileResourceTableMap::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setProfileId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setResourceId($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setAccess($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
if (array_key_exists($keys[0], $arr)) $this->setProfileId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setResourceId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setAccess($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
}
/**
@@ -1189,7 +1123,6 @@ abstract class ProfileResource implements ActiveRecordInterface
{
$criteria = new Criteria(ProfileResourceTableMap::DATABASE_NAME);
if ($this->isColumnModified(ProfileResourceTableMap::ID)) $criteria->add(ProfileResourceTableMap::ID, $this->id);
if ($this->isColumnModified(ProfileResourceTableMap::PROFILE_ID)) $criteria->add(ProfileResourceTableMap::PROFILE_ID, $this->profile_id);
if ($this->isColumnModified(ProfileResourceTableMap::RESOURCE_ID)) $criteria->add(ProfileResourceTableMap::RESOURCE_ID, $this->resource_id);
if ($this->isColumnModified(ProfileResourceTableMap::ACCESS)) $criteria->add(ProfileResourceTableMap::ACCESS, $this->access);
@@ -1210,7 +1143,6 @@ abstract class ProfileResource implements ActiveRecordInterface
public function buildPkeyCriteria()
{
$criteria = new Criteria(ProfileResourceTableMap::DATABASE_NAME);
$criteria->add(ProfileResourceTableMap::ID, $this->id);
$criteria->add(ProfileResourceTableMap::PROFILE_ID, $this->profile_id);
$criteria->add(ProfileResourceTableMap::RESOURCE_ID, $this->resource_id);
@@ -1225,9 +1157,8 @@ abstract class ProfileResource implements ActiveRecordInterface
public function getPrimaryKey()
{
$pks = array();
$pks[0] = $this->getId();
$pks[1] = $this->getProfileId();
$pks[2] = $this->getResourceId();
$pks[0] = $this->getProfileId();
$pks[1] = $this->getResourceId();
return $pks;
}
@@ -1240,9 +1171,8 @@ abstract class ProfileResource implements ActiveRecordInterface
*/
public function setPrimaryKey($keys)
{
$this->setId($keys[0]);
$this->setProfileId($keys[1]);
$this->setResourceId($keys[2]);
$this->setProfileId($keys[0]);
$this->setResourceId($keys[1]);
}
/**
@@ -1252,7 +1182,7 @@ abstract class ProfileResource implements ActiveRecordInterface
public function isPrimaryKeyNull()
{
return (null === $this->getId()) && (null === $this->getProfileId()) && (null === $this->getResourceId());
return (null === $this->getProfileId()) && (null === $this->getResourceId());
}
/**
@@ -1275,7 +1205,6 @@ abstract class ProfileResource implements ActiveRecordInterface
$copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) {
$copyObj->setNew(true);
$copyObj->setId(NULL); // this is a auto-increment column, so set to default value
}
}
@@ -1408,7 +1337,6 @@ abstract class ProfileResource implements ActiveRecordInterface
*/
public function clear()
{
$this->id = null;
$this->profile_id = null;
$this->resource_id = null;
$this->access = null;

View File

@@ -21,14 +21,12 @@ use Thelia\Model\Map\ProfileResourceTableMap;
*
*
*
* @method ChildProfileResourceQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildProfileResourceQuery orderByProfileId($order = Criteria::ASC) Order by the profile_id column
* @method ChildProfileResourceQuery orderByResourceId($order = Criteria::ASC) Order by the resource_id column
* @method ChildProfileResourceQuery orderByAccess($order = Criteria::ASC) Order by the access column
* @method ChildProfileResourceQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildProfileResourceQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildProfileResourceQuery groupById() Group by the id column
* @method ChildProfileResourceQuery groupByProfileId() Group by the profile_id column
* @method ChildProfileResourceQuery groupByResourceId() Group by the resource_id column
* @method ChildProfileResourceQuery groupByAccess() Group by the access column
@@ -50,14 +48,12 @@ use Thelia\Model\Map\ProfileResourceTableMap;
* @method ChildProfileResource findOne(ConnectionInterface $con = null) Return the first ChildProfileResource matching the query
* @method ChildProfileResource findOneOrCreate(ConnectionInterface $con = null) Return the first ChildProfileResource matching the query, or a new ChildProfileResource object populated from the query conditions when no match is found
*
* @method ChildProfileResource findOneById(int $id) Return the first ChildProfileResource filtered by the id column
* @method ChildProfileResource findOneByProfileId(int $profile_id) Return the first ChildProfileResource filtered by the profile_id column
* @method ChildProfileResource findOneByResourceId(int $resource_id) Return the first ChildProfileResource filtered by the resource_id column
* @method ChildProfileResource findOneByAccess(int $access) Return the first ChildProfileResource filtered by the access column
* @method ChildProfileResource findOneByCreatedAt(string $created_at) Return the first ChildProfileResource filtered by the created_at column
* @method ChildProfileResource findOneByUpdatedAt(string $updated_at) Return the first ChildProfileResource filtered by the updated_at column
*
* @method array findById(int $id) Return ChildProfileResource objects filtered by the id column
* @method array findByProfileId(int $profile_id) Return ChildProfileResource objects filtered by the profile_id column
* @method array findByResourceId(int $resource_id) Return ChildProfileResource objects filtered by the resource_id column
* @method array findByAccess(int $access) Return ChildProfileResource objects filtered by the access column
@@ -110,10 +106,10 @@ abstract class ProfileResourceQuery extends ModelCriteria
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(array(12, 34, 56), $con);
* $obj = $c->findPk(array(12, 34), $con);
* </code>
*
* @param array[$id, $profile_id, $resource_id] $key Primary key to use for the query
* @param array[$profile_id, $resource_id] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildProfileResource|array|mixed the result, formatted by the current formatter
@@ -123,7 +119,7 @@ abstract class ProfileResourceQuery extends ModelCriteria
if ($key === null) {
return null;
}
if ((null !== ($obj = ProfileResourceTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1], (string) $key[2]))))) && !$this->formatter) {
if ((null !== ($obj = ProfileResourceTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
@@ -151,12 +147,11 @@ abstract class ProfileResourceQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, PROFILE_ID, RESOURCE_ID, ACCESS, CREATED_AT, UPDATED_AT FROM profile_resource WHERE ID = :p0 AND PROFILE_ID = :p1 AND RESOURCE_ID = :p2';
$sql = 'SELECT PROFILE_ID, RESOURCE_ID, ACCESS, CREATED_AT, UPDATED_AT FROM profile_resource WHERE PROFILE_ID = :p0 AND RESOURCE_ID = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
$stmt->bindValue(':p2', $key[2], PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
@@ -166,7 +161,7 @@ abstract class ProfileResourceQuery extends ModelCriteria
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildProfileResource();
$obj->hydrate($row);
ProfileResourceTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1], (string) $key[2])));
ProfileResourceTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
}
$stmt->closeCursor();
@@ -225,9 +220,8 @@ abstract class ProfileResourceQuery extends ModelCriteria
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(ProfileResourceTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(ProfileResourceTableMap::PROFILE_ID, $key[1], Criteria::EQUAL);
$this->addUsingAlias(ProfileResourceTableMap::RESOURCE_ID, $key[2], Criteria::EQUAL);
$this->addUsingAlias(ProfileResourceTableMap::PROFILE_ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(ProfileResourceTableMap::RESOURCE_ID, $key[1], Criteria::EQUAL);
return $this;
}
@@ -245,58 +239,15 @@ abstract class ProfileResourceQuery extends ModelCriteria
return $this->add(null, '1<>1', Criteria::CUSTOM);
}
foreach ($keys as $key) {
$cton0 = $this->getNewCriterion(ProfileResourceTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(ProfileResourceTableMap::PROFILE_ID, $key[1], Criteria::EQUAL);
$cton0 = $this->getNewCriterion(ProfileResourceTableMap::PROFILE_ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(ProfileResourceTableMap::RESOURCE_ID, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$cton2 = $this->getNewCriterion(ProfileResourceTableMap::RESOURCE_ID, $key[2], Criteria::EQUAL);
$cton0->addAnd($cton2);
$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>
*
* @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 ChildProfileResourceQuery 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(ProfileResourceTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(ProfileResourceTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ProfileResourceTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the profile_id column
*
@@ -670,10 +621,9 @@ abstract class ProfileResourceQuery extends ModelCriteria
public function prune($profileResource = null)
{
if ($profileResource) {
$this->addCond('pruneCond0', $this->getAliasedColName(ProfileResourceTableMap::ID), $profileResource->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(ProfileResourceTableMap::PROFILE_ID), $profileResource->getProfileId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond2', $this->getAliasedColName(ProfileResourceTableMap::RESOURCE_ID), $profileResource->getResourceId(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1', 'pruneCond2'), Criteria::LOGICAL_OR);
$this->addCond('pruneCond0', $this->getAliasedColName(ProfileResourceTableMap::PROFILE_ID), $profileResource->getProfileId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(ProfileResourceTableMap::RESOURCE_ID), $profileResource->getResourceId(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;

View File

@@ -60,14 +60,31 @@ class CartItem extends BaseCartItem
}
}
$this->addQuantity($value);
$this->setQuantity($value);
return $this;
}
public function addQuantity($quantity)
public function addQuantity($value)
{
$this->setQuantity($this->getQuantity() + $quantity);
$currentQuantity = $this->getQuantity();
$newQuantity = $currentQuantity + $value;
if($value <= 0)
{
$value = $currentQuantity;
}
if(ConfigQuery::read("verifyStock", 1) == 1)
{
$productSaleElements = $this->getProductSaleElements();
if($productSaleElements->getQuantity() < $newQuantity) {
$newQuantity = $currentQuantity;
}
}
$this->setQuantity($newQuantity);
return $this;
}

View File

@@ -3,10 +3,15 @@
namespace Thelia\Model;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Propel;
use Thelia\Core\Event\Country\CountryEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\Base\Country as BaseCountry;
use Thelia\Model\Map\CountryTableMap;
use Thelia\Core\Translation\Translator;
class Country extends BaseCountry
{
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
@@ -16,13 +21,25 @@ class Country extends BaseCountry
if($this->getId() === null) {
throw new \RuntimeException("impossible to just uncheck default country, choose a new one");
}
CountryQuery::create()
->filterByByDefault(1)
->update(array('ByDefault' => 0));
$this
->setByDefault(1)
->save();
$con = Propel::getWriteConnection(CountryTableMap::DATABASE_NAME);
$con->beginTransaction();
try {
CountryQuery::create()
->filterByByDefault(1)
->update(array('ByDefault' => 0), $con);
$this
->setByDefault(1)
->save($con);
$con->commit();
} catch(PropelException $e) {
$con->rollBack();
throw $e;
}
}
public function preInsert(ConnectionInterface $con = null)
@@ -64,4 +81,31 @@ class Country extends BaseCountry
$this->dispatchEvent(TheliaEvents::AFTER_DELETECOUNTRY, new CountryEvent($this));
}
/**
* Return the default country
*
* @throws LogicException if no default country is defined
*/
public static function getDefaultCountry() {
$dc = CountryQuery::create()->findOneByByDefault(true);
if ($dc == null)
throw new \LogicException(Translator::getInstance()->trans("Cannot find a default country. Please define one."));
return $dc;
}
/**
* Return the shop country
*
* @throws LogicException if no shop country is defined
*/
public static function getShopLocation() {
$dc = CountryQuery::create()->findOneByShopCountry(true);
if ($dc == null)
throw new \LogicException(Translator::getInstance()->trans("Cannot find the shop country. Please select a shop country."));
return $dc;
}
}

View File

@@ -2,10 +2,18 @@
namespace Thelia\Model;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Propel;
use Thelia\Core\Event\Lang\LangEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\Base\Lang as BaseLang;
use Thelia\Model\Base\LangQuery;
use Thelia\Model\Map\LangTableMap;
class Lang extends BaseLang {
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
/**
* Return the default language object, using a local variable to cache it.
*
@@ -20,4 +28,65 @@ class Lang extends BaseLang {
return $default_lang;
}
public function toggleDefault()
{
if($this->getId() === null) {
throw new \RuntimeException("impossible to just uncheck default language, choose a new one");
}
$con = Propel::getWriteConnection(LangTableMap::DATABASE_NAME);
$con->beginTransaction();
try {
LangQuery::create()
->filterByByDefault(1)
->update(array('ByDefault' => 0), $con);
$this
->setByDefault(1)
->save($con);
$con->commit();
} catch(PropelException $e) {
$con->rollBack();
throw $e;
}
}
public function preInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_CREATELANG, new LangEvent($this));
return true;
}
public function postInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_CREATELANG, new LangEvent($this));
}
public function preUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATELANG, new LangEvent($this));
return true;
}
public function postUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_UPDATELANG, new LangEvent($this));
}
public function preDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_DELETELANG, new LangEvent($this));
return true;
}
public function postDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_DELETELANG, new LangEvent($this));
}
}

View File

@@ -238,8 +238,8 @@ class AddressTableMap extends TableMap
$this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::MANY_TO_ONE, array('customer_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('CustomerTitle', '\\Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('title_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('country_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('CartRelatedByAddressDeliveryId', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'address_delivery_id', ), null, null, 'CartsRelatedByAddressDeliveryId');
$this->addRelation('CartRelatedByAddressInvoiceId', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'address_invoice_id', ), null, null, 'CartsRelatedByAddressInvoiceId');
$this->addRelation('CartRelatedByAddressDeliveryId', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'address_delivery_id', ), 'RESTRICT', 'RESTRICT', 'CartsRelatedByAddressDeliveryId');
$this->addRelation('CartRelatedByAddressInvoiceId', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'address_invoice_id', ), 'RESTRICT', 'RESTRICT', 'CartsRelatedByAddressInvoiceId');
} // buildRelations()
/**

View File

@@ -199,9 +199,9 @@ class CartItemTableMap extends TableMap
*/
public function buildRelations()
{
$this->addRelation('Cart', '\\Thelia\\Model\\Cart', RelationMap::MANY_TO_ONE, array('cart_id' => 'id', ), null, null);
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), null, null);
$this->addRelation('ProductSaleElements', '\\Thelia\\Model\\ProductSaleElements', RelationMap::MANY_TO_ONE, array('product_sale_elements_id' => 'id', ), null, null);
$this->addRelation('Cart', '\\Thelia\\Model\\Cart', RelationMap::MANY_TO_ONE, array('cart_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('ProductSaleElements', '\\Thelia\\Model\\ProductSaleElements', RelationMap::MANY_TO_ONE, array('product_sale_elements_id' => 'id', ), 'CASCADE', 'RESTRICT');
} // buildRelations()
/**

View File

@@ -181,11 +181,11 @@ class CartTableMap extends TableMap
*/
public function buildRelations()
{
$this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::MANY_TO_ONE, array('customer_id' => 'id', ), null, null);
$this->addRelation('AddressRelatedByAddressDeliveryId', '\\Thelia\\Model\\Address', RelationMap::MANY_TO_ONE, array('address_delivery_id' => 'id', ), null, null);
$this->addRelation('AddressRelatedByAddressInvoiceId', '\\Thelia\\Model\\Address', RelationMap::MANY_TO_ONE, array('address_invoice_id' => 'id', ), null, null);
$this->addRelation('Currency', '\\Thelia\\Model\\Currency', RelationMap::MANY_TO_ONE, array('currency_id' => 'id', ), null, null);
$this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'cart_id', ), null, null, 'CartItems');
$this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::MANY_TO_ONE, array('customer_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('AddressRelatedByAddressDeliveryId', '\\Thelia\\Model\\Address', RelationMap::MANY_TO_ONE, array('address_delivery_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('AddressRelatedByAddressInvoiceId', '\\Thelia\\Model\\Address', RelationMap::MANY_TO_ONE, array('address_invoice_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('Currency', '\\Thelia\\Model\\Currency', RelationMap::MANY_TO_ONE, array('currency_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'cart_id', ), 'CASCADE', 'RESTRICT', 'CartItems');
} // buildRelations()
/**
@@ -200,6 +200,15 @@ class CartTableMap extends TableMap
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
);
} // getBehaviors()
/**
* Method to invalidate the instance pool of all tables related to cart * by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CartItemTableMap::clearInstancePool();
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.

View File

@@ -57,7 +57,7 @@ class CountryTableMap extends TableMap
/**
* The total number of columns
*/
const NUM_COLUMNS = 8;
const NUM_COLUMNS = 9;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class CountryTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 8;
const NUM_HYDRATE_COLUMNS = 9;
/**
* the column name for the ID field
@@ -99,6 +99,11 @@ class CountryTableMap extends TableMap
*/
const BY_DEFAULT = 'country.BY_DEFAULT';
/**
* the column name for the SHOP_COUNTRY field
*/
const SHOP_COUNTRY = 'country.SHOP_COUNTRY';
/**
* the column name for the CREATED_AT field
*/
@@ -130,12 +135,12 @@ class CountryTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'AreaId', 'Isocode', 'Isoalpha2', 'Isoalpha3', 'ByDefault', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'isocode', 'isoalpha2', 'isoalpha3', 'byDefault', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(CountryTableMap::ID, CountryTableMap::AREA_ID, CountryTableMap::ISOCODE, CountryTableMap::ISOALPHA2, CountryTableMap::ISOALPHA3, CountryTableMap::BY_DEFAULT, CountryTableMap::CREATED_AT, CountryTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'ISOCODE', 'ISOALPHA2', 'ISOALPHA3', 'BY_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'area_id', 'isocode', 'isoalpha2', 'isoalpha3', 'by_default', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
self::TYPE_PHPNAME => array('Id', 'AreaId', 'Isocode', 'Isoalpha2', 'Isoalpha3', 'ByDefault', 'ShopCountry', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'isocode', 'isoalpha2', 'isoalpha3', 'byDefault', 'shopCountry', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(CountryTableMap::ID, CountryTableMap::AREA_ID, CountryTableMap::ISOCODE, CountryTableMap::ISOALPHA2, CountryTableMap::ISOALPHA3, CountryTableMap::BY_DEFAULT, CountryTableMap::SHOP_COUNTRY, CountryTableMap::CREATED_AT, CountryTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'ISOCODE', 'ISOALPHA2', 'ISOALPHA3', 'BY_DEFAULT', 'SHOP_COUNTRY', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'area_id', 'isocode', 'isoalpha2', 'isoalpha3', 'by_default', 'shop_country', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
@@ -145,12 +150,12 @@ class CountryTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'AreaId' => 1, 'Isocode' => 2, 'Isoalpha2' => 3, 'Isoalpha3' => 4, 'ByDefault' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'isocode' => 2, 'isoalpha2' => 3, 'isoalpha3' => 4, 'byDefault' => 5, 'createdAt' => 6, 'updatedAt' => 7, ),
self::TYPE_COLNAME => array(CountryTableMap::ID => 0, CountryTableMap::AREA_ID => 1, CountryTableMap::ISOCODE => 2, CountryTableMap::ISOALPHA2 => 3, CountryTableMap::ISOALPHA3 => 4, CountryTableMap::BY_DEFAULT => 5, CountryTableMap::CREATED_AT => 6, CountryTableMap::UPDATED_AT => 7, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'ISOCODE' => 2, 'ISOALPHA2' => 3, 'ISOALPHA3' => 4, 'BY_DEFAULT' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ),
self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'isocode' => 2, 'isoalpha2' => 3, 'isoalpha3' => 4, 'by_default' => 5, 'created_at' => 6, 'updated_at' => 7, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
self::TYPE_PHPNAME => array('Id' => 0, 'AreaId' => 1, 'Isocode' => 2, 'Isoalpha2' => 3, 'Isoalpha3' => 4, 'ByDefault' => 5, 'ShopCountry' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'isocode' => 2, 'isoalpha2' => 3, 'isoalpha3' => 4, 'byDefault' => 5, 'shopCountry' => 6, 'createdAt' => 7, 'updatedAt' => 8, ),
self::TYPE_COLNAME => array(CountryTableMap::ID => 0, CountryTableMap::AREA_ID => 1, CountryTableMap::ISOCODE => 2, CountryTableMap::ISOALPHA2 => 3, CountryTableMap::ISOALPHA3 => 4, CountryTableMap::BY_DEFAULT => 5, CountryTableMap::SHOP_COUNTRY => 6, CountryTableMap::CREATED_AT => 7, CountryTableMap::UPDATED_AT => 8, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'ISOCODE' => 2, 'ISOALPHA2' => 3, 'ISOALPHA3' => 4, 'BY_DEFAULT' => 5, 'SHOP_COUNTRY' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ),
self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'isocode' => 2, 'isoalpha2' => 3, 'isoalpha3' => 4, 'by_default' => 5, 'shop_country' => 6, 'created_at' => 7, 'updated_at' => 8, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
@@ -174,7 +179,8 @@ class CountryTableMap extends TableMap
$this->addColumn('ISOCODE', 'Isocode', 'VARCHAR', true, 4, null);
$this->addColumn('ISOALPHA2', 'Isoalpha2', 'VARCHAR', false, 2, null);
$this->addColumn('ISOALPHA3', 'Isoalpha3', 'VARCHAR', false, 4, null);
$this->addColumn('BY_DEFAULT', 'ByDefault', 'TINYINT', false, null, null);
$this->addColumn('BY_DEFAULT', 'ByDefault', 'TINYINT', false, null, 0);
$this->addColumn('SHOP_COUNTRY', 'ShopCountry', 'BOOLEAN', true, 1, false);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -358,6 +364,7 @@ class CountryTableMap extends TableMap
$criteria->addSelectColumn(CountryTableMap::ISOALPHA2);
$criteria->addSelectColumn(CountryTableMap::ISOALPHA3);
$criteria->addSelectColumn(CountryTableMap::BY_DEFAULT);
$criteria->addSelectColumn(CountryTableMap::SHOP_COUNTRY);
$criteria->addSelectColumn(CountryTableMap::CREATED_AT);
$criteria->addSelectColumn(CountryTableMap::UPDATED_AT);
} else {
@@ -367,6 +374,7 @@ class CountryTableMap extends TableMap
$criteria->addSelectColumn($alias . '.ISOALPHA2');
$criteria->addSelectColumn($alias . '.ISOALPHA3');
$criteria->addSelectColumn($alias . '.BY_DEFAULT');
$criteria->addSelectColumn($alias . '.SHOP_COUNTRY');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}

View File

@@ -185,7 +185,7 @@ class CurrencyTableMap extends TableMap
public function buildRelations()
{
$this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'currency_id', ), 'RESTRICT', 'RESTRICT', 'Orders');
$this->addRelation('Cart', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'currency_id', ), null, null, 'Carts');
$this->addRelation('Cart', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'currency_id', ), 'CASCADE', 'RESTRICT', 'Carts');
$this->addRelation('ProductPrice', '\\Thelia\\Model\\ProductPrice', RelationMap::ONE_TO_MANY, array('id' => 'currency_id', ), 'CASCADE', null, 'ProductPrices');
$this->addRelation('CurrencyI18n', '\\Thelia\\Model\\CurrencyI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CurrencyI18ns');
} // buildRelations()
@@ -210,6 +210,7 @@ class CurrencyTableMap extends TableMap
{
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CartTableMap::clearInstancePool();
ProductPriceTableMap::clearInstancePool();
CurrencyI18nTableMap::clearInstancePool();
}

View File

@@ -226,7 +226,7 @@ class CustomerTableMap extends TableMap
$this->addRelation('CustomerTitle', '\\Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('title_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('Address', '\\Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', 'RESTRICT', 'Addresses');
$this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'RESTRICT', 'RESTRICT', 'Orders');
$this->addRelation('Cart', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), null, null, 'Carts');
$this->addRelation('Cart', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', 'RESTRICT', 'Carts');
} // buildRelations()
/**
@@ -249,6 +249,7 @@ class CustomerTableMap extends TableMap
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AddressTableMap::clearInstancePool();
CartTableMap::clearInstancePool();
}
/**

View File

@@ -57,7 +57,7 @@ class NewsletterTableMap extends TableMap
/**
* The total number of columns
*/
const NUM_COLUMNS = 7;
const NUM_COLUMNS = 4;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class NewsletterTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 7;
const NUM_HYDRATE_COLUMNS = 4;
/**
* the column name for the ID field
@@ -89,21 +89,6 @@ class NewsletterTableMap extends TableMap
*/
const LASTNAME = 'newsletter.LASTNAME';
/**
* the column name for the LOCALE field
*/
const LOCALE = 'newsletter.LOCALE';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'newsletter.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'newsletter.UPDATED_AT';
/**
* The default string format for model objects of the related table
*/
@@ -116,12 +101,12 @@ class NewsletterTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Email', 'Firstname', 'Lastname', 'Locale', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'email', 'firstname', 'lastname', 'locale', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(NewsletterTableMap::ID, NewsletterTableMap::EMAIL, NewsletterTableMap::FIRSTNAME, NewsletterTableMap::LASTNAME, NewsletterTableMap::LOCALE, NewsletterTableMap::CREATED_AT, NewsletterTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'EMAIL', 'FIRSTNAME', 'LASTNAME', 'LOCALE', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'email', 'firstname', 'lastname', 'locale', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
self::TYPE_PHPNAME => array('Id', 'Email', 'Firstname', 'Lastname', ),
self::TYPE_STUDLYPHPNAME => array('id', 'email', 'firstname', 'lastname', ),
self::TYPE_COLNAME => array(NewsletterTableMap::ID, NewsletterTableMap::EMAIL, NewsletterTableMap::FIRSTNAME, NewsletterTableMap::LASTNAME, ),
self::TYPE_RAW_COLNAME => array('ID', 'EMAIL', 'FIRSTNAME', 'LASTNAME', ),
self::TYPE_FIELDNAME => array('id', 'email', 'firstname', 'lastname', ),
self::TYPE_NUM => array(0, 1, 2, 3, )
);
/**
@@ -131,12 +116,12 @@ class NewsletterTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Email' => 1, 'Firstname' => 2, 'Lastname' => 3, 'Locale' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, 'locale' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
self::TYPE_COLNAME => array(NewsletterTableMap::ID => 0, NewsletterTableMap::EMAIL => 1, NewsletterTableMap::FIRSTNAME => 2, NewsletterTableMap::LASTNAME => 3, NewsletterTableMap::LOCALE => 4, NewsletterTableMap::CREATED_AT => 5, NewsletterTableMap::UPDATED_AT => 6, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'EMAIL' => 1, 'FIRSTNAME' => 2, 'LASTNAME' => 3, 'LOCALE' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
self::TYPE_FIELDNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, 'locale' => 4, 'created_at' => 5, 'updated_at' => 6, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
self::TYPE_PHPNAME => array('Id' => 0, 'Email' => 1, 'Firstname' => 2, 'Lastname' => 3, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, ),
self::TYPE_COLNAME => array(NewsletterTableMap::ID => 0, NewsletterTableMap::EMAIL => 1, NewsletterTableMap::FIRSTNAME => 2, NewsletterTableMap::LASTNAME => 3, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'EMAIL' => 1, 'FIRSTNAME' => 2, 'LASTNAME' => 3, ),
self::TYPE_FIELDNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, ),
self::TYPE_NUM => array(0, 1, 2, 3, )
);
/**
@@ -159,9 +144,6 @@ class NewsletterTableMap extends TableMap
$this->addColumn('EMAIL', 'Email', 'VARCHAR', true, 255, null);
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', false, 255, null);
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', false, 255, null);
$this->addColumn('LOCALE', 'Locale', 'VARCHAR', false, 45, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
/**
@@ -171,19 +153,6 @@ class NewsletterTableMap extends TableMap
{
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
);
} // getBehaviors()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
@@ -326,17 +295,11 @@ class NewsletterTableMap extends TableMap
$criteria->addSelectColumn(NewsletterTableMap::EMAIL);
$criteria->addSelectColumn(NewsletterTableMap::FIRSTNAME);
$criteria->addSelectColumn(NewsletterTableMap::LASTNAME);
$criteria->addSelectColumn(NewsletterTableMap::LOCALE);
$criteria->addSelectColumn(NewsletterTableMap::CREATED_AT);
$criteria->addSelectColumn(NewsletterTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.EMAIL');
$criteria->addSelectColumn($alias . '.FIRSTNAME');
$criteria->addSelectColumn($alias . '.LASTNAME');
$criteria->addSelectColumn($alias . '.LOCALE');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}

View File

@@ -57,7 +57,7 @@ class ProductPriceTableMap extends TableMap
/**
* The total number of columns
*/
const NUM_COLUMNS = 6;
const NUM_COLUMNS = 7;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class ProductPriceTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 6;
const NUM_HYDRATE_COLUMNS = 7;
/**
* the column name for the PRODUCT_SALE_ELEMENTS_ID field
@@ -89,6 +89,11 @@ class ProductPriceTableMap extends TableMap
*/
const PROMO_PRICE = 'product_price.PROMO_PRICE';
/**
* the column name for the FROM_DEFAULT_CURRENCY field
*/
const FROM_DEFAULT_CURRENCY = 'product_price.FROM_DEFAULT_CURRENCY';
/**
* the column name for the CREATED_AT field
*/
@@ -111,12 +116,12 @@ class ProductPriceTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('ProductSaleElementsId', 'CurrencyId', 'Price', 'PromoPrice', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('productSaleElementsId', 'currencyId', 'price', 'promoPrice', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID, ProductPriceTableMap::CURRENCY_ID, ProductPriceTableMap::PRICE, ProductPriceTableMap::PROMO_PRICE, ProductPriceTableMap::CREATED_AT, ProductPriceTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('PRODUCT_SALE_ELEMENTS_ID', 'CURRENCY_ID', 'PRICE', 'PROMO_PRICE', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('product_sale_elements_id', 'currency_id', 'price', 'promo_price', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
self::TYPE_PHPNAME => array('ProductSaleElementsId', 'CurrencyId', 'Price', 'PromoPrice', 'FromDefaultCurrency', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('productSaleElementsId', 'currencyId', 'price', 'promoPrice', 'fromDefaultCurrency', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID, ProductPriceTableMap::CURRENCY_ID, ProductPriceTableMap::PRICE, ProductPriceTableMap::PROMO_PRICE, ProductPriceTableMap::FROM_DEFAULT_CURRENCY, ProductPriceTableMap::CREATED_AT, ProductPriceTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('PRODUCT_SALE_ELEMENTS_ID', 'CURRENCY_ID', 'PRICE', 'PROMO_PRICE', 'FROM_DEFAULT_CURRENCY', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('product_sale_elements_id', 'currency_id', 'price', 'promo_price', 'from_default_currency', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
);
/**
@@ -126,12 +131,12 @@ class ProductPriceTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('ProductSaleElementsId' => 0, 'CurrencyId' => 1, 'Price' => 2, 'PromoPrice' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
self::TYPE_STUDLYPHPNAME => array('productSaleElementsId' => 0, 'currencyId' => 1, 'price' => 2, 'promoPrice' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
self::TYPE_COLNAME => array(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID => 0, ProductPriceTableMap::CURRENCY_ID => 1, ProductPriceTableMap::PRICE => 2, ProductPriceTableMap::PROMO_PRICE => 3, ProductPriceTableMap::CREATED_AT => 4, ProductPriceTableMap::UPDATED_AT => 5, ),
self::TYPE_RAW_COLNAME => array('PRODUCT_SALE_ELEMENTS_ID' => 0, 'CURRENCY_ID' => 1, 'PRICE' => 2, 'PROMO_PRICE' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
self::TYPE_FIELDNAME => array('product_sale_elements_id' => 0, 'currency_id' => 1, 'price' => 2, 'promo_price' => 3, 'created_at' => 4, 'updated_at' => 5, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
self::TYPE_PHPNAME => array('ProductSaleElementsId' => 0, 'CurrencyId' => 1, 'Price' => 2, 'PromoPrice' => 3, 'FromDefaultCurrency' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
self::TYPE_STUDLYPHPNAME => array('productSaleElementsId' => 0, 'currencyId' => 1, 'price' => 2, 'promoPrice' => 3, 'fromDefaultCurrency' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
self::TYPE_COLNAME => array(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID => 0, ProductPriceTableMap::CURRENCY_ID => 1, ProductPriceTableMap::PRICE => 2, ProductPriceTableMap::PROMO_PRICE => 3, ProductPriceTableMap::FROM_DEFAULT_CURRENCY => 4, ProductPriceTableMap::CREATED_AT => 5, ProductPriceTableMap::UPDATED_AT => 6, ),
self::TYPE_RAW_COLNAME => array('PRODUCT_SALE_ELEMENTS_ID' => 0, 'CURRENCY_ID' => 1, 'PRICE' => 2, 'PROMO_PRICE' => 3, 'FROM_DEFAULT_CURRENCY' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
self::TYPE_FIELDNAME => array('product_sale_elements_id' => 0, 'currency_id' => 1, 'price' => 2, 'promo_price' => 3, 'from_default_currency' => 4, 'created_at' => 5, 'updated_at' => 6, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
);
/**
@@ -154,6 +159,7 @@ class ProductPriceTableMap extends TableMap
$this->addForeignPrimaryKey('CURRENCY_ID', 'CurrencyId', 'INTEGER' , 'currency', 'ID', true, null, null);
$this->addColumn('PRICE', 'Price', 'FLOAT', true, null, null);
$this->addColumn('PROMO_PRICE', 'PromoPrice', 'FLOAT', false, null, null);
$this->addColumn('FROM_DEFAULT_CURRENCY', 'FromDefaultCurrency', 'BOOLEAN', true, 1, false);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -371,6 +377,7 @@ class ProductPriceTableMap extends TableMap
$criteria->addSelectColumn(ProductPriceTableMap::CURRENCY_ID);
$criteria->addSelectColumn(ProductPriceTableMap::PRICE);
$criteria->addSelectColumn(ProductPriceTableMap::PROMO_PRICE);
$criteria->addSelectColumn(ProductPriceTableMap::FROM_DEFAULT_CURRENCY);
$criteria->addSelectColumn(ProductPriceTableMap::CREATED_AT);
$criteria->addSelectColumn(ProductPriceTableMap::UPDATED_AT);
} else {
@@ -378,6 +385,7 @@ class ProductPriceTableMap extends TableMap
$criteria->addSelectColumn($alias . '.CURRENCY_ID');
$criteria->addSelectColumn($alias . '.PRICE');
$criteria->addSelectColumn($alias . '.PROMO_PRICE');
$criteria->addSelectColumn($alias . '.FROM_DEFAULT_CURRENCY');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}

View File

@@ -195,7 +195,7 @@ class ProductSaleElementsTableMap extends TableMap
{
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('AttributeCombination', '\\Thelia\\Model\\AttributeCombination', RelationMap::ONE_TO_MANY, array('id' => 'product_sale_elements_id', ), 'CASCADE', 'RESTRICT', 'AttributeCombinations');
$this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'product_sale_elements_id', ), null, null, 'CartItems');
$this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'product_sale_elements_id', ), 'CASCADE', 'RESTRICT', 'CartItems');
$this->addRelation('ProductPrice', '\\Thelia\\Model\\ProductPrice', RelationMap::ONE_TO_MANY, array('id' => 'product_sale_elements_id', ), 'CASCADE', null, 'ProductPrices');
} // buildRelations()
@@ -219,6 +219,7 @@ class ProductSaleElementsTableMap extends TableMap
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AttributeCombinationTableMap::clearInstancePool();
CartItemTableMap::clearInstancePool();
ProductPriceTableMap::clearInstancePool();
}

View File

@@ -211,7 +211,7 @@ class ProductTableMap extends TableMap
$this->addRelation('ProductDocument', '\\Thelia\\Model\\ProductDocument', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductDocuments');
$this->addRelation('AccessoryRelatedByProductId', '\\Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'AccessoriesRelatedByProductId');
$this->addRelation('AccessoryRelatedByAccessory', '\\Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'accessory', ), 'CASCADE', 'RESTRICT', 'AccessoriesRelatedByAccessory');
$this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), null, null, 'CartItems');
$this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'CartItems');
$this->addRelation('ProductAssociatedContent', '\\Thelia\\Model\\ProductAssociatedContent', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductAssociatedContents');
$this->addRelation('ProductI18n', '\\Thelia\\Model\\ProductI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductI18ns');
$this->addRelation('ProductVersion', '\\Thelia\\Model\\ProductVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductVersions');
@@ -247,6 +247,7 @@ class ProductTableMap extends TableMap
ProductImageTableMap::clearInstancePool();
ProductDocumentTableMap::clearInstancePool();
AccessoryTableMap::clearInstancePool();
CartItemTableMap::clearInstancePool();
ProductAssociatedContentTableMap::clearInstancePool();
ProductI18nTableMap::clearInstancePool();
ProductVersionTableMap::clearInstancePool();

View File

@@ -57,7 +57,7 @@ class ProfileModuleTableMap extends TableMap
/**
* The total number of columns
*/
const NUM_COLUMNS = 6;
const NUM_COLUMNS = 5;
/**
* The number of lazy-loaded columns
@@ -67,12 +67,7 @@ class ProfileModuleTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 6;
/**
* the column name for the ID field
*/
const ID = 'profile_module.ID';
const NUM_HYDRATE_COLUMNS = 5;
/**
* the column name for the PROFILE_ID field
@@ -111,12 +106,12 @@ class ProfileModuleTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'ProfileId', 'ModuleId', 'Access', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'profileId', 'moduleId', 'access', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(ProfileModuleTableMap::ID, ProfileModuleTableMap::PROFILE_ID, ProfileModuleTableMap::MODULE_ID, ProfileModuleTableMap::ACCESS, ProfileModuleTableMap::CREATED_AT, ProfileModuleTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'PROFILE_ID', 'MODULE_ID', 'ACCESS', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'profile_id', 'module_id', 'access', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
self::TYPE_PHPNAME => array('ProfileId', 'ModuleId', 'Access', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('profileId', 'moduleId', 'access', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(ProfileModuleTableMap::PROFILE_ID, ProfileModuleTableMap::MODULE_ID, ProfileModuleTableMap::ACCESS, ProfileModuleTableMap::CREATED_AT, ProfileModuleTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('PROFILE_ID', 'MODULE_ID', 'ACCESS', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('profile_id', 'module_id', 'access', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
@@ -126,12 +121,12 @@ class ProfileModuleTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'ProfileId' => 1, 'ModuleId' => 2, 'Access' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'profileId' => 1, 'moduleId' => 2, 'access' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
self::TYPE_COLNAME => array(ProfileModuleTableMap::ID => 0, ProfileModuleTableMap::PROFILE_ID => 1, ProfileModuleTableMap::MODULE_ID => 2, ProfileModuleTableMap::ACCESS => 3, ProfileModuleTableMap::CREATED_AT => 4, ProfileModuleTableMap::UPDATED_AT => 5, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PROFILE_ID' => 1, 'MODULE_ID' => 2, 'ACCESS' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
self::TYPE_FIELDNAME => array('id' => 0, 'profile_id' => 1, 'module_id' => 2, 'access' => 3, 'created_at' => 4, 'updated_at' => 5, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
self::TYPE_PHPNAME => array('ProfileId' => 0, 'ModuleId' => 1, 'Access' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
self::TYPE_STUDLYPHPNAME => array('profileId' => 0, 'moduleId' => 1, 'access' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
self::TYPE_COLNAME => array(ProfileModuleTableMap::PROFILE_ID => 0, ProfileModuleTableMap::MODULE_ID => 1, ProfileModuleTableMap::ACCESS => 2, ProfileModuleTableMap::CREATED_AT => 3, ProfileModuleTableMap::UPDATED_AT => 4, ),
self::TYPE_RAW_COLNAME => array('PROFILE_ID' => 0, 'MODULE_ID' => 1, 'ACCESS' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
self::TYPE_FIELDNAME => array('profile_id' => 0, 'module_id' => 1, 'access' => 2, 'created_at' => 3, 'updated_at' => 4, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
@@ -148,11 +143,10 @@ class ProfileModuleTableMap extends TableMap
$this->setPhpName('ProfileModule');
$this->setClassName('\\Thelia\\Model\\ProfileModule');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(true);
$this->setUseIdGenerator(false);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('PROFILE_ID', 'ProfileId', 'INTEGER', 'profile', 'ID', true, null, null);
$this->addForeignKey('MODULE_ID', 'ModuleId', 'INTEGER', 'module', 'ID', false, null, null);
$this->addForeignPrimaryKey('PROFILE_ID', 'ProfileId', 'INTEGER' , 'profile', 'ID', true, null, null);
$this->addForeignPrimaryKey('MODULE_ID', 'ModuleId', 'INTEGER' , 'module', 'ID', true, null, null);
$this->addColumn('ACCESS', 'Access', 'TINYINT', false, null, 0);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
@@ -180,6 +174,59 @@ class ProfileModuleTableMap extends TableMap
);
} // getBehaviors()
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by find*()
* and findPk*() calls.
*
* @param \Thelia\Model\ProfileModule $obj A \Thelia\Model\ProfileModule object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if (null === $key) {
$key = serialize(array((string) $obj->getProfileId(), (string) $obj->getModuleId()));
} // if key === null
self::$instances[$key] = $obj;
}
}
/**
* Removes an object from the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doDelete
* methods in your stub classes -- you may need to explicitly remove objects
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A \Thelia\Model\ProfileModule object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && null !== $value) {
if (is_object($value) && $value instanceof \Thelia\Model\ProfileModule) {
$key = serialize(array((string) $value->getProfileId(), (string) $value->getModuleId()));
} elseif (is_array($value) && count($value) === 2) {
// assume we've been passed a primary key";
$key = serialize(array((string) $value[0], (string) $value[1]));
} elseif ($value instanceof Criteria) {
self::$instances = [];
return;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\ProfileModule object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
throw $e;
}
unset(self::$instances[$key]);
}
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
@@ -194,11 +241,11 @@ class ProfileModuleTableMap extends TableMap
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
// If the PK cannot be derived from the row, return NULL.
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('ProfileId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ModuleId', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('ProfileId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ModuleId', TableMap::TYPE_PHPNAME, $indexType)]));
}
/**
@@ -216,11 +263,7 @@ class ProfileModuleTableMap extends TableMap
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
return (int) $row[
$indexType == TableMap::TYPE_NUM
? 0 + $offset
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
];
return $pks;
}
/**
@@ -318,14 +361,12 @@ class ProfileModuleTableMap extends TableMap
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(ProfileModuleTableMap::ID);
$criteria->addSelectColumn(ProfileModuleTableMap::PROFILE_ID);
$criteria->addSelectColumn(ProfileModuleTableMap::MODULE_ID);
$criteria->addSelectColumn(ProfileModuleTableMap::ACCESS);
$criteria->addSelectColumn(ProfileModuleTableMap::CREATED_AT);
$criteria->addSelectColumn(ProfileModuleTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.PROFILE_ID');
$criteria->addSelectColumn($alias . '.MODULE_ID');
$criteria->addSelectColumn($alias . '.ACCESS');
@@ -382,7 +423,17 @@ class ProfileModuleTableMap extends TableMap
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(ProfileModuleTableMap::DATABASE_NAME);
$criteria->add(ProfileModuleTableMap::ID, (array) $values, Criteria::IN);
// primary key is composite; we therefore, expect
// the primary key passed to be an array of pkey values
if (count($values) == count($values, COUNT_RECURSIVE)) {
// array is not multi-dimensional
$values = array($values);
}
foreach ($values as $value) {
$criterion = $criteria->getNewCriterion(ProfileModuleTableMap::PROFILE_ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(ProfileModuleTableMap::MODULE_ID, $value[1]));
$criteria->addOr($criterion);
}
}
$query = ProfileModuleQuery::create()->mergeWith($criteria);
@@ -428,10 +479,6 @@ class ProfileModuleTableMap extends TableMap
$criteria = $criteria->buildCriteria(); // build Criteria from ProfileModule object
}
if ($criteria->containsKey(ProfileModuleTableMap::ID) && $criteria->keyContainsValue(ProfileModuleTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ProfileModuleTableMap::ID.')');
}
// Set the correct dbName
$query = ProfileModuleQuery::create()->mergeWith($criteria);

View File

@@ -57,7 +57,7 @@ class ProfileResourceTableMap extends TableMap
/**
* The total number of columns
*/
const NUM_COLUMNS = 6;
const NUM_COLUMNS = 5;
/**
* The number of lazy-loaded columns
@@ -67,12 +67,7 @@ class ProfileResourceTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 6;
/**
* the column name for the ID field
*/
const ID = 'profile_resource.ID';
const NUM_HYDRATE_COLUMNS = 5;
/**
* the column name for the PROFILE_ID field
@@ -111,12 +106,12 @@ class ProfileResourceTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'ProfileId', 'ResourceId', 'Access', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'profileId', 'resourceId', 'access', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(ProfileResourceTableMap::ID, ProfileResourceTableMap::PROFILE_ID, ProfileResourceTableMap::RESOURCE_ID, ProfileResourceTableMap::ACCESS, ProfileResourceTableMap::CREATED_AT, ProfileResourceTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'PROFILE_ID', 'RESOURCE_ID', 'ACCESS', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'profile_id', 'resource_id', 'access', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
self::TYPE_PHPNAME => array('ProfileId', 'ResourceId', 'Access', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('profileId', 'resourceId', 'access', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(ProfileResourceTableMap::PROFILE_ID, ProfileResourceTableMap::RESOURCE_ID, ProfileResourceTableMap::ACCESS, ProfileResourceTableMap::CREATED_AT, ProfileResourceTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('PROFILE_ID', 'RESOURCE_ID', 'ACCESS', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('profile_id', 'resource_id', 'access', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
@@ -126,12 +121,12 @@ class ProfileResourceTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'ProfileId' => 1, 'ResourceId' => 2, 'Access' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'profileId' => 1, 'resourceId' => 2, 'access' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
self::TYPE_COLNAME => array(ProfileResourceTableMap::ID => 0, ProfileResourceTableMap::PROFILE_ID => 1, ProfileResourceTableMap::RESOURCE_ID => 2, ProfileResourceTableMap::ACCESS => 3, ProfileResourceTableMap::CREATED_AT => 4, ProfileResourceTableMap::UPDATED_AT => 5, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PROFILE_ID' => 1, 'RESOURCE_ID' => 2, 'ACCESS' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
self::TYPE_FIELDNAME => array('id' => 0, 'profile_id' => 1, 'resource_id' => 2, 'access' => 3, 'created_at' => 4, 'updated_at' => 5, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
self::TYPE_PHPNAME => array('ProfileId' => 0, 'ResourceId' => 1, 'Access' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
self::TYPE_STUDLYPHPNAME => array('profileId' => 0, 'resourceId' => 1, 'access' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
self::TYPE_COLNAME => array(ProfileResourceTableMap::PROFILE_ID => 0, ProfileResourceTableMap::RESOURCE_ID => 1, ProfileResourceTableMap::ACCESS => 2, ProfileResourceTableMap::CREATED_AT => 3, ProfileResourceTableMap::UPDATED_AT => 4, ),
self::TYPE_RAW_COLNAME => array('PROFILE_ID' => 0, 'RESOURCE_ID' => 1, 'ACCESS' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
self::TYPE_FIELDNAME => array('profile_id' => 0, 'resource_id' => 1, 'access' => 2, 'created_at' => 3, 'updated_at' => 4, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
@@ -148,10 +143,9 @@ class ProfileResourceTableMap extends TableMap
$this->setPhpName('ProfileResource');
$this->setClassName('\\Thelia\\Model\\ProfileResource');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(true);
$this->setUseIdGenerator(false);
$this->setIsCrossRef(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignPrimaryKey('PROFILE_ID', 'ProfileId', 'INTEGER' , 'profile', 'ID', true, null, null);
$this->addForeignPrimaryKey('RESOURCE_ID', 'ResourceId', 'INTEGER' , 'resource', 'ID', true, null, null);
$this->addColumn('ACCESS', 'Access', 'INTEGER', true, null, 0);
@@ -196,7 +190,7 @@ class ProfileResourceTableMap extends TableMap
{
if (Propel::isInstancePoolingEnabled()) {
if (null === $key) {
$key = serialize(array((string) $obj->getId(), (string) $obj->getProfileId(), (string) $obj->getResourceId()));
$key = serialize(array((string) $obj->getProfileId(), (string) $obj->getResourceId()));
} // if key === null
self::$instances[$key] = $obj;
}
@@ -216,11 +210,11 @@ class ProfileResourceTableMap extends TableMap
{
if (Propel::isInstancePoolingEnabled() && null !== $value) {
if (is_object($value) && $value instanceof \Thelia\Model\ProfileResource) {
$key = serialize(array((string) $value->getId(), (string) $value->getProfileId(), (string) $value->getResourceId()));
$key = serialize(array((string) $value->getProfileId(), (string) $value->getResourceId()));
} elseif (is_array($value) && count($value) === 3) {
} elseif (is_array($value) && count($value) === 2) {
// assume we've been passed a primary key";
$key = serialize(array((string) $value[0], (string) $value[1], (string) $value[2]));
$key = serialize(array((string) $value[0], (string) $value[1]));
} elseif ($value instanceof Criteria) {
self::$instances = [];
@@ -248,11 +242,11 @@ class ProfileResourceTableMap extends TableMap
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
// If the PK cannot be derived from the row, return NULL.
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProfileId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 2 + $offset : static::translateFieldName('ResourceId', TableMap::TYPE_PHPNAME, $indexType)] === null) {
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('ProfileId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ResourceId', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProfileId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 2 + $offset : static::translateFieldName('ResourceId', TableMap::TYPE_PHPNAME, $indexType)]));
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('ProfileId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ResourceId', TableMap::TYPE_PHPNAME, $indexType)]));
}
/**
@@ -368,14 +362,12 @@ class ProfileResourceTableMap extends TableMap
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(ProfileResourceTableMap::ID);
$criteria->addSelectColumn(ProfileResourceTableMap::PROFILE_ID);
$criteria->addSelectColumn(ProfileResourceTableMap::RESOURCE_ID);
$criteria->addSelectColumn(ProfileResourceTableMap::ACCESS);
$criteria->addSelectColumn(ProfileResourceTableMap::CREATED_AT);
$criteria->addSelectColumn(ProfileResourceTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.PROFILE_ID');
$criteria->addSelectColumn($alias . '.RESOURCE_ID');
$criteria->addSelectColumn($alias . '.ACCESS');
@@ -439,9 +431,8 @@ class ProfileResourceTableMap extends TableMap
$values = array($values);
}
foreach ($values as $value) {
$criterion = $criteria->getNewCriterion(ProfileResourceTableMap::ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(ProfileResourceTableMap::PROFILE_ID, $value[1]));
$criterion->addAnd($criteria->getNewCriterion(ProfileResourceTableMap::RESOURCE_ID, $value[2]));
$criterion = $criteria->getNewCriterion(ProfileResourceTableMap::PROFILE_ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(ProfileResourceTableMap::RESOURCE_ID, $value[1]));
$criteria->addOr($criterion);
}
}
@@ -489,10 +480,6 @@ class ProfileResourceTableMap extends TableMap
$criteria = $criteria->buildCriteria(); // build Criteria from ProfileResource object
}
if ($criteria->containsKey(ProfileResourceTableMap::ID) && $criteria->keyContainsValue(ProfileResourceTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ProfileResourceTableMap::ID.')');
}
// Set the correct dbName
$query = ProfileResourceQuery::create()->mergeWith($criteria);

View File

@@ -12,6 +12,7 @@ use Thelia\Core\Event\Product\ProductEvent;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Propel;
use Thelia\Model\Map\ProductTableMap;
use Thelia\Model\ProductSaleElementsQuery;
class Product extends BaseProduct
{
@@ -47,6 +48,20 @@ class Product extends BaseProduct
return $taxCalculator->load($this, $country)->getTaxedPrice($this->getRealLowestPrice());
}
/**
* Return the default PSE for this product.
*/
public function getDefaultSaleElements() {
return ProductSaleElementsQuery::create()->filterByProductId($this->id)->filterByIsDefault(true)->find();
}
/**
* Return PSE count fir this product.
*/
public function countSaleElements() {
return ProductSaleElementsQuery::create()->filterByProductId($this->id)->filterByIsDefault(true)->count();
}
/**
* @return the current default category ID for this product
*/
@@ -100,7 +115,7 @@ class Product extends BaseProduct
;
if ($productCategory == null || $productCategory->getCategoryId() != $defaultCategoryId) {
exit;
// Delete the old default category
if ($productCategory !== null) $productCategory->delete();
@@ -131,10 +146,10 @@ class Product extends BaseProduct
$con = Propel::getWriteConnection(ProductTableMap::DATABASE_NAME);
$con->beginTransaction();
$this->dispatchEvent(TheliaEvents::BEFORE_CREATEPRODUCT, new ProductEvent($this));
try {
// Create the product
$this->save($con);
@@ -146,29 +161,8 @@ class Product extends BaseProduct
$this->setTaxRuleId($taxRuleId);
// Create an empty product sale element
$sale_elements = new ProductSaleElements();
$sale_elements
->setProduct($this)
->setRef($this->getRef())
->setPromo(0)
->setNewness(0)
->setWeight($baseWeight)
->setIsDefault(true)
->save($con)
;
// Create an empty product price in the default currency
$product_price = new ProductPrice();
$product_price
->setProductSaleElements($sale_elements)
->setPromoPrice($basePrice)
->setPrice($basePrice)
->setCurrencyId($priceCurrencyId)
->save($con)
;
// Create the default product sale element of this product
$sale_elements = $this->createDefaultProductSaleElement($con, $baseWeight, $basePrice, $priceCurrencyId, true);
// Store all the stuff !
$con->commit();
@@ -183,6 +177,38 @@ class Product extends BaseProduct
}
}
/**
* Create a basic product sale element attached to this product.
*/
public function createDefaultProductSaleElement(ConnectionInterface $con, $weight, $basePrice, $currencyId, $isDefault) {
// Create an empty product sale element
$sale_elements = new ProductSaleElements();
$sale_elements
->setProduct($this)
->setRef($this->getRef())
->setPromo(0)
->setNewness(0)
->setWeight($weight)
->setIsDefault($isDefault)
->save($con)
;
// Create an empty product price in the default currency
$product_price = new ProductPrice();
$product_price
->setProductSaleElements($sale_elements)
->setPromoPrice($basePrice)
->setPrice($basePrice)
->setCurrencyId($currencyId)
->save($con)
;
return $sale_elements;
}
/**
* Calculate next position relative to our default category
*/

View File

@@ -1,5 +1,4 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\Profile as BaseProfile;
@@ -8,4 +7,4 @@ use Thelia\Model\Tools\ModelEventDispatcherTrait;
class Profile extends BaseProfile
{
use ModelEventDispatcherTrait;
}
}

View File

@@ -2,6 +2,7 @@
namespace Thelia\Model;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Model\Base\ProfileQuery as BaseProfileQuery;
@@ -17,5 +18,14 @@ use Thelia\Model\Base\ProfileQuery as BaseProfileQuery;
*/
class ProfileQuery extends BaseProfileQuery
{
public static function getProfileList()
{
$profileList = array(
0 => AdminResources::SUPERADMINISTRATOR,
);
foreach(ProfileQuery::create()->find() as $profile) {
$profileList[$profile->getId()] = $profile->getCode();
}
return $profileList;
}
} // ProfileQuery