Merge branch 'master' into tinymce
Conflicts: local/modules/Tinymce/templates/backOffice/default/include/tinymce_init.tpl
This commit is contained in:
@@ -111,6 +111,7 @@ class Admin extends BaseAdmin implements UserInterface
|
||||
public function eraseCredentials()
|
||||
{
|
||||
parent::setPassword(null);
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -58,6 +58,14 @@ use Thelia\Model\Map\CountryTableMap;
|
||||
* @method ChildCountryQuery rightJoinAddress($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Address relation
|
||||
* @method ChildCountryQuery innerJoinAddress($relationAlias = null) Adds a INNER JOIN clause to the query using the Address relation
|
||||
*
|
||||
* @method ChildCountryQuery leftJoinCouponCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponCountry relation
|
||||
* @method ChildCountryQuery rightJoinCouponCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponCountry relation
|
||||
* @method ChildCountryQuery innerJoinCouponCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponCountry relation
|
||||
*
|
||||
* @method ChildCountryQuery leftJoinOrderCouponCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderCouponCountry relation
|
||||
* @method ChildCountryQuery rightJoinOrderCouponCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderCouponCountry relation
|
||||
* @method ChildCountryQuery innerJoinOrderCouponCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderCouponCountry relation
|
||||
*
|
||||
* @method ChildCountryQuery leftJoinCountryI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CountryI18n relation
|
||||
* @method ChildCountryQuery rightJoinCountryI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CountryI18n relation
|
||||
* @method ChildCountryQuery innerJoinCountryI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CountryI18n relation
|
||||
@@ -807,6 +815,152 @@ abstract class CountryQuery extends ModelCriteria
|
||||
->useQuery($relationAlias ? $relationAlias : 'Address', '\Thelia\Model\AddressQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\CouponCountry object
|
||||
*
|
||||
* @param \Thelia\Model\CouponCountry|ObjectCollection $couponCountry the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCouponCountry($couponCountry, $comparison = null)
|
||||
{
|
||||
if ($couponCountry instanceof \Thelia\Model\CouponCountry) {
|
||||
return $this
|
||||
->addUsingAlias(CountryTableMap::ID, $couponCountry->getCountryId(), $comparison);
|
||||
} elseif ($couponCountry instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useCouponCountryQuery()
|
||||
->filterByPrimaryKeys($couponCountry->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByCouponCountry() only accepts arguments of type \Thelia\Model\CouponCountry or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the CouponCountry relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCouponCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('CouponCountry');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'CouponCountry');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the CouponCountry relation CouponCountry object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\CouponCountryQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCouponCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCouponCountry($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'CouponCountry', '\Thelia\Model\CouponCountryQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\OrderCouponCountry object
|
||||
*
|
||||
* @param \Thelia\Model\OrderCouponCountry|ObjectCollection $orderCouponCountry the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByOrderCouponCountry($orderCouponCountry, $comparison = null)
|
||||
{
|
||||
if ($orderCouponCountry instanceof \Thelia\Model\OrderCouponCountry) {
|
||||
return $this
|
||||
->addUsingAlias(CountryTableMap::ID, $orderCouponCountry->getCountryId(), $comparison);
|
||||
} elseif ($orderCouponCountry instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useOrderCouponCountryQuery()
|
||||
->filterByPrimaryKeys($orderCouponCountry->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByOrderCouponCountry() only accepts arguments of type \Thelia\Model\OrderCouponCountry or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the OrderCouponCountry relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinOrderCouponCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('OrderCouponCountry');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'OrderCouponCountry');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the OrderCouponCountry relation OrderCouponCountry object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\OrderCouponCountryQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useOrderCouponCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinOrderCouponCountry($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'OrderCouponCountry', '\Thelia\Model\OrderCouponCountryQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\CountryI18n object
|
||||
*
|
||||
@@ -880,6 +1034,40 @@ abstract class CountryQuery extends ModelCriteria
|
||||
->useQuery($relationAlias ? $relationAlias : 'CountryI18n', '\Thelia\Model\CountryI18nQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Coupon object
|
||||
* using the coupon_country table as cross reference
|
||||
*
|
||||
* @param Coupon $coupon the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCoupon($coupon, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useCouponCountryQuery()
|
||||
->filterByCoupon($coupon, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related OrderCoupon object
|
||||
* using the order_coupon_country table as cross reference
|
||||
*
|
||||
* @param OrderCoupon $orderCoupon the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByOrderCoupon($orderCoupon, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useOrderCouponCountryQuery()
|
||||
->filterByOrderCoupon($orderCoupon, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1268
core/lib/Thelia/Model/Base/CouponCountry.php
Normal file
1268
core/lib/Thelia/Model/Base/CouponCountry.php
Normal file
File diff suppressed because it is too large
Load Diff
568
core/lib/Thelia/Model/Base/CouponCountryQuery.php
Normal file
568
core/lib/Thelia/Model/Base/CouponCountryQuery.php
Normal file
@@ -0,0 +1,568 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelJoin;
|
||||
use Propel\Runtime\Collection\Collection;
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Thelia\Model\CouponCountry as ChildCouponCountry;
|
||||
use Thelia\Model\CouponCountryQuery as ChildCouponCountryQuery;
|
||||
use Thelia\Model\Map\CouponCountryTableMap;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'coupon_country' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildCouponCountryQuery orderByCouponId($order = Criteria::ASC) Order by the coupon_id column
|
||||
* @method ChildCouponCountryQuery orderByCountryId($order = Criteria::ASC) Order by the country_id column
|
||||
*
|
||||
* @method ChildCouponCountryQuery groupByCouponId() Group by the coupon_id column
|
||||
* @method ChildCouponCountryQuery groupByCountryId() Group by the country_id column
|
||||
*
|
||||
* @method ChildCouponCountryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildCouponCountryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildCouponCountryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildCouponCountryQuery leftJoinCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the Country relation
|
||||
* @method ChildCouponCountryQuery rightJoinCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Country relation
|
||||
* @method ChildCouponCountryQuery innerJoinCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the Country relation
|
||||
*
|
||||
* @method ChildCouponCountryQuery leftJoinCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the Coupon relation
|
||||
* @method ChildCouponCountryQuery rightJoinCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Coupon relation
|
||||
* @method ChildCouponCountryQuery innerJoinCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the Coupon relation
|
||||
*
|
||||
* @method ChildCouponCountry findOne(ConnectionInterface $con = null) Return the first ChildCouponCountry matching the query
|
||||
* @method ChildCouponCountry findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCouponCountry matching the query, or a new ChildCouponCountry object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildCouponCountry findOneByCouponId(int $coupon_id) Return the first ChildCouponCountry filtered by the coupon_id column
|
||||
* @method ChildCouponCountry findOneByCountryId(int $country_id) Return the first ChildCouponCountry filtered by the country_id column
|
||||
*
|
||||
* @method array findByCouponId(int $coupon_id) Return ChildCouponCountry objects filtered by the coupon_id column
|
||||
* @method array findByCountryId(int $country_id) Return ChildCouponCountry objects filtered by the country_id column
|
||||
*
|
||||
*/
|
||||
abstract class CouponCountryQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \Thelia\Model\Base\CouponCountryQuery object.
|
||||
*
|
||||
* @param string $dbName The database name
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\CouponCountry', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildCouponCountryQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildCouponCountryQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \Thelia\Model\CouponCountryQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \Thelia\Model\CouponCountryQuery();
|
||||
if (null !== $modelAlias) {
|
||||
$query->setModelAlias($modelAlias);
|
||||
}
|
||||
if ($criteria instanceof Criteria) {
|
||||
$query->mergeWith($criteria);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
* Propel uses the instance pool to skip the database if the object exists.
|
||||
* Go fast if the query is untouched.
|
||||
*
|
||||
* <code>
|
||||
* $obj = $c->findPk(array(12, 34), $con);
|
||||
* </code>
|
||||
*
|
||||
* @param array[$coupon_id, $country_id] $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ChildCouponCountry|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = CouponCountryTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(CouponCountryTableMap::DATABASE_NAME);
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|
||||
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|
||||
|| $this->map || $this->having || $this->joins) {
|
||||
return $this->findPkComplex($key, $con);
|
||||
} else {
|
||||
return $this->findPkSimple($key, $con);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key using raw SQL to go fast.
|
||||
* Bypass doSelect() and the object formatter by using generated code.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildCouponCountry A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT `COUPON_ID`, `COUNTRY_ID` FROM `coupon_country` WHERE `COUPON_ID` = :p0 AND `COUNTRY_ID` = :p1';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$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);
|
||||
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
|
||||
}
|
||||
$obj = null;
|
||||
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
|
||||
$obj = new ChildCouponCountry();
|
||||
$obj->hydrate($row);
|
||||
CouponCountryTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildCouponCountry|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
protected function findPkComplex($key, $con)
|
||||
{
|
||||
// As the query uses a PK condition, no limit(1) is necessary.
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKey($key)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find objects by primary key
|
||||
* <code>
|
||||
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
|
||||
* </code>
|
||||
* @param array $keys Primary keys to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
|
||||
*/
|
||||
public function findPks($keys, $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKeys($keys)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by primary key
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
*
|
||||
* @return ChildCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
$this->addUsingAlias(CouponCountryTableMap::COUPON_ID, $key[0], Criteria::EQUAL);
|
||||
$this->addUsingAlias(CouponCountryTableMap::COUNTRY_ID, $key[1], Criteria::EQUAL);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a list of primary keys
|
||||
*
|
||||
* @param array $keys The list of primary key to use for the query
|
||||
*
|
||||
* @return ChildCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
if (empty($keys)) {
|
||||
return $this->add(null, '1<>1', Criteria::CUSTOM);
|
||||
}
|
||||
foreach ($keys as $key) {
|
||||
$cton0 = $this->getNewCriterion(CouponCountryTableMap::COUPON_ID, $key[0], Criteria::EQUAL);
|
||||
$cton1 = $this->getNewCriterion(CouponCountryTableMap::COUNTRY_ID, $key[1], Criteria::EQUAL);
|
||||
$cton0->addAnd($cton1);
|
||||
$this->addOr($cton0);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the coupon_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCouponId(1234); // WHERE coupon_id = 1234
|
||||
* $query->filterByCouponId(array(12, 34)); // WHERE coupon_id IN (12, 34)
|
||||
* $query->filterByCouponId(array('min' => 12)); // WHERE coupon_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByCoupon()
|
||||
*
|
||||
* @param mixed $couponId 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 ChildCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCouponId($couponId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($couponId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($couponId['min'])) {
|
||||
$this->addUsingAlias(CouponCountryTableMap::COUPON_ID, $couponId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($couponId['max'])) {
|
||||
$this->addUsingAlias(CouponCountryTableMap::COUPON_ID, $couponId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponCountryTableMap::COUPON_ID, $couponId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the country_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCountryId(1234); // WHERE country_id = 1234
|
||||
* $query->filterByCountryId(array(12, 34)); // WHERE country_id IN (12, 34)
|
||||
* $query->filterByCountryId(array('min' => 12)); // WHERE country_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByCountry()
|
||||
*
|
||||
* @param mixed $countryId 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 ChildCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCountryId($countryId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($countryId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($countryId['min'])) {
|
||||
$this->addUsingAlias(CouponCountryTableMap::COUNTRY_ID, $countryId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($countryId['max'])) {
|
||||
$this->addUsingAlias(CouponCountryTableMap::COUNTRY_ID, $countryId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponCountryTableMap::COUNTRY_ID, $countryId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Country object
|
||||
*
|
||||
* @param \Thelia\Model\Country|ObjectCollection $country The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCountry($country, $comparison = null)
|
||||
{
|
||||
if ($country instanceof \Thelia\Model\Country) {
|
||||
return $this
|
||||
->addUsingAlias(CouponCountryTableMap::COUNTRY_ID, $country->getId(), $comparison);
|
||||
} elseif ($country instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(CouponCountryTableMap::COUNTRY_ID, $country->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByCountry() only accepts arguments of type \Thelia\Model\Country or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Country relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Country');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Country');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Country relation Country object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\CountryQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCountry($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Country', '\Thelia\Model\CountryQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Coupon object
|
||||
*
|
||||
* @param \Thelia\Model\Coupon|ObjectCollection $coupon The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCoupon($coupon, $comparison = null)
|
||||
{
|
||||
if ($coupon instanceof \Thelia\Model\Coupon) {
|
||||
return $this
|
||||
->addUsingAlias(CouponCountryTableMap::COUPON_ID, $coupon->getId(), $comparison);
|
||||
} elseif ($coupon instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(CouponCountryTableMap::COUPON_ID, $coupon->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByCoupon() only accepts arguments of type \Thelia\Model\Coupon or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Coupon relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCoupon($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Coupon');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Coupon');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Coupon relation Coupon object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\CouponQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCouponQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCoupon($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Coupon', '\Thelia\Model\CouponQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildCouponCountry $couponCountry Object to remove from the list of results
|
||||
*
|
||||
* @return ChildCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($couponCountry = null)
|
||||
{
|
||||
if ($couponCountry) {
|
||||
$this->addCond('pruneCond0', $this->getAliasedColName(CouponCountryTableMap::COUPON_ID), $couponCountry->getCouponId(), Criteria::NOT_EQUAL);
|
||||
$this->addCond('pruneCond1', $this->getAliasedColName(CouponCountryTableMap::COUNTRY_ID), $couponCountry->getCountryId(), Criteria::NOT_EQUAL);
|
||||
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the coupon_country table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CouponCountryTableMap::DATABASE_NAME);
|
||||
}
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
$affectedRows += parent::doDeleteAll($con);
|
||||
// Because this db requires some delete cascade/set null emulation, we have to
|
||||
// clear the cached instance *after* the emulation has happened (since
|
||||
// instances get re-added by the select statement contained therein).
|
||||
CouponCountryTableMap::clearInstancePool();
|
||||
CouponCountryTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildCouponCountry or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildCouponCountry object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public function delete(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CouponCountryTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(CouponCountryTableMap::DATABASE_NAME);
|
||||
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
|
||||
|
||||
CouponCountryTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
CouponCountryTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // CouponCountryQuery
|
||||
1341
core/lib/Thelia/Model/Base/CouponCustomerCount.php
Normal file
1341
core/lib/Thelia/Model/Base/CouponCustomerCount.php
Normal file
File diff suppressed because it is too large
Load Diff
521
core/lib/Thelia/Model/Base/CouponCustomerCountQuery.php
Normal file
521
core/lib/Thelia/Model/Base/CouponCustomerCountQuery.php
Normal file
@@ -0,0 +1,521 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelJoin;
|
||||
use Propel\Runtime\Collection\Collection;
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Thelia\Model\CouponCustomerCount as ChildCouponCustomerCount;
|
||||
use Thelia\Model\CouponCustomerCountQuery as ChildCouponCustomerCountQuery;
|
||||
use Thelia\Model\Map\CouponCustomerCountTableMap;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'coupon_customer_count' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildCouponCustomerCountQuery orderByCouponId($order = Criteria::ASC) Order by the coupon_id column
|
||||
* @method ChildCouponCustomerCountQuery orderByCustomerId($order = Criteria::ASC) Order by the customer_id column
|
||||
* @method ChildCouponCustomerCountQuery orderByCount($order = Criteria::ASC) Order by the count column
|
||||
*
|
||||
* @method ChildCouponCustomerCountQuery groupByCouponId() Group by the coupon_id column
|
||||
* @method ChildCouponCustomerCountQuery groupByCustomerId() Group by the customer_id column
|
||||
* @method ChildCouponCustomerCountQuery groupByCount() Group by the count column
|
||||
*
|
||||
* @method ChildCouponCustomerCountQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildCouponCustomerCountQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildCouponCustomerCountQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildCouponCustomerCountQuery leftJoinCustomer($relationAlias = null) Adds a LEFT JOIN clause to the query using the Customer relation
|
||||
* @method ChildCouponCustomerCountQuery rightJoinCustomer($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Customer relation
|
||||
* @method ChildCouponCustomerCountQuery innerJoinCustomer($relationAlias = null) Adds a INNER JOIN clause to the query using the Customer relation
|
||||
*
|
||||
* @method ChildCouponCustomerCountQuery leftJoinCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the Coupon relation
|
||||
* @method ChildCouponCustomerCountQuery rightJoinCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Coupon relation
|
||||
* @method ChildCouponCustomerCountQuery innerJoinCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the Coupon relation
|
||||
*
|
||||
* @method ChildCouponCustomerCount findOne(ConnectionInterface $con = null) Return the first ChildCouponCustomerCount matching the query
|
||||
* @method ChildCouponCustomerCount findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCouponCustomerCount matching the query, or a new ChildCouponCustomerCount object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildCouponCustomerCount findOneByCouponId(int $coupon_id) Return the first ChildCouponCustomerCount filtered by the coupon_id column
|
||||
* @method ChildCouponCustomerCount findOneByCustomerId(int $customer_id) Return the first ChildCouponCustomerCount filtered by the customer_id column
|
||||
* @method ChildCouponCustomerCount findOneByCount(int $count) Return the first ChildCouponCustomerCount filtered by the count column
|
||||
*
|
||||
* @method array findByCouponId(int $coupon_id) Return ChildCouponCustomerCount objects filtered by the coupon_id column
|
||||
* @method array findByCustomerId(int $customer_id) Return ChildCouponCustomerCount objects filtered by the customer_id column
|
||||
* @method array findByCount(int $count) Return ChildCouponCustomerCount objects filtered by the count column
|
||||
*
|
||||
*/
|
||||
abstract class CouponCustomerCountQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \Thelia\Model\Base\CouponCustomerCountQuery object.
|
||||
*
|
||||
* @param string $dbName The database name
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\CouponCustomerCount', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildCouponCustomerCountQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildCouponCustomerCountQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \Thelia\Model\CouponCustomerCountQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \Thelia\Model\CouponCustomerCountQuery();
|
||||
if (null !== $modelAlias) {
|
||||
$query->setModelAlias($modelAlias);
|
||||
}
|
||||
if ($criteria instanceof Criteria) {
|
||||
$query->mergeWith($criteria);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
* Propel uses the instance pool to skip the database if the object exists.
|
||||
* Go fast if the query is untouched.
|
||||
*
|
||||
* <code>
|
||||
* $obj = $c->findPk(12, $con);
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ChildCouponCustomerCount|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
throw new \LogicException('The ChildCouponCustomerCount class has no primary key');
|
||||
}
|
||||
|
||||
/**
|
||||
* Find objects by primary key
|
||||
* <code>
|
||||
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
|
||||
* </code>
|
||||
* @param array $keys Primary keys to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
|
||||
*/
|
||||
public function findPks($keys, $con = null)
|
||||
{
|
||||
throw new \LogicException('The ChildCouponCustomerCount class has no primary key');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by primary key
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
*
|
||||
* @return ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
throw new \LogicException('The ChildCouponCustomerCount class has no primary key');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a list of primary keys
|
||||
*
|
||||
* @param array $keys The list of primary key to use for the query
|
||||
*
|
||||
* @return ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
throw new \LogicException('The ChildCouponCustomerCount class has no primary key');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the coupon_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCouponId(1234); // WHERE coupon_id = 1234
|
||||
* $query->filterByCouponId(array(12, 34)); // WHERE coupon_id IN (12, 34)
|
||||
* $query->filterByCouponId(array('min' => 12)); // WHERE coupon_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByCoupon()
|
||||
*
|
||||
* @param mixed $couponId 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 ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCouponId($couponId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($couponId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($couponId['min'])) {
|
||||
$this->addUsingAlias(CouponCustomerCountTableMap::COUPON_ID, $couponId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($couponId['max'])) {
|
||||
$this->addUsingAlias(CouponCustomerCountTableMap::COUPON_ID, $couponId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponCustomerCountTableMap::COUPON_ID, $couponId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the customer_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCustomerId(1234); // WHERE customer_id = 1234
|
||||
* $query->filterByCustomerId(array(12, 34)); // WHERE customer_id IN (12, 34)
|
||||
* $query->filterByCustomerId(array('min' => 12)); // WHERE customer_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByCustomer()
|
||||
*
|
||||
* @param mixed $customerId 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 ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCustomerId($customerId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($customerId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($customerId['min'])) {
|
||||
$this->addUsingAlias(CouponCustomerCountTableMap::CUSTOMER_ID, $customerId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($customerId['max'])) {
|
||||
$this->addUsingAlias(CouponCustomerCountTableMap::CUSTOMER_ID, $customerId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponCustomerCountTableMap::CUSTOMER_ID, $customerId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the count column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCount(1234); // WHERE count = 1234
|
||||
* $query->filterByCount(array(12, 34)); // WHERE count IN (12, 34)
|
||||
* $query->filterByCount(array('min' => 12)); // WHERE count > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $count 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 ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCount($count = null, $comparison = null)
|
||||
{
|
||||
if (is_array($count)) {
|
||||
$useMinMax = false;
|
||||
if (isset($count['min'])) {
|
||||
$this->addUsingAlias(CouponCustomerCountTableMap::COUNT, $count['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($count['max'])) {
|
||||
$this->addUsingAlias(CouponCustomerCountTableMap::COUNT, $count['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponCustomerCountTableMap::COUNT, $count, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Customer object
|
||||
*
|
||||
* @param \Thelia\Model\Customer|ObjectCollection $customer The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCustomer($customer, $comparison = null)
|
||||
{
|
||||
if ($customer instanceof \Thelia\Model\Customer) {
|
||||
return $this
|
||||
->addUsingAlias(CouponCustomerCountTableMap::CUSTOMER_ID, $customer->getId(), $comparison);
|
||||
} elseif ($customer instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(CouponCustomerCountTableMap::CUSTOMER_ID, $customer->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByCustomer() only accepts arguments of type \Thelia\Model\Customer or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Customer relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCustomer($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Customer');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Customer');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Customer relation Customer object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\CustomerQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCustomerQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCustomer($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Customer', '\Thelia\Model\CustomerQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Coupon object
|
||||
*
|
||||
* @param \Thelia\Model\Coupon|ObjectCollection $coupon The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCoupon($coupon, $comparison = null)
|
||||
{
|
||||
if ($coupon instanceof \Thelia\Model\Coupon) {
|
||||
return $this
|
||||
->addUsingAlias(CouponCustomerCountTableMap::COUPON_ID, $coupon->getId(), $comparison);
|
||||
} elseif ($coupon instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(CouponCustomerCountTableMap::COUPON_ID, $coupon->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByCoupon() only accepts arguments of type \Thelia\Model\Coupon or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Coupon relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCoupon($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Coupon');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Coupon');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Coupon relation Coupon object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\CouponQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCouponQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCoupon($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Coupon', '\Thelia\Model\CouponQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildCouponCustomerCount $couponCustomerCount Object to remove from the list of results
|
||||
*
|
||||
* @return ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($couponCustomerCount = null)
|
||||
{
|
||||
if ($couponCustomerCount) {
|
||||
throw new \LogicException('ChildCouponCustomerCount class has no primary key');
|
||||
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the coupon_customer_count table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CouponCustomerCountTableMap::DATABASE_NAME);
|
||||
}
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
$affectedRows += parent::doDeleteAll($con);
|
||||
// Because this db requires some delete cascade/set null emulation, we have to
|
||||
// clear the cached instance *after* the emulation has happened (since
|
||||
// instances get re-added by the select statement contained therein).
|
||||
CouponCustomerCountTableMap::clearInstancePool();
|
||||
CouponCustomerCountTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildCouponCustomerCount or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildCouponCustomerCount object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public function delete(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CouponCustomerCountTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(CouponCustomerCountTableMap::DATABASE_NAME);
|
||||
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
|
||||
|
||||
CouponCustomerCountTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
CouponCustomerCountTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // CouponCustomerCountQuery
|
||||
1268
core/lib/Thelia/Model/Base/CouponModule.php
Normal file
1268
core/lib/Thelia/Model/Base/CouponModule.php
Normal file
File diff suppressed because it is too large
Load Diff
568
core/lib/Thelia/Model/Base/CouponModuleQuery.php
Normal file
568
core/lib/Thelia/Model/Base/CouponModuleQuery.php
Normal file
@@ -0,0 +1,568 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelJoin;
|
||||
use Propel\Runtime\Collection\Collection;
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Thelia\Model\CouponModule as ChildCouponModule;
|
||||
use Thelia\Model\CouponModuleQuery as ChildCouponModuleQuery;
|
||||
use Thelia\Model\Map\CouponModuleTableMap;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'coupon_module' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildCouponModuleQuery orderByCouponId($order = Criteria::ASC) Order by the coupon_id column
|
||||
* @method ChildCouponModuleQuery orderByModuleId($order = Criteria::ASC) Order by the module_id column
|
||||
*
|
||||
* @method ChildCouponModuleQuery groupByCouponId() Group by the coupon_id column
|
||||
* @method ChildCouponModuleQuery groupByModuleId() Group by the module_id column
|
||||
*
|
||||
* @method ChildCouponModuleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildCouponModuleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildCouponModuleQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildCouponModuleQuery leftJoinCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the Coupon relation
|
||||
* @method ChildCouponModuleQuery rightJoinCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Coupon relation
|
||||
* @method ChildCouponModuleQuery innerJoinCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the Coupon relation
|
||||
*
|
||||
* @method ChildCouponModuleQuery leftJoinModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the Module relation
|
||||
* @method ChildCouponModuleQuery rightJoinModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Module relation
|
||||
* @method ChildCouponModuleQuery innerJoinModule($relationAlias = null) Adds a INNER JOIN clause to the query using the Module relation
|
||||
*
|
||||
* @method ChildCouponModule findOne(ConnectionInterface $con = null) Return the first ChildCouponModule matching the query
|
||||
* @method ChildCouponModule findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCouponModule matching the query, or a new ChildCouponModule object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildCouponModule findOneByCouponId(int $coupon_id) Return the first ChildCouponModule filtered by the coupon_id column
|
||||
* @method ChildCouponModule findOneByModuleId(int $module_id) Return the first ChildCouponModule filtered by the module_id column
|
||||
*
|
||||
* @method array findByCouponId(int $coupon_id) Return ChildCouponModule objects filtered by the coupon_id column
|
||||
* @method array findByModuleId(int $module_id) Return ChildCouponModule objects filtered by the module_id column
|
||||
*
|
||||
*/
|
||||
abstract class CouponModuleQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \Thelia\Model\Base\CouponModuleQuery object.
|
||||
*
|
||||
* @param string $dbName The database name
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\CouponModule', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildCouponModuleQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildCouponModuleQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \Thelia\Model\CouponModuleQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \Thelia\Model\CouponModuleQuery();
|
||||
if (null !== $modelAlias) {
|
||||
$query->setModelAlias($modelAlias);
|
||||
}
|
||||
if ($criteria instanceof Criteria) {
|
||||
$query->mergeWith($criteria);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
* Propel uses the instance pool to skip the database if the object exists.
|
||||
* Go fast if the query is untouched.
|
||||
*
|
||||
* <code>
|
||||
* $obj = $c->findPk(array(12, 34), $con);
|
||||
* </code>
|
||||
*
|
||||
* @param array[$coupon_id, $module_id] $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ChildCouponModule|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = CouponModuleTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(CouponModuleTableMap::DATABASE_NAME);
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|
||||
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|
||||
|| $this->map || $this->having || $this->joins) {
|
||||
return $this->findPkComplex($key, $con);
|
||||
} else {
|
||||
return $this->findPkSimple($key, $con);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key using raw SQL to go fast.
|
||||
* Bypass doSelect() and the object formatter by using generated code.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildCouponModule A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT `COUPON_ID`, `MODULE_ID` FROM `coupon_module` WHERE `COUPON_ID` = :p0 AND `MODULE_ID` = :p1';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$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);
|
||||
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
|
||||
}
|
||||
$obj = null;
|
||||
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
|
||||
$obj = new ChildCouponModule();
|
||||
$obj->hydrate($row);
|
||||
CouponModuleTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildCouponModule|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
protected function findPkComplex($key, $con)
|
||||
{
|
||||
// As the query uses a PK condition, no limit(1) is necessary.
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKey($key)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find objects by primary key
|
||||
* <code>
|
||||
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
|
||||
* </code>
|
||||
* @param array $keys Primary keys to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
|
||||
*/
|
||||
public function findPks($keys, $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKeys($keys)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by primary key
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
*
|
||||
* @return ChildCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
$this->addUsingAlias(CouponModuleTableMap::COUPON_ID, $key[0], Criteria::EQUAL);
|
||||
$this->addUsingAlias(CouponModuleTableMap::MODULE_ID, $key[1], Criteria::EQUAL);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a list of primary keys
|
||||
*
|
||||
* @param array $keys The list of primary key to use for the query
|
||||
*
|
||||
* @return ChildCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
if (empty($keys)) {
|
||||
return $this->add(null, '1<>1', Criteria::CUSTOM);
|
||||
}
|
||||
foreach ($keys as $key) {
|
||||
$cton0 = $this->getNewCriterion(CouponModuleTableMap::COUPON_ID, $key[0], Criteria::EQUAL);
|
||||
$cton1 = $this->getNewCriterion(CouponModuleTableMap::MODULE_ID, $key[1], Criteria::EQUAL);
|
||||
$cton0->addAnd($cton1);
|
||||
$this->addOr($cton0);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the coupon_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCouponId(1234); // WHERE coupon_id = 1234
|
||||
* $query->filterByCouponId(array(12, 34)); // WHERE coupon_id IN (12, 34)
|
||||
* $query->filterByCouponId(array('min' => 12)); // WHERE coupon_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByCoupon()
|
||||
*
|
||||
* @param mixed $couponId 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 ChildCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCouponId($couponId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($couponId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($couponId['min'])) {
|
||||
$this->addUsingAlias(CouponModuleTableMap::COUPON_ID, $couponId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($couponId['max'])) {
|
||||
$this->addUsingAlias(CouponModuleTableMap::COUPON_ID, $couponId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponModuleTableMap::COUPON_ID, $couponId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the module_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByModuleId(1234); // WHERE module_id = 1234
|
||||
* $query->filterByModuleId(array(12, 34)); // WHERE module_id IN (12, 34)
|
||||
* $query->filterByModuleId(array('min' => 12)); // WHERE module_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByModule()
|
||||
*
|
||||
* @param mixed $moduleId 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 ChildCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByModuleId($moduleId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($moduleId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($moduleId['min'])) {
|
||||
$this->addUsingAlias(CouponModuleTableMap::MODULE_ID, $moduleId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($moduleId['max'])) {
|
||||
$this->addUsingAlias(CouponModuleTableMap::MODULE_ID, $moduleId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponModuleTableMap::MODULE_ID, $moduleId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Coupon object
|
||||
*
|
||||
* @param \Thelia\Model\Coupon|ObjectCollection $coupon The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCoupon($coupon, $comparison = null)
|
||||
{
|
||||
if ($coupon instanceof \Thelia\Model\Coupon) {
|
||||
return $this
|
||||
->addUsingAlias(CouponModuleTableMap::COUPON_ID, $coupon->getId(), $comparison);
|
||||
} elseif ($coupon instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(CouponModuleTableMap::COUPON_ID, $coupon->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByCoupon() only accepts arguments of type \Thelia\Model\Coupon or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Coupon relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCoupon($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Coupon');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Coupon');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Coupon relation Coupon object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\CouponQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCouponQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCoupon($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Coupon', '\Thelia\Model\CouponQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Module object
|
||||
*
|
||||
* @param \Thelia\Model\Module|ObjectCollection $module The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByModule($module, $comparison = null)
|
||||
{
|
||||
if ($module instanceof \Thelia\Model\Module) {
|
||||
return $this
|
||||
->addUsingAlias(CouponModuleTableMap::MODULE_ID, $module->getId(), $comparison);
|
||||
} elseif ($module instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(CouponModuleTableMap::MODULE_ID, $module->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByModule() only accepts arguments of type \Thelia\Model\Module or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Module relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Module');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Module');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Module relation Module object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\ModuleQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinModule($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Module', '\Thelia\Model\ModuleQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildCouponModule $couponModule Object to remove from the list of results
|
||||
*
|
||||
* @return ChildCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($couponModule = null)
|
||||
{
|
||||
if ($couponModule) {
|
||||
$this->addCond('pruneCond0', $this->getAliasedColName(CouponModuleTableMap::COUPON_ID), $couponModule->getCouponId(), Criteria::NOT_EQUAL);
|
||||
$this->addCond('pruneCond1', $this->getAliasedColName(CouponModuleTableMap::MODULE_ID), $couponModule->getModuleId(), Criteria::NOT_EQUAL);
|
||||
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the coupon_module table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CouponModuleTableMap::DATABASE_NAME);
|
||||
}
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
$affectedRows += parent::doDeleteAll($con);
|
||||
// Because this db requires some delete cascade/set null emulation, we have to
|
||||
// clear the cached instance *after* the emulation has happened (since
|
||||
// instances get re-added by the select statement contained therein).
|
||||
CouponModuleTableMap::clearInstancePool();
|
||||
CouponModuleTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildCouponModule or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildCouponModule object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public function delete(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CouponModuleTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(CouponModuleTableMap::DATABASE_NAME);
|
||||
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
|
||||
|
||||
CouponModuleTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
CouponModuleTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // CouponModuleQuery
|
||||
@@ -34,6 +34,7 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method ChildCouponQuery orderByIsAvailableOnSpecialOffers($order = Criteria::ASC) Order by the is_available_on_special_offers column
|
||||
* @method ChildCouponQuery orderByIsUsed($order = Criteria::ASC) Order by the is_used column
|
||||
* @method ChildCouponQuery orderBySerializedConditions($order = Criteria::ASC) Order by the serialized_conditions column
|
||||
* @method ChildCouponQuery orderByPerCustomerUsageCount($order = Criteria::ASC) Order by the per_customer_usage_count column
|
||||
* @method ChildCouponQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildCouponQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
* @method ChildCouponQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
||||
@@ -50,6 +51,7 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method ChildCouponQuery groupByIsAvailableOnSpecialOffers() Group by the is_available_on_special_offers column
|
||||
* @method ChildCouponQuery groupByIsUsed() Group by the is_used column
|
||||
* @method ChildCouponQuery groupBySerializedConditions() Group by the serialized_conditions column
|
||||
* @method ChildCouponQuery groupByPerCustomerUsageCount() Group by the per_customer_usage_count column
|
||||
* @method ChildCouponQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildCouponQuery groupByUpdatedAt() Group by the updated_at column
|
||||
* @method ChildCouponQuery groupByVersion() Group by the version column
|
||||
@@ -58,6 +60,18 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method ChildCouponQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildCouponQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildCouponQuery leftJoinCouponCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponCountry relation
|
||||
* @method ChildCouponQuery rightJoinCouponCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponCountry relation
|
||||
* @method ChildCouponQuery innerJoinCouponCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponCountry relation
|
||||
*
|
||||
* @method ChildCouponQuery leftJoinCouponModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponModule relation
|
||||
* @method ChildCouponQuery rightJoinCouponModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponModule relation
|
||||
* @method ChildCouponQuery innerJoinCouponModule($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponModule relation
|
||||
*
|
||||
* @method ChildCouponQuery leftJoinCouponCustomerCount($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponCustomerCount relation
|
||||
* @method ChildCouponQuery rightJoinCouponCustomerCount($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponCustomerCount relation
|
||||
* @method ChildCouponQuery innerJoinCouponCustomerCount($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponCustomerCount relation
|
||||
*
|
||||
* @method ChildCouponQuery leftJoinCouponI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponI18n relation
|
||||
* @method ChildCouponQuery rightJoinCouponI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponI18n relation
|
||||
* @method ChildCouponQuery innerJoinCouponI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponI18n relation
|
||||
@@ -81,6 +95,7 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method ChildCoupon findOneByIsAvailableOnSpecialOffers(boolean $is_available_on_special_offers) Return the first ChildCoupon filtered by the is_available_on_special_offers column
|
||||
* @method ChildCoupon findOneByIsUsed(boolean $is_used) Return the first ChildCoupon filtered by the is_used column
|
||||
* @method ChildCoupon findOneBySerializedConditions(string $serialized_conditions) Return the first ChildCoupon filtered by the serialized_conditions column
|
||||
* @method ChildCoupon findOneByPerCustomerUsageCount(boolean $per_customer_usage_count) Return the first ChildCoupon filtered by the per_customer_usage_count column
|
||||
* @method ChildCoupon findOneByCreatedAt(string $created_at) Return the first ChildCoupon filtered by the created_at column
|
||||
* @method ChildCoupon findOneByUpdatedAt(string $updated_at) Return the first ChildCoupon filtered by the updated_at column
|
||||
* @method ChildCoupon findOneByVersion(int $version) Return the first ChildCoupon filtered by the version column
|
||||
@@ -97,6 +112,7 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method array findByIsAvailableOnSpecialOffers(boolean $is_available_on_special_offers) Return ChildCoupon objects filtered by the is_available_on_special_offers column
|
||||
* @method array findByIsUsed(boolean $is_used) Return ChildCoupon objects filtered by the is_used column
|
||||
* @method array findBySerializedConditions(string $serialized_conditions) Return ChildCoupon objects filtered by the serialized_conditions column
|
||||
* @method array findByPerCustomerUsageCount(boolean $per_customer_usage_count) Return ChildCoupon objects filtered by the per_customer_usage_count column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildCoupon objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildCoupon objects filtered by the updated_at column
|
||||
* @method array findByVersion(int $version) Return ChildCoupon objects filtered by the version column
|
||||
@@ -195,7 +211,7 @@ abstract class CouponQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT `ID`, `CODE`, `TYPE`, `SERIALIZED_EFFECTS`, `IS_ENABLED`, `EXPIRATION_DATE`, `MAX_USAGE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `IS_USED`, `SERIALIZED_CONDITIONS`, `CREATED_AT`, `UPDATED_AT`, `VERSION` FROM `coupon` WHERE `ID` = :p0';
|
||||
$sql = 'SELECT `ID`, `CODE`, `TYPE`, `SERIALIZED_EFFECTS`, `IS_ENABLED`, `EXPIRATION_DATE`, `MAX_USAGE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `IS_USED`, `SERIALIZED_CONDITIONS`, `PER_CUSTOMER_USAGE_COUNT`, `CREATED_AT`, `UPDATED_AT`, `VERSION` FROM `coupon` WHERE `ID` = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -660,6 +676,33 @@ abstract class CouponQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(CouponTableMap::SERIALIZED_CONDITIONS, $serializedConditions, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the per_customer_usage_count column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByPerCustomerUsageCount(true); // WHERE per_customer_usage_count = true
|
||||
* $query->filterByPerCustomerUsageCount('yes'); // WHERE per_customer_usage_count = true
|
||||
* </code>
|
||||
*
|
||||
* @param boolean|string $perCustomerUsageCount 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 ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPerCustomerUsageCount($perCustomerUsageCount = null, $comparison = null)
|
||||
{
|
||||
if (is_string($perCustomerUsageCount)) {
|
||||
$per_customer_usage_count = in_array(strtolower($perCustomerUsageCount), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponTableMap::PER_CUSTOMER_USAGE_COUNT, $perCustomerUsageCount, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
@@ -787,6 +830,225 @@ abstract class CouponQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(CouponTableMap::VERSION, $version, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\CouponCountry object
|
||||
*
|
||||
* @param \Thelia\Model\CouponCountry|ObjectCollection $couponCountry the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCouponCountry($couponCountry, $comparison = null)
|
||||
{
|
||||
if ($couponCountry instanceof \Thelia\Model\CouponCountry) {
|
||||
return $this
|
||||
->addUsingAlias(CouponTableMap::ID, $couponCountry->getCouponId(), $comparison);
|
||||
} elseif ($couponCountry instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useCouponCountryQuery()
|
||||
->filterByPrimaryKeys($couponCountry->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByCouponCountry() only accepts arguments of type \Thelia\Model\CouponCountry or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the CouponCountry relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCouponCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('CouponCountry');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'CouponCountry');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the CouponCountry relation CouponCountry object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\CouponCountryQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCouponCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCouponCountry($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'CouponCountry', '\Thelia\Model\CouponCountryQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\CouponModule object
|
||||
*
|
||||
* @param \Thelia\Model\CouponModule|ObjectCollection $couponModule the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCouponModule($couponModule, $comparison = null)
|
||||
{
|
||||
if ($couponModule instanceof \Thelia\Model\CouponModule) {
|
||||
return $this
|
||||
->addUsingAlias(CouponTableMap::ID, $couponModule->getCouponId(), $comparison);
|
||||
} elseif ($couponModule instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useCouponModuleQuery()
|
||||
->filterByPrimaryKeys($couponModule->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByCouponModule() only accepts arguments of type \Thelia\Model\CouponModule or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the CouponModule relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCouponModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('CouponModule');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'CouponModule');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the CouponModule relation CouponModule object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\CouponModuleQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCouponModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCouponModule($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'CouponModule', '\Thelia\Model\CouponModuleQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\CouponCustomerCount object
|
||||
*
|
||||
* @param \Thelia\Model\CouponCustomerCount|ObjectCollection $couponCustomerCount the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCouponCustomerCount($couponCustomerCount, $comparison = null)
|
||||
{
|
||||
if ($couponCustomerCount instanceof \Thelia\Model\CouponCustomerCount) {
|
||||
return $this
|
||||
->addUsingAlias(CouponTableMap::ID, $couponCustomerCount->getCouponId(), $comparison);
|
||||
} elseif ($couponCustomerCount instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useCouponCustomerCountQuery()
|
||||
->filterByPrimaryKeys($couponCustomerCount->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByCouponCustomerCount() only accepts arguments of type \Thelia\Model\CouponCustomerCount or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the CouponCustomerCount relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCouponCustomerCount($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('CouponCustomerCount');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'CouponCustomerCount');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the CouponCustomerCount relation CouponCustomerCount object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\CouponCustomerCountQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCouponCustomerCountQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCouponCustomerCount($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'CouponCustomerCount', '\Thelia\Model\CouponCustomerCountQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\CouponI18n object
|
||||
*
|
||||
@@ -933,6 +1195,57 @@ abstract class CouponQuery extends ModelCriteria
|
||||
->useQuery($relationAlias ? $relationAlias : 'CouponVersion', '\Thelia\Model\CouponVersionQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Country object
|
||||
* using the coupon_country table as cross reference
|
||||
*
|
||||
* @param Country $country the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCountry($country, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useCouponCountryQuery()
|
||||
->filterByCountry($country, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Module object
|
||||
* using the coupon_module table as cross reference
|
||||
*
|
||||
* @param Module $module the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByModule($module, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useCouponModuleQuery()
|
||||
->filterByModule($module, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Customer object
|
||||
* using the coupon_customer_count table as cross reference
|
||||
*
|
||||
* @param Customer $customer the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCustomer($customer, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useCouponCustomerCountQuery()
|
||||
->filterByCustomer($customer, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
|
||||
@@ -127,6 +127,12 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
*/
|
||||
protected $serialized_conditions;
|
||||
|
||||
/**
|
||||
* The value for the per_customer_usage_count field.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $per_customer_usage_count;
|
||||
|
||||
/**
|
||||
* The value for the created_at field.
|
||||
* @var string
|
||||
@@ -571,6 +577,17 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
return $this->serialized_conditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [per_customer_usage_count] column value.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getPerCustomerUsageCount()
|
||||
{
|
||||
|
||||
return $this->per_customer_usage_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
@@ -918,6 +935,35 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setSerializedConditions()
|
||||
|
||||
/**
|
||||
* Sets the value of the [per_customer_usage_count] 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\CouponVersion The current object (for fluent API support)
|
||||
*/
|
||||
public function setPerCustomerUsageCount($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->per_customer_usage_count !== $v) {
|
||||
$this->per_customer_usage_count = $v;
|
||||
$this->modifiedColumns[CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT] = true;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setPerCustomerUsageCount()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
@@ -1061,19 +1107,22 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponVersionTableMap::translateFieldName('SerializedConditions', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->serialized_conditions = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponVersionTableMap::translateFieldName('PerCustomerUsageCount', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->per_customer_usage_count = (null !== $col) ? (boolean) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CouponVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->version = (null !== $col) ? (int) $col : null;
|
||||
$this->resetModified();
|
||||
|
||||
@@ -1083,7 +1132,7 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 15; // 15 = CouponVersionTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 16; // 16 = CouponVersionTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\CouponVersion object", 0, $e);
|
||||
@@ -1340,6 +1389,9 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CouponVersionTableMap::SERIALIZED_CONDITIONS)) {
|
||||
$modifiedColumns[':p' . $index++] = '`SERIALIZED_CONDITIONS`';
|
||||
}
|
||||
if ($this->isColumnModified(CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT)) {
|
||||
$modifiedColumns[':p' . $index++] = '`PER_CUSTOMER_USAGE_COUNT`';
|
||||
}
|
||||
if ($this->isColumnModified(CouponVersionTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = '`CREATED_AT`';
|
||||
}
|
||||
@@ -1396,6 +1448,9 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
case '`SERIALIZED_CONDITIONS`':
|
||||
$stmt->bindValue($identifier, $this->serialized_conditions, PDO::PARAM_STR);
|
||||
break;
|
||||
case '`PER_CUSTOMER_USAGE_COUNT`':
|
||||
$stmt->bindValue($identifier, (int) $this->per_customer_usage_count, 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;
|
||||
@@ -1497,12 +1552,15 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
return $this->getSerializedConditions();
|
||||
break;
|
||||
case 12:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getPerCustomerUsageCount();
|
||||
break;
|
||||
case 13:
|
||||
return $this->getUpdatedAt();
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 14:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
case 15:
|
||||
return $this->getVersion();
|
||||
break;
|
||||
default:
|
||||
@@ -1546,9 +1604,10 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$keys[9] => $this->getIsAvailableOnSpecialOffers(),
|
||||
$keys[10] => $this->getIsUsed(),
|
||||
$keys[11] => $this->getSerializedConditions(),
|
||||
$keys[12] => $this->getCreatedAt(),
|
||||
$keys[13] => $this->getUpdatedAt(),
|
||||
$keys[14] => $this->getVersion(),
|
||||
$keys[12] => $this->getPerCustomerUsageCount(),
|
||||
$keys[13] => $this->getCreatedAt(),
|
||||
$keys[14] => $this->getUpdatedAt(),
|
||||
$keys[15] => $this->getVersion(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach ($virtualColumns as $key => $virtualColumn) {
|
||||
@@ -1630,12 +1689,15 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$this->setSerializedConditions($value);
|
||||
break;
|
||||
case 12:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setPerCustomerUsageCount($value);
|
||||
break;
|
||||
case 13:
|
||||
$this->setUpdatedAt($value);
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 14:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
case 15:
|
||||
$this->setVersion($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1674,9 +1736,10 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[9], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setIsUsed($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[11], $arr)) $this->setSerializedConditions($arr[$keys[11]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[14], $arr)) $this->setVersion($arr[$keys[14]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setPerCustomerUsageCount($arr[$keys[12]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setCreatedAt($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[14], $arr)) $this->setUpdatedAt($arr[$keys[14]]);
|
||||
if (array_key_exists($keys[15], $arr)) $this->setVersion($arr[$keys[15]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1700,6 +1763,7 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS)) $criteria->add(CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, $this->is_available_on_special_offers);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::IS_USED)) $criteria->add(CouponVersionTableMap::IS_USED, $this->is_used);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::SERIALIZED_CONDITIONS)) $criteria->add(CouponVersionTableMap::SERIALIZED_CONDITIONS, $this->serialized_conditions);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT)) $criteria->add(CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT, $this->per_customer_usage_count);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::CREATED_AT)) $criteria->add(CouponVersionTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::UPDATED_AT)) $criteria->add(CouponVersionTableMap::UPDATED_AT, $this->updated_at);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::VERSION)) $criteria->add(CouponVersionTableMap::VERSION, $this->version);
|
||||
@@ -1785,6 +1849,7 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$copyObj->setIsAvailableOnSpecialOffers($this->getIsAvailableOnSpecialOffers());
|
||||
$copyObj->setIsUsed($this->getIsUsed());
|
||||
$copyObj->setSerializedConditions($this->getSerializedConditions());
|
||||
$copyObj->setPerCustomerUsageCount($this->getPerCustomerUsageCount());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
$copyObj->setVersion($this->getVersion());
|
||||
@@ -1883,6 +1948,7 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$this->is_available_on_special_offers = null;
|
||||
$this->is_used = null;
|
||||
$this->serialized_conditions = null;
|
||||
$this->per_customer_usage_count = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->version = null;
|
||||
|
||||
@@ -33,6 +33,7 @@ use Thelia\Model\Map\CouponVersionTableMap;
|
||||
* @method ChildCouponVersionQuery orderByIsAvailableOnSpecialOffers($order = Criteria::ASC) Order by the is_available_on_special_offers column
|
||||
* @method ChildCouponVersionQuery orderByIsUsed($order = Criteria::ASC) Order by the is_used column
|
||||
* @method ChildCouponVersionQuery orderBySerializedConditions($order = Criteria::ASC) Order by the serialized_conditions column
|
||||
* @method ChildCouponVersionQuery orderByPerCustomerUsageCount($order = Criteria::ASC) Order by the per_customer_usage_count column
|
||||
* @method ChildCouponVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildCouponVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
* @method ChildCouponVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
||||
@@ -49,6 +50,7 @@ use Thelia\Model\Map\CouponVersionTableMap;
|
||||
* @method ChildCouponVersionQuery groupByIsAvailableOnSpecialOffers() Group by the is_available_on_special_offers column
|
||||
* @method ChildCouponVersionQuery groupByIsUsed() Group by the is_used column
|
||||
* @method ChildCouponVersionQuery groupBySerializedConditions() Group by the serialized_conditions column
|
||||
* @method ChildCouponVersionQuery groupByPerCustomerUsageCount() Group by the per_customer_usage_count column
|
||||
* @method ChildCouponVersionQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildCouponVersionQuery groupByUpdatedAt() Group by the updated_at column
|
||||
* @method ChildCouponVersionQuery groupByVersion() Group by the version column
|
||||
@@ -76,6 +78,7 @@ use Thelia\Model\Map\CouponVersionTableMap;
|
||||
* @method ChildCouponVersion findOneByIsAvailableOnSpecialOffers(boolean $is_available_on_special_offers) Return the first ChildCouponVersion filtered by the is_available_on_special_offers column
|
||||
* @method ChildCouponVersion findOneByIsUsed(boolean $is_used) Return the first ChildCouponVersion filtered by the is_used column
|
||||
* @method ChildCouponVersion findOneBySerializedConditions(string $serialized_conditions) Return the first ChildCouponVersion filtered by the serialized_conditions column
|
||||
* @method ChildCouponVersion findOneByPerCustomerUsageCount(boolean $per_customer_usage_count) Return the first ChildCouponVersion filtered by the per_customer_usage_count column
|
||||
* @method ChildCouponVersion findOneByCreatedAt(string $created_at) Return the first ChildCouponVersion filtered by the created_at column
|
||||
* @method ChildCouponVersion findOneByUpdatedAt(string $updated_at) Return the first ChildCouponVersion filtered by the updated_at column
|
||||
* @method ChildCouponVersion findOneByVersion(int $version) Return the first ChildCouponVersion filtered by the version column
|
||||
@@ -92,6 +95,7 @@ use Thelia\Model\Map\CouponVersionTableMap;
|
||||
* @method array findByIsAvailableOnSpecialOffers(boolean $is_available_on_special_offers) Return ChildCouponVersion objects filtered by the is_available_on_special_offers column
|
||||
* @method array findByIsUsed(boolean $is_used) Return ChildCouponVersion objects filtered by the is_used column
|
||||
* @method array findBySerializedConditions(string $serialized_conditions) Return ChildCouponVersion objects filtered by the serialized_conditions column
|
||||
* @method array findByPerCustomerUsageCount(boolean $per_customer_usage_count) Return ChildCouponVersion objects filtered by the per_customer_usage_count column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildCouponVersion objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildCouponVersion objects filtered by the updated_at column
|
||||
* @method array findByVersion(int $version) Return ChildCouponVersion objects filtered by the version column
|
||||
@@ -183,7 +187,7 @@ abstract class CouponVersionQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT `ID`, `CODE`, `TYPE`, `SERIALIZED_EFFECTS`, `IS_ENABLED`, `EXPIRATION_DATE`, `MAX_USAGE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `IS_USED`, `SERIALIZED_CONDITIONS`, `CREATED_AT`, `UPDATED_AT`, `VERSION` FROM `coupon_version` WHERE `ID` = :p0 AND `VERSION` = :p1';
|
||||
$sql = 'SELECT `ID`, `CODE`, `TYPE`, `SERIALIZED_EFFECTS`, `IS_ENABLED`, `EXPIRATION_DATE`, `MAX_USAGE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `IS_USED`, `SERIALIZED_CONDITIONS`, `PER_CUSTOMER_USAGE_COUNT`, `CREATED_AT`, `UPDATED_AT`, `VERSION` FROM `coupon_version` WHERE `ID` = :p0 AND `VERSION` = :p1';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
|
||||
@@ -662,6 +666,33 @@ abstract class CouponVersionQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(CouponVersionTableMap::SERIALIZED_CONDITIONS, $serializedConditions, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the per_customer_usage_count column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByPerCustomerUsageCount(true); // WHERE per_customer_usage_count = true
|
||||
* $query->filterByPerCustomerUsageCount('yes'); // WHERE per_customer_usage_count = true
|
||||
* </code>
|
||||
*
|
||||
* @param boolean|string $perCustomerUsageCount 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 ChildCouponVersionQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPerCustomerUsageCount($perCustomerUsageCount = null, $comparison = null)
|
||||
{
|
||||
if (is_string($perCustomerUsageCount)) {
|
||||
$per_customer_usage_count = in_array(strtolower($perCustomerUsageCount), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT, $perCustomerUsageCount, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
|
||||
@@ -21,6 +21,10 @@ use Thelia\Model\Address as ChildAddress;
|
||||
use Thelia\Model\AddressQuery as ChildAddressQuery;
|
||||
use Thelia\Model\Cart as ChildCart;
|
||||
use Thelia\Model\CartQuery as ChildCartQuery;
|
||||
use Thelia\Model\Coupon as ChildCoupon;
|
||||
use Thelia\Model\CouponCustomerCount as ChildCouponCustomerCount;
|
||||
use Thelia\Model\CouponCustomerCountQuery as ChildCouponCustomerCountQuery;
|
||||
use Thelia\Model\CouponQuery as ChildCouponQuery;
|
||||
use Thelia\Model\Customer as ChildCustomer;
|
||||
use Thelia\Model\CustomerQuery as ChildCustomerQuery;
|
||||
use Thelia\Model\CustomerTitle as ChildCustomerTitle;
|
||||
@@ -182,6 +186,17 @@ abstract class Customer implements ActiveRecordInterface
|
||||
protected $collCarts;
|
||||
protected $collCartsPartial;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildCouponCustomerCount[] Collection to store aggregation of ChildCouponCustomerCount objects.
|
||||
*/
|
||||
protected $collCouponCustomerCounts;
|
||||
protected $collCouponCustomerCountsPartial;
|
||||
|
||||
/**
|
||||
* @var ChildCoupon[] Collection to store aggregation of ChildCoupon objects.
|
||||
*/
|
||||
protected $collCoupons;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
@@ -190,6 +205,12 @@ abstract class Customer implements ActiveRecordInterface
|
||||
*/
|
||||
protected $alreadyInSave = false;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $couponsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
@@ -208,6 +229,12 @@ abstract class Customer implements ActiveRecordInterface
|
||||
*/
|
||||
protected $cartsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $couponCustomerCountsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Initializes internal state of Thelia\Model\Base\Customer object.
|
||||
*/
|
||||
@@ -1169,6 +1196,9 @@ abstract class Customer implements ActiveRecordInterface
|
||||
|
||||
$this->collCarts = null;
|
||||
|
||||
$this->collCouponCustomerCounts = null;
|
||||
|
||||
$this->collCoupons = null;
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -1314,6 +1344,33 @@ abstract class Customer implements ActiveRecordInterface
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->couponsScheduledForDeletion !== null) {
|
||||
if (!$this->couponsScheduledForDeletion->isEmpty()) {
|
||||
$pks = array();
|
||||
$pk = $this->getPrimaryKey();
|
||||
foreach ($this->couponsScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
|
||||
$pks[] = array($pk, $remotePk);
|
||||
}
|
||||
|
||||
CouponCustomerCountQuery::create()
|
||||
->filterByPrimaryKeys($pks)
|
||||
->delete($con);
|
||||
$this->couponsScheduledForDeletion = null;
|
||||
}
|
||||
|
||||
foreach ($this->getCoupons() as $coupon) {
|
||||
if ($coupon->isModified()) {
|
||||
$coupon->save($con);
|
||||
}
|
||||
}
|
||||
} elseif ($this->collCoupons) {
|
||||
foreach ($this->collCoupons as $coupon) {
|
||||
if ($coupon->isModified()) {
|
||||
$coupon->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->addressesScheduledForDeletion !== null) {
|
||||
if (!$this->addressesScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\AddressQuery::create()
|
||||
@@ -1365,6 +1422,23 @@ abstract class Customer implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->couponCustomerCountsScheduledForDeletion !== null) {
|
||||
if (!$this->couponCustomerCountsScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\CouponCustomerCountQuery::create()
|
||||
->filterByPrimaryKeys($this->couponCustomerCountsScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->couponCustomerCountsScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collCouponCustomerCounts !== null) {
|
||||
foreach ($this->collCouponCustomerCounts as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
}
|
||||
@@ -1672,6 +1746,9 @@ abstract class Customer implements ActiveRecordInterface
|
||||
if (null !== $this->collCarts) {
|
||||
$result['Carts'] = $this->collCarts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->collCouponCustomerCounts) {
|
||||
$result['CouponCustomerCounts'] = $this->collCouponCustomerCounts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
@@ -1923,6 +2000,12 @@ abstract class Customer implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->getCouponCustomerCounts() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addCouponCustomerCount($relObj->copy($deepCopy));
|
||||
}
|
||||
}
|
||||
|
||||
} // if ($deepCopy)
|
||||
|
||||
if ($makeNew) {
|
||||
@@ -2024,6 +2107,9 @@ abstract class Customer implements ActiveRecordInterface
|
||||
if ('Cart' == $relationName) {
|
||||
return $this->initCarts();
|
||||
}
|
||||
if ('CouponCustomerCount' == $relationName) {
|
||||
return $this->initCouponCustomerCounts();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2980,6 +3066,432 @@ abstract class Customer implements ActiveRecordInterface
|
||||
return $this->getCarts($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collCouponCustomerCounts collection
|
||||
*
|
||||
* This does not modify the database; however, it will remove any associated objects, causing
|
||||
* them to be refetched by subsequent calls to accessor method.
|
||||
*
|
||||
* @return void
|
||||
* @see addCouponCustomerCounts()
|
||||
*/
|
||||
public function clearCouponCustomerCounts()
|
||||
{
|
||||
$this->collCouponCustomerCounts = null; // important to set this to NULL since that means it is uninitialized
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset is the collCouponCustomerCounts collection loaded partially.
|
||||
*/
|
||||
public function resetPartialCouponCustomerCounts($v = true)
|
||||
{
|
||||
$this->collCouponCustomerCountsPartial = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collCouponCustomerCounts collection.
|
||||
*
|
||||
* By default this just sets the collCouponCustomerCounts collection to an empty array (like clearcollCouponCustomerCounts());
|
||||
* however, you may wish to override this method in your stub class to provide setting appropriate
|
||||
* to your application -- for example, setting the initial array to the values stored in database.
|
||||
*
|
||||
* @param boolean $overrideExisting If set to true, the method call initializes
|
||||
* the collection even if it is not empty
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initCouponCustomerCounts($overrideExisting = true)
|
||||
{
|
||||
if (null !== $this->collCouponCustomerCounts && !$overrideExisting) {
|
||||
return;
|
||||
}
|
||||
$this->collCouponCustomerCounts = new ObjectCollection();
|
||||
$this->collCouponCustomerCounts->setModel('\Thelia\Model\CouponCustomerCount');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of ChildCouponCustomerCount objects which contain a foreign key that references this object.
|
||||
*
|
||||
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||
* Otherwise the results are fetched from the database the first time, then cached.
|
||||
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||
* If this ChildCustomer is new, it will return
|
||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @return Collection|ChildCouponCustomerCount[] List of ChildCouponCustomerCount objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getCouponCustomerCounts($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collCouponCustomerCountsPartial && !$this->isNew();
|
||||
if (null === $this->collCouponCustomerCounts || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collCouponCustomerCounts) {
|
||||
// return empty collection
|
||||
$this->initCouponCustomerCounts();
|
||||
} else {
|
||||
$collCouponCustomerCounts = ChildCouponCustomerCountQuery::create(null, $criteria)
|
||||
->filterByCustomer($this)
|
||||
->find($con);
|
||||
|
||||
if (null !== $criteria) {
|
||||
if (false !== $this->collCouponCustomerCountsPartial && count($collCouponCustomerCounts)) {
|
||||
$this->initCouponCustomerCounts(false);
|
||||
|
||||
foreach ($collCouponCustomerCounts as $obj) {
|
||||
if (false == $this->collCouponCustomerCounts->contains($obj)) {
|
||||
$this->collCouponCustomerCounts->append($obj);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collCouponCustomerCountsPartial = true;
|
||||
}
|
||||
|
||||
reset($collCouponCustomerCounts);
|
||||
|
||||
return $collCouponCustomerCounts;
|
||||
}
|
||||
|
||||
if ($partial && $this->collCouponCustomerCounts) {
|
||||
foreach ($this->collCouponCustomerCounts as $obj) {
|
||||
if ($obj->isNew()) {
|
||||
$collCouponCustomerCounts[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->collCouponCustomerCounts = $collCouponCustomerCounts;
|
||||
$this->collCouponCustomerCountsPartial = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collCouponCustomerCounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of CouponCustomerCount objects related by a one-to-many relationship
|
||||
* to the current object.
|
||||
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
|
||||
* and new objects from the given Propel collection.
|
||||
*
|
||||
* @param Collection $couponCustomerCounts A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildCustomer The current object (for fluent API support)
|
||||
*/
|
||||
public function setCouponCustomerCounts(Collection $couponCustomerCounts, ConnectionInterface $con = null)
|
||||
{
|
||||
$couponCustomerCountsToDelete = $this->getCouponCustomerCounts(new Criteria(), $con)->diff($couponCustomerCounts);
|
||||
|
||||
|
||||
$this->couponCustomerCountsScheduledForDeletion = $couponCustomerCountsToDelete;
|
||||
|
||||
foreach ($couponCustomerCountsToDelete as $couponCustomerCountRemoved) {
|
||||
$couponCustomerCountRemoved->setCustomer(null);
|
||||
}
|
||||
|
||||
$this->collCouponCustomerCounts = null;
|
||||
foreach ($couponCustomerCounts as $couponCustomerCount) {
|
||||
$this->addCouponCustomerCount($couponCustomerCount);
|
||||
}
|
||||
|
||||
$this->collCouponCustomerCounts = $couponCustomerCounts;
|
||||
$this->collCouponCustomerCountsPartial = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related CouponCustomerCount objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param ConnectionInterface $con
|
||||
* @return int Count of related CouponCustomerCount objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countCouponCustomerCounts(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collCouponCustomerCountsPartial && !$this->isNew();
|
||||
if (null === $this->collCouponCustomerCounts || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collCouponCustomerCounts) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($partial && !$criteria) {
|
||||
return count($this->getCouponCustomerCounts());
|
||||
}
|
||||
|
||||
$query = ChildCouponCustomerCountQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
|
||||
return $query
|
||||
->filterByCustomer($this)
|
||||
->count($con);
|
||||
}
|
||||
|
||||
return count($this->collCouponCustomerCounts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called to associate a ChildCouponCustomerCount object to this object
|
||||
* through the ChildCouponCustomerCount foreign key attribute.
|
||||
*
|
||||
* @param ChildCouponCustomerCount $l ChildCouponCustomerCount
|
||||
* @return \Thelia\Model\Customer The current object (for fluent API support)
|
||||
*/
|
||||
public function addCouponCustomerCount(ChildCouponCustomerCount $l)
|
||||
{
|
||||
if ($this->collCouponCustomerCounts === null) {
|
||||
$this->initCouponCustomerCounts();
|
||||
$this->collCouponCustomerCountsPartial = true;
|
||||
}
|
||||
|
||||
if (!in_array($l, $this->collCouponCustomerCounts->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddCouponCustomerCount($l);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CouponCustomerCount $couponCustomerCount The couponCustomerCount object to add.
|
||||
*/
|
||||
protected function doAddCouponCustomerCount($couponCustomerCount)
|
||||
{
|
||||
$this->collCouponCustomerCounts[]= $couponCustomerCount;
|
||||
$couponCustomerCount->setCustomer($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CouponCustomerCount $couponCustomerCount The couponCustomerCount object to remove.
|
||||
* @return ChildCustomer The current object (for fluent API support)
|
||||
*/
|
||||
public function removeCouponCustomerCount($couponCustomerCount)
|
||||
{
|
||||
if ($this->getCouponCustomerCounts()->contains($couponCustomerCount)) {
|
||||
$this->collCouponCustomerCounts->remove($this->collCouponCustomerCounts->search($couponCustomerCount));
|
||||
if (null === $this->couponCustomerCountsScheduledForDeletion) {
|
||||
$this->couponCustomerCountsScheduledForDeletion = clone $this->collCouponCustomerCounts;
|
||||
$this->couponCustomerCountsScheduledForDeletion->clear();
|
||||
}
|
||||
$this->couponCustomerCountsScheduledForDeletion[]= clone $couponCustomerCount;
|
||||
$couponCustomerCount->setCustomer(null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this Customer is new, it will return
|
||||
* an empty collection; or if this Customer has previously
|
||||
* been saved, it will retrieve related CouponCustomerCounts from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
* actually need in Customer.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return Collection|ChildCouponCustomerCount[] List of ChildCouponCustomerCount objects
|
||||
*/
|
||||
public function getCouponCustomerCountsJoinCoupon($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = ChildCouponCustomerCountQuery::create(null, $criteria);
|
||||
$query->joinWith('Coupon', $joinBehavior);
|
||||
|
||||
return $this->getCouponCustomerCounts($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collCoupons collection
|
||||
*
|
||||
* This does not modify the database; however, it will remove any associated objects, causing
|
||||
* them to be refetched by subsequent calls to accessor method.
|
||||
*
|
||||
* @return void
|
||||
* @see addCoupons()
|
||||
*/
|
||||
public function clearCoupons()
|
||||
{
|
||||
$this->collCoupons = null; // important to set this to NULL since that means it is uninitialized
|
||||
$this->collCouponsPartial = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collCoupons collection.
|
||||
*
|
||||
* By default this just sets the collCoupons collection to an empty collection (like clearCoupons());
|
||||
* however, you may wish to override this method in your stub class to provide setting appropriate
|
||||
* to your application -- for example, setting the initial array to the values stored in database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initCoupons()
|
||||
{
|
||||
$this->collCoupons = new ObjectCollection();
|
||||
$this->collCoupons->setModel('\Thelia\Model\Coupon');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a collection of ChildCoupon objects related by a many-to-many relationship
|
||||
* to the current object by way of the coupon_customer_count cross-reference table.
|
||||
*
|
||||
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||
* Otherwise the results are fetched from the database the first time, then cached.
|
||||
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||
* If this ChildCustomer is new, it will return
|
||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||
*
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return ObjectCollection|ChildCoupon[] List of ChildCoupon objects
|
||||
*/
|
||||
public function getCoupons($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collCoupons || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collCoupons) {
|
||||
// return empty collection
|
||||
$this->initCoupons();
|
||||
} else {
|
||||
$collCoupons = ChildCouponQuery::create(null, $criteria)
|
||||
->filterByCustomer($this)
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
return $collCoupons;
|
||||
}
|
||||
$this->collCoupons = $collCoupons;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collCoupons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of Coupon objects related by a many-to-many relationship
|
||||
* to the current object by way of the coupon_customer_count cross-reference table.
|
||||
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
|
||||
* and new objects from the given Propel collection.
|
||||
*
|
||||
* @param Collection $coupons A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildCustomer The current object (for fluent API support)
|
||||
*/
|
||||
public function setCoupons(Collection $coupons, ConnectionInterface $con = null)
|
||||
{
|
||||
$this->clearCoupons();
|
||||
$currentCoupons = $this->getCoupons();
|
||||
|
||||
$this->couponsScheduledForDeletion = $currentCoupons->diff($coupons);
|
||||
|
||||
foreach ($coupons as $coupon) {
|
||||
if (!$currentCoupons->contains($coupon)) {
|
||||
$this->doAddCoupon($coupon);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collCoupons = $coupons;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of ChildCoupon objects related by a many-to-many relationship
|
||||
* to the current object by way of the coupon_customer_count cross-reference table.
|
||||
*
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param boolean $distinct Set to true to force count distinct
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return int the number of related ChildCoupon objects
|
||||
*/
|
||||
public function countCoupons($criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collCoupons || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collCoupons) {
|
||||
return 0;
|
||||
} else {
|
||||
$query = ChildCouponQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
|
||||
return $query
|
||||
->filterByCustomer($this)
|
||||
->count($con);
|
||||
}
|
||||
} else {
|
||||
return count($this->collCoupons);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate a ChildCoupon object to this object
|
||||
* through the coupon_customer_count cross reference table.
|
||||
*
|
||||
* @param ChildCoupon $coupon The ChildCouponCustomerCount object to relate
|
||||
* @return ChildCustomer The current object (for fluent API support)
|
||||
*/
|
||||
public function addCoupon(ChildCoupon $coupon)
|
||||
{
|
||||
if ($this->collCoupons === null) {
|
||||
$this->initCoupons();
|
||||
}
|
||||
|
||||
if (!$this->collCoupons->contains($coupon)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddCoupon($coupon);
|
||||
$this->collCoupons[] = $coupon;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Coupon $coupon The coupon object to add.
|
||||
*/
|
||||
protected function doAddCoupon($coupon)
|
||||
{
|
||||
$couponCustomerCount = new ChildCouponCustomerCount();
|
||||
$couponCustomerCount->setCoupon($coupon);
|
||||
$this->addCouponCustomerCount($couponCustomerCount);
|
||||
// set the back reference to this object directly as using provided method either results
|
||||
// in endless loop or in multiple relations
|
||||
if (!$coupon->getCustomers()->contains($this)) {
|
||||
$foreignCollection = $coupon->getCustomers();
|
||||
$foreignCollection[] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a ChildCoupon object to this object
|
||||
* through the coupon_customer_count cross reference table.
|
||||
*
|
||||
* @param ChildCoupon $coupon The ChildCouponCustomerCount object to relate
|
||||
* @return ChildCustomer The current object (for fluent API support)
|
||||
*/
|
||||
public function removeCoupon(ChildCoupon $coupon)
|
||||
{
|
||||
if ($this->getCoupons()->contains($coupon)) {
|
||||
$this->collCoupons->remove($this->collCoupons->search($coupon));
|
||||
|
||||
if (null === $this->couponsScheduledForDeletion) {
|
||||
$this->couponsScheduledForDeletion = clone $this->collCoupons;
|
||||
$this->couponsScheduledForDeletion->clear();
|
||||
}
|
||||
|
||||
$this->couponsScheduledForDeletion[] = $coupon;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
@@ -3035,11 +3547,23 @@ abstract class Customer implements ActiveRecordInterface
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collCouponCustomerCounts) {
|
||||
foreach ($this->collCouponCustomerCounts as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collCoupons) {
|
||||
foreach ($this->collCoupons as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
$this->collAddresses = null;
|
||||
$this->collOrders = null;
|
||||
$this->collCarts = null;
|
||||
$this->collCouponCustomerCounts = null;
|
||||
$this->collCoupons = null;
|
||||
$this->aCustomerTitle = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,10 @@ use Thelia\Model\Map\CustomerTableMap;
|
||||
* @method ChildCustomerQuery rightJoinCart($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Cart relation
|
||||
* @method ChildCustomerQuery innerJoinCart($relationAlias = null) Adds a INNER JOIN clause to the query using the Cart relation
|
||||
*
|
||||
* @method ChildCustomerQuery leftJoinCouponCustomerCount($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponCustomerCount relation
|
||||
* @method ChildCustomerQuery rightJoinCouponCustomerCount($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponCustomerCount relation
|
||||
* @method ChildCustomerQuery innerJoinCouponCustomerCount($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponCustomerCount relation
|
||||
*
|
||||
* @method ChildCustomer findOne(ConnectionInterface $con = null) Return the first ChildCustomer matching the query
|
||||
* @method ChildCustomer findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCustomer matching the query, or a new ChildCustomer object populated from the query conditions when no match is found
|
||||
*
|
||||
@@ -1124,6 +1128,96 @@ abstract class CustomerQuery extends ModelCriteria
|
||||
->useQuery($relationAlias ? $relationAlias : 'Cart', '\Thelia\Model\CartQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\CouponCustomerCount object
|
||||
*
|
||||
* @param \Thelia\Model\CouponCustomerCount|ObjectCollection $couponCustomerCount the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCustomerQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCouponCustomerCount($couponCustomerCount, $comparison = null)
|
||||
{
|
||||
if ($couponCustomerCount instanceof \Thelia\Model\CouponCustomerCount) {
|
||||
return $this
|
||||
->addUsingAlias(CustomerTableMap::ID, $couponCustomerCount->getCustomerId(), $comparison);
|
||||
} elseif ($couponCustomerCount instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useCouponCustomerCountQuery()
|
||||
->filterByPrimaryKeys($couponCustomerCount->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByCouponCustomerCount() only accepts arguments of type \Thelia\Model\CouponCustomerCount or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the CouponCustomerCount relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCustomerQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCouponCustomerCount($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('CouponCustomerCount');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'CouponCustomerCount');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the CouponCustomerCount relation CouponCustomerCount object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\CouponCustomerCountQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCouponCustomerCountQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCouponCustomerCount($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'CouponCustomerCount', '\Thelia\Model\CouponCustomerCountQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Coupon object
|
||||
* using the coupon_customer_count table as cross reference
|
||||
*
|
||||
* @param Coupon $coupon the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCustomerQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCoupon($coupon, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useCouponCustomerCountQuery()
|
||||
->filterByCoupon($coupon, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -64,6 +64,14 @@ use Thelia\Model\Map\ModuleTableMap;
|
||||
* @method ChildModuleQuery rightJoinModuleImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleImage relation
|
||||
* @method ChildModuleQuery innerJoinModuleImage($relationAlias = null) Adds a INNER JOIN clause to the query using the ModuleImage relation
|
||||
*
|
||||
* @method ChildModuleQuery leftJoinCouponModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponModule relation
|
||||
* @method ChildModuleQuery rightJoinCouponModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponModule relation
|
||||
* @method ChildModuleQuery innerJoinCouponModule($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponModule relation
|
||||
*
|
||||
* @method ChildModuleQuery leftJoinOrderCouponModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderCouponModule relation
|
||||
* @method ChildModuleQuery rightJoinOrderCouponModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderCouponModule relation
|
||||
* @method ChildModuleQuery innerJoinOrderCouponModule($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderCouponModule relation
|
||||
*
|
||||
* @method ChildModuleQuery leftJoinModuleI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ModuleI18n relation
|
||||
* @method ChildModuleQuery rightJoinModuleI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleI18n relation
|
||||
* @method ChildModuleQuery innerJoinModuleI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ModuleI18n relation
|
||||
@@ -938,6 +946,152 @@ abstract class ModuleQuery extends ModelCriteria
|
||||
->useQuery($relationAlias ? $relationAlias : 'ModuleImage', '\Thelia\Model\ModuleImageQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\CouponModule object
|
||||
*
|
||||
* @param \Thelia\Model\CouponModule|ObjectCollection $couponModule the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCouponModule($couponModule, $comparison = null)
|
||||
{
|
||||
if ($couponModule instanceof \Thelia\Model\CouponModule) {
|
||||
return $this
|
||||
->addUsingAlias(ModuleTableMap::ID, $couponModule->getModuleId(), $comparison);
|
||||
} elseif ($couponModule instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useCouponModuleQuery()
|
||||
->filterByPrimaryKeys($couponModule->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByCouponModule() only accepts arguments of type \Thelia\Model\CouponModule or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the CouponModule relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCouponModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('CouponModule');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'CouponModule');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the CouponModule relation CouponModule object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\CouponModuleQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCouponModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCouponModule($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'CouponModule', '\Thelia\Model\CouponModuleQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\OrderCouponModule object
|
||||
*
|
||||
* @param \Thelia\Model\OrderCouponModule|ObjectCollection $orderCouponModule the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByOrderCouponModule($orderCouponModule, $comparison = null)
|
||||
{
|
||||
if ($orderCouponModule instanceof \Thelia\Model\OrderCouponModule) {
|
||||
return $this
|
||||
->addUsingAlias(ModuleTableMap::ID, $orderCouponModule->getModuleId(), $comparison);
|
||||
} elseif ($orderCouponModule instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useOrderCouponModuleQuery()
|
||||
->filterByPrimaryKeys($orderCouponModule->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByOrderCouponModule() only accepts arguments of type \Thelia\Model\OrderCouponModule or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the OrderCouponModule relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinOrderCouponModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('OrderCouponModule');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'OrderCouponModule');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the OrderCouponModule relation OrderCouponModule object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\OrderCouponModuleQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useOrderCouponModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinOrderCouponModule($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'OrderCouponModule', '\Thelia\Model\OrderCouponModuleQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\ModuleI18n object
|
||||
*
|
||||
@@ -1011,6 +1165,40 @@ abstract class ModuleQuery extends ModelCriteria
|
||||
->useQuery($relationAlias ? $relationAlias : 'ModuleI18n', '\Thelia\Model\ModuleI18nQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Coupon object
|
||||
* using the coupon_module table as cross reference
|
||||
*
|
||||
* @param Coupon $coupon the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCoupon($coupon, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useCouponModuleQuery()
|
||||
->filterByCoupon($coupon, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related OrderCoupon object
|
||||
* using the order_coupon_module table as cross reference
|
||||
*
|
||||
* @param OrderCoupon $orderCoupon the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByOrderCoupon($orderCoupon, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useOrderCouponModuleQuery()
|
||||
->filterByOrderCoupon($orderCoupon, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1268
core/lib/Thelia/Model/Base/OrderCouponCountry.php
Normal file
1268
core/lib/Thelia/Model/Base/OrderCouponCountry.php
Normal file
File diff suppressed because it is too large
Load Diff
568
core/lib/Thelia/Model/Base/OrderCouponCountryQuery.php
Normal file
568
core/lib/Thelia/Model/Base/OrderCouponCountryQuery.php
Normal file
@@ -0,0 +1,568 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelJoin;
|
||||
use Propel\Runtime\Collection\Collection;
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Thelia\Model\OrderCouponCountry as ChildOrderCouponCountry;
|
||||
use Thelia\Model\OrderCouponCountryQuery as ChildOrderCouponCountryQuery;
|
||||
use Thelia\Model\Map\OrderCouponCountryTableMap;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'order_coupon_country' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildOrderCouponCountryQuery orderByCouponId($order = Criteria::ASC) Order by the coupon_id column
|
||||
* @method ChildOrderCouponCountryQuery orderByCountryId($order = Criteria::ASC) Order by the country_id column
|
||||
*
|
||||
* @method ChildOrderCouponCountryQuery groupByCouponId() Group by the coupon_id column
|
||||
* @method ChildOrderCouponCountryQuery groupByCountryId() Group by the country_id column
|
||||
*
|
||||
* @method ChildOrderCouponCountryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildOrderCouponCountryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildOrderCouponCountryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildOrderCouponCountryQuery leftJoinCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the Country relation
|
||||
* @method ChildOrderCouponCountryQuery rightJoinCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Country relation
|
||||
* @method ChildOrderCouponCountryQuery innerJoinCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the Country relation
|
||||
*
|
||||
* @method ChildOrderCouponCountryQuery leftJoinOrderCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderCoupon relation
|
||||
* @method ChildOrderCouponCountryQuery rightJoinOrderCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderCoupon relation
|
||||
* @method ChildOrderCouponCountryQuery innerJoinOrderCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderCoupon relation
|
||||
*
|
||||
* @method ChildOrderCouponCountry findOne(ConnectionInterface $con = null) Return the first ChildOrderCouponCountry matching the query
|
||||
* @method ChildOrderCouponCountry findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderCouponCountry matching the query, or a new ChildOrderCouponCountry object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildOrderCouponCountry findOneByCouponId(int $coupon_id) Return the first ChildOrderCouponCountry filtered by the coupon_id column
|
||||
* @method ChildOrderCouponCountry findOneByCountryId(int $country_id) Return the first ChildOrderCouponCountry filtered by the country_id column
|
||||
*
|
||||
* @method array findByCouponId(int $coupon_id) Return ChildOrderCouponCountry objects filtered by the coupon_id column
|
||||
* @method array findByCountryId(int $country_id) Return ChildOrderCouponCountry objects filtered by the country_id column
|
||||
*
|
||||
*/
|
||||
abstract class OrderCouponCountryQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \Thelia\Model\Base\OrderCouponCountryQuery object.
|
||||
*
|
||||
* @param string $dbName The database name
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\OrderCouponCountry', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildOrderCouponCountryQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildOrderCouponCountryQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \Thelia\Model\OrderCouponCountryQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \Thelia\Model\OrderCouponCountryQuery();
|
||||
if (null !== $modelAlias) {
|
||||
$query->setModelAlias($modelAlias);
|
||||
}
|
||||
if ($criteria instanceof Criteria) {
|
||||
$query->mergeWith($criteria);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
* Propel uses the instance pool to skip the database if the object exists.
|
||||
* Go fast if the query is untouched.
|
||||
*
|
||||
* <code>
|
||||
* $obj = $c->findPk(array(12, 34), $con);
|
||||
* </code>
|
||||
*
|
||||
* @param array[$coupon_id, $country_id] $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ChildOrderCouponCountry|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = OrderCouponCountryTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(OrderCouponCountryTableMap::DATABASE_NAME);
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|
||||
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|
||||
|| $this->map || $this->having || $this->joins) {
|
||||
return $this->findPkComplex($key, $con);
|
||||
} else {
|
||||
return $this->findPkSimple($key, $con);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key using raw SQL to go fast.
|
||||
* Bypass doSelect() and the object formatter by using generated code.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildOrderCouponCountry A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT `COUPON_ID`, `COUNTRY_ID` FROM `order_coupon_country` WHERE `COUPON_ID` = :p0 AND `COUNTRY_ID` = :p1';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$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);
|
||||
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
|
||||
}
|
||||
$obj = null;
|
||||
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
|
||||
$obj = new ChildOrderCouponCountry();
|
||||
$obj->hydrate($row);
|
||||
OrderCouponCountryTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildOrderCouponCountry|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
protected function findPkComplex($key, $con)
|
||||
{
|
||||
// As the query uses a PK condition, no limit(1) is necessary.
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKey($key)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find objects by primary key
|
||||
* <code>
|
||||
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
|
||||
* </code>
|
||||
* @param array $keys Primary keys to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
|
||||
*/
|
||||
public function findPks($keys, $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKeys($keys)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by primary key
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
*
|
||||
* @return ChildOrderCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
$this->addUsingAlias(OrderCouponCountryTableMap::COUPON_ID, $key[0], Criteria::EQUAL);
|
||||
$this->addUsingAlias(OrderCouponCountryTableMap::COUNTRY_ID, $key[1], Criteria::EQUAL);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a list of primary keys
|
||||
*
|
||||
* @param array $keys The list of primary key to use for the query
|
||||
*
|
||||
* @return ChildOrderCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
if (empty($keys)) {
|
||||
return $this->add(null, '1<>1', Criteria::CUSTOM);
|
||||
}
|
||||
foreach ($keys as $key) {
|
||||
$cton0 = $this->getNewCriterion(OrderCouponCountryTableMap::COUPON_ID, $key[0], Criteria::EQUAL);
|
||||
$cton1 = $this->getNewCriterion(OrderCouponCountryTableMap::COUNTRY_ID, $key[1], Criteria::EQUAL);
|
||||
$cton0->addAnd($cton1);
|
||||
$this->addOr($cton0);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the coupon_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCouponId(1234); // WHERE coupon_id = 1234
|
||||
* $query->filterByCouponId(array(12, 34)); // WHERE coupon_id IN (12, 34)
|
||||
* $query->filterByCouponId(array('min' => 12)); // WHERE coupon_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByOrderCoupon()
|
||||
*
|
||||
* @param mixed $couponId 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 ChildOrderCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCouponId($couponId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($couponId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($couponId['min'])) {
|
||||
$this->addUsingAlias(OrderCouponCountryTableMap::COUPON_ID, $couponId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($couponId['max'])) {
|
||||
$this->addUsingAlias(OrderCouponCountryTableMap::COUPON_ID, $couponId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(OrderCouponCountryTableMap::COUPON_ID, $couponId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the country_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCountryId(1234); // WHERE country_id = 1234
|
||||
* $query->filterByCountryId(array(12, 34)); // WHERE country_id IN (12, 34)
|
||||
* $query->filterByCountryId(array('min' => 12)); // WHERE country_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByCountry()
|
||||
*
|
||||
* @param mixed $countryId 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 ChildOrderCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCountryId($countryId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($countryId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($countryId['min'])) {
|
||||
$this->addUsingAlias(OrderCouponCountryTableMap::COUNTRY_ID, $countryId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($countryId['max'])) {
|
||||
$this->addUsingAlias(OrderCouponCountryTableMap::COUNTRY_ID, $countryId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(OrderCouponCountryTableMap::COUNTRY_ID, $countryId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Country object
|
||||
*
|
||||
* @param \Thelia\Model\Country|ObjectCollection $country The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildOrderCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCountry($country, $comparison = null)
|
||||
{
|
||||
if ($country instanceof \Thelia\Model\Country) {
|
||||
return $this
|
||||
->addUsingAlias(OrderCouponCountryTableMap::COUNTRY_ID, $country->getId(), $comparison);
|
||||
} elseif ($country instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(OrderCouponCountryTableMap::COUNTRY_ID, $country->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByCountry() only accepts arguments of type \Thelia\Model\Country or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Country relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildOrderCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Country');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Country');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Country relation Country object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\CountryQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCountry($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Country', '\Thelia\Model\CountryQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\OrderCoupon object
|
||||
*
|
||||
* @param \Thelia\Model\OrderCoupon|ObjectCollection $orderCoupon The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildOrderCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByOrderCoupon($orderCoupon, $comparison = null)
|
||||
{
|
||||
if ($orderCoupon instanceof \Thelia\Model\OrderCoupon) {
|
||||
return $this
|
||||
->addUsingAlias(OrderCouponCountryTableMap::COUPON_ID, $orderCoupon->getId(), $comparison);
|
||||
} elseif ($orderCoupon instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(OrderCouponCountryTableMap::COUPON_ID, $orderCoupon->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByOrderCoupon() only accepts arguments of type \Thelia\Model\OrderCoupon or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the OrderCoupon relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildOrderCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinOrderCoupon($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('OrderCoupon');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'OrderCoupon');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the OrderCoupon relation OrderCoupon object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\OrderCouponQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useOrderCouponQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinOrderCoupon($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'OrderCoupon', '\Thelia\Model\OrderCouponQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildOrderCouponCountry $orderCouponCountry Object to remove from the list of results
|
||||
*
|
||||
* @return ChildOrderCouponCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($orderCouponCountry = null)
|
||||
{
|
||||
if ($orderCouponCountry) {
|
||||
$this->addCond('pruneCond0', $this->getAliasedColName(OrderCouponCountryTableMap::COUPON_ID), $orderCouponCountry->getCouponId(), Criteria::NOT_EQUAL);
|
||||
$this->addCond('pruneCond1', $this->getAliasedColName(OrderCouponCountryTableMap::COUNTRY_ID), $orderCouponCountry->getCountryId(), Criteria::NOT_EQUAL);
|
||||
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the order_coupon_country table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(OrderCouponCountryTableMap::DATABASE_NAME);
|
||||
}
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
$affectedRows += parent::doDeleteAll($con);
|
||||
// Because this db requires some delete cascade/set null emulation, we have to
|
||||
// clear the cached instance *after* the emulation has happened (since
|
||||
// instances get re-added by the select statement contained therein).
|
||||
OrderCouponCountryTableMap::clearInstancePool();
|
||||
OrderCouponCountryTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildOrderCouponCountry or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildOrderCouponCountry object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public function delete(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(OrderCouponCountryTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(OrderCouponCountryTableMap::DATABASE_NAME);
|
||||
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
|
||||
|
||||
OrderCouponCountryTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
OrderCouponCountryTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // OrderCouponCountryQuery
|
||||
1268
core/lib/Thelia/Model/Base/OrderCouponModule.php
Normal file
1268
core/lib/Thelia/Model/Base/OrderCouponModule.php
Normal file
File diff suppressed because it is too large
Load Diff
568
core/lib/Thelia/Model/Base/OrderCouponModuleQuery.php
Normal file
568
core/lib/Thelia/Model/Base/OrderCouponModuleQuery.php
Normal file
@@ -0,0 +1,568 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelJoin;
|
||||
use Propel\Runtime\Collection\Collection;
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Thelia\Model\OrderCouponModule as ChildOrderCouponModule;
|
||||
use Thelia\Model\OrderCouponModuleQuery as ChildOrderCouponModuleQuery;
|
||||
use Thelia\Model\Map\OrderCouponModuleTableMap;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'order_coupon_module' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildOrderCouponModuleQuery orderByCouponId($order = Criteria::ASC) Order by the coupon_id column
|
||||
* @method ChildOrderCouponModuleQuery orderByModuleId($order = Criteria::ASC) Order by the module_id column
|
||||
*
|
||||
* @method ChildOrderCouponModuleQuery groupByCouponId() Group by the coupon_id column
|
||||
* @method ChildOrderCouponModuleQuery groupByModuleId() Group by the module_id column
|
||||
*
|
||||
* @method ChildOrderCouponModuleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildOrderCouponModuleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildOrderCouponModuleQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildOrderCouponModuleQuery leftJoinOrderCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderCoupon relation
|
||||
* @method ChildOrderCouponModuleQuery rightJoinOrderCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderCoupon relation
|
||||
* @method ChildOrderCouponModuleQuery innerJoinOrderCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderCoupon relation
|
||||
*
|
||||
* @method ChildOrderCouponModuleQuery leftJoinModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the Module relation
|
||||
* @method ChildOrderCouponModuleQuery rightJoinModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Module relation
|
||||
* @method ChildOrderCouponModuleQuery innerJoinModule($relationAlias = null) Adds a INNER JOIN clause to the query using the Module relation
|
||||
*
|
||||
* @method ChildOrderCouponModule findOne(ConnectionInterface $con = null) Return the first ChildOrderCouponModule matching the query
|
||||
* @method ChildOrderCouponModule findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderCouponModule matching the query, or a new ChildOrderCouponModule object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildOrderCouponModule findOneByCouponId(int $coupon_id) Return the first ChildOrderCouponModule filtered by the coupon_id column
|
||||
* @method ChildOrderCouponModule findOneByModuleId(int $module_id) Return the first ChildOrderCouponModule filtered by the module_id column
|
||||
*
|
||||
* @method array findByCouponId(int $coupon_id) Return ChildOrderCouponModule objects filtered by the coupon_id column
|
||||
* @method array findByModuleId(int $module_id) Return ChildOrderCouponModule objects filtered by the module_id column
|
||||
*
|
||||
*/
|
||||
abstract class OrderCouponModuleQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \Thelia\Model\Base\OrderCouponModuleQuery object.
|
||||
*
|
||||
* @param string $dbName The database name
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\OrderCouponModule', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildOrderCouponModuleQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildOrderCouponModuleQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \Thelia\Model\OrderCouponModuleQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \Thelia\Model\OrderCouponModuleQuery();
|
||||
if (null !== $modelAlias) {
|
||||
$query->setModelAlias($modelAlias);
|
||||
}
|
||||
if ($criteria instanceof Criteria) {
|
||||
$query->mergeWith($criteria);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
* Propel uses the instance pool to skip the database if the object exists.
|
||||
* Go fast if the query is untouched.
|
||||
*
|
||||
* <code>
|
||||
* $obj = $c->findPk(array(12, 34), $con);
|
||||
* </code>
|
||||
*
|
||||
* @param array[$coupon_id, $module_id] $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ChildOrderCouponModule|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = OrderCouponModuleTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(OrderCouponModuleTableMap::DATABASE_NAME);
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|
||||
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|
||||
|| $this->map || $this->having || $this->joins) {
|
||||
return $this->findPkComplex($key, $con);
|
||||
} else {
|
||||
return $this->findPkSimple($key, $con);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key using raw SQL to go fast.
|
||||
* Bypass doSelect() and the object formatter by using generated code.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildOrderCouponModule A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT `COUPON_ID`, `MODULE_ID` FROM `order_coupon_module` WHERE `COUPON_ID` = :p0 AND `MODULE_ID` = :p1';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$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);
|
||||
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
|
||||
}
|
||||
$obj = null;
|
||||
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
|
||||
$obj = new ChildOrderCouponModule();
|
||||
$obj->hydrate($row);
|
||||
OrderCouponModuleTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildOrderCouponModule|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
protected function findPkComplex($key, $con)
|
||||
{
|
||||
// As the query uses a PK condition, no limit(1) is necessary.
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKey($key)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find objects by primary key
|
||||
* <code>
|
||||
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
|
||||
* </code>
|
||||
* @param array $keys Primary keys to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
|
||||
*/
|
||||
public function findPks($keys, $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKeys($keys)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by primary key
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
*
|
||||
* @return ChildOrderCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
$this->addUsingAlias(OrderCouponModuleTableMap::COUPON_ID, $key[0], Criteria::EQUAL);
|
||||
$this->addUsingAlias(OrderCouponModuleTableMap::MODULE_ID, $key[1], Criteria::EQUAL);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a list of primary keys
|
||||
*
|
||||
* @param array $keys The list of primary key to use for the query
|
||||
*
|
||||
* @return ChildOrderCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
if (empty($keys)) {
|
||||
return $this->add(null, '1<>1', Criteria::CUSTOM);
|
||||
}
|
||||
foreach ($keys as $key) {
|
||||
$cton0 = $this->getNewCriterion(OrderCouponModuleTableMap::COUPON_ID, $key[0], Criteria::EQUAL);
|
||||
$cton1 = $this->getNewCriterion(OrderCouponModuleTableMap::MODULE_ID, $key[1], Criteria::EQUAL);
|
||||
$cton0->addAnd($cton1);
|
||||
$this->addOr($cton0);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the coupon_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCouponId(1234); // WHERE coupon_id = 1234
|
||||
* $query->filterByCouponId(array(12, 34)); // WHERE coupon_id IN (12, 34)
|
||||
* $query->filterByCouponId(array('min' => 12)); // WHERE coupon_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByOrderCoupon()
|
||||
*
|
||||
* @param mixed $couponId 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 ChildOrderCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCouponId($couponId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($couponId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($couponId['min'])) {
|
||||
$this->addUsingAlias(OrderCouponModuleTableMap::COUPON_ID, $couponId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($couponId['max'])) {
|
||||
$this->addUsingAlias(OrderCouponModuleTableMap::COUPON_ID, $couponId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(OrderCouponModuleTableMap::COUPON_ID, $couponId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the module_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByModuleId(1234); // WHERE module_id = 1234
|
||||
* $query->filterByModuleId(array(12, 34)); // WHERE module_id IN (12, 34)
|
||||
* $query->filterByModuleId(array('min' => 12)); // WHERE module_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByModule()
|
||||
*
|
||||
* @param mixed $moduleId 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 ChildOrderCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByModuleId($moduleId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($moduleId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($moduleId['min'])) {
|
||||
$this->addUsingAlias(OrderCouponModuleTableMap::MODULE_ID, $moduleId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($moduleId['max'])) {
|
||||
$this->addUsingAlias(OrderCouponModuleTableMap::MODULE_ID, $moduleId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(OrderCouponModuleTableMap::MODULE_ID, $moduleId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\OrderCoupon object
|
||||
*
|
||||
* @param \Thelia\Model\OrderCoupon|ObjectCollection $orderCoupon The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildOrderCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByOrderCoupon($orderCoupon, $comparison = null)
|
||||
{
|
||||
if ($orderCoupon instanceof \Thelia\Model\OrderCoupon) {
|
||||
return $this
|
||||
->addUsingAlias(OrderCouponModuleTableMap::COUPON_ID, $orderCoupon->getId(), $comparison);
|
||||
} elseif ($orderCoupon instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(OrderCouponModuleTableMap::COUPON_ID, $orderCoupon->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByOrderCoupon() only accepts arguments of type \Thelia\Model\OrderCoupon or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the OrderCoupon relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildOrderCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinOrderCoupon($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('OrderCoupon');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'OrderCoupon');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the OrderCoupon relation OrderCoupon object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\OrderCouponQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useOrderCouponQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinOrderCoupon($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'OrderCoupon', '\Thelia\Model\OrderCouponQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Module object
|
||||
*
|
||||
* @param \Thelia\Model\Module|ObjectCollection $module The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildOrderCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByModule($module, $comparison = null)
|
||||
{
|
||||
if ($module instanceof \Thelia\Model\Module) {
|
||||
return $this
|
||||
->addUsingAlias(OrderCouponModuleTableMap::MODULE_ID, $module->getId(), $comparison);
|
||||
} elseif ($module instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(OrderCouponModuleTableMap::MODULE_ID, $module->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByModule() only accepts arguments of type \Thelia\Model\Module or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Module relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildOrderCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Module');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Module');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Module relation Module object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\ModuleQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinModule($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Module', '\Thelia\Model\ModuleQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildOrderCouponModule $orderCouponModule Object to remove from the list of results
|
||||
*
|
||||
* @return ChildOrderCouponModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($orderCouponModule = null)
|
||||
{
|
||||
if ($orderCouponModule) {
|
||||
$this->addCond('pruneCond0', $this->getAliasedColName(OrderCouponModuleTableMap::COUPON_ID), $orderCouponModule->getCouponId(), Criteria::NOT_EQUAL);
|
||||
$this->addCond('pruneCond1', $this->getAliasedColName(OrderCouponModuleTableMap::MODULE_ID), $orderCouponModule->getModuleId(), Criteria::NOT_EQUAL);
|
||||
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the order_coupon_module table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(OrderCouponModuleTableMap::DATABASE_NAME);
|
||||
}
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
$affectedRows += parent::doDeleteAll($con);
|
||||
// Because this db requires some delete cascade/set null emulation, we have to
|
||||
// clear the cached instance *after* the emulation has happened (since
|
||||
// instances get re-added by the select statement contained therein).
|
||||
OrderCouponModuleTableMap::clearInstancePool();
|
||||
OrderCouponModuleTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildOrderCouponModule or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildOrderCouponModule object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public function delete(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(OrderCouponModuleTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(OrderCouponModuleTableMap::DATABASE_NAME);
|
||||
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
|
||||
|
||||
OrderCouponModuleTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
OrderCouponModuleTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // OrderCouponModuleQuery
|
||||
@@ -34,6 +34,7 @@ use Thelia\Model\Map\OrderCouponTableMap;
|
||||
* @method ChildOrderCouponQuery orderByIsRemovingPostage($order = Criteria::ASC) Order by the is_removing_postage column
|
||||
* @method ChildOrderCouponQuery orderByIsAvailableOnSpecialOffers($order = Criteria::ASC) Order by the is_available_on_special_offers column
|
||||
* @method ChildOrderCouponQuery orderBySerializedConditions($order = Criteria::ASC) Order by the serialized_conditions column
|
||||
* @method ChildOrderCouponQuery orderByPerCustomerUsageCount($order = Criteria::ASC) Order by the per_customer_usage_count column
|
||||
* @method ChildOrderCouponQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildOrderCouponQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
@@ -50,6 +51,7 @@ use Thelia\Model\Map\OrderCouponTableMap;
|
||||
* @method ChildOrderCouponQuery groupByIsRemovingPostage() Group by the is_removing_postage column
|
||||
* @method ChildOrderCouponQuery groupByIsAvailableOnSpecialOffers() Group by the is_available_on_special_offers column
|
||||
* @method ChildOrderCouponQuery groupBySerializedConditions() Group by the serialized_conditions column
|
||||
* @method ChildOrderCouponQuery groupByPerCustomerUsageCount() Group by the per_customer_usage_count column
|
||||
* @method ChildOrderCouponQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildOrderCouponQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
@@ -61,6 +63,14 @@ use Thelia\Model\Map\OrderCouponTableMap;
|
||||
* @method ChildOrderCouponQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation
|
||||
* @method ChildOrderCouponQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation
|
||||
*
|
||||
* @method ChildOrderCouponQuery leftJoinOrderCouponCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderCouponCountry relation
|
||||
* @method ChildOrderCouponQuery rightJoinOrderCouponCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderCouponCountry relation
|
||||
* @method ChildOrderCouponQuery innerJoinOrderCouponCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderCouponCountry relation
|
||||
*
|
||||
* @method ChildOrderCouponQuery leftJoinOrderCouponModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderCouponModule relation
|
||||
* @method ChildOrderCouponQuery rightJoinOrderCouponModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderCouponModule relation
|
||||
* @method ChildOrderCouponQuery innerJoinOrderCouponModule($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderCouponModule relation
|
||||
*
|
||||
* @method ChildOrderCoupon findOne(ConnectionInterface $con = null) Return the first ChildOrderCoupon matching the query
|
||||
* @method ChildOrderCoupon findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderCoupon matching the query, or a new ChildOrderCoupon object populated from the query conditions when no match is found
|
||||
*
|
||||
@@ -77,6 +87,7 @@ use Thelia\Model\Map\OrderCouponTableMap;
|
||||
* @method ChildOrderCoupon findOneByIsRemovingPostage(boolean $is_removing_postage) Return the first ChildOrderCoupon filtered by the is_removing_postage column
|
||||
* @method ChildOrderCoupon findOneByIsAvailableOnSpecialOffers(boolean $is_available_on_special_offers) Return the first ChildOrderCoupon filtered by the is_available_on_special_offers column
|
||||
* @method ChildOrderCoupon findOneBySerializedConditions(string $serialized_conditions) Return the first ChildOrderCoupon filtered by the serialized_conditions column
|
||||
* @method ChildOrderCoupon findOneByPerCustomerUsageCount(boolean $per_customer_usage_count) Return the first ChildOrderCoupon filtered by the per_customer_usage_count column
|
||||
* @method ChildOrderCoupon findOneByCreatedAt(string $created_at) Return the first ChildOrderCoupon filtered by the created_at column
|
||||
* @method ChildOrderCoupon findOneByUpdatedAt(string $updated_at) Return the first ChildOrderCoupon filtered by the updated_at column
|
||||
*
|
||||
@@ -93,6 +104,7 @@ use Thelia\Model\Map\OrderCouponTableMap;
|
||||
* @method array findByIsRemovingPostage(boolean $is_removing_postage) Return ChildOrderCoupon objects filtered by the is_removing_postage column
|
||||
* @method array findByIsAvailableOnSpecialOffers(boolean $is_available_on_special_offers) Return ChildOrderCoupon objects filtered by the is_available_on_special_offers column
|
||||
* @method array findBySerializedConditions(string $serialized_conditions) Return ChildOrderCoupon objects filtered by the serialized_conditions column
|
||||
* @method array findByPerCustomerUsageCount(boolean $per_customer_usage_count) Return ChildOrderCoupon objects filtered by the per_customer_usage_count column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildOrderCoupon objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildOrderCoupon objects filtered by the updated_at column
|
||||
*
|
||||
@@ -183,7 +195,7 @@ abstract class OrderCouponQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT `ID`, `ORDER_ID`, `CODE`, `TYPE`, `AMOUNT`, `TITLE`, `SHORT_DESCRIPTION`, `DESCRIPTION`, `EXPIRATION_DATE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `SERIALIZED_CONDITIONS`, `CREATED_AT`, `UPDATED_AT` FROM `order_coupon` WHERE `ID` = :p0';
|
||||
$sql = 'SELECT `ID`, `ORDER_ID`, `CODE`, `TYPE`, `AMOUNT`, `TITLE`, `SHORT_DESCRIPTION`, `DESCRIPTION`, `EXPIRATION_DATE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `SERIALIZED_CONDITIONS`, `PER_CUSTOMER_USAGE_COUNT`, `CREATED_AT`, `UPDATED_AT` FROM `order_coupon` WHERE `ID` = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -695,6 +707,33 @@ abstract class OrderCouponQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(OrderCouponTableMap::SERIALIZED_CONDITIONS, $serializedConditions, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the per_customer_usage_count column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByPerCustomerUsageCount(true); // WHERE per_customer_usage_count = true
|
||||
* $query->filterByPerCustomerUsageCount('yes'); // WHERE per_customer_usage_count = true
|
||||
* </code>
|
||||
*
|
||||
* @param boolean|string $perCustomerUsageCount 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 ChildOrderCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPerCustomerUsageCount($perCustomerUsageCount = null, $comparison = null)
|
||||
{
|
||||
if (is_string($perCustomerUsageCount)) {
|
||||
$per_customer_usage_count = in_array(strtolower($perCustomerUsageCount), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(OrderCouponTableMap::PER_CUSTOMER_USAGE_COUNT, $perCustomerUsageCount, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
@@ -856,6 +895,186 @@ abstract class OrderCouponQuery extends ModelCriteria
|
||||
->useQuery($relationAlias ? $relationAlias : 'Order', '\Thelia\Model\OrderQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\OrderCouponCountry object
|
||||
*
|
||||
* @param \Thelia\Model\OrderCouponCountry|ObjectCollection $orderCouponCountry the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildOrderCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByOrderCouponCountry($orderCouponCountry, $comparison = null)
|
||||
{
|
||||
if ($orderCouponCountry instanceof \Thelia\Model\OrderCouponCountry) {
|
||||
return $this
|
||||
->addUsingAlias(OrderCouponTableMap::ID, $orderCouponCountry->getCouponId(), $comparison);
|
||||
} elseif ($orderCouponCountry instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useOrderCouponCountryQuery()
|
||||
->filterByPrimaryKeys($orderCouponCountry->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByOrderCouponCountry() only accepts arguments of type \Thelia\Model\OrderCouponCountry or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the OrderCouponCountry relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildOrderCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinOrderCouponCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('OrderCouponCountry');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'OrderCouponCountry');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the OrderCouponCountry relation OrderCouponCountry object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\OrderCouponCountryQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useOrderCouponCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinOrderCouponCountry($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'OrderCouponCountry', '\Thelia\Model\OrderCouponCountryQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\OrderCouponModule object
|
||||
*
|
||||
* @param \Thelia\Model\OrderCouponModule|ObjectCollection $orderCouponModule the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildOrderCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByOrderCouponModule($orderCouponModule, $comparison = null)
|
||||
{
|
||||
if ($orderCouponModule instanceof \Thelia\Model\OrderCouponModule) {
|
||||
return $this
|
||||
->addUsingAlias(OrderCouponTableMap::ID, $orderCouponModule->getCouponId(), $comparison);
|
||||
} elseif ($orderCouponModule instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useOrderCouponModuleQuery()
|
||||
->filterByPrimaryKeys($orderCouponModule->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByOrderCouponModule() only accepts arguments of type \Thelia\Model\OrderCouponModule or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the OrderCouponModule relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildOrderCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinOrderCouponModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('OrderCouponModule');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'OrderCouponModule');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the OrderCouponModule relation OrderCouponModule object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\OrderCouponModuleQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useOrderCouponModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinOrderCouponModule($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'OrderCouponModule', '\Thelia\Model\OrderCouponModuleQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Country object
|
||||
* using the order_coupon_country table as cross reference
|
||||
*
|
||||
* @param Country $country the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildOrderCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCountry($country, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useOrderCouponCountryQuery()
|
||||
->filterByCountry($country, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Module object
|
||||
* using the order_coupon_module table as cross reference
|
||||
*
|
||||
* @param Module $module the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildOrderCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByModule($module, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useOrderCouponModuleQuery()
|
||||
->filterByModule($module, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
|
||||
28
core/lib/Thelia/Model/Breadcrumb/BreadcrumbInterface.php
Normal file
28
core/lib/Thelia/Model/Breadcrumb/BreadcrumbInterface.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Model\Breadcrumb;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Routing\Router;
|
||||
|
||||
interface BreadcrumbInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* return the complete breadcrumb for a given resource.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab);
|
||||
}
|
||||
84
core/lib/Thelia/Model/Breadcrumb/CatalogBreadcrumbTrait.php
Normal file
84
core/lib/Thelia/Model/Breadcrumb/CatalogBreadcrumbTrait.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Model\Breadcrumb;
|
||||
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Core\Template\Loop\CategoryPath;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
trait CatalogBreadcrumbTrait
|
||||
{
|
||||
|
||||
public function getBaseBreadcrumb(Router $router, ContainerInterface $container, $categoryId, &$locale)
|
||||
{
|
||||
$translator = Translator::getInstance();
|
||||
$catalogUrl = $router->generate('admin.catalog', [], Router::ABSOLUTE_URL);
|
||||
$breadcrumb = [
|
||||
$translator->trans('Home', [], 'bo.default') => $router->generate('admin.home.view', [], Router::ABSOLUTE_URL),
|
||||
$translator->trans('Catalog', [], 'bo.default') => $catalogUrl,
|
||||
];
|
||||
|
||||
$categoryPath = new CategoryPath($container);
|
||||
$categoryPath->initializeArgs([
|
||||
'category' => $categoryId,
|
||||
'visible' => '*'
|
||||
]);
|
||||
|
||||
$results = $categoryPath->buildArray();
|
||||
|
||||
foreach ($results as $result) {
|
||||
$breadcrumb[$result['TITLE']] = sprintf("%s?category_id=%d",$catalogUrl, $result['ID']);
|
||||
}
|
||||
|
||||
$locale = $result['LOCALE'];
|
||||
|
||||
return $breadcrumb;
|
||||
}
|
||||
|
||||
public function getProductBreadcrumb(Router $router, ContainerInterface $container, $tab)
|
||||
{
|
||||
$product = $this->getProduct();
|
||||
$locale = null;
|
||||
|
||||
$breadcrumb = $this->getBaseBreadcrumb($router, $container, $product->getDefaultCategoryId(), $locale);
|
||||
|
||||
$product->setLocale($locale);
|
||||
|
||||
$breadcrumb[$product->getTitle()] = sprintf("%s?product_id=%d¤t_tab=%s",
|
||||
$router->generate('admin.products.update', [], Router::ABSOLUTE_URL),
|
||||
$product->getId(),
|
||||
$tab
|
||||
);
|
||||
|
||||
return $breadcrumb;
|
||||
}
|
||||
|
||||
public function getCategoryBreadcrumb(Router $router, ContainerInterface $container, $tab)
|
||||
{
|
||||
$locale = null;
|
||||
$category = $this->getCategory();
|
||||
$breadcrumb = $this->getBaseBreadcrumb($router, $container, $this->getParentId(), $locale);
|
||||
|
||||
$category->setLocale($locale);
|
||||
|
||||
$breadcrumb[$category->getTitle()] = sprintf("%s?category_id=%d¤t_tab=%s",
|
||||
$router->generate('admin.categories.update',[], Router::ABSOLUTE_URL),
|
||||
$category->getId(),
|
||||
$tab
|
||||
);
|
||||
|
||||
return $breadcrumb;
|
||||
}
|
||||
}
|
||||
85
core/lib/Thelia/Model/Breadcrumb/FolderBreadcrumbTrait.php
Normal file
85
core/lib/Thelia/Model/Breadcrumb/FolderBreadcrumbTrait.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Model\Breadcrumb;
|
||||
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Core\Template\Loop\FolderPath;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
trait FolderBreadcrumbTrait
|
||||
{
|
||||
|
||||
public function getBaseBreadcrumb(Router $router, ContainerInterface $container, $folderId, &$locale)
|
||||
{
|
||||
$translator = Translator::getInstance();
|
||||
$catalogUrl = $router->generate('admin.catalog', [], Router::ABSOLUTE_URL);
|
||||
$breadcrumb = [
|
||||
$translator->trans('Home', [], 'bo.default') => $router->generate('admin.home.view', [], Router::ABSOLUTE_URL),
|
||||
$translator->trans('Folder', [], 'bo.default') => $catalogUrl,
|
||||
];
|
||||
|
||||
$folderPath = new FolderPath($container);
|
||||
$folderPath->initializeArgs([
|
||||
'folder' => $folderId,
|
||||
'visible' => '*'
|
||||
]);
|
||||
|
||||
$results = $folderPath->buildArray();
|
||||
|
||||
foreach ($results as $result) {
|
||||
$breadcrumb[$result['TITLE']] = sprintf("%s?folder_id=%d",
|
||||
$router->generate('admin.folders.default',[], Router::ABSOLUTE_URL),
|
||||
$result['ID']
|
||||
);
|
||||
}
|
||||
|
||||
$locale = $result['LOCALE'];
|
||||
|
||||
return $breadcrumb;
|
||||
}
|
||||
|
||||
public function getFolderBreadcrumb($router, $container, $tab)
|
||||
{
|
||||
$locale = null;
|
||||
$folder = $this->getFolder();
|
||||
$breadcrumb = $this->getBaseBreadcrumb($router, $container, $this->getParentId(), $locale);
|
||||
|
||||
$folder->setLocale($locale);
|
||||
|
||||
$breadcrumb[$folder->getTitle()] = sprintf("%s?current_tab=%s",
|
||||
$router->generate('admin.folders.update',['folder_id' => $folder->getId()], Router::ABSOLUTE_URL),
|
||||
$tab
|
||||
);
|
||||
|
||||
return $breadcrumb;
|
||||
}
|
||||
|
||||
public function getContentBreadcrumb(Router $router, ContainerInterface $container, $tab)
|
||||
{
|
||||
$content = $this->getContent();
|
||||
$locale = null;
|
||||
|
||||
$breadcrumb = $this->getBaseBreadcrumb($router, $container, $content->getDefaultFolderId(), $locale);
|
||||
|
||||
$content->setLocale($locale);
|
||||
|
||||
$breadcrumb[$content->getTitle()] = sprintf("%s?current_tab=%s",
|
||||
$router->generate('admin.content.update', ['content_id' => $content->getId()], Router::ABSOLUTE_URL),
|
||||
$tab
|
||||
);
|
||||
|
||||
return $breadcrumb;
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,6 @@ class Cart extends BaseCart
|
||||
}
|
||||
|
||||
$cart->save();
|
||||
$currentDateTime = new \DateTime();
|
||||
foreach ($cartItems as $cartItem) {
|
||||
|
||||
$product = $cartItem->getProduct();
|
||||
|
||||
@@ -89,6 +89,23 @@ class CartItem extends BaseCartItem
|
||||
return $this->getPromo() == 1 ? $this->getPromoPrice() : $this->getPrice();
|
||||
}
|
||||
|
||||
public function getProduct(ConnectionInterface $con = null, $locale = null)
|
||||
{
|
||||
$product = parent::getProduct($con);
|
||||
|
||||
$translation = $product->getTranslation($locale);
|
||||
|
||||
if ($translation->isNew()) {
|
||||
if (ConfigQuery::getDefaultLangWhenNoTranslationAvailable()) {
|
||||
$locale = Lang::getDefaultLanguage()->getLocale();
|
||||
}
|
||||
}
|
||||
|
||||
$product->setLocale($locale);
|
||||
|
||||
return $product;
|
||||
}
|
||||
|
||||
public function getRealTaxedPrice(Country $country)
|
||||
{
|
||||
return $this->getPromo() == 1 ? $this->getTaxedPromoPrice($country) : $this->getTaxedPrice($country);
|
||||
|
||||
@@ -2,13 +2,20 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Model\Base\CategoryDocument as BaseCategoryDocument;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
|
||||
use Thelia\Model\Breadcrumb\CatalogBreadcrumbTrait;
|
||||
use Thelia\Model\Tools\PositionManagementTrait;
|
||||
use Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
|
||||
class CategoryDocument extends BaseCategoryDocument
|
||||
class CategoryDocument extends BaseCategoryDocument implements BreadcrumbInterface
|
||||
{
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
use \Thelia\Model\Tools\PositionManagementTrait;
|
||||
use ModelEventDispatcherTrait;
|
||||
use PositionManagementTrait;
|
||||
use CatalogBreadcrumbTrait;
|
||||
|
||||
/**
|
||||
* Calculate next position relative to our parent
|
||||
@@ -62,4 +69,15 @@ class CategoryDocument extends BaseCategoryDocument
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* return the complete breadcrumb for a given resource.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab)
|
||||
{
|
||||
return $this->getCategoryBreadcrumb($router, $container, $tab);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,20 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Model\Base\CategoryImage as BaseCategoryImage;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
|
||||
use Thelia\Model\Breadcrumb\CatalogBreadcrumbTrait;
|
||||
use Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
use Thelia\Model\Tools\PositionManagementTrait;
|
||||
|
||||
class CategoryImage extends BaseCategoryImage
|
||||
class CategoryImage extends BaseCategoryImage implements BreadcrumbInterface
|
||||
{
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
use \Thelia\Model\Tools\PositionManagementTrait;
|
||||
use ModelEventDispatcherTrait;
|
||||
use PositionManagementTrait;
|
||||
use CatalogBreadcrumbTrait;
|
||||
|
||||
/**
|
||||
* Calculate next position relative to our parent
|
||||
@@ -62,4 +69,15 @@ class CategoryImage extends BaseCategoryImage
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* return the complete breadcrumb for a given resource.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab)
|
||||
{
|
||||
return $this->getCategoryBreadcrumb($router, $container, $tab);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,18 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Model\Base\ContentDocument as BaseContentDocument;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
|
||||
use Thelia\Model\Breadcrumb\FolderBreadcrumbTrait;
|
||||
|
||||
class ContentDocument extends BaseContentDocument
|
||||
class ContentDocument extends BaseContentDocument implements BreadcrumbInterface
|
||||
{
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
use \Thelia\Model\Tools\PositionManagementTrait;
|
||||
use FolderBreadcrumbTrait;
|
||||
|
||||
/**
|
||||
* Calculate next position relative to our parent
|
||||
@@ -62,4 +67,15 @@ class ContentDocument extends BaseContentDocument
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* return the complete breadcrumb for a given resource.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab)
|
||||
{
|
||||
return $this->getContentBreadcrumb($router, $container, $tab);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,18 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Model\Base\ContentImage as BaseContentImage;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
|
||||
use Thelia\Model\Breadcrumb\FolderBreadcrumbTrait;
|
||||
|
||||
class ContentImage extends BaseContentImage
|
||||
class ContentImage extends BaseContentImage implements BreadcrumbInterface
|
||||
{
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
use \Thelia\Model\Tools\PositionManagementTrait;
|
||||
use FolderBreadcrumbTrait;
|
||||
|
||||
/**
|
||||
* Calculate next position relative to our parent
|
||||
@@ -62,4 +67,15 @@ class ContentImage extends BaseContentImage
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* return the complete breadcrumb for a given resource.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab)
|
||||
{
|
||||
return $this->getContentBreadcrumb($router, $container, $tab);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,11 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Propel\Runtime\Propel;
|
||||
use Thelia\Model\Base\Coupon as BaseCoupon;
|
||||
use Thelia\Model\Exception\InvalidArgumentException;
|
||||
use Thelia\Model\Map\CouponTableMap;
|
||||
use Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
|
||||
/**
|
||||
* Used to provide an effect (mostly a discount)
|
||||
@@ -38,7 +41,10 @@ use Thelia\Model\Exception\InvalidArgumentException;
|
||||
class Coupon extends BaseCoupon
|
||||
{
|
||||
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
// Define the value of an unlimited coupon usage.
|
||||
const UNLIMITED_COUPON_USE = -1;
|
||||
|
||||
use ModelEventDispatcherTrait;
|
||||
|
||||
/**
|
||||
* Create or Update this Coupon
|
||||
@@ -57,32 +63,85 @@ class Coupon extends BaseCoupon
|
||||
* @param int $maxUsage Coupon quantity
|
||||
* @param string $defaultSerializedRule Serialized default rule added if none found
|
||||
* @param string $locale Coupon Language code ISO (ex: fr_FR)
|
||||
* @param array $freeShippingForCountries ID of Countries to which shipping is free
|
||||
* @param array $freeShippingForMethods ID of Shipping modules for which shipping is free
|
||||
* @param bool $perCustomerUsageCount True if usage coiunt is per customer
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function createOrUpdate($code, $title, array $effects, $type, $isRemovingPostage, $shortDescription, $description, $isEnabled, $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $maxUsage, $defaultSerializedRule, $locale = null)
|
||||
public function createOrUpdate(
|
||||
$code, $title, array $effects, $type, $isRemovingPostage, $shortDescription, $description,
|
||||
$isEnabled, $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $maxUsage, $defaultSerializedRule,
|
||||
$locale, $freeShippingForCountries, $freeShippingForMethods,
|
||||
$perCustomerUsageCount)
|
||||
{
|
||||
$this
|
||||
->setCode($code)
|
||||
->setType($type)
|
||||
->setEffects($effects)
|
||||
->setIsRemovingPostage($isRemovingPostage)
|
||||
->setIsEnabled($isEnabled)
|
||||
->setExpirationDate($expirationDate)
|
||||
->setIsAvailableOnSpecialOffers($isAvailableOnSpecialOffers)
|
||||
->setIsCumulative($isCumulative)
|
||||
->setMaxUsage($maxUsage)
|
||||
->setLocale($locale)
|
||||
->setTitle($title)
|
||||
->setShortDescription($shortDescription)
|
||||
->setDescription($description);
|
||||
$con = Propel::getWriteConnection(CouponTableMap::DATABASE_NAME);
|
||||
|
||||
// If no rule given, set default rule
|
||||
if (null === $this->getSerializedConditions()) {
|
||||
$this->setSerializedConditions($defaultSerializedRule);
|
||||
$con->beginTransaction();
|
||||
|
||||
try {
|
||||
$this
|
||||
->setCode($code)
|
||||
->setType($type)
|
||||
->setEffects($effects)
|
||||
->setIsRemovingPostage($isRemovingPostage)
|
||||
->setIsEnabled($isEnabled)
|
||||
->setExpirationDate($expirationDate)
|
||||
->setIsAvailableOnSpecialOffers($isAvailableOnSpecialOffers)
|
||||
->setIsCumulative($isCumulative)
|
||||
->setMaxUsage($maxUsage)
|
||||
->setPerCustomerUsageCount($perCustomerUsageCount)
|
||||
->setLocale($locale)
|
||||
->setTitle($title)
|
||||
->setShortDescription($shortDescription)
|
||||
->setDescription($description)
|
||||
;
|
||||
|
||||
// If no rule given, set default rule
|
||||
if (null === $this->getSerializedConditions()) {
|
||||
$this->setSerializedConditions($defaultSerializedRule);
|
||||
}
|
||||
|
||||
$this->save();
|
||||
|
||||
// Update countries and modules relation for free shipping
|
||||
CouponCountryQuery::create()->filterByCouponId($this->id)->delete();
|
||||
CouponModuleQuery::create()->filterByCouponId($this->id)->delete();
|
||||
|
||||
foreach ($freeShippingForCountries as $countryId) {
|
||||
|
||||
if ($countryId <= 0) continue;
|
||||
|
||||
$couponCountry = new CouponCountry();
|
||||
|
||||
$couponCountry
|
||||
->setCouponId($this->getId())
|
||||
->setCountryId($countryId)
|
||||
->save();
|
||||
;
|
||||
}
|
||||
|
||||
foreach ($freeShippingForMethods as $moduleId) {
|
||||
|
||||
if ($moduleId <= 0) continue;
|
||||
|
||||
$couponModule = new CouponModule();
|
||||
|
||||
$couponModule
|
||||
->setCouponId($this->getId())
|
||||
->setModuleId($moduleId)
|
||||
->save()
|
||||
;
|
||||
}
|
||||
|
||||
$con->commit();
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
|
||||
$con->rollback();
|
||||
|
||||
throw $ex;
|
||||
}
|
||||
|
||||
$this->save();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,7 +187,8 @@ class Coupon extends BaseCoupon
|
||||
*/
|
||||
public function getAmount()
|
||||
{
|
||||
$amount = $this->getEffects()['amount'];
|
||||
// Amount is now optional
|
||||
$amount = isset($this->getEffects()['amount']) ? $this->getEffects()['amount'] : 0;
|
||||
|
||||
return floatval($amount);
|
||||
}
|
||||
@@ -143,10 +203,6 @@ class Coupon extends BaseCoupon
|
||||
{
|
||||
$effects = $this->unserializeEffects($this->getSerializedEffects());
|
||||
|
||||
if (null === $effects['amount']) {
|
||||
throw new InvalidArgumentException('Missing key \'amount\' in Coupon effect coming from database');
|
||||
}
|
||||
|
||||
return $effects;
|
||||
}
|
||||
|
||||
@@ -154,18 +210,12 @@ class Coupon extends BaseCoupon
|
||||
* Get the Coupon effects
|
||||
*
|
||||
* @param array $effects Effect ready to be serialized
|
||||
* Needs at least the key 'amount'
|
||||
* with the amount removed from the cart
|
||||
*
|
||||
* @throws Exception\InvalidArgumentException
|
||||
* @return $this
|
||||
*/
|
||||
public function setEffects(array $effects)
|
||||
{
|
||||
if (null === $effects['amount']) {
|
||||
throw new InvalidArgumentException('Missing key \'amount\' in Coupon effect ready to be serialized array');
|
||||
}
|
||||
|
||||
$this->setSerializedEffects($this->serializeEffects($effects));
|
||||
|
||||
return $this;
|
||||
@@ -198,4 +248,55 @@ class Coupon extends BaseCoupon
|
||||
|
||||
return $effects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the countries for which free shipping is valid
|
||||
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
|
||||
*/
|
||||
public function getFreeShippingForCountries()
|
||||
{
|
||||
return CouponCountryQuery::create()->filterByCouponId($this->getId())->find();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the modules for which free shipping is valid
|
||||
*
|
||||
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
|
||||
*/
|
||||
public function getFreeShippingForModules()
|
||||
{
|
||||
return CouponModuleQuery::create()->filterByCouponId($this->getId())->find();
|
||||
}
|
||||
|
||||
public function isUsageUnlimited()
|
||||
{
|
||||
return $this->getMaxUsage() == self::UNLIMITED_COUPON_USE;
|
||||
}
|
||||
/**
|
||||
* Get coupon usage left, either overall, or per customer.
|
||||
*
|
||||
* @param int|null $customerId the ID of the ordering customer
|
||||
*
|
||||
* @return int the usage left.
|
||||
*/
|
||||
public function getUsagesLeft($customerId = null)
|
||||
{
|
||||
$usageLeft = $this->getMaxUsage();
|
||||
|
||||
if ($this->getPerCustomerUsageCount()) {
|
||||
|
||||
// Get usage left for current customer. If the record is not found,
|
||||
// it means that the customer has not yes used this coupon.
|
||||
if (null !== $couponCustomerCount = CouponCustomerCountQuery::create()
|
||||
->filterByCouponId($this->getId())
|
||||
->filterByCustomerId($customerId)
|
||||
->findOne()) {
|
||||
|
||||
// The coupon has already been used -> remove this customer's usage count
|
||||
$usageLeft -= $couponCustomerCount->getCount();
|
||||
}
|
||||
}
|
||||
|
||||
return $usageLeft;
|
||||
}
|
||||
}
|
||||
|
||||
10
core/lib/Thelia/Model/CouponCountry.php
Normal file
10
core/lib/Thelia/Model/CouponCountry.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\CouponCountry as BaseCouponCountry;
|
||||
|
||||
class CouponCountry extends BaseCouponCountry
|
||||
{
|
||||
|
||||
}
|
||||
20
core/lib/Thelia/Model/CouponCountryQuery.php
Normal file
20
core/lib/Thelia/Model/CouponCountryQuery.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\CouponCountryQuery as BaseCouponCountryQuery;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'coupon_country' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class CouponCountryQuery extends BaseCouponCountryQuery
|
||||
{
|
||||
|
||||
} // CouponCountryQuery
|
||||
10
core/lib/Thelia/Model/CouponCustomerCount.php
Normal file
10
core/lib/Thelia/Model/CouponCustomerCount.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\CouponCustomerCount as BaseCouponCustomerCount;
|
||||
|
||||
class CouponCustomerCount extends BaseCouponCustomerCount
|
||||
{
|
||||
|
||||
}
|
||||
20
core/lib/Thelia/Model/CouponCustomerCountQuery.php
Normal file
20
core/lib/Thelia/Model/CouponCustomerCountQuery.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\CouponCustomerCountQuery as BaseCouponCustomerCountQuery;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'coupon_customer_count' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class CouponCustomerCountQuery extends BaseCouponCustomerCountQuery
|
||||
{
|
||||
|
||||
} // CouponCustomerCountQuery
|
||||
10
core/lib/Thelia/Model/CouponModule.php
Normal file
10
core/lib/Thelia/Model/CouponModule.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\CouponModule as BaseCouponModule;
|
||||
|
||||
class CouponModule extends BaseCouponModule
|
||||
{
|
||||
|
||||
}
|
||||
20
core/lib/Thelia/Model/CouponModuleQuery.php
Normal file
20
core/lib/Thelia/Model/CouponModuleQuery.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\CouponModuleQuery as BaseCouponModuleQuery;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'coupon_module' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class CouponModuleQuery extends BaseCouponModuleQuery
|
||||
{
|
||||
|
||||
} // CouponModuleQuery
|
||||
@@ -2,13 +2,18 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Model\Base\FolderDocument as BaseFolderDocument;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
|
||||
use Thelia\Model\Breadcrumb\FolderBreadcrumbTrait;
|
||||
|
||||
class FolderDocument extends BaseFolderDocument
|
||||
class FolderDocument extends BaseFolderDocument implements BreadcrumbInterface
|
||||
{
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
use \Thelia\Model\Tools\PositionManagementTrait;
|
||||
use FolderBreadcrumbTrait;
|
||||
|
||||
/**
|
||||
* Calculate next position relative to our parent
|
||||
@@ -62,4 +67,9 @@ class FolderDocument extends BaseFolderDocument
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab)
|
||||
{
|
||||
return $this->getFolderBreadcrumb($router, $container, $tab);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,18 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Model\Base\FolderImage as BaseFolderImage;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
|
||||
use Thelia\Model\Breadcrumb\FolderBreadcrumbTrait;
|
||||
|
||||
class FolderImage extends BaseFolderImage
|
||||
class FolderImage extends BaseFolderImage implements BreadcrumbInterface
|
||||
{
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
use \Thelia\Model\Tools\PositionManagementTrait;
|
||||
use FolderBreadcrumbTrait;
|
||||
|
||||
/**
|
||||
* Calculate next position relative to our parent
|
||||
@@ -62,4 +67,15 @@ class FolderImage extends BaseFolderImage
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* return the complete breadcrumb for a given resource.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab)
|
||||
{
|
||||
return $this->getFolderBreadcrumb($router, $container, $tab);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,9 @@ use Thelia\Model\Map\LangTableMap;
|
||||
class Lang extends BaseLang
|
||||
{
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
|
||||
protected static $defaultLanguage;
|
||||
|
||||
/**
|
||||
* Return the default language object, using a local variable to cache it.
|
||||
*
|
||||
@@ -24,10 +27,13 @@ class Lang extends BaseLang
|
||||
*/
|
||||
public static function getDefaultLanguage()
|
||||
{
|
||||
$default_lang = LangQuery::create()->findOneByByDefault(1);
|
||||
if (null === self::$defaultLanguage) {
|
||||
self::$defaultLanguage = LangQuery::create()->findOneByByDefault(1);
|
||||
|
||||
if ($default_lang == null) throw new \RuntimeException("No default language is defined. Please define one.");
|
||||
return $default_lang;
|
||||
if (self::$defaultLanguage == null) throw new \RuntimeException("No default language is defined. Please define one.");
|
||||
}
|
||||
|
||||
return self::$defaultLanguage;
|
||||
}
|
||||
|
||||
public function toggleDefault()
|
||||
|
||||
@@ -194,7 +194,11 @@ class CountryTableMap extends TableMap
|
||||
$this->addRelation('Area', '\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('TaxRuleCountry', '\\Thelia\\Model\\TaxRuleCountry', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'CASCADE', 'RESTRICT', 'TaxRuleCountries');
|
||||
$this->addRelation('Address', '\\Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'RESTRICT', 'RESTRICT', 'Addresses');
|
||||
$this->addRelation('CouponCountry', '\\Thelia\\Model\\CouponCountry', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'CASCADE', null, 'CouponCountries');
|
||||
$this->addRelation('OrderCouponCountry', '\\Thelia\\Model\\OrderCouponCountry', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'CASCADE', null, 'OrderCouponCountries');
|
||||
$this->addRelation('CountryI18n', '\\Thelia\\Model\\CountryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CountryI18ns');
|
||||
$this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Coupons');
|
||||
$this->addRelation('OrderCoupon', '\\Thelia\\Model\\OrderCoupon', RelationMap::MANY_TO_MANY, array(), null, null, 'OrderCoupons');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
@@ -218,6 +222,8 @@ class CountryTableMap 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.
|
||||
TaxRuleCountryTableMap::clearInstancePool();
|
||||
CouponCountryTableMap::clearInstancePool();
|
||||
OrderCouponCountryTableMap::clearInstancePool();
|
||||
CountryI18nTableMap::clearInstancePool();
|
||||
}
|
||||
|
||||
|
||||
468
core/lib/Thelia/Model/Map/CouponCountryTableMap.php
Normal file
468
core/lib/Thelia/Model/Map/CouponCountryTableMap.php
Normal file
@@ -0,0 +1,468 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Map;
|
||||
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\DataFetcher\DataFetcherInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\RelationMap;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Map\TableMapTrait;
|
||||
use Thelia\Model\CouponCountry;
|
||||
use Thelia\Model\CouponCountryQuery;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'coupon_country' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This map class is used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
*/
|
||||
class CouponCountryTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'Thelia.Model.Map.CouponCountryTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'coupon_country';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\Thelia\\Model\\CouponCountry';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'Thelia.Model.CouponCountry';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 2;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
*/
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 2;
|
||||
|
||||
/**
|
||||
* the column name for the COUPON_ID field
|
||||
*/
|
||||
const COUPON_ID = 'coupon_country.COUPON_ID';
|
||||
|
||||
/**
|
||||
* the column name for the COUNTRY_ID field
|
||||
*/
|
||||
const COUNTRY_ID = 'coupon_country.COUNTRY_ID';
|
||||
|
||||
/**
|
||||
* The default string format for model objects of the related table
|
||||
*/
|
||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||
|
||||
/**
|
||||
* holds an array of fieldnames
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('CouponId', 'CountryId', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('couponId', 'countryId', ),
|
||||
self::TYPE_COLNAME => array(CouponCountryTableMap::COUPON_ID, CouponCountryTableMap::COUNTRY_ID, ),
|
||||
self::TYPE_RAW_COLNAME => array('COUPON_ID', 'COUNTRY_ID', ),
|
||||
self::TYPE_FIELDNAME => array('coupon_id', 'country_id', ),
|
||||
self::TYPE_NUM => array(0, 1, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('CouponId' => 0, 'CountryId' => 1, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('couponId' => 0, 'countryId' => 1, ),
|
||||
self::TYPE_COLNAME => array(CouponCountryTableMap::COUPON_ID => 0, CouponCountryTableMap::COUNTRY_ID => 1, ),
|
||||
self::TYPE_RAW_COLNAME => array('COUPON_ID' => 0, 'COUNTRY_ID' => 1, ),
|
||||
self::TYPE_FIELDNAME => array('coupon_id' => 0, 'country_id' => 1, ),
|
||||
self::TYPE_NUM => array(0, 1, )
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialize the table attributes and columns
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('coupon_country');
|
||||
$this->setPhpName('CouponCountry');
|
||||
$this->setClassName('\\Thelia\\Model\\CouponCountry');
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(false);
|
||||
$this->setIsCrossRef(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('COUPON_ID', 'CouponId', 'INTEGER' , 'coupon', 'ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('COUNTRY_ID', 'CountryId', 'INTEGER' , 'country', 'ID', true, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('country_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('coupon_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
* Adds an object to the instance pool.
|
||||
*
|
||||
* Propel keeps cached copies of objects in an instance pool when they are retrieved
|
||||
* from the database. In some cases you may need to explicitly add objects
|
||||
* to the cache in order to ensure that the same objects are always returned by find*()
|
||||
* and findPk*() calls.
|
||||
*
|
||||
* @param \Thelia\Model\CouponCountry $obj A \Thelia\Model\CouponCountry 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->getCouponId(), (string) $obj->getCountryId()));
|
||||
} // 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\CouponCountry object or a primary key value.
|
||||
*/
|
||||
public static function removeInstanceFromPool($value)
|
||||
{
|
||||
if (Propel::isInstancePoolingEnabled() && null !== $value) {
|
||||
if (is_object($value) && $value instanceof \Thelia\Model\CouponCountry) {
|
||||
$key = serialize(array((string) $value->getCouponId(), (string) $value->getCountryId()));
|
||||
|
||||
} 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\CouponCountry object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
|
||||
throw $e;
|
||||
}
|
||||
|
||||
unset(self::$instances[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
*
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*/
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// If the PK cannot be derived from the row, return NULL.
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('CouponId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('CountryId', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('CouponId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('CountryId', TableMap::TYPE_PHPNAME, $indexType)]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the primary key from the DB resultset row
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*
|
||||
* @return mixed The primary key of the row
|
||||
*/
|
||||
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
|
||||
return $pks;
|
||||
}
|
||||
|
||||
/**
|
||||
* The class that the tableMap will make instances of.
|
||||
*
|
||||
* If $withPrefix is true, the returned path
|
||||
* uses a dot-path notation which is translated into a path
|
||||
* relative to a location on the PHP include_path.
|
||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||
*
|
||||
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||
* @return string path.to.ClassName
|
||||
*/
|
||||
public static function getOMClass($withPrefix = true)
|
||||
{
|
||||
return $withPrefix ? CouponCountryTableMap::CLASS_DEFAULT : CouponCountryTableMap::OM_CLASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates an object of the default type or an object that inherit from the default.
|
||||
*
|
||||
* @param array $row row returned by DataFetcher->fetch().
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
|
||||
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
|
||||
*
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @return array (CouponCountry object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = CouponCountryTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = CouponCountryTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, $offset, true); // rehydrate
|
||||
$col = $offset + CouponCountryTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = CouponCountryTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
CouponCountryTableMap::addInstanceToPool($obj, $key);
|
||||
}
|
||||
|
||||
return array($obj, $col);
|
||||
}
|
||||
|
||||
/**
|
||||
* The returned array will contain objects of the default type or
|
||||
* objects that inherit from the default.
|
||||
*
|
||||
* @param DataFetcherInterface $dataFetcher
|
||||
* @return array
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function populateObjects(DataFetcherInterface $dataFetcher)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = static::getOMClass(false);
|
||||
// populate the object(s)
|
||||
while ($row = $dataFetcher->fetch()) {
|
||||
$key = CouponCountryTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = CouponCountryTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, 0, true); // rehydrate
|
||||
$results[] = $obj;
|
||||
} else {
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($row);
|
||||
$results[] = $obj;
|
||||
CouponCountryTableMap::addInstanceToPool($obj, $key);
|
||||
} // if key exists
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
/**
|
||||
* Add all the columns needed to create a new object.
|
||||
*
|
||||
* Note: any columns that were marked with lazyLoad="true" in the
|
||||
* XML schema will not be added to the select list and only loaded
|
||||
* on demand.
|
||||
*
|
||||
* @param Criteria $criteria object containing the columns to add.
|
||||
* @param string $alias optional table alias
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function addSelectColumns(Criteria $criteria, $alias = null)
|
||||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(CouponCountryTableMap::COUPON_ID);
|
||||
$criteria->addSelectColumn(CouponCountryTableMap::COUNTRY_ID);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.COUPON_ID');
|
||||
$criteria->addSelectColumn($alias . '.COUNTRY_ID');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TableMap related to this object.
|
||||
* This method is not needed for general use but a specific application could have a need.
|
||||
* @return TableMap
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getTableMap()
|
||||
{
|
||||
return Propel::getServiceContainer()->getDatabaseMap(CouponCountryTableMap::DATABASE_NAME)->getTable(CouponCountryTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(CouponCountryTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(CouponCountryTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new CouponCountryTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a CouponCountry or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or CouponCountry object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doDelete($values, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CouponCountryTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \Thelia\Model\CouponCountry) { // it's a model object
|
||||
// create criteria based on pk values
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else { // it's a primary key, or an array of pks
|
||||
$criteria = new Criteria(CouponCountryTableMap::DATABASE_NAME);
|
||||
// primary key is composite; we therefore, expect
|
||||
// the primary key passed to be an array of pkey values
|
||||
if (count($values) == count($values, COUNT_RECURSIVE)) {
|
||||
// array is not multi-dimensional
|
||||
$values = array($values);
|
||||
}
|
||||
foreach ($values as $value) {
|
||||
$criterion = $criteria->getNewCriterion(CouponCountryTableMap::COUPON_ID, $value[0]);
|
||||
$criterion->addAnd($criteria->getNewCriterion(CouponCountryTableMap::COUNTRY_ID, $value[1]));
|
||||
$criteria->addOr($criterion);
|
||||
}
|
||||
}
|
||||
|
||||
$query = CouponCountryQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { CouponCountryTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { CouponCountryTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the coupon_country table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public static function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
return CouponCountryQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a CouponCountry or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or CouponCountry object containing data that is used to create the INSERT statement.
|
||||
* @param ConnectionInterface $con the ConnectionInterface connection to use
|
||||
* @return mixed The new primary key.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doInsert($criteria, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CouponCountryTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from CouponCountry object
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = CouponCountryQuery::create()->mergeWith($criteria);
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table (I guess, conceivably)
|
||||
$con->beginTransaction();
|
||||
$pk = $query->doInsert($con);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
} // CouponCountryTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
CouponCountryTableMap::buildTableMap();
|
||||
416
core/lib/Thelia/Model/Map/CouponCustomerCountTableMap.php
Normal file
416
core/lib/Thelia/Model/Map/CouponCustomerCountTableMap.php
Normal file
@@ -0,0 +1,416 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Map;
|
||||
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\DataFetcher\DataFetcherInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\RelationMap;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Map\TableMapTrait;
|
||||
use Thelia\Model\CouponCustomerCount;
|
||||
use Thelia\Model\CouponCustomerCountQuery;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'coupon_customer_count' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This map class is used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
*/
|
||||
class CouponCustomerCountTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'Thelia.Model.Map.CouponCustomerCountTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'coupon_customer_count';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\Thelia\\Model\\CouponCustomerCount';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'Thelia.Model.CouponCustomerCount';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 3;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
*/
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 3;
|
||||
|
||||
/**
|
||||
* the column name for the COUPON_ID field
|
||||
*/
|
||||
const COUPON_ID = 'coupon_customer_count.COUPON_ID';
|
||||
|
||||
/**
|
||||
* the column name for the CUSTOMER_ID field
|
||||
*/
|
||||
const CUSTOMER_ID = 'coupon_customer_count.CUSTOMER_ID';
|
||||
|
||||
/**
|
||||
* the column name for the COUNT field
|
||||
*/
|
||||
const COUNT = 'coupon_customer_count.COUNT';
|
||||
|
||||
/**
|
||||
* The default string format for model objects of the related table
|
||||
*/
|
||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||
|
||||
/**
|
||||
* holds an array of fieldnames
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('CouponId', 'CustomerId', 'Count', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('couponId', 'customerId', 'count', ),
|
||||
self::TYPE_COLNAME => array(CouponCustomerCountTableMap::COUPON_ID, CouponCustomerCountTableMap::CUSTOMER_ID, CouponCustomerCountTableMap::COUNT, ),
|
||||
self::TYPE_RAW_COLNAME => array('COUPON_ID', 'CUSTOMER_ID', 'COUNT', ),
|
||||
self::TYPE_FIELDNAME => array('coupon_id', 'customer_id', 'count', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('CouponId' => 0, 'CustomerId' => 1, 'Count' => 2, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('couponId' => 0, 'customerId' => 1, 'count' => 2, ),
|
||||
self::TYPE_COLNAME => array(CouponCustomerCountTableMap::COUPON_ID => 0, CouponCustomerCountTableMap::CUSTOMER_ID => 1, CouponCustomerCountTableMap::COUNT => 2, ),
|
||||
self::TYPE_RAW_COLNAME => array('COUPON_ID' => 0, 'CUSTOMER_ID' => 1, 'COUNT' => 2, ),
|
||||
self::TYPE_FIELDNAME => array('coupon_id' => 0, 'customer_id' => 1, 'count' => 2, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, )
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialize the table attributes and columns
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('coupon_customer_count');
|
||||
$this->setPhpName('CouponCustomerCount');
|
||||
$this->setClassName('\\Thelia\\Model\\CouponCustomerCount');
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(false);
|
||||
$this->setIsCrossRef(true);
|
||||
// columns
|
||||
$this->addForeignKey('COUPON_ID', 'CouponId', 'INTEGER', 'coupon', 'ID', true, null, null);
|
||||
$this->addForeignKey('CUSTOMER_ID', 'CustomerId', 'INTEGER', 'customer', 'ID', true, null, null);
|
||||
$this->addColumn('COUNT', 'Count', 'INTEGER', true, null, 0);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::MANY_TO_ONE, array('customer_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('coupon_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
*
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*/
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the primary key from the DB resultset row
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*
|
||||
* @return mixed The primary key of the row
|
||||
*/
|
||||
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* The class that the tableMap will make instances of.
|
||||
*
|
||||
* If $withPrefix is true, the returned path
|
||||
* uses a dot-path notation which is translated into a path
|
||||
* relative to a location on the PHP include_path.
|
||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||
*
|
||||
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||
* @return string path.to.ClassName
|
||||
*/
|
||||
public static function getOMClass($withPrefix = true)
|
||||
{
|
||||
return $withPrefix ? CouponCustomerCountTableMap::CLASS_DEFAULT : CouponCustomerCountTableMap::OM_CLASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates an object of the default type or an object that inherit from the default.
|
||||
*
|
||||
* @param array $row row returned by DataFetcher->fetch().
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
|
||||
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
|
||||
*
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @return array (CouponCustomerCount object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = CouponCustomerCountTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = CouponCustomerCountTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, $offset, true); // rehydrate
|
||||
$col = $offset + CouponCustomerCountTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = CouponCustomerCountTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
CouponCustomerCountTableMap::addInstanceToPool($obj, $key);
|
||||
}
|
||||
|
||||
return array($obj, $col);
|
||||
}
|
||||
|
||||
/**
|
||||
* The returned array will contain objects of the default type or
|
||||
* objects that inherit from the default.
|
||||
*
|
||||
* @param DataFetcherInterface $dataFetcher
|
||||
* @return array
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function populateObjects(DataFetcherInterface $dataFetcher)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = static::getOMClass(false);
|
||||
// populate the object(s)
|
||||
while ($row = $dataFetcher->fetch()) {
|
||||
$key = CouponCustomerCountTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = CouponCustomerCountTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, 0, true); // rehydrate
|
||||
$results[] = $obj;
|
||||
} else {
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($row);
|
||||
$results[] = $obj;
|
||||
CouponCustomerCountTableMap::addInstanceToPool($obj, $key);
|
||||
} // if key exists
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
/**
|
||||
* Add all the columns needed to create a new object.
|
||||
*
|
||||
* Note: any columns that were marked with lazyLoad="true" in the
|
||||
* XML schema will not be added to the select list and only loaded
|
||||
* on demand.
|
||||
*
|
||||
* @param Criteria $criteria object containing the columns to add.
|
||||
* @param string $alias optional table alias
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function addSelectColumns(Criteria $criteria, $alias = null)
|
||||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(CouponCustomerCountTableMap::COUPON_ID);
|
||||
$criteria->addSelectColumn(CouponCustomerCountTableMap::CUSTOMER_ID);
|
||||
$criteria->addSelectColumn(CouponCustomerCountTableMap::COUNT);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.COUPON_ID');
|
||||
$criteria->addSelectColumn($alias . '.CUSTOMER_ID');
|
||||
$criteria->addSelectColumn($alias . '.COUNT');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TableMap related to this object.
|
||||
* This method is not needed for general use but a specific application could have a need.
|
||||
* @return TableMap
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getTableMap()
|
||||
{
|
||||
return Propel::getServiceContainer()->getDatabaseMap(CouponCustomerCountTableMap::DATABASE_NAME)->getTable(CouponCustomerCountTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(CouponCustomerCountTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(CouponCustomerCountTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new CouponCustomerCountTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a CouponCustomerCount or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or CouponCustomerCount object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doDelete($values, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CouponCustomerCountTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \Thelia\Model\CouponCustomerCount) { // it's a model object
|
||||
// create criteria based on pk value
|
||||
$criteria = $values->buildCriteria();
|
||||
} else { // it's a primary key, or an array of pks
|
||||
$criteria = new Criteria(CouponCustomerCountTableMap::DATABASE_NAME);
|
||||
// primary key is composite; we therefore, expect
|
||||
// the primary key passed to be an array of pkey values
|
||||
if (count($values) == count($values, COUNT_RECURSIVE)) {
|
||||
// array is not multi-dimensional
|
||||
$values = array($values);
|
||||
}
|
||||
foreach ($values as $value) {
|
||||
$criteria->addOr($criterion);
|
||||
}
|
||||
}
|
||||
|
||||
$query = CouponCustomerCountQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { CouponCustomerCountTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { CouponCustomerCountTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the coupon_customer_count table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public static function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
return CouponCustomerCountQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a CouponCustomerCount or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or CouponCustomerCount object containing data that is used to create the INSERT statement.
|
||||
* @param ConnectionInterface $con the ConnectionInterface connection to use
|
||||
* @return mixed The new primary key.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doInsert($criteria, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CouponCustomerCountTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from CouponCustomerCount object
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = CouponCustomerCountQuery::create()->mergeWith($criteria);
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table (I guess, conceivably)
|
||||
$con->beginTransaction();
|
||||
$pk = $query->doInsert($con);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
} // CouponCustomerCountTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
CouponCustomerCountTableMap::buildTableMap();
|
||||
468
core/lib/Thelia/Model/Map/CouponModuleTableMap.php
Normal file
468
core/lib/Thelia/Model/Map/CouponModuleTableMap.php
Normal file
@@ -0,0 +1,468 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Map;
|
||||
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\DataFetcher\DataFetcherInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\RelationMap;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Map\TableMapTrait;
|
||||
use Thelia\Model\CouponModule;
|
||||
use Thelia\Model\CouponModuleQuery;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'coupon_module' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This map class is used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
*/
|
||||
class CouponModuleTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'Thelia.Model.Map.CouponModuleTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'coupon_module';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\Thelia\\Model\\CouponModule';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'Thelia.Model.CouponModule';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 2;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
*/
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 2;
|
||||
|
||||
/**
|
||||
* the column name for the COUPON_ID field
|
||||
*/
|
||||
const COUPON_ID = 'coupon_module.COUPON_ID';
|
||||
|
||||
/**
|
||||
* the column name for the MODULE_ID field
|
||||
*/
|
||||
const MODULE_ID = 'coupon_module.MODULE_ID';
|
||||
|
||||
/**
|
||||
* The default string format for model objects of the related table
|
||||
*/
|
||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||
|
||||
/**
|
||||
* holds an array of fieldnames
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('CouponId', 'ModuleId', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('couponId', 'moduleId', ),
|
||||
self::TYPE_COLNAME => array(CouponModuleTableMap::COUPON_ID, CouponModuleTableMap::MODULE_ID, ),
|
||||
self::TYPE_RAW_COLNAME => array('COUPON_ID', 'MODULE_ID', ),
|
||||
self::TYPE_FIELDNAME => array('coupon_id', 'module_id', ),
|
||||
self::TYPE_NUM => array(0, 1, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('CouponId' => 0, 'ModuleId' => 1, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('couponId' => 0, 'moduleId' => 1, ),
|
||||
self::TYPE_COLNAME => array(CouponModuleTableMap::COUPON_ID => 0, CouponModuleTableMap::MODULE_ID => 1, ),
|
||||
self::TYPE_RAW_COLNAME => array('COUPON_ID' => 0, 'MODULE_ID' => 1, ),
|
||||
self::TYPE_FIELDNAME => array('coupon_id' => 0, 'module_id' => 1, ),
|
||||
self::TYPE_NUM => array(0, 1, )
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialize the table attributes and columns
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('coupon_module');
|
||||
$this->setPhpName('CouponModule');
|
||||
$this->setClassName('\\Thelia\\Model\\CouponModule');
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(false);
|
||||
$this->setIsCrossRef(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('COUPON_ID', 'CouponId', 'INTEGER' , 'coupon', 'ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('MODULE_ID', 'ModuleId', 'INTEGER' , 'module', 'ID', true, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('coupon_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Module', '\\Thelia\\Model\\Module', RelationMap::MANY_TO_ONE, array('module_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
* Adds an object to the instance pool.
|
||||
*
|
||||
* Propel keeps cached copies of objects in an instance pool when they are retrieved
|
||||
* from the database. In some cases you may need to explicitly add objects
|
||||
* to the cache in order to ensure that the same objects are always returned by find*()
|
||||
* and findPk*() calls.
|
||||
*
|
||||
* @param \Thelia\Model\CouponModule $obj A \Thelia\Model\CouponModule 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->getCouponId(), (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\CouponModule object or a primary key value.
|
||||
*/
|
||||
public static function removeInstanceFromPool($value)
|
||||
{
|
||||
if (Propel::isInstancePoolingEnabled() && null !== $value) {
|
||||
if (is_object($value) && $value instanceof \Thelia\Model\CouponModule) {
|
||||
$key = serialize(array((string) $value->getCouponId(), (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\CouponModule object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
|
||||
throw $e;
|
||||
}
|
||||
|
||||
unset(self::$instances[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
*
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*/
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// If the PK cannot be derived from the row, return NULL.
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('CouponId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ModuleId', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('CouponId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ModuleId', TableMap::TYPE_PHPNAME, $indexType)]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the primary key from the DB resultset row
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*
|
||||
* @return mixed The primary key of the row
|
||||
*/
|
||||
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
|
||||
return $pks;
|
||||
}
|
||||
|
||||
/**
|
||||
* The class that the tableMap will make instances of.
|
||||
*
|
||||
* If $withPrefix is true, the returned path
|
||||
* uses a dot-path notation which is translated into a path
|
||||
* relative to a location on the PHP include_path.
|
||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||
*
|
||||
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||
* @return string path.to.ClassName
|
||||
*/
|
||||
public static function getOMClass($withPrefix = true)
|
||||
{
|
||||
return $withPrefix ? CouponModuleTableMap::CLASS_DEFAULT : CouponModuleTableMap::OM_CLASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates an object of the default type or an object that inherit from the default.
|
||||
*
|
||||
* @param array $row row returned by DataFetcher->fetch().
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
|
||||
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
|
||||
*
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @return array (CouponModule object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = CouponModuleTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = CouponModuleTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, $offset, true); // rehydrate
|
||||
$col = $offset + CouponModuleTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = CouponModuleTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
CouponModuleTableMap::addInstanceToPool($obj, $key);
|
||||
}
|
||||
|
||||
return array($obj, $col);
|
||||
}
|
||||
|
||||
/**
|
||||
* The returned array will contain objects of the default type or
|
||||
* objects that inherit from the default.
|
||||
*
|
||||
* @param DataFetcherInterface $dataFetcher
|
||||
* @return array
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function populateObjects(DataFetcherInterface $dataFetcher)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = static::getOMClass(false);
|
||||
// populate the object(s)
|
||||
while ($row = $dataFetcher->fetch()) {
|
||||
$key = CouponModuleTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = CouponModuleTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, 0, true); // rehydrate
|
||||
$results[] = $obj;
|
||||
} else {
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($row);
|
||||
$results[] = $obj;
|
||||
CouponModuleTableMap::addInstanceToPool($obj, $key);
|
||||
} // if key exists
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
/**
|
||||
* Add all the columns needed to create a new object.
|
||||
*
|
||||
* Note: any columns that were marked with lazyLoad="true" in the
|
||||
* XML schema will not be added to the select list and only loaded
|
||||
* on demand.
|
||||
*
|
||||
* @param Criteria $criteria object containing the columns to add.
|
||||
* @param string $alias optional table alias
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function addSelectColumns(Criteria $criteria, $alias = null)
|
||||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(CouponModuleTableMap::COUPON_ID);
|
||||
$criteria->addSelectColumn(CouponModuleTableMap::MODULE_ID);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.COUPON_ID');
|
||||
$criteria->addSelectColumn($alias . '.MODULE_ID');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TableMap related to this object.
|
||||
* This method is not needed for general use but a specific application could have a need.
|
||||
* @return TableMap
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getTableMap()
|
||||
{
|
||||
return Propel::getServiceContainer()->getDatabaseMap(CouponModuleTableMap::DATABASE_NAME)->getTable(CouponModuleTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(CouponModuleTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(CouponModuleTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new CouponModuleTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a CouponModule or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or CouponModule object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doDelete($values, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CouponModuleTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \Thelia\Model\CouponModule) { // it's a model object
|
||||
// create criteria based on pk values
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else { // it's a primary key, or an array of pks
|
||||
$criteria = new Criteria(CouponModuleTableMap::DATABASE_NAME);
|
||||
// primary key is composite; we therefore, expect
|
||||
// the primary key passed to be an array of pkey values
|
||||
if (count($values) == count($values, COUNT_RECURSIVE)) {
|
||||
// array is not multi-dimensional
|
||||
$values = array($values);
|
||||
}
|
||||
foreach ($values as $value) {
|
||||
$criterion = $criteria->getNewCriterion(CouponModuleTableMap::COUPON_ID, $value[0]);
|
||||
$criterion->addAnd($criteria->getNewCriterion(CouponModuleTableMap::MODULE_ID, $value[1]));
|
||||
$criteria->addOr($criterion);
|
||||
}
|
||||
}
|
||||
|
||||
$query = CouponModuleQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { CouponModuleTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { CouponModuleTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the coupon_module table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public static function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
return CouponModuleQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a CouponModule or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or CouponModule object containing data that is used to create the INSERT statement.
|
||||
* @param ConnectionInterface $con the ConnectionInterface connection to use
|
||||
* @return mixed The new primary key.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doInsert($criteria, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CouponModuleTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from CouponModule object
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = CouponModuleQuery::create()->mergeWith($criteria);
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table (I guess, conceivably)
|
||||
$con->beginTransaction();
|
||||
$pk = $query->doInsert($con);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
} // CouponModuleTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
CouponModuleTableMap::buildTableMap();
|
||||
@@ -58,7 +58,7 @@ class CouponTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 15;
|
||||
const NUM_COLUMNS = 16;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -68,7 +68,7 @@ class CouponTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 15;
|
||||
const NUM_HYDRATE_COLUMNS = 16;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -130,6 +130,11 @@ class CouponTableMap extends TableMap
|
||||
*/
|
||||
const SERIALIZED_CONDITIONS = 'coupon.SERIALIZED_CONDITIONS';
|
||||
|
||||
/**
|
||||
* the column name for the PER_CUSTOMER_USAGE_COUNT field
|
||||
*/
|
||||
const PER_CUSTOMER_USAGE_COUNT = 'coupon.PER_CUSTOMER_USAGE_COUNT';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
@@ -166,12 +171,12 @@ class CouponTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'SerializedEffects', 'IsEnabled', 'ExpirationDate', 'MaxUsage', 'IsCumulative', 'IsRemovingPostage', 'IsAvailableOnSpecialOffers', 'IsUsed', 'SerializedConditions', 'CreatedAt', 'UpdatedAt', 'Version', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'serializedEffects', 'isEnabled', 'expirationDate', 'maxUsage', 'isCumulative', 'isRemovingPostage', 'isAvailableOnSpecialOffers', 'isUsed', 'serializedConditions', 'createdAt', 'updatedAt', 'version', ),
|
||||
self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::TYPE, CouponTableMap::SERIALIZED_EFFECTS, CouponTableMap::IS_ENABLED, CouponTableMap::EXPIRATION_DATE, CouponTableMap::MAX_USAGE, CouponTableMap::IS_CUMULATIVE, CouponTableMap::IS_REMOVING_POSTAGE, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponTableMap::IS_USED, CouponTableMap::SERIALIZED_CONDITIONS, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, CouponTableMap::VERSION, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'SERIALIZED_EFFECTS', 'IS_ENABLED', 'EXPIRATION_DATE', 'MAX_USAGE', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IS_USED', 'SERIALIZED_CONDITIONS', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'serialized_effects', 'is_enabled', 'expiration_date', 'max_usage', 'is_cumulative', 'is_removing_postage', 'is_available_on_special_offers', 'is_used', 'serialized_conditions', 'created_at', 'updated_at', 'version', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
|
||||
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'SerializedEffects', 'IsEnabled', 'ExpirationDate', 'MaxUsage', 'IsCumulative', 'IsRemovingPostage', 'IsAvailableOnSpecialOffers', 'IsUsed', 'SerializedConditions', 'PerCustomerUsageCount', 'CreatedAt', 'UpdatedAt', 'Version', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'serializedEffects', 'isEnabled', 'expirationDate', 'maxUsage', 'isCumulative', 'isRemovingPostage', 'isAvailableOnSpecialOffers', 'isUsed', 'serializedConditions', 'perCustomerUsageCount', 'createdAt', 'updatedAt', 'version', ),
|
||||
self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::TYPE, CouponTableMap::SERIALIZED_EFFECTS, CouponTableMap::IS_ENABLED, CouponTableMap::EXPIRATION_DATE, CouponTableMap::MAX_USAGE, CouponTableMap::IS_CUMULATIVE, CouponTableMap::IS_REMOVING_POSTAGE, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponTableMap::IS_USED, CouponTableMap::SERIALIZED_CONDITIONS, CouponTableMap::PER_CUSTOMER_USAGE_COUNT, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, CouponTableMap::VERSION, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'SERIALIZED_EFFECTS', 'IS_ENABLED', 'EXPIRATION_DATE', 'MAX_USAGE', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IS_USED', 'SERIALIZED_CONDITIONS', 'PER_CUSTOMER_USAGE_COUNT', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'serialized_effects', 'is_enabled', 'expiration_date', 'max_usage', 'is_cumulative', 'is_removing_postage', 'is_available_on_special_offers', 'is_used', 'serialized_conditions', 'per_customer_usage_count', 'created_at', 'updated_at', 'version', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -181,12 +186,12 @@ class CouponTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'SerializedEffects' => 3, 'IsEnabled' => 4, 'ExpirationDate' => 5, 'MaxUsage' => 6, 'IsCumulative' => 7, 'IsRemovingPostage' => 8, 'IsAvailableOnSpecialOffers' => 9, 'IsUsed' => 10, 'SerializedConditions' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, 'Version' => 14, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serializedEffects' => 3, 'isEnabled' => 4, 'expirationDate' => 5, 'maxUsage' => 6, 'isCumulative' => 7, 'isRemovingPostage' => 8, 'isAvailableOnSpecialOffers' => 9, 'isUsed' => 10, 'serializedConditions' => 11, 'createdAt' => 12, 'updatedAt' => 13, 'version' => 14, ),
|
||||
self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::TYPE => 2, CouponTableMap::SERIALIZED_EFFECTS => 3, CouponTableMap::IS_ENABLED => 4, CouponTableMap::EXPIRATION_DATE => 5, CouponTableMap::MAX_USAGE => 6, CouponTableMap::IS_CUMULATIVE => 7, CouponTableMap::IS_REMOVING_POSTAGE => 8, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 9, CouponTableMap::IS_USED => 10, CouponTableMap::SERIALIZED_CONDITIONS => 11, CouponTableMap::CREATED_AT => 12, CouponTableMap::UPDATED_AT => 13, CouponTableMap::VERSION => 14, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'SERIALIZED_EFFECTS' => 3, 'IS_ENABLED' => 4, 'EXPIRATION_DATE' => 5, 'MAX_USAGE' => 6, 'IS_CUMULATIVE' => 7, 'IS_REMOVING_POSTAGE' => 8, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 9, 'IS_USED' => 10, 'SERIALIZED_CONDITIONS' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, 'VERSION' => 14, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serialized_effects' => 3, 'is_enabled' => 4, 'expiration_date' => 5, 'max_usage' => 6, 'is_cumulative' => 7, 'is_removing_postage' => 8, 'is_available_on_special_offers' => 9, 'is_used' => 10, 'serialized_conditions' => 11, 'created_at' => 12, 'updated_at' => 13, 'version' => 14, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'SerializedEffects' => 3, 'IsEnabled' => 4, 'ExpirationDate' => 5, 'MaxUsage' => 6, 'IsCumulative' => 7, 'IsRemovingPostage' => 8, 'IsAvailableOnSpecialOffers' => 9, 'IsUsed' => 10, 'SerializedConditions' => 11, 'PerCustomerUsageCount' => 12, 'CreatedAt' => 13, 'UpdatedAt' => 14, 'Version' => 15, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serializedEffects' => 3, 'isEnabled' => 4, 'expirationDate' => 5, 'maxUsage' => 6, 'isCumulative' => 7, 'isRemovingPostage' => 8, 'isAvailableOnSpecialOffers' => 9, 'isUsed' => 10, 'serializedConditions' => 11, 'perCustomerUsageCount' => 12, 'createdAt' => 13, 'updatedAt' => 14, 'version' => 15, ),
|
||||
self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::TYPE => 2, CouponTableMap::SERIALIZED_EFFECTS => 3, CouponTableMap::IS_ENABLED => 4, CouponTableMap::EXPIRATION_DATE => 5, CouponTableMap::MAX_USAGE => 6, CouponTableMap::IS_CUMULATIVE => 7, CouponTableMap::IS_REMOVING_POSTAGE => 8, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 9, CouponTableMap::IS_USED => 10, CouponTableMap::SERIALIZED_CONDITIONS => 11, CouponTableMap::PER_CUSTOMER_USAGE_COUNT => 12, CouponTableMap::CREATED_AT => 13, CouponTableMap::UPDATED_AT => 14, CouponTableMap::VERSION => 15, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'SERIALIZED_EFFECTS' => 3, 'IS_ENABLED' => 4, 'EXPIRATION_DATE' => 5, 'MAX_USAGE' => 6, 'IS_CUMULATIVE' => 7, 'IS_REMOVING_POSTAGE' => 8, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 9, 'IS_USED' => 10, 'SERIALIZED_CONDITIONS' => 11, 'PER_CUSTOMER_USAGE_COUNT' => 12, 'CREATED_AT' => 13, 'UPDATED_AT' => 14, 'VERSION' => 15, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serialized_effects' => 3, 'is_enabled' => 4, 'expiration_date' => 5, 'max_usage' => 6, 'is_cumulative' => 7, 'is_removing_postage' => 8, 'is_available_on_special_offers' => 9, 'is_used' => 10, 'serialized_conditions' => 11, 'per_customer_usage_count' => 12, 'created_at' => 13, 'updated_at' => 14, 'version' => 15, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -217,6 +222,7 @@ class CouponTableMap extends TableMap
|
||||
$this->addColumn('IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IsAvailableOnSpecialOffers', 'BOOLEAN', true, 1, null);
|
||||
$this->addColumn('IS_USED', 'IsUsed', 'BOOLEAN', true, 1, null);
|
||||
$this->addColumn('SERIALIZED_CONDITIONS', 'SerializedConditions', 'LONGVARCHAR', true, null, null);
|
||||
$this->addColumn('PER_CUSTOMER_USAGE_COUNT', 'PerCustomerUsageCount', 'BOOLEAN', true, 1, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0);
|
||||
@@ -227,8 +233,14 @@ class CouponTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CouponCountry', '\\Thelia\\Model\\CouponCountry', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', null, 'CouponCountries');
|
||||
$this->addRelation('CouponModule', '\\Thelia\\Model\\CouponModule', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', null, 'CouponModules');
|
||||
$this->addRelation('CouponCustomerCount', '\\Thelia\\Model\\CouponCustomerCount', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', null, 'CouponCustomerCounts');
|
||||
$this->addRelation('CouponI18n', '\\Thelia\\Model\\CouponI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponI18ns');
|
||||
$this->addRelation('CouponVersion', '\\Thelia\\Model\\CouponVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponVersions');
|
||||
$this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Countries');
|
||||
$this->addRelation('Module', '\\Thelia\\Model\\Module', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Modules');
|
||||
$this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Customers');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
@@ -252,6 +264,9 @@ class CouponTableMap extends TableMap
|
||||
{
|
||||
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
CouponCountryTableMap::clearInstancePool();
|
||||
CouponModuleTableMap::clearInstancePool();
|
||||
CouponCustomerCountTableMap::clearInstancePool();
|
||||
CouponI18nTableMap::clearInstancePool();
|
||||
CouponVersionTableMap::clearInstancePool();
|
||||
}
|
||||
@@ -406,6 +421,7 @@ class CouponTableMap extends TableMap
|
||||
$criteria->addSelectColumn(CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS);
|
||||
$criteria->addSelectColumn(CouponTableMap::IS_USED);
|
||||
$criteria->addSelectColumn(CouponTableMap::SERIALIZED_CONDITIONS);
|
||||
$criteria->addSelectColumn(CouponTableMap::PER_CUSTOMER_USAGE_COUNT);
|
||||
$criteria->addSelectColumn(CouponTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(CouponTableMap::UPDATED_AT);
|
||||
$criteria->addSelectColumn(CouponTableMap::VERSION);
|
||||
@@ -422,6 +438,7 @@ class CouponTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.IS_AVAILABLE_ON_SPECIAL_OFFERS');
|
||||
$criteria->addSelectColumn($alias . '.IS_USED');
|
||||
$criteria->addSelectColumn($alias . '.SERIALIZED_CONDITIONS');
|
||||
$criteria->addSelectColumn($alias . '.PER_CUSTOMER_USAGE_COUNT');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.VERSION');
|
||||
|
||||
@@ -58,7 +58,7 @@ class CouponVersionTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 15;
|
||||
const NUM_COLUMNS = 16;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -68,7 +68,7 @@ class CouponVersionTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 15;
|
||||
const NUM_HYDRATE_COLUMNS = 16;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -130,6 +130,11 @@ class CouponVersionTableMap extends TableMap
|
||||
*/
|
||||
const SERIALIZED_CONDITIONS = 'coupon_version.SERIALIZED_CONDITIONS';
|
||||
|
||||
/**
|
||||
* the column name for the PER_CUSTOMER_USAGE_COUNT field
|
||||
*/
|
||||
const PER_CUSTOMER_USAGE_COUNT = 'coupon_version.PER_CUSTOMER_USAGE_COUNT';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
@@ -157,12 +162,12 @@ class CouponVersionTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'SerializedEffects', 'IsEnabled', 'ExpirationDate', 'MaxUsage', 'IsCumulative', 'IsRemovingPostage', 'IsAvailableOnSpecialOffers', 'IsUsed', 'SerializedConditions', 'CreatedAt', 'UpdatedAt', 'Version', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'serializedEffects', 'isEnabled', 'expirationDate', 'maxUsage', 'isCumulative', 'isRemovingPostage', 'isAvailableOnSpecialOffers', 'isUsed', 'serializedConditions', 'createdAt', 'updatedAt', 'version', ),
|
||||
self::TYPE_COLNAME => array(CouponVersionTableMap::ID, CouponVersionTableMap::CODE, CouponVersionTableMap::TYPE, CouponVersionTableMap::SERIALIZED_EFFECTS, CouponVersionTableMap::IS_ENABLED, CouponVersionTableMap::EXPIRATION_DATE, CouponVersionTableMap::MAX_USAGE, CouponVersionTableMap::IS_CUMULATIVE, CouponVersionTableMap::IS_REMOVING_POSTAGE, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponVersionTableMap::IS_USED, CouponVersionTableMap::SERIALIZED_CONDITIONS, CouponVersionTableMap::CREATED_AT, CouponVersionTableMap::UPDATED_AT, CouponVersionTableMap::VERSION, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'SERIALIZED_EFFECTS', 'IS_ENABLED', 'EXPIRATION_DATE', 'MAX_USAGE', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IS_USED', 'SERIALIZED_CONDITIONS', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'serialized_effects', 'is_enabled', 'expiration_date', 'max_usage', 'is_cumulative', 'is_removing_postage', 'is_available_on_special_offers', 'is_used', 'serialized_conditions', 'created_at', 'updated_at', 'version', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
|
||||
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'SerializedEffects', 'IsEnabled', 'ExpirationDate', 'MaxUsage', 'IsCumulative', 'IsRemovingPostage', 'IsAvailableOnSpecialOffers', 'IsUsed', 'SerializedConditions', 'PerCustomerUsageCount', 'CreatedAt', 'UpdatedAt', 'Version', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'serializedEffects', 'isEnabled', 'expirationDate', 'maxUsage', 'isCumulative', 'isRemovingPostage', 'isAvailableOnSpecialOffers', 'isUsed', 'serializedConditions', 'perCustomerUsageCount', 'createdAt', 'updatedAt', 'version', ),
|
||||
self::TYPE_COLNAME => array(CouponVersionTableMap::ID, CouponVersionTableMap::CODE, CouponVersionTableMap::TYPE, CouponVersionTableMap::SERIALIZED_EFFECTS, CouponVersionTableMap::IS_ENABLED, CouponVersionTableMap::EXPIRATION_DATE, CouponVersionTableMap::MAX_USAGE, CouponVersionTableMap::IS_CUMULATIVE, CouponVersionTableMap::IS_REMOVING_POSTAGE, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponVersionTableMap::IS_USED, CouponVersionTableMap::SERIALIZED_CONDITIONS, CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT, CouponVersionTableMap::CREATED_AT, CouponVersionTableMap::UPDATED_AT, CouponVersionTableMap::VERSION, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'SERIALIZED_EFFECTS', 'IS_ENABLED', 'EXPIRATION_DATE', 'MAX_USAGE', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IS_USED', 'SERIALIZED_CONDITIONS', 'PER_CUSTOMER_USAGE_COUNT', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'serialized_effects', 'is_enabled', 'expiration_date', 'max_usage', 'is_cumulative', 'is_removing_postage', 'is_available_on_special_offers', 'is_used', 'serialized_conditions', 'per_customer_usage_count', 'created_at', 'updated_at', 'version', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -172,12 +177,12 @@ class CouponVersionTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'SerializedEffects' => 3, 'IsEnabled' => 4, 'ExpirationDate' => 5, 'MaxUsage' => 6, 'IsCumulative' => 7, 'IsRemovingPostage' => 8, 'IsAvailableOnSpecialOffers' => 9, 'IsUsed' => 10, 'SerializedConditions' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, 'Version' => 14, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serializedEffects' => 3, 'isEnabled' => 4, 'expirationDate' => 5, 'maxUsage' => 6, 'isCumulative' => 7, 'isRemovingPostage' => 8, 'isAvailableOnSpecialOffers' => 9, 'isUsed' => 10, 'serializedConditions' => 11, 'createdAt' => 12, 'updatedAt' => 13, 'version' => 14, ),
|
||||
self::TYPE_COLNAME => array(CouponVersionTableMap::ID => 0, CouponVersionTableMap::CODE => 1, CouponVersionTableMap::TYPE => 2, CouponVersionTableMap::SERIALIZED_EFFECTS => 3, CouponVersionTableMap::IS_ENABLED => 4, CouponVersionTableMap::EXPIRATION_DATE => 5, CouponVersionTableMap::MAX_USAGE => 6, CouponVersionTableMap::IS_CUMULATIVE => 7, CouponVersionTableMap::IS_REMOVING_POSTAGE => 8, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 9, CouponVersionTableMap::IS_USED => 10, CouponVersionTableMap::SERIALIZED_CONDITIONS => 11, CouponVersionTableMap::CREATED_AT => 12, CouponVersionTableMap::UPDATED_AT => 13, CouponVersionTableMap::VERSION => 14, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'SERIALIZED_EFFECTS' => 3, 'IS_ENABLED' => 4, 'EXPIRATION_DATE' => 5, 'MAX_USAGE' => 6, 'IS_CUMULATIVE' => 7, 'IS_REMOVING_POSTAGE' => 8, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 9, 'IS_USED' => 10, 'SERIALIZED_CONDITIONS' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, 'VERSION' => 14, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serialized_effects' => 3, 'is_enabled' => 4, 'expiration_date' => 5, 'max_usage' => 6, 'is_cumulative' => 7, 'is_removing_postage' => 8, 'is_available_on_special_offers' => 9, 'is_used' => 10, 'serialized_conditions' => 11, 'created_at' => 12, 'updated_at' => 13, 'version' => 14, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'SerializedEffects' => 3, 'IsEnabled' => 4, 'ExpirationDate' => 5, 'MaxUsage' => 6, 'IsCumulative' => 7, 'IsRemovingPostage' => 8, 'IsAvailableOnSpecialOffers' => 9, 'IsUsed' => 10, 'SerializedConditions' => 11, 'PerCustomerUsageCount' => 12, 'CreatedAt' => 13, 'UpdatedAt' => 14, 'Version' => 15, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serializedEffects' => 3, 'isEnabled' => 4, 'expirationDate' => 5, 'maxUsage' => 6, 'isCumulative' => 7, 'isRemovingPostage' => 8, 'isAvailableOnSpecialOffers' => 9, 'isUsed' => 10, 'serializedConditions' => 11, 'perCustomerUsageCount' => 12, 'createdAt' => 13, 'updatedAt' => 14, 'version' => 15, ),
|
||||
self::TYPE_COLNAME => array(CouponVersionTableMap::ID => 0, CouponVersionTableMap::CODE => 1, CouponVersionTableMap::TYPE => 2, CouponVersionTableMap::SERIALIZED_EFFECTS => 3, CouponVersionTableMap::IS_ENABLED => 4, CouponVersionTableMap::EXPIRATION_DATE => 5, CouponVersionTableMap::MAX_USAGE => 6, CouponVersionTableMap::IS_CUMULATIVE => 7, CouponVersionTableMap::IS_REMOVING_POSTAGE => 8, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 9, CouponVersionTableMap::IS_USED => 10, CouponVersionTableMap::SERIALIZED_CONDITIONS => 11, CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT => 12, CouponVersionTableMap::CREATED_AT => 13, CouponVersionTableMap::UPDATED_AT => 14, CouponVersionTableMap::VERSION => 15, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'SERIALIZED_EFFECTS' => 3, 'IS_ENABLED' => 4, 'EXPIRATION_DATE' => 5, 'MAX_USAGE' => 6, 'IS_CUMULATIVE' => 7, 'IS_REMOVING_POSTAGE' => 8, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 9, 'IS_USED' => 10, 'SERIALIZED_CONDITIONS' => 11, 'PER_CUSTOMER_USAGE_COUNT' => 12, 'CREATED_AT' => 13, 'UPDATED_AT' => 14, 'VERSION' => 15, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serialized_effects' => 3, 'is_enabled' => 4, 'expiration_date' => 5, 'max_usage' => 6, 'is_cumulative' => 7, 'is_removing_postage' => 8, 'is_available_on_special_offers' => 9, 'is_used' => 10, 'serialized_conditions' => 11, 'per_customer_usage_count' => 12, 'created_at' => 13, 'updated_at' => 14, 'version' => 15, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -208,6 +213,7 @@ class CouponVersionTableMap extends TableMap
|
||||
$this->addColumn('IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IsAvailableOnSpecialOffers', 'BOOLEAN', true, 1, null);
|
||||
$this->addColumn('IS_USED', 'IsUsed', 'BOOLEAN', true, 1, null);
|
||||
$this->addColumn('SERIALIZED_CONDITIONS', 'SerializedConditions', 'LONGVARCHAR', true, null, null);
|
||||
$this->addColumn('PER_CUSTOMER_USAGE_COUNT', 'PerCustomerUsageCount', 'BOOLEAN', true, 1, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0);
|
||||
@@ -288,11 +294,11 @@ class CouponVersionTableMap extends TableMap
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// If the PK cannot be derived from the row, return NULL.
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 14 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 15 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 14 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]));
|
||||
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 15 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -420,6 +426,7 @@ class CouponVersionTableMap extends TableMap
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::IS_USED);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::SERIALIZED_CONDITIONS);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::UPDATED_AT);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::VERSION);
|
||||
@@ -436,6 +443,7 @@ class CouponVersionTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.IS_AVAILABLE_ON_SPECIAL_OFFERS');
|
||||
$criteria->addSelectColumn($alias . '.IS_USED');
|
||||
$criteria->addSelectColumn($alias . '.SERIALIZED_CONDITIONS');
|
||||
$criteria->addSelectColumn($alias . '.PER_CUSTOMER_USAGE_COUNT');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.VERSION');
|
||||
|
||||
@@ -228,6 +228,8 @@ class CustomerTableMap extends TableMap
|
||||
$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', ), 'CASCADE', 'RESTRICT', 'Carts');
|
||||
$this->addRelation('CouponCustomerCount', '\\Thelia\\Model\\CouponCustomerCount', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', null, 'CouponCustomerCounts');
|
||||
$this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Coupons');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
@@ -251,6 +253,7 @@ class CustomerTableMap extends TableMap
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
AddressTableMap::clearInstancePool();
|
||||
CartTableMap::clearInstancePool();
|
||||
CouponCustomerCountTableMap::clearInstancePool();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -190,7 +190,11 @@ class ModuleTableMap extends TableMap
|
||||
$this->addRelation('AreaDeliveryModule', '\\Thelia\\Model\\AreaDeliveryModule', RelationMap::ONE_TO_MANY, array('id' => 'delivery_module_id', ), 'CASCADE', 'RESTRICT', 'AreaDeliveryModules');
|
||||
$this->addRelation('ProfileModule', '\\Thelia\\Model\\ProfileModule', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', 'RESTRICT', 'ProfileModules');
|
||||
$this->addRelation('ModuleImage', '\\Thelia\\Model\\ModuleImage', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', 'RESTRICT', 'ModuleImages');
|
||||
$this->addRelation('CouponModule', '\\Thelia\\Model\\CouponModule', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', null, 'CouponModules');
|
||||
$this->addRelation('OrderCouponModule', '\\Thelia\\Model\\OrderCouponModule', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', null, 'OrderCouponModules');
|
||||
$this->addRelation('ModuleI18n', '\\Thelia\\Model\\ModuleI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ModuleI18ns');
|
||||
$this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Coupons');
|
||||
$this->addRelation('OrderCoupon', '\\Thelia\\Model\\OrderCoupon', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'OrderCoupons');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
@@ -216,6 +220,8 @@ class ModuleTableMap extends TableMap
|
||||
AreaDeliveryModuleTableMap::clearInstancePool();
|
||||
ProfileModuleTableMap::clearInstancePool();
|
||||
ModuleImageTableMap::clearInstancePool();
|
||||
CouponModuleTableMap::clearInstancePool();
|
||||
OrderCouponModuleTableMap::clearInstancePool();
|
||||
ModuleI18nTableMap::clearInstancePool();
|
||||
}
|
||||
|
||||
|
||||
468
core/lib/Thelia/Model/Map/OrderCouponCountryTableMap.php
Normal file
468
core/lib/Thelia/Model/Map/OrderCouponCountryTableMap.php
Normal file
@@ -0,0 +1,468 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Map;
|
||||
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\DataFetcher\DataFetcherInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\RelationMap;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Map\TableMapTrait;
|
||||
use Thelia\Model\OrderCouponCountry;
|
||||
use Thelia\Model\OrderCouponCountryQuery;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'order_coupon_country' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This map class is used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
*/
|
||||
class OrderCouponCountryTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'Thelia.Model.Map.OrderCouponCountryTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'order_coupon_country';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\Thelia\\Model\\OrderCouponCountry';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'Thelia.Model.OrderCouponCountry';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 2;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
*/
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 2;
|
||||
|
||||
/**
|
||||
* the column name for the COUPON_ID field
|
||||
*/
|
||||
const COUPON_ID = 'order_coupon_country.COUPON_ID';
|
||||
|
||||
/**
|
||||
* the column name for the COUNTRY_ID field
|
||||
*/
|
||||
const COUNTRY_ID = 'order_coupon_country.COUNTRY_ID';
|
||||
|
||||
/**
|
||||
* The default string format for model objects of the related table
|
||||
*/
|
||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||
|
||||
/**
|
||||
* holds an array of fieldnames
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('CouponId', 'CountryId', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('couponId', 'countryId', ),
|
||||
self::TYPE_COLNAME => array(OrderCouponCountryTableMap::COUPON_ID, OrderCouponCountryTableMap::COUNTRY_ID, ),
|
||||
self::TYPE_RAW_COLNAME => array('COUPON_ID', 'COUNTRY_ID', ),
|
||||
self::TYPE_FIELDNAME => array('coupon_id', 'country_id', ),
|
||||
self::TYPE_NUM => array(0, 1, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('CouponId' => 0, 'CountryId' => 1, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('couponId' => 0, 'countryId' => 1, ),
|
||||
self::TYPE_COLNAME => array(OrderCouponCountryTableMap::COUPON_ID => 0, OrderCouponCountryTableMap::COUNTRY_ID => 1, ),
|
||||
self::TYPE_RAW_COLNAME => array('COUPON_ID' => 0, 'COUNTRY_ID' => 1, ),
|
||||
self::TYPE_FIELDNAME => array('coupon_id' => 0, 'country_id' => 1, ),
|
||||
self::TYPE_NUM => array(0, 1, )
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialize the table attributes and columns
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('order_coupon_country');
|
||||
$this->setPhpName('OrderCouponCountry');
|
||||
$this->setClassName('\\Thelia\\Model\\OrderCouponCountry');
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(false);
|
||||
$this->setIsCrossRef(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('COUPON_ID', 'CouponId', 'INTEGER' , 'order_coupon', 'ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('COUNTRY_ID', 'CountryId', 'INTEGER' , 'country', 'ID', true, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('country_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('OrderCoupon', '\\Thelia\\Model\\OrderCoupon', RelationMap::MANY_TO_ONE, array('coupon_id' => 'id', ), null, null);
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
* Adds an object to the instance pool.
|
||||
*
|
||||
* Propel keeps cached copies of objects in an instance pool when they are retrieved
|
||||
* from the database. In some cases you may need to explicitly add objects
|
||||
* to the cache in order to ensure that the same objects are always returned by find*()
|
||||
* and findPk*() calls.
|
||||
*
|
||||
* @param \Thelia\Model\OrderCouponCountry $obj A \Thelia\Model\OrderCouponCountry 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->getCouponId(), (string) $obj->getCountryId()));
|
||||
} // 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\OrderCouponCountry object or a primary key value.
|
||||
*/
|
||||
public static function removeInstanceFromPool($value)
|
||||
{
|
||||
if (Propel::isInstancePoolingEnabled() && null !== $value) {
|
||||
if (is_object($value) && $value instanceof \Thelia\Model\OrderCouponCountry) {
|
||||
$key = serialize(array((string) $value->getCouponId(), (string) $value->getCountryId()));
|
||||
|
||||
} 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\OrderCouponCountry object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
|
||||
throw $e;
|
||||
}
|
||||
|
||||
unset(self::$instances[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
*
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*/
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// If the PK cannot be derived from the row, return NULL.
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('CouponId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('CountryId', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('CouponId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('CountryId', TableMap::TYPE_PHPNAME, $indexType)]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the primary key from the DB resultset row
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*
|
||||
* @return mixed The primary key of the row
|
||||
*/
|
||||
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
|
||||
return $pks;
|
||||
}
|
||||
|
||||
/**
|
||||
* The class that the tableMap will make instances of.
|
||||
*
|
||||
* If $withPrefix is true, the returned path
|
||||
* uses a dot-path notation which is translated into a path
|
||||
* relative to a location on the PHP include_path.
|
||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||
*
|
||||
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||
* @return string path.to.ClassName
|
||||
*/
|
||||
public static function getOMClass($withPrefix = true)
|
||||
{
|
||||
return $withPrefix ? OrderCouponCountryTableMap::CLASS_DEFAULT : OrderCouponCountryTableMap::OM_CLASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates an object of the default type or an object that inherit from the default.
|
||||
*
|
||||
* @param array $row row returned by DataFetcher->fetch().
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
|
||||
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
|
||||
*
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @return array (OrderCouponCountry object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = OrderCouponCountryTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = OrderCouponCountryTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, $offset, true); // rehydrate
|
||||
$col = $offset + OrderCouponCountryTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = OrderCouponCountryTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
OrderCouponCountryTableMap::addInstanceToPool($obj, $key);
|
||||
}
|
||||
|
||||
return array($obj, $col);
|
||||
}
|
||||
|
||||
/**
|
||||
* The returned array will contain objects of the default type or
|
||||
* objects that inherit from the default.
|
||||
*
|
||||
* @param DataFetcherInterface $dataFetcher
|
||||
* @return array
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function populateObjects(DataFetcherInterface $dataFetcher)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = static::getOMClass(false);
|
||||
// populate the object(s)
|
||||
while ($row = $dataFetcher->fetch()) {
|
||||
$key = OrderCouponCountryTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = OrderCouponCountryTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, 0, true); // rehydrate
|
||||
$results[] = $obj;
|
||||
} else {
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($row);
|
||||
$results[] = $obj;
|
||||
OrderCouponCountryTableMap::addInstanceToPool($obj, $key);
|
||||
} // if key exists
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
/**
|
||||
* Add all the columns needed to create a new object.
|
||||
*
|
||||
* Note: any columns that were marked with lazyLoad="true" in the
|
||||
* XML schema will not be added to the select list and only loaded
|
||||
* on demand.
|
||||
*
|
||||
* @param Criteria $criteria object containing the columns to add.
|
||||
* @param string $alias optional table alias
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function addSelectColumns(Criteria $criteria, $alias = null)
|
||||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(OrderCouponCountryTableMap::COUPON_ID);
|
||||
$criteria->addSelectColumn(OrderCouponCountryTableMap::COUNTRY_ID);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.COUPON_ID');
|
||||
$criteria->addSelectColumn($alias . '.COUNTRY_ID');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TableMap related to this object.
|
||||
* This method is not needed for general use but a specific application could have a need.
|
||||
* @return TableMap
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getTableMap()
|
||||
{
|
||||
return Propel::getServiceContainer()->getDatabaseMap(OrderCouponCountryTableMap::DATABASE_NAME)->getTable(OrderCouponCountryTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(OrderCouponCountryTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(OrderCouponCountryTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new OrderCouponCountryTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a OrderCouponCountry or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or OrderCouponCountry object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doDelete($values, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(OrderCouponCountryTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \Thelia\Model\OrderCouponCountry) { // it's a model object
|
||||
// create criteria based on pk values
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else { // it's a primary key, or an array of pks
|
||||
$criteria = new Criteria(OrderCouponCountryTableMap::DATABASE_NAME);
|
||||
// primary key is composite; we therefore, expect
|
||||
// the primary key passed to be an array of pkey values
|
||||
if (count($values) == count($values, COUNT_RECURSIVE)) {
|
||||
// array is not multi-dimensional
|
||||
$values = array($values);
|
||||
}
|
||||
foreach ($values as $value) {
|
||||
$criterion = $criteria->getNewCriterion(OrderCouponCountryTableMap::COUPON_ID, $value[0]);
|
||||
$criterion->addAnd($criteria->getNewCriterion(OrderCouponCountryTableMap::COUNTRY_ID, $value[1]));
|
||||
$criteria->addOr($criterion);
|
||||
}
|
||||
}
|
||||
|
||||
$query = OrderCouponCountryQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { OrderCouponCountryTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { OrderCouponCountryTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the order_coupon_country table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public static function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
return OrderCouponCountryQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a OrderCouponCountry or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or OrderCouponCountry object containing data that is used to create the INSERT statement.
|
||||
* @param ConnectionInterface $con the ConnectionInterface connection to use
|
||||
* @return mixed The new primary key.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doInsert($criteria, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(OrderCouponCountryTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from OrderCouponCountry object
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = OrderCouponCountryQuery::create()->mergeWith($criteria);
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table (I guess, conceivably)
|
||||
$con->beginTransaction();
|
||||
$pk = $query->doInsert($con);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
} // OrderCouponCountryTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
OrderCouponCountryTableMap::buildTableMap();
|
||||
468
core/lib/Thelia/Model/Map/OrderCouponModuleTableMap.php
Normal file
468
core/lib/Thelia/Model/Map/OrderCouponModuleTableMap.php
Normal file
@@ -0,0 +1,468 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Map;
|
||||
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\DataFetcher\DataFetcherInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\RelationMap;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Map\TableMapTrait;
|
||||
use Thelia\Model\OrderCouponModule;
|
||||
use Thelia\Model\OrderCouponModuleQuery;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'order_coupon_module' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This map class is used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
*/
|
||||
class OrderCouponModuleTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'Thelia.Model.Map.OrderCouponModuleTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'order_coupon_module';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\Thelia\\Model\\OrderCouponModule';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'Thelia.Model.OrderCouponModule';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 2;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
*/
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 2;
|
||||
|
||||
/**
|
||||
* the column name for the COUPON_ID field
|
||||
*/
|
||||
const COUPON_ID = 'order_coupon_module.COUPON_ID';
|
||||
|
||||
/**
|
||||
* the column name for the MODULE_ID field
|
||||
*/
|
||||
const MODULE_ID = 'order_coupon_module.MODULE_ID';
|
||||
|
||||
/**
|
||||
* The default string format for model objects of the related table
|
||||
*/
|
||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||
|
||||
/**
|
||||
* holds an array of fieldnames
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('CouponId', 'ModuleId', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('couponId', 'moduleId', ),
|
||||
self::TYPE_COLNAME => array(OrderCouponModuleTableMap::COUPON_ID, OrderCouponModuleTableMap::MODULE_ID, ),
|
||||
self::TYPE_RAW_COLNAME => array('COUPON_ID', 'MODULE_ID', ),
|
||||
self::TYPE_FIELDNAME => array('coupon_id', 'module_id', ),
|
||||
self::TYPE_NUM => array(0, 1, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('CouponId' => 0, 'ModuleId' => 1, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('couponId' => 0, 'moduleId' => 1, ),
|
||||
self::TYPE_COLNAME => array(OrderCouponModuleTableMap::COUPON_ID => 0, OrderCouponModuleTableMap::MODULE_ID => 1, ),
|
||||
self::TYPE_RAW_COLNAME => array('COUPON_ID' => 0, 'MODULE_ID' => 1, ),
|
||||
self::TYPE_FIELDNAME => array('coupon_id' => 0, 'module_id' => 1, ),
|
||||
self::TYPE_NUM => array(0, 1, )
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialize the table attributes and columns
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('order_coupon_module');
|
||||
$this->setPhpName('OrderCouponModule');
|
||||
$this->setClassName('\\Thelia\\Model\\OrderCouponModule');
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(false);
|
||||
$this->setIsCrossRef(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('COUPON_ID', 'CouponId', 'INTEGER' , 'order_coupon', 'ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('MODULE_ID', 'ModuleId', 'INTEGER' , 'module', 'ID', true, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('OrderCoupon', '\\Thelia\\Model\\OrderCoupon', RelationMap::MANY_TO_ONE, array('coupon_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Module', '\\Thelia\\Model\\Module', RelationMap::MANY_TO_ONE, array('module_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
* Adds an object to the instance pool.
|
||||
*
|
||||
* Propel keeps cached copies of objects in an instance pool when they are retrieved
|
||||
* from the database. In some cases you may need to explicitly add objects
|
||||
* to the cache in order to ensure that the same objects are always returned by find*()
|
||||
* and findPk*() calls.
|
||||
*
|
||||
* @param \Thelia\Model\OrderCouponModule $obj A \Thelia\Model\OrderCouponModule 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->getCouponId(), (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\OrderCouponModule object or a primary key value.
|
||||
*/
|
||||
public static function removeInstanceFromPool($value)
|
||||
{
|
||||
if (Propel::isInstancePoolingEnabled() && null !== $value) {
|
||||
if (is_object($value) && $value instanceof \Thelia\Model\OrderCouponModule) {
|
||||
$key = serialize(array((string) $value->getCouponId(), (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\OrderCouponModule object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
|
||||
throw $e;
|
||||
}
|
||||
|
||||
unset(self::$instances[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
*
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*/
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// If the PK cannot be derived from the row, return NULL.
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('CouponId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ModuleId', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('CouponId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ModuleId', TableMap::TYPE_PHPNAME, $indexType)]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the primary key from the DB resultset row
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*
|
||||
* @return mixed The primary key of the row
|
||||
*/
|
||||
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
|
||||
return $pks;
|
||||
}
|
||||
|
||||
/**
|
||||
* The class that the tableMap will make instances of.
|
||||
*
|
||||
* If $withPrefix is true, the returned path
|
||||
* uses a dot-path notation which is translated into a path
|
||||
* relative to a location on the PHP include_path.
|
||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||
*
|
||||
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||
* @return string path.to.ClassName
|
||||
*/
|
||||
public static function getOMClass($withPrefix = true)
|
||||
{
|
||||
return $withPrefix ? OrderCouponModuleTableMap::CLASS_DEFAULT : OrderCouponModuleTableMap::OM_CLASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates an object of the default type or an object that inherit from the default.
|
||||
*
|
||||
* @param array $row row returned by DataFetcher->fetch().
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
|
||||
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
|
||||
*
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @return array (OrderCouponModule object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = OrderCouponModuleTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = OrderCouponModuleTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, $offset, true); // rehydrate
|
||||
$col = $offset + OrderCouponModuleTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = OrderCouponModuleTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
OrderCouponModuleTableMap::addInstanceToPool($obj, $key);
|
||||
}
|
||||
|
||||
return array($obj, $col);
|
||||
}
|
||||
|
||||
/**
|
||||
* The returned array will contain objects of the default type or
|
||||
* objects that inherit from the default.
|
||||
*
|
||||
* @param DataFetcherInterface $dataFetcher
|
||||
* @return array
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function populateObjects(DataFetcherInterface $dataFetcher)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = static::getOMClass(false);
|
||||
// populate the object(s)
|
||||
while ($row = $dataFetcher->fetch()) {
|
||||
$key = OrderCouponModuleTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = OrderCouponModuleTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, 0, true); // rehydrate
|
||||
$results[] = $obj;
|
||||
} else {
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($row);
|
||||
$results[] = $obj;
|
||||
OrderCouponModuleTableMap::addInstanceToPool($obj, $key);
|
||||
} // if key exists
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
/**
|
||||
* Add all the columns needed to create a new object.
|
||||
*
|
||||
* Note: any columns that were marked with lazyLoad="true" in the
|
||||
* XML schema will not be added to the select list and only loaded
|
||||
* on demand.
|
||||
*
|
||||
* @param Criteria $criteria object containing the columns to add.
|
||||
* @param string $alias optional table alias
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function addSelectColumns(Criteria $criteria, $alias = null)
|
||||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(OrderCouponModuleTableMap::COUPON_ID);
|
||||
$criteria->addSelectColumn(OrderCouponModuleTableMap::MODULE_ID);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.COUPON_ID');
|
||||
$criteria->addSelectColumn($alias . '.MODULE_ID');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TableMap related to this object.
|
||||
* This method is not needed for general use but a specific application could have a need.
|
||||
* @return TableMap
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getTableMap()
|
||||
{
|
||||
return Propel::getServiceContainer()->getDatabaseMap(OrderCouponModuleTableMap::DATABASE_NAME)->getTable(OrderCouponModuleTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(OrderCouponModuleTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(OrderCouponModuleTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new OrderCouponModuleTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a OrderCouponModule or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or OrderCouponModule object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doDelete($values, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(OrderCouponModuleTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \Thelia\Model\OrderCouponModule) { // it's a model object
|
||||
// create criteria based on pk values
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else { // it's a primary key, or an array of pks
|
||||
$criteria = new Criteria(OrderCouponModuleTableMap::DATABASE_NAME);
|
||||
// primary key is composite; we therefore, expect
|
||||
// the primary key passed to be an array of pkey values
|
||||
if (count($values) == count($values, COUNT_RECURSIVE)) {
|
||||
// array is not multi-dimensional
|
||||
$values = array($values);
|
||||
}
|
||||
foreach ($values as $value) {
|
||||
$criterion = $criteria->getNewCriterion(OrderCouponModuleTableMap::COUPON_ID, $value[0]);
|
||||
$criterion->addAnd($criteria->getNewCriterion(OrderCouponModuleTableMap::MODULE_ID, $value[1]));
|
||||
$criteria->addOr($criterion);
|
||||
}
|
||||
}
|
||||
|
||||
$query = OrderCouponModuleQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { OrderCouponModuleTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { OrderCouponModuleTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the order_coupon_module table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public static function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
return OrderCouponModuleQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a OrderCouponModule or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or OrderCouponModule object containing data that is used to create the INSERT statement.
|
||||
* @param ConnectionInterface $con the ConnectionInterface connection to use
|
||||
* @return mixed The new primary key.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doInsert($criteria, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(OrderCouponModuleTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from OrderCouponModule object
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = OrderCouponModuleQuery::create()->mergeWith($criteria);
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table (I guess, conceivably)
|
||||
$con->beginTransaction();
|
||||
$pk = $query->doInsert($con);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
} // OrderCouponModuleTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
OrderCouponModuleTableMap::buildTableMap();
|
||||
@@ -58,7 +58,7 @@ class OrderCouponTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 15;
|
||||
const NUM_COLUMNS = 16;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -68,7 +68,7 @@ class OrderCouponTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 15;
|
||||
const NUM_HYDRATE_COLUMNS = 16;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -135,6 +135,11 @@ class OrderCouponTableMap extends TableMap
|
||||
*/
|
||||
const SERIALIZED_CONDITIONS = 'order_coupon.SERIALIZED_CONDITIONS';
|
||||
|
||||
/**
|
||||
* the column name for the PER_CUSTOMER_USAGE_COUNT field
|
||||
*/
|
||||
const PER_CUSTOMER_USAGE_COUNT = 'order_coupon.PER_CUSTOMER_USAGE_COUNT';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
@@ -157,12 +162,12 @@ class OrderCouponTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'OrderId', 'Code', 'Type', 'Amount', 'Title', 'ShortDescription', 'Description', 'ExpirationDate', 'IsCumulative', 'IsRemovingPostage', 'IsAvailableOnSpecialOffers', 'SerializedConditions', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'code', 'type', 'amount', 'title', 'shortDescription', 'description', 'expirationDate', 'isCumulative', 'isRemovingPostage', 'isAvailableOnSpecialOffers', 'serializedConditions', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(OrderCouponTableMap::ID, OrderCouponTableMap::ORDER_ID, OrderCouponTableMap::CODE, OrderCouponTableMap::TYPE, OrderCouponTableMap::AMOUNT, OrderCouponTableMap::TITLE, OrderCouponTableMap::SHORT_DESCRIPTION, OrderCouponTableMap::DESCRIPTION, OrderCouponTableMap::EXPIRATION_DATE, OrderCouponTableMap::IS_CUMULATIVE, OrderCouponTableMap::IS_REMOVING_POSTAGE, OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, OrderCouponTableMap::SERIALIZED_CONDITIONS, OrderCouponTableMap::CREATED_AT, OrderCouponTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'CODE', 'TYPE', 'AMOUNT', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', 'EXPIRATION_DATE', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'SERIALIZED_CONDITIONS', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'order_id', 'code', 'type', 'amount', 'title', 'short_description', 'description', 'expiration_date', 'is_cumulative', 'is_removing_postage', 'is_available_on_special_offers', 'serialized_conditions', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
|
||||
self::TYPE_PHPNAME => array('Id', 'OrderId', 'Code', 'Type', 'Amount', 'Title', 'ShortDescription', 'Description', 'ExpirationDate', 'IsCumulative', 'IsRemovingPostage', 'IsAvailableOnSpecialOffers', 'SerializedConditions', 'PerCustomerUsageCount', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'code', 'type', 'amount', 'title', 'shortDescription', 'description', 'expirationDate', 'isCumulative', 'isRemovingPostage', 'isAvailableOnSpecialOffers', 'serializedConditions', 'perCustomerUsageCount', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(OrderCouponTableMap::ID, OrderCouponTableMap::ORDER_ID, OrderCouponTableMap::CODE, OrderCouponTableMap::TYPE, OrderCouponTableMap::AMOUNT, OrderCouponTableMap::TITLE, OrderCouponTableMap::SHORT_DESCRIPTION, OrderCouponTableMap::DESCRIPTION, OrderCouponTableMap::EXPIRATION_DATE, OrderCouponTableMap::IS_CUMULATIVE, OrderCouponTableMap::IS_REMOVING_POSTAGE, OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, OrderCouponTableMap::SERIALIZED_CONDITIONS, OrderCouponTableMap::PER_CUSTOMER_USAGE_COUNT, OrderCouponTableMap::CREATED_AT, OrderCouponTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'CODE', 'TYPE', 'AMOUNT', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', 'EXPIRATION_DATE', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'SERIALIZED_CONDITIONS', 'PER_CUSTOMER_USAGE_COUNT', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'order_id', 'code', 'type', 'amount', 'title', 'short_description', 'description', 'expiration_date', 'is_cumulative', 'is_removing_postage', 'is_available_on_special_offers', 'serialized_conditions', 'per_customer_usage_count', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -172,12 +177,12 @@ class OrderCouponTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'Code' => 2, 'Type' => 3, 'Amount' => 4, 'Title' => 5, 'ShortDescription' => 6, 'Description' => 7, 'ExpirationDate' => 8, 'IsCumulative' => 9, 'IsRemovingPostage' => 10, 'IsAvailableOnSpecialOffers' => 11, 'SerializedConditions' => 12, 'CreatedAt' => 13, 'UpdatedAt' => 14, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'code' => 2, 'type' => 3, 'amount' => 4, 'title' => 5, 'shortDescription' => 6, 'description' => 7, 'expirationDate' => 8, 'isCumulative' => 9, 'isRemovingPostage' => 10, 'isAvailableOnSpecialOffers' => 11, 'serializedConditions' => 12, 'createdAt' => 13, 'updatedAt' => 14, ),
|
||||
self::TYPE_COLNAME => array(OrderCouponTableMap::ID => 0, OrderCouponTableMap::ORDER_ID => 1, OrderCouponTableMap::CODE => 2, OrderCouponTableMap::TYPE => 3, OrderCouponTableMap::AMOUNT => 4, OrderCouponTableMap::TITLE => 5, OrderCouponTableMap::SHORT_DESCRIPTION => 6, OrderCouponTableMap::DESCRIPTION => 7, OrderCouponTableMap::EXPIRATION_DATE => 8, OrderCouponTableMap::IS_CUMULATIVE => 9, OrderCouponTableMap::IS_REMOVING_POSTAGE => 10, OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 11, OrderCouponTableMap::SERIALIZED_CONDITIONS => 12, OrderCouponTableMap::CREATED_AT => 13, OrderCouponTableMap::UPDATED_AT => 14, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'CODE' => 2, 'TYPE' => 3, 'AMOUNT' => 4, 'TITLE' => 5, 'SHORT_DESCRIPTION' => 6, 'DESCRIPTION' => 7, 'EXPIRATION_DATE' => 8, 'IS_CUMULATIVE' => 9, 'IS_REMOVING_POSTAGE' => 10, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 11, 'SERIALIZED_CONDITIONS' => 12, 'CREATED_AT' => 13, 'UPDATED_AT' => 14, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'code' => 2, 'type' => 3, 'amount' => 4, 'title' => 5, 'short_description' => 6, 'description' => 7, 'expiration_date' => 8, 'is_cumulative' => 9, 'is_removing_postage' => 10, 'is_available_on_special_offers' => 11, 'serialized_conditions' => 12, 'created_at' => 13, 'updated_at' => 14, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'Code' => 2, 'Type' => 3, 'Amount' => 4, 'Title' => 5, 'ShortDescription' => 6, 'Description' => 7, 'ExpirationDate' => 8, 'IsCumulative' => 9, 'IsRemovingPostage' => 10, 'IsAvailableOnSpecialOffers' => 11, 'SerializedConditions' => 12, 'PerCustomerUsageCount' => 13, 'CreatedAt' => 14, 'UpdatedAt' => 15, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'code' => 2, 'type' => 3, 'amount' => 4, 'title' => 5, 'shortDescription' => 6, 'description' => 7, 'expirationDate' => 8, 'isCumulative' => 9, 'isRemovingPostage' => 10, 'isAvailableOnSpecialOffers' => 11, 'serializedConditions' => 12, 'perCustomerUsageCount' => 13, 'createdAt' => 14, 'updatedAt' => 15, ),
|
||||
self::TYPE_COLNAME => array(OrderCouponTableMap::ID => 0, OrderCouponTableMap::ORDER_ID => 1, OrderCouponTableMap::CODE => 2, OrderCouponTableMap::TYPE => 3, OrderCouponTableMap::AMOUNT => 4, OrderCouponTableMap::TITLE => 5, OrderCouponTableMap::SHORT_DESCRIPTION => 6, OrderCouponTableMap::DESCRIPTION => 7, OrderCouponTableMap::EXPIRATION_DATE => 8, OrderCouponTableMap::IS_CUMULATIVE => 9, OrderCouponTableMap::IS_REMOVING_POSTAGE => 10, OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 11, OrderCouponTableMap::SERIALIZED_CONDITIONS => 12, OrderCouponTableMap::PER_CUSTOMER_USAGE_COUNT => 13, OrderCouponTableMap::CREATED_AT => 14, OrderCouponTableMap::UPDATED_AT => 15, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'CODE' => 2, 'TYPE' => 3, 'AMOUNT' => 4, 'TITLE' => 5, 'SHORT_DESCRIPTION' => 6, 'DESCRIPTION' => 7, 'EXPIRATION_DATE' => 8, 'IS_CUMULATIVE' => 9, 'IS_REMOVING_POSTAGE' => 10, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 11, 'SERIALIZED_CONDITIONS' => 12, 'PER_CUSTOMER_USAGE_COUNT' => 13, 'CREATED_AT' => 14, 'UPDATED_AT' => 15, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'code' => 2, 'type' => 3, 'amount' => 4, 'title' => 5, 'short_description' => 6, 'description' => 7, 'expiration_date' => 8, 'is_cumulative' => 9, 'is_removing_postage' => 10, 'is_available_on_special_offers' => 11, 'serialized_conditions' => 12, 'per_customer_usage_count' => 13, 'created_at' => 14, 'updated_at' => 15, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -209,6 +214,7 @@ class OrderCouponTableMap extends TableMap
|
||||
$this->addColumn('IS_REMOVING_POSTAGE', 'IsRemovingPostage', 'BOOLEAN', true, 1, null);
|
||||
$this->addColumn('IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IsAvailableOnSpecialOffers', 'BOOLEAN', true, 1, null);
|
||||
$this->addColumn('SERIALIZED_CONDITIONS', 'SerializedConditions', 'LONGVARCHAR', true, null, null);
|
||||
$this->addColumn('PER_CUSTOMER_USAGE_COUNT', 'PerCustomerUsageCount', 'BOOLEAN', true, 1, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
@@ -219,6 +225,10 @@ class OrderCouponTableMap extends TableMap
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('order_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('OrderCouponCountry', '\\Thelia\\Model\\OrderCouponCountry', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), null, null, 'OrderCouponCountries');
|
||||
$this->addRelation('OrderCouponModule', '\\Thelia\\Model\\OrderCouponModule', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', null, 'OrderCouponModules');
|
||||
$this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Countries');
|
||||
$this->addRelation('Module', '\\Thelia\\Model\\Module', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Modules');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
@@ -233,6 +243,15 @@ class OrderCouponTableMap extends TableMap
|
||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
|
||||
);
|
||||
} // getBehaviors()
|
||||
/**
|
||||
* Method to invalidate the instance pool of all tables related to order_coupon * 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.
|
||||
OrderCouponModuleTableMap::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.
|
||||
@@ -385,6 +404,7 @@ class OrderCouponTableMap extends TableMap
|
||||
$criteria->addSelectColumn(OrderCouponTableMap::IS_REMOVING_POSTAGE);
|
||||
$criteria->addSelectColumn(OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS);
|
||||
$criteria->addSelectColumn(OrderCouponTableMap::SERIALIZED_CONDITIONS);
|
||||
$criteria->addSelectColumn(OrderCouponTableMap::PER_CUSTOMER_USAGE_COUNT);
|
||||
$criteria->addSelectColumn(OrderCouponTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(OrderCouponTableMap::UPDATED_AT);
|
||||
} else {
|
||||
@@ -401,6 +421,7 @@ class OrderCouponTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.IS_REMOVING_POSTAGE');
|
||||
$criteria->addSelectColumn($alias . '.IS_AVAILABLE_ON_SPECIAL_OFFERS');
|
||||
$criteria->addSelectColumn($alias . '.SERIALIZED_CONDITIONS');
|
||||
$criteria->addSelectColumn($alias . '.PER_CUSTOMER_USAGE_COUNT');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
|
||||
@@ -75,8 +75,6 @@ class Message extends BaseMessage
|
||||
{
|
||||
$body = false;
|
||||
|
||||
//$mail_template_path = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath() . DS;
|
||||
|
||||
// Try to get the body from template file, if a file is defined
|
||||
if (! empty($template)) {
|
||||
try {
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Thelia\Core\Template\TemplateDefinition;
|
||||
use Thelia\Model\Base\Module as BaseModule;
|
||||
use Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
use Thelia\Model\Tools\PositionManagementTrait;
|
||||
use Thelia\Module\BaseModuleInterface;
|
||||
|
||||
class Module extends BaseModule
|
||||
{
|
||||
@@ -182,6 +184,21 @@ class Module extends BaseModule
|
||||
return $moduleReflection->implementsInterface("Thelia\Module\PaymentModuleInterface");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerInterface $container the Thelia container
|
||||
* @return BaseModuleInterface a module instance
|
||||
* @throws \InvalidArgumentException if the module could not be found in the container/
|
||||
*/
|
||||
public function getModuleInstance(ContainerInterface $container)
|
||||
{
|
||||
$instance = $container->get(sprintf('module.%s', $this->getCode()));
|
||||
|
||||
if ($instance == null) {
|
||||
throw new \InvalidArgumentException(sprintf('Undefined module in container: "%s"', $this->getCode()));
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
/**
|
||||
* @return BaseModule a new module instance.
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\ModuleQuery as BaseModuleQuery;
|
||||
use Thelia\Module\BaseModule;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'module' table.
|
||||
@@ -24,7 +25,7 @@ class ModuleQuery extends BaseModuleQuery
|
||||
{
|
||||
if (null === self::$activated) {
|
||||
self::$activated = self::create()
|
||||
->filterByActivate(1)
|
||||
->filterByActivate(BaseModule::IS_ACTIVATED)
|
||||
->orderByPosition()
|
||||
->find();
|
||||
}
|
||||
@@ -37,4 +38,17 @@ class ModuleQuery extends BaseModuleQuery
|
||||
self::$activated = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $moduleType the module type : classic, payment or delivery. Use BaseModule constant here.
|
||||
* @param int $id the module id
|
||||
* @return ModuleQuery
|
||||
*/
|
||||
public function filterActivatedByTypeAndId($moduleType, $id)
|
||||
{
|
||||
return $this
|
||||
->filterByType($moduleType)
|
||||
->filterByActivate(BaseModule::IS_ACTIVATED)
|
||||
->filterById($id);
|
||||
}
|
||||
|
||||
} // ModuleQuery
|
||||
|
||||
@@ -4,19 +4,54 @@ namespace Thelia\Model;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Base\Order as BaseOrder;
|
||||
use Thelia\Model\Base\OrderProductTaxQuery;
|
||||
use Thelia\Model\Map\OrderProductTaxTableMap;
|
||||
use Thelia\Model\Base\Order as BaseOrder;
|
||||
use Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
|
||||
class Order extends BaseOrder
|
||||
{
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
use ModelEventDispatcherTrait;
|
||||
|
||||
public $chosenDeliveryAddress = null;
|
||||
public $chosenInvoiceAddress = null;
|
||||
protected $choosenDeliveryAddress = null;
|
||||
protected $choosenInvoiceAddress = null;
|
||||
|
||||
/**
|
||||
* @param null $choosenDeliveryAddress
|
||||
*/
|
||||
public function setChoosenDeliveryAddress($choosenDeliveryAddress)
|
||||
{
|
||||
$this->choosenDeliveryAddress = $choosenDeliveryAddress;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getChoosenDeliveryAddress()
|
||||
{
|
||||
return $this->choosenDeliveryAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $choosenInvoiceAddress
|
||||
*/
|
||||
public function setChoosenInvoiceAddress($choosenInvoiceAddress)
|
||||
{
|
||||
$this->choosenInvoiceAddress = $choosenInvoiceAddress;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getChoosenInvoiceAddress()
|
||||
{
|
||||
return $this->choosenInvoiceAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
||||
@@ -7,4 +7,22 @@ use Thelia\Model\Base\OrderCoupon as BaseOrderCoupon;
|
||||
class OrderCoupon extends BaseOrderCoupon
|
||||
{
|
||||
|
||||
/**
|
||||
* Return the countries for which free shipping is valid
|
||||
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
|
||||
*/
|
||||
public function getFreeShippingForCountries()
|
||||
{
|
||||
return OrderCouponCountryQuery::create()->filterByOrderCoupon($this)->find();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the modules for which free shipping is valid
|
||||
*
|
||||
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
|
||||
*/
|
||||
public function getFreeShippingForModules()
|
||||
{
|
||||
return OrderCouponModuleQuery::create()->filterByOrderCoupon($this)->find();
|
||||
}
|
||||
}
|
||||
|
||||
10
core/lib/Thelia/Model/OrderCouponCountry.php
Normal file
10
core/lib/Thelia/Model/OrderCouponCountry.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\OrderCouponCountry as BaseOrderCouponCountry;
|
||||
|
||||
class OrderCouponCountry extends BaseOrderCouponCountry
|
||||
{
|
||||
|
||||
}
|
||||
20
core/lib/Thelia/Model/OrderCouponCountryQuery.php
Normal file
20
core/lib/Thelia/Model/OrderCouponCountryQuery.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\OrderCouponCountryQuery as BaseOrderCouponCountryQuery;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'order_coupon_country' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class OrderCouponCountryQuery extends BaseOrderCouponCountryQuery
|
||||
{
|
||||
|
||||
} // OrderCouponCountryQuery
|
||||
10
core/lib/Thelia/Model/OrderCouponModule.php
Normal file
10
core/lib/Thelia/Model/OrderCouponModule.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\OrderCouponModule as BaseOrderCouponModule;
|
||||
|
||||
class OrderCouponModule extends BaseOrderCouponModule
|
||||
{
|
||||
|
||||
}
|
||||
20
core/lib/Thelia/Model/OrderCouponModuleQuery.php
Normal file
20
core/lib/Thelia/Model/OrderCouponModuleQuery.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\OrderCouponModuleQuery as BaseOrderCouponModuleQuery;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'order_coupon_module' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class OrderCouponModuleQuery extends BaseOrderCouponModuleQuery
|
||||
{
|
||||
|
||||
} // OrderCouponModuleQuery
|
||||
@@ -61,7 +61,7 @@ class Product extends BaseProduct
|
||||
*/
|
||||
public function getDefaultSaleElements()
|
||||
{
|
||||
return ProductSaleElementsQuery::create()->filterByProductId($this->id)->filterByIsDefault(true)->find();
|
||||
return ProductSaleElementsQuery::create()->filterByProductId($this->id)->filterByIsDefault(true)->findOne();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,13 +2,20 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Model\Base\ProductDocument as BaseProductDocument;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
|
||||
use Thelia\Model\Breadcrumb\CatalogBreadcrumbTrait;
|
||||
use Thelia\Model\Tools\PositionManagementTrait;
|
||||
use Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
|
||||
class ProductDocument extends BaseProductDocument
|
||||
class ProductDocument extends BaseProductDocument implements BreadcrumbInterface
|
||||
{
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
use \Thelia\Model\Tools\PositionManagementTrait;
|
||||
use ModelEventDispatcherTrait;
|
||||
use PositionManagementTrait;
|
||||
use CatalogBreadcrumbTrait;
|
||||
|
||||
/**
|
||||
* Calculate next position relative to our parent
|
||||
@@ -63,4 +70,14 @@ class ProductDocument extends BaseProductDocument
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* return the complete breadcrumb for a given resource.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab)
|
||||
{
|
||||
return $this->getProductBreadcrumb($router, $container, $tab);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,20 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Model\Base\ProductImage as BaseProductImage;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
|
||||
use Thelia\Model\Breadcrumb\CatalogBreadcrumbTrait;
|
||||
use Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
use Thelia\Model\Tools\PositionManagementTrait;
|
||||
|
||||
class ProductImage extends BaseProductImage
|
||||
class ProductImage extends BaseProductImage implements BreadcrumbInterface
|
||||
{
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
use \Thelia\Model\Tools\PositionManagementTrait;
|
||||
use ModelEventDispatcherTrait;
|
||||
use PositionManagementTrait;
|
||||
use CatalogBreadcrumbTrait;
|
||||
|
||||
/**
|
||||
* Calculate next position relative to our parent
|
||||
@@ -62,4 +69,15 @@ class ProductImage extends BaseProductImage
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* return the complete breadcrumb for a given resource.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab)
|
||||
{
|
||||
return $this->getProductBreadcrumb($router, $container, $tab);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class RewritingUrlQuery extends BaseRewritingUrlQuery
|
||||
->filterByViewLocale($viewLocale)
|
||||
->filterByViewId($viewId)
|
||||
->filterByRedirected(null)
|
||||
->orderByUpdatedAt(Criteria::DESC)
|
||||
->orderById(Criteria::DESC)
|
||||
->findOne();
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ class RewritingUrlQuery extends BaseRewritingUrlQuery
|
||||
->filterByViewLocale($viewLocale)
|
||||
->filterByViewId($viewId)
|
||||
->filterByRedirected(null)
|
||||
->orderByUpdatedAt(Criteria::DESC);
|
||||
->orderById(Criteria::DESC);
|
||||
|
||||
$otherParametersCount = count($viewOtherParameters);
|
||||
if ($otherParametersCount > 0) {
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Thelia\Model\Tools;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\Join;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Thelia\Model\Base\LangQuery;
|
||||
use Thelia\Model\LangQuery;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\Lang;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user