WIP Coupon
Update Coupon Model + SQL Implementattion Fixtures for Coupon and CouponFactory
This commit is contained in:
@@ -24,6 +24,12 @@
|
|||||||
namespace Thelia\Coupon;
|
namespace Thelia\Coupon;
|
||||||
|
|
||||||
use Thelia\Coupon\Type\CouponInterface;
|
use Thelia\Coupon\Type\CouponInterface;
|
||||||
|
use Thelia\Coupon\Type\RemoveXAmount;
|
||||||
|
use Thelia\Model\Base\CouponQuery;
|
||||||
|
use Thelia\Model\Coupon;
|
||||||
|
use Symfony\Component\Serializer\Serializer;
|
||||||
|
use Symfony\Component\Serializer\Encoder\JsonEncoder;
|
||||||
|
use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by JetBrains PhpStorm.
|
* Created by JetBrains PhpStorm.
|
||||||
@@ -41,11 +47,67 @@ class CouponFactory
|
|||||||
/**
|
/**
|
||||||
* Build a CouponInterface from its database data
|
* Build a CouponInterface from its database data
|
||||||
*
|
*
|
||||||
* @param int $couponCode CouponInterface id
|
* @param string $couponCode Coupon code ex: XMAS
|
||||||
*
|
*
|
||||||
* @return CouponInterface ready to be processed
|
* @return CouponInterface ready to be processed
|
||||||
*/
|
*/
|
||||||
public function buildCouponFromCode($couponCode)
|
public function buildCouponFromCode($couponCode)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$couponQuery = CouponQuery::create();
|
||||||
|
$couponModel = $couponQuery->findByCode($couponCode);
|
||||||
|
|
||||||
|
return $this->buildCouponInterfacFromModel($couponModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a CouponInterface from its Model data contained in the DataBase
|
||||||
|
*
|
||||||
|
* @param Coupon $model Database data
|
||||||
|
*
|
||||||
|
* @return CouponInterface ready to use CouponInterface object instance
|
||||||
|
*/
|
||||||
|
protected function buildCouponInterfacFromModel(Coupon $model)
|
||||||
|
{
|
||||||
|
$isCumulative = ($model->getIsCumulative() == 1 ? true : false);
|
||||||
|
$isRemovingPostage = ($model->getIsRemovingPostage() == 1 ? true : false);
|
||||||
|
$couponClass = $model->getType();
|
||||||
|
|
||||||
|
/** @var CouponInterface $coupon*/
|
||||||
|
$coupon = new $$couponClass(
|
||||||
|
$model->getCode(),
|
||||||
|
$model->getTitle(),
|
||||||
|
$model->getShortDescription(),
|
||||||
|
$model->getDescription(),
|
||||||
|
$model->getAmount(),
|
||||||
|
$isCumulative,
|
||||||
|
$isRemovingPostage
|
||||||
|
);
|
||||||
|
|
||||||
|
$normalizer = new GetSetMethodNormalizer();
|
||||||
|
$encoder = new JsonEncoder();
|
||||||
|
|
||||||
|
$serializer = new Serializer(array($normalizer), array($encoder));
|
||||||
|
|
||||||
|
$o = new \ArrayObject();
|
||||||
|
$unserializedRuleTypes = $o->unserialize(
|
||||||
|
$model->getSerializedRulesType()
|
||||||
|
);
|
||||||
|
$unserializedRuleContents = $o->unserialize(
|
||||||
|
$model->getSerializedRulesContent()
|
||||||
|
);
|
||||||
|
|
||||||
|
$rules = array();
|
||||||
|
foreach ($unserializedRuleTypes as $key => $unserializedRuleType) {
|
||||||
|
$rules[] = $serializer->deserialize(
|
||||||
|
$unserializedRuleContents[$key],
|
||||||
|
$unserializedRuleType,
|
||||||
|
'json'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$coupon->setRules($rules);
|
||||||
|
|
||||||
|
return $coupon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ use Thelia\Coupon\Parameter\ComparableInterface;
|
|||||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class DateParam implements ComparableInterface
|
class DateParam implements ComparableInterface, RuleParameterInterface
|
||||||
{
|
{
|
||||||
/** @var \DateTime Date */
|
/** @var \DateTime Date */
|
||||||
protected $dateTime = null;
|
protected $dateTime = null;
|
||||||
@@ -93,4 +93,15 @@ class DateParam implements ComparableInterface
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Parameter value to test against
|
||||||
|
*
|
||||||
|
* @return \Datetime
|
||||||
|
*/
|
||||||
|
public function getValue()
|
||||||
|
{
|
||||||
|
return clone $this->dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ use Thelia\Coupon\Parameter\ComparableInterface;
|
|||||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class IntegerParam implements ComparableInterface
|
class IntegerParam implements ComparableInterface, RuleParameterInterface
|
||||||
{
|
{
|
||||||
/** @var int Integer to compare with */
|
/** @var int Integer to compare with */
|
||||||
protected $integer = 0;
|
protected $integer = 0;
|
||||||
@@ -94,4 +94,14 @@ class IntegerParam implements ComparableInterface
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Parameter value to test against
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getValue()
|
||||||
|
{
|
||||||
|
return $this->integer;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ namespace Thelia\Coupon\Parameter;
|
|||||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class IntervalParam implements ComparableInterface
|
class IntervalParam implements ComparableInterface, RuleParameterInterface
|
||||||
{
|
{
|
||||||
/** @var \DatePeriod Date period */
|
/** @var \DatePeriod Date period */
|
||||||
protected $datePeriod = null;
|
protected $datePeriod = null;
|
||||||
@@ -105,4 +105,14 @@ class IntervalParam implements ComparableInterface
|
|||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Parameter value to test against
|
||||||
|
*
|
||||||
|
* @return \DatePeriod
|
||||||
|
*/
|
||||||
|
public function getValue()
|
||||||
|
{
|
||||||
|
return clone $this->datePeriod;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@ use Thelia\Coupon\Parameter\ComparableInterface;
|
|||||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class PriceParam implements ComparableInterface
|
class PriceParam implements ComparableInterface, RuleParameterInterface
|
||||||
{
|
{
|
||||||
/** @var float Positive Float to compare with */
|
/** @var float Positive Float to compare with */
|
||||||
protected $price = null;
|
protected $price = null;
|
||||||
@@ -113,4 +113,13 @@ class PriceParam implements ComparableInterface
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Parameter value to test against
|
||||||
|
*
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function getValue()
|
||||||
|
{
|
||||||
|
return $this->price;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -75,4 +75,4 @@ class QuantityParam extends IntegerParam
|
|||||||
return parent::compareTo($other);
|
return parent::compareTo($other);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,4 +87,14 @@ class RepeatedDateParam extends RepeatedParam
|
|||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Parameter value to test against
|
||||||
|
*
|
||||||
|
* @return \DatePeriod
|
||||||
|
*/
|
||||||
|
public function getValue()
|
||||||
|
{
|
||||||
|
return clone $this->datePeriod;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -121,4 +121,14 @@ class RepeatedIntervalParam extends RepeatedParam
|
|||||||
return $ret;
|
return $ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Parameter value to test against
|
||||||
|
*
|
||||||
|
* @return \DatePeriod
|
||||||
|
*/
|
||||||
|
public function getValue()
|
||||||
|
{
|
||||||
|
return clone $this->datePeriod;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ use DateTime;
|
|||||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
abstract class RepeatedParam implements ComparableInterface
|
abstract class RepeatedParam implements ComparableInterface, RuleParameterInterface
|
||||||
{
|
{
|
||||||
/** @var DateTime The start date of the period. */
|
/** @var DateTime The start date of the period. */
|
||||||
protected $from = null;
|
protected $from = null;
|
||||||
@@ -232,10 +232,20 @@ abstract class RepeatedParam implements ComparableInterface
|
|||||||
/**
|
/**
|
||||||
* Get date DatePeriod
|
* Get date DatePeriod
|
||||||
*
|
*
|
||||||
* @return DatePeriod
|
* @return \DatePeriod
|
||||||
*/
|
*/
|
||||||
public function getDatePeriod()
|
public function getDatePeriod()
|
||||||
{
|
{
|
||||||
return clone $this->datePeriod;
|
return clone $this->datePeriod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Parameter value to test against
|
||||||
|
*
|
||||||
|
* @return \DatePeriod
|
||||||
|
*/
|
||||||
|
public function getValue()
|
||||||
|
{
|
||||||
|
return clone $this->datePeriod;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
45
core/lib/Thelia/Coupon/Parameter/RuleParameterInterface.php
Normal file
45
core/lib/Thelia/Coupon/Parameter/RuleParameterInterface.php
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
/**********************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Thelia */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : info@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* This program is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU General Public License as published by */
|
||||||
|
/* the Free Software Foundation; either version 3 of the License */
|
||||||
|
/* */
|
||||||
|
/* This program is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU General Public License */
|
||||||
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
/* */
|
||||||
|
/**********************************************************************************/
|
||||||
|
|
||||||
|
namespace Thelia\Coupon\Parameter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by JetBrains PhpStorm.
|
||||||
|
* Date: 8/19/13
|
||||||
|
* Time: 3:24 PM
|
||||||
|
*
|
||||||
|
* Get a Param value
|
||||||
|
*
|
||||||
|
* @package Coupon
|
||||||
|
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
interface RuleParameterInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get Parameter value to test against
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getValue();
|
||||||
|
}
|
||||||
77
core/lib/Thelia/Coupon/Parameter/RuleValidator.php
Normal file
77
core/lib/Thelia/Coupon/Parameter/RuleValidator.php
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
/**********************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Thelia */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : info@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* This program is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU General Public License as published by */
|
||||||
|
/* the Free Software Foundation; either version 3 of the License */
|
||||||
|
/* */
|
||||||
|
/* This program is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU General Public License */
|
||||||
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
/* */
|
||||||
|
/**********************************************************************************/
|
||||||
|
|
||||||
|
namespace Thelia\Coupon\Parameter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by JetBrains PhpStorm.
|
||||||
|
* Date: 8/19/13
|
||||||
|
* Time: 3:24 PM
|
||||||
|
*
|
||||||
|
* Allow to validate parameters
|
||||||
|
*
|
||||||
|
* @package Coupon
|
||||||
|
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class RuleValidator
|
||||||
|
{
|
||||||
|
/** @var string Operator ex: Operators::INFERIOR */
|
||||||
|
protected $operator = null;
|
||||||
|
|
||||||
|
/** @var ComparableInterface Validator */
|
||||||
|
protected $param = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param string $operator Operator ex: Operators::INFERIOR
|
||||||
|
* @param ComparableInterface $param Validator ex: PriceParam
|
||||||
|
*/
|
||||||
|
function __construct($operator, ComparableInterface $param)
|
||||||
|
{
|
||||||
|
$this->operator = $operator;
|
||||||
|
$this->param = $param;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Validator Operator
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getOperator()
|
||||||
|
{
|
||||||
|
return $this->operator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Validator Param
|
||||||
|
*
|
||||||
|
* @return ComparableInterface
|
||||||
|
*/
|
||||||
|
public function getParam()
|
||||||
|
{
|
||||||
|
return $this->param;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -26,6 +26,8 @@ namespace Thelia\Coupon\Rule;
|
|||||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||||
use Thelia\Coupon\CouponAdapterInterface;
|
use Thelia\Coupon\CouponAdapterInterface;
|
||||||
use Thelia\Coupon\Parameter\PriceParam;
|
use Thelia\Coupon\Parameter\PriceParam;
|
||||||
|
use Thelia\Coupon\Parameter\RuleValidator;
|
||||||
|
use Thelia\Exception\InvalidRuleException;
|
||||||
use Thelia\Exception\InvalidRuleOperatorException;
|
use Thelia\Exception\InvalidRuleOperatorException;
|
||||||
use Thelia\Exception\InvalidRuleValueException;
|
use Thelia\Exception\InvalidRuleValueException;
|
||||||
|
|
||||||
@@ -53,20 +55,30 @@ class AvailableForTotalAmount extends CouponRuleAbstract
|
|||||||
Operators::SUPERIOR,
|
Operators::SUPERIOR,
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var PriceParam Price Validator */
|
/** @var RuleValidator Price Validator */
|
||||||
protected $priceValidator = null;
|
protected $priceValidator = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param array $validators Parameters validating $paramsToValidate against
|
* @param array $validators Array of RuleValidator
|
||||||
|
* validating $paramsToValidate against
|
||||||
* @param array $validated Parameters to be paramsToValidate
|
* @param array $validated Parameters to be paramsToValidate
|
||||||
|
*
|
||||||
|
* @throws \Thelia\Exception\InvalidRuleException
|
||||||
*/
|
*/
|
||||||
public function __construct(array $validators, array $validated = null)
|
public function __construct(array $validators, array $validated = null)
|
||||||
{
|
{
|
||||||
parent::__construct($validators, $validated);
|
parent::__construct($validators, $validated);
|
||||||
|
|
||||||
$this->priceValidator = $validators[self::PARAM1_PRICE][self::VALUE];
|
if (isset($validators[self::PARAM1_PRICE])
|
||||||
|
&& $validators[self::PARAM1_PRICE] instanceof RuleValidator
|
||||||
|
) {
|
||||||
|
$this->priceValidator = $validators[self::PARAM1_PRICE];
|
||||||
|
} else {
|
||||||
|
throw new InvalidRuleException(get_class());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -82,16 +94,23 @@ class AvailableForTotalAmount extends CouponRuleAbstract
|
|||||||
if (!isset($this->validators)
|
if (!isset($this->validators)
|
||||||
|| empty($this->validators)
|
|| empty($this->validators)
|
||||||
||!isset($this->validators[self::PARAM1_PRICE])
|
||!isset($this->validators[self::PARAM1_PRICE])
|
||||||
||!isset($this->validators[self::PARAM1_PRICE][self::VALUE])
|
||!isset($this->validators[self::PARAM1_PRICE])
|
||||||
||!$this->validators[self::PARAM1_PRICE][self::VALUE] instanceof PriceParam
|
|
||||||
) {
|
) {
|
||||||
throw new InvalidRuleValueException(get_class(), self::PARAM1_PRICE);
|
throw new InvalidRuleValueException(get_class(), self::PARAM1_PRICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var RuleValidator $ruleValidator */
|
||||||
|
$ruleValidator = $this->validators[self::PARAM1_PRICE];
|
||||||
|
/** @var PriceParam $price */
|
||||||
|
$price = $ruleValidator->getParam();
|
||||||
|
|
||||||
|
if (!$price instanceof PriceParam) {
|
||||||
|
throw new InvalidRuleValueException(get_class(), self::PARAM1_PRICE);
|
||||||
|
}
|
||||||
|
|
||||||
$this->checkBackOfficeInputsOperators();
|
$this->checkBackOfficeInputsOperators();
|
||||||
|
|
||||||
/** @var PriceParam $price */
|
|
||||||
$price = $this->validators[self::PARAM1_PRICE][self::VALUE];
|
|
||||||
|
|
||||||
return $this->isPriceValid($price->getPrice());
|
return $this->isPriceValid($price->getPrice());
|
||||||
}
|
}
|
||||||
@@ -128,7 +147,7 @@ class AvailableForTotalAmount extends CouponRuleAbstract
|
|||||||
{
|
{
|
||||||
$priceValidator = $this->priceValidator;
|
$priceValidator = $this->priceValidator;
|
||||||
try {
|
try {
|
||||||
$priceValidator->compareTo($price);
|
$priceValidator->getParam()->compareTo($price);
|
||||||
} catch(\InvalidArgumentException $e) {
|
} catch(\InvalidArgumentException $e) {
|
||||||
throw new InvalidRuleValueException(get_class(), self::PARAM1_PRICE);
|
throw new InvalidRuleValueException(get_class(), self::PARAM1_PRICE);
|
||||||
}
|
}
|
||||||
@@ -145,7 +164,7 @@ class AvailableForTotalAmount extends CouponRuleAbstract
|
|||||||
* @throws \Symfony\Component\Intl\Exception\NotImplementedException
|
* @throws \Symfony\Component\Intl\Exception\NotImplementedException
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
protected function setValidators(CouponAdapterInterface $adapter)
|
protected function setValidatorsFromAdapter(CouponAdapterInterface $adapter)
|
||||||
{
|
{
|
||||||
$adapter->getRule($this);
|
$adapter->getRule($this);
|
||||||
}
|
}
|
||||||
@@ -167,5 +186,16 @@ class AvailableForTotalAmount extends CouponRuleAbstract
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all validators
|
||||||
|
* Serialization purpose
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getValidators()
|
||||||
|
{
|
||||||
|
return $this->validators;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -26,6 +26,8 @@ namespace Thelia\Coupon\Rule;
|
|||||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||||
use Thelia\Coupon\CouponAdapterInterface;
|
use Thelia\Coupon\CouponAdapterInterface;
|
||||||
use Thelia\Coupon\Parameter\ComparableInterface;
|
use Thelia\Coupon\Parameter\ComparableInterface;
|
||||||
|
use Thelia\Coupon\Parameter\RuleValidator;
|
||||||
|
use Thelia\Exception\InvalidRuleException;
|
||||||
use Thelia\Exception\InvalidRuleOperatorException;
|
use Thelia\Exception\InvalidRuleOperatorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,21 +61,48 @@ abstract class CouponRuleAbstract implements CouponRuleInterface
|
|||||||
* Constructor
|
* Constructor
|
||||||
* Ex:
|
* Ex:
|
||||||
* Param 1 :
|
* Param 1 :
|
||||||
* $validators['price']['operator'] = Operators::INFERIOR
|
* $priceValidator = new RuleValidator(
|
||||||
* ['value'] = new IntegerParam(10)
|
* Operators::INFERIOR,
|
||||||
|
* new IntegerParam(10)
|
||||||
|
* )
|
||||||
|
* $validators[AvailableForTotalAmount::PARAM1_PRICE] = $priceValidator
|
||||||
*
|
*
|
||||||
* Param 2 :
|
* Param 2 :
|
||||||
* $paramsToValidate['price'] = 9
|
* $paramsToValidate[AvailableForTotalAmount::PARAM1_PRICE] = 9
|
||||||
*
|
*
|
||||||
* @param array $validators Parameters validating $paramsToValidate against
|
* @param array $validators Array of RuleValidator
|
||||||
|
* validating $paramsToValidate against
|
||||||
* @param array $validated Parameters to be paramsToValidate
|
* @param array $validated Parameters to be paramsToValidate
|
||||||
|
*
|
||||||
|
* @throws InvalidRuleException
|
||||||
*/
|
*/
|
||||||
public function __construct(array $validators, array $validated = null)
|
public function __construct(array $validators, array $validated = null)
|
||||||
{
|
{
|
||||||
$this->validators = $validators;
|
$this->setValidators($validators);
|
||||||
$this->paramsToValidate = $validated;
|
$this->paramsToValidate = $validated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check validator relevancy and store them
|
||||||
|
*
|
||||||
|
* @param array $validators Array of RuleValidator
|
||||||
|
* validating $paramsToValidate against
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
* @throws InvalidRuleException
|
||||||
|
*/
|
||||||
|
protected function setValidators(array $validators)
|
||||||
|
{
|
||||||
|
foreach ($validators as $validator) {
|
||||||
|
if (!$validator instanceof RuleValidator) {
|
||||||
|
throw new InvalidRuleException(get_class());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->validators = $validators;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the current Checkout matches this condition
|
* Check if the current Checkout matches this condition
|
||||||
*
|
*
|
||||||
@@ -85,11 +114,12 @@ abstract class CouponRuleAbstract implements CouponRuleInterface
|
|||||||
$this->checkCheckoutInput();
|
$this->checkCheckoutInput();
|
||||||
|
|
||||||
$isMatching = true;
|
$isMatching = true;
|
||||||
|
/** @var $validator RuleValidator*/
|
||||||
foreach ($this->validators as $param => $validator) {
|
foreach ($this->validators as $param => $validator) {
|
||||||
$a = $this->paramsToValidate[$param];
|
$a = $this->paramsToValidate[$param];
|
||||||
$operator = $validator[self::OPERATOR];
|
$operator = $validator->getOperator();
|
||||||
/** @var ComparableInterface $b */
|
/** @var ComparableInterface, RuleParameterInterface $b */
|
||||||
$b = $validator[self::VALUE];
|
$b = $validator->getParam();
|
||||||
|
|
||||||
if (!Operators::isValidAccordingToOperator($a, $operator, $b)) {
|
if (!Operators::isValidAccordingToOperator($a, $operator, $b)) {
|
||||||
$isMatching = false;
|
$isMatching = false;
|
||||||
@@ -118,9 +148,11 @@ abstract class CouponRuleAbstract implements CouponRuleInterface
|
|||||||
*/
|
*/
|
||||||
protected function checkBackOfficeInputsOperators()
|
protected function checkBackOfficeInputsOperators()
|
||||||
{
|
{
|
||||||
|
/** @var RuleValidator $param */
|
||||||
foreach ($this->validators as $key => $param) {
|
foreach ($this->validators as $key => $param) {
|
||||||
if (!isset($param[self::OPERATOR])
|
$operator = $param->getOperator();
|
||||||
||!in_array($param[self::OPERATOR], $this->availableOperators)
|
if (!isset($operator)
|
||||||
|
||!in_array($operator, $this->availableOperators)
|
||||||
) {
|
) {
|
||||||
throw new InvalidRuleOperatorException(get_class(), $key);
|
throw new InvalidRuleOperatorException(get_class(), $key);
|
||||||
}
|
}
|
||||||
@@ -137,7 +169,7 @@ abstract class CouponRuleAbstract implements CouponRuleInterface
|
|||||||
* @throws \Symfony\Component\Intl\Exception\NotImplementedException
|
* @throws \Symfony\Component\Intl\Exception\NotImplementedException
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
protected function setValidators(CouponAdapterInterface $adapter)
|
protected function setValidatorsFromAdapter(CouponAdapterInterface $adapter)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException(
|
throw new NotImplementedException(
|
||||||
'CouponRuleInterface::setValidators needs to be implemented'
|
'CouponRuleInterface::setValidators needs to be implemented'
|
||||||
|
|||||||
@@ -109,4 +109,15 @@ interface CouponInterface
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isMatching();
|
public function isMatching();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace the existing Rules by those given in parameter
|
||||||
|
* If one Rule is badly implemented, no Rule will be added
|
||||||
|
*
|
||||||
|
* @param array $rules CouponRuleInterface to add
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
* @throws \Thelia\Exception\InvalidRuleException
|
||||||
|
*/
|
||||||
|
public function setRules(array $rules);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -891,6 +891,10 @@ abstract class Accessory implements ActiveRecordInterface
|
|||||||
$modifiedColumns = array();
|
$modifiedColumns = array();
|
||||||
$index = 0;
|
$index = 0;
|
||||||
|
|
||||||
|
$this->modifiedColumns[] = AccessoryTableMap::ID;
|
||||||
|
if (null !== $this->id) {
|
||||||
|
throw new PropelException('Cannot insert a value for auto-increment primary key (' . AccessoryTableMap::ID . ')');
|
||||||
|
}
|
||||||
|
|
||||||
// check the columns in natural order for more readable SQL queries
|
// check the columns in natural order for more readable SQL queries
|
||||||
if ($this->isColumnModified(AccessoryTableMap::ID)) {
|
if ($this->isColumnModified(AccessoryTableMap::ID)) {
|
||||||
@@ -948,6 +952,13 @@ abstract class Accessory implements ActiveRecordInterface
|
|||||||
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
|
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pk = $con->lastInsertId();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw new PropelException('Unable to get autoincrement id.', 0, $e);
|
||||||
|
}
|
||||||
|
$this->setId($pk);
|
||||||
|
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1224,7 +1235,6 @@ abstract class Accessory implements ActiveRecordInterface
|
|||||||
*/
|
*/
|
||||||
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
|
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
|
||||||
{
|
{
|
||||||
$copyObj->setId($this->getId());
|
|
||||||
$copyObj->setProductId($this->getProductId());
|
$copyObj->setProductId($this->getProductId());
|
||||||
$copyObj->setAccessory($this->getAccessory());
|
$copyObj->setAccessory($this->getAccessory());
|
||||||
$copyObj->setPosition($this->getPosition());
|
$copyObj->setPosition($this->getPosition());
|
||||||
@@ -1232,6 +1242,7 @@ abstract class Accessory implements ActiveRecordInterface
|
|||||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||||
if ($makeNew) {
|
if ($makeNew) {
|
||||||
$copyObj->setNew(true);
|
$copyObj->setNew(true);
|
||||||
|
$copyObj->setId(NULL); // this is a auto-increment column, so set to default value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ use Thelia\Model\AttributeCategory as ChildAttributeCategory;
|
|||||||
use Thelia\Model\AttributeCategoryQuery as ChildAttributeCategoryQuery;
|
use Thelia\Model\AttributeCategoryQuery as ChildAttributeCategoryQuery;
|
||||||
use Thelia\Model\AttributeQuery as ChildAttributeQuery;
|
use Thelia\Model\AttributeQuery as ChildAttributeQuery;
|
||||||
use Thelia\Model\Category as ChildCategory;
|
use Thelia\Model\Category as ChildCategory;
|
||||||
|
use Thelia\Model\CategoryAssociatedContent as ChildCategoryAssociatedContent;
|
||||||
|
use Thelia\Model\CategoryAssociatedContentQuery as ChildCategoryAssociatedContentQuery;
|
||||||
use Thelia\Model\CategoryDocument as ChildCategoryDocument;
|
use Thelia\Model\CategoryDocument as ChildCategoryDocument;
|
||||||
use Thelia\Model\CategoryDocumentQuery as ChildCategoryDocumentQuery;
|
use Thelia\Model\CategoryDocumentQuery as ChildCategoryDocumentQuery;
|
||||||
use Thelia\Model\CategoryI18n as ChildCategoryI18n;
|
use Thelia\Model\CategoryI18n as ChildCategoryI18n;
|
||||||
@@ -31,8 +33,6 @@ use Thelia\Model\CategoryImageQuery as ChildCategoryImageQuery;
|
|||||||
use Thelia\Model\CategoryQuery as ChildCategoryQuery;
|
use Thelia\Model\CategoryQuery as ChildCategoryQuery;
|
||||||
use Thelia\Model\CategoryVersion as ChildCategoryVersion;
|
use Thelia\Model\CategoryVersion as ChildCategoryVersion;
|
||||||
use Thelia\Model\CategoryVersionQuery as ChildCategoryVersionQuery;
|
use Thelia\Model\CategoryVersionQuery as ChildCategoryVersionQuery;
|
||||||
use Thelia\Model\ContentAssoc as ChildContentAssoc;
|
|
||||||
use Thelia\Model\ContentAssocQuery as ChildContentAssocQuery;
|
|
||||||
use Thelia\Model\Feature as ChildFeature;
|
use Thelia\Model\Feature as ChildFeature;
|
||||||
use Thelia\Model\FeatureCategory as ChildFeatureCategory;
|
use Thelia\Model\FeatureCategory as ChildFeatureCategory;
|
||||||
use Thelia\Model\FeatureCategoryQuery as ChildFeatureCategoryQuery;
|
use Thelia\Model\FeatureCategoryQuery as ChildFeatureCategoryQuery;
|
||||||
@@ -153,12 +153,6 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
protected $collAttributeCategories;
|
protected $collAttributeCategories;
|
||||||
protected $collAttributeCategoriesPartial;
|
protected $collAttributeCategoriesPartial;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var ObjectCollection|ChildContentAssoc[] Collection to store aggregation of ChildContentAssoc objects.
|
|
||||||
*/
|
|
||||||
protected $collContentAssocs;
|
|
||||||
protected $collContentAssocsPartial;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ObjectCollection|ChildRewriting[] Collection to store aggregation of ChildRewriting objects.
|
* @var ObjectCollection|ChildRewriting[] Collection to store aggregation of ChildRewriting objects.
|
||||||
*/
|
*/
|
||||||
@@ -177,6 +171,12 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
protected $collCategoryDocuments;
|
protected $collCategoryDocuments;
|
||||||
protected $collCategoryDocumentsPartial;
|
protected $collCategoryDocumentsPartial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ObjectCollection|ChildCategoryAssociatedContent[] Collection to store aggregation of ChildCategoryAssociatedContent objects.
|
||||||
|
*/
|
||||||
|
protected $collCategoryAssociatedContents;
|
||||||
|
protected $collCategoryAssociatedContentsPartial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ObjectCollection|ChildCategoryI18n[] Collection to store aggregation of ChildCategoryI18n objects.
|
* @var ObjectCollection|ChildCategoryI18n[] Collection to store aggregation of ChildCategoryI18n objects.
|
||||||
*/
|
*/
|
||||||
@@ -270,12 +270,6 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
*/
|
*/
|
||||||
protected $attributeCategoriesScheduledForDeletion = null;
|
protected $attributeCategoriesScheduledForDeletion = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* An array of objects scheduled for deletion.
|
|
||||||
* @var ObjectCollection
|
|
||||||
*/
|
|
||||||
protected $contentAssocsScheduledForDeletion = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of objects scheduled for deletion.
|
* An array of objects scheduled for deletion.
|
||||||
* @var ObjectCollection
|
* @var ObjectCollection
|
||||||
@@ -294,6 +288,12 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
*/
|
*/
|
||||||
protected $categoryDocumentsScheduledForDeletion = null;
|
protected $categoryDocumentsScheduledForDeletion = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of objects scheduled for deletion.
|
||||||
|
* @var ObjectCollection
|
||||||
|
*/
|
||||||
|
protected $categoryAssociatedContentsScheduledForDeletion = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of objects scheduled for deletion.
|
* An array of objects scheduled for deletion.
|
||||||
* @var ObjectCollection
|
* @var ObjectCollection
|
||||||
@@ -1039,14 +1039,14 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
|
|
||||||
$this->collAttributeCategories = null;
|
$this->collAttributeCategories = null;
|
||||||
|
|
||||||
$this->collContentAssocs = null;
|
|
||||||
|
|
||||||
$this->collRewritings = null;
|
$this->collRewritings = null;
|
||||||
|
|
||||||
$this->collCategoryImages = null;
|
$this->collCategoryImages = null;
|
||||||
|
|
||||||
$this->collCategoryDocuments = null;
|
$this->collCategoryDocuments = null;
|
||||||
|
|
||||||
|
$this->collCategoryAssociatedContents = null;
|
||||||
|
|
||||||
$this->collCategoryI18ns = null;
|
$this->collCategoryI18ns = null;
|
||||||
|
|
||||||
$this->collCategoryVersions = null;
|
$this->collCategoryVersions = null;
|
||||||
@@ -1331,23 +1331,6 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->contentAssocsScheduledForDeletion !== null) {
|
|
||||||
if (!$this->contentAssocsScheduledForDeletion->isEmpty()) {
|
|
||||||
\Thelia\Model\ContentAssocQuery::create()
|
|
||||||
->filterByPrimaryKeys($this->contentAssocsScheduledForDeletion->getPrimaryKeys(false))
|
|
||||||
->delete($con);
|
|
||||||
$this->contentAssocsScheduledForDeletion = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->collContentAssocs !== null) {
|
|
||||||
foreach ($this->collContentAssocs as $referrerFK) {
|
|
||||||
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
|
||||||
$affectedRows += $referrerFK->save($con);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->rewritingsScheduledForDeletion !== null) {
|
if ($this->rewritingsScheduledForDeletion !== null) {
|
||||||
if (!$this->rewritingsScheduledForDeletion->isEmpty()) {
|
if (!$this->rewritingsScheduledForDeletion->isEmpty()) {
|
||||||
\Thelia\Model\RewritingQuery::create()
|
\Thelia\Model\RewritingQuery::create()
|
||||||
@@ -1399,6 +1382,23 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->categoryAssociatedContentsScheduledForDeletion !== null) {
|
||||||
|
if (!$this->categoryAssociatedContentsScheduledForDeletion->isEmpty()) {
|
||||||
|
\Thelia\Model\CategoryAssociatedContentQuery::create()
|
||||||
|
->filterByPrimaryKeys($this->categoryAssociatedContentsScheduledForDeletion->getPrimaryKeys(false))
|
||||||
|
->delete($con);
|
||||||
|
$this->categoryAssociatedContentsScheduledForDeletion = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->collCategoryAssociatedContents !== null) {
|
||||||
|
foreach ($this->collCategoryAssociatedContents as $referrerFK) {
|
||||||
|
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
||||||
|
$affectedRows += $referrerFK->save($con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->categoryI18nsScheduledForDeletion !== null) {
|
if ($this->categoryI18nsScheduledForDeletion !== null) {
|
||||||
if (!$this->categoryI18nsScheduledForDeletion->isEmpty()) {
|
if (!$this->categoryI18nsScheduledForDeletion->isEmpty()) {
|
||||||
\Thelia\Model\CategoryI18nQuery::create()
|
\Thelia\Model\CategoryI18nQuery::create()
|
||||||
@@ -1668,9 +1668,6 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
if (null !== $this->collAttributeCategories) {
|
if (null !== $this->collAttributeCategories) {
|
||||||
$result['AttributeCategories'] = $this->collAttributeCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
$result['AttributeCategories'] = $this->collAttributeCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
}
|
}
|
||||||
if (null !== $this->collContentAssocs) {
|
|
||||||
$result['ContentAssocs'] = $this->collContentAssocs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
|
||||||
}
|
|
||||||
if (null !== $this->collRewritings) {
|
if (null !== $this->collRewritings) {
|
||||||
$result['Rewritings'] = $this->collRewritings->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
$result['Rewritings'] = $this->collRewritings->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
}
|
}
|
||||||
@@ -1680,6 +1677,9 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
if (null !== $this->collCategoryDocuments) {
|
if (null !== $this->collCategoryDocuments) {
|
||||||
$result['CategoryDocuments'] = $this->collCategoryDocuments->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
$result['CategoryDocuments'] = $this->collCategoryDocuments->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
}
|
}
|
||||||
|
if (null !== $this->collCategoryAssociatedContents) {
|
||||||
|
$result['CategoryAssociatedContents'] = $this->collCategoryAssociatedContents->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
|
}
|
||||||
if (null !== $this->collCategoryI18ns) {
|
if (null !== $this->collCategoryI18ns) {
|
||||||
$result['CategoryI18ns'] = $this->collCategoryI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
$result['CategoryI18ns'] = $this->collCategoryI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
}
|
}
|
||||||
@@ -1895,12 +1895,6 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->getContentAssocs() as $relObj) {
|
|
||||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
|
||||||
$copyObj->addContentAssoc($relObj->copy($deepCopy));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($this->getRewritings() as $relObj) {
|
foreach ($this->getRewritings() as $relObj) {
|
||||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||||
$copyObj->addRewriting($relObj->copy($deepCopy));
|
$copyObj->addRewriting($relObj->copy($deepCopy));
|
||||||
@@ -1919,6 +1913,12 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($this->getCategoryAssociatedContents() as $relObj) {
|
||||||
|
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||||
|
$copyObj->addCategoryAssociatedContent($relObj->copy($deepCopy));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->getCategoryI18ns() as $relObj) {
|
foreach ($this->getCategoryI18ns() as $relObj) {
|
||||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||||
$copyObj->addCategoryI18n($relObj->copy($deepCopy));
|
$copyObj->addCategoryI18n($relObj->copy($deepCopy));
|
||||||
@@ -1981,9 +1981,6 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
if ('AttributeCategory' == $relationName) {
|
if ('AttributeCategory' == $relationName) {
|
||||||
return $this->initAttributeCategories();
|
return $this->initAttributeCategories();
|
||||||
}
|
}
|
||||||
if ('ContentAssoc' == $relationName) {
|
|
||||||
return $this->initContentAssocs();
|
|
||||||
}
|
|
||||||
if ('Rewriting' == $relationName) {
|
if ('Rewriting' == $relationName) {
|
||||||
return $this->initRewritings();
|
return $this->initRewritings();
|
||||||
}
|
}
|
||||||
@@ -1993,6 +1990,9 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
if ('CategoryDocument' == $relationName) {
|
if ('CategoryDocument' == $relationName) {
|
||||||
return $this->initCategoryDocuments();
|
return $this->initCategoryDocuments();
|
||||||
}
|
}
|
||||||
|
if ('CategoryAssociatedContent' == $relationName) {
|
||||||
|
return $this->initCategoryAssociatedContents();
|
||||||
|
}
|
||||||
if ('CategoryI18n' == $relationName) {
|
if ('CategoryI18n' == $relationName) {
|
||||||
return $this->initCategoryI18ns();
|
return $this->initCategoryI18ns();
|
||||||
}
|
}
|
||||||
@@ -2733,274 +2733,6 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
return $this->getAttributeCategories($query, $con);
|
return $this->getAttributeCategories($query, $con);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears out the collContentAssocs collection
|
|
||||||
*
|
|
||||||
* This does not modify the database; however, it will remove any associated objects, causing
|
|
||||||
* them to be refetched by subsequent calls to accessor method.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @see addContentAssocs()
|
|
||||||
*/
|
|
||||||
public function clearContentAssocs()
|
|
||||||
{
|
|
||||||
$this->collContentAssocs = null; // important to set this to NULL since that means it is uninitialized
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset is the collContentAssocs collection loaded partially.
|
|
||||||
*/
|
|
||||||
public function resetPartialContentAssocs($v = true)
|
|
||||||
{
|
|
||||||
$this->collContentAssocsPartial = $v;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the collContentAssocs collection.
|
|
||||||
*
|
|
||||||
* By default this just sets the collContentAssocs collection to an empty array (like clearcollContentAssocs());
|
|
||||||
* however, you may wish to override this method in your stub class to provide setting appropriate
|
|
||||||
* to your application -- for example, setting the initial array to the values stored in database.
|
|
||||||
*
|
|
||||||
* @param boolean $overrideExisting If set to true, the method call initializes
|
|
||||||
* the collection even if it is not empty
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function initContentAssocs($overrideExisting = true)
|
|
||||||
{
|
|
||||||
if (null !== $this->collContentAssocs && !$overrideExisting) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$this->collContentAssocs = new ObjectCollection();
|
|
||||||
$this->collContentAssocs->setModel('\Thelia\Model\ContentAssoc');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets an array of ChildContentAssoc objects which contain a foreign key that references this object.
|
|
||||||
*
|
|
||||||
* If the $criteria is not null, it is used to always fetch the results from the database.
|
|
||||||
* Otherwise the results are fetched from the database the first time, then cached.
|
|
||||||
* Next time the same method is called without $criteria, the cached collection is returned.
|
|
||||||
* If this ChildCategory is new, it will return
|
|
||||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
|
||||||
*
|
|
||||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
|
||||||
* @param ConnectionInterface $con optional connection object
|
|
||||||
* @return Collection|ChildContentAssoc[] List of ChildContentAssoc objects
|
|
||||||
* @throws PropelException
|
|
||||||
*/
|
|
||||||
public function getContentAssocs($criteria = null, ConnectionInterface $con = null)
|
|
||||||
{
|
|
||||||
$partial = $this->collContentAssocsPartial && !$this->isNew();
|
|
||||||
if (null === $this->collContentAssocs || null !== $criteria || $partial) {
|
|
||||||
if ($this->isNew() && null === $this->collContentAssocs) {
|
|
||||||
// return empty collection
|
|
||||||
$this->initContentAssocs();
|
|
||||||
} else {
|
|
||||||
$collContentAssocs = ChildContentAssocQuery::create(null, $criteria)
|
|
||||||
->filterByCategory($this)
|
|
||||||
->find($con);
|
|
||||||
|
|
||||||
if (null !== $criteria) {
|
|
||||||
if (false !== $this->collContentAssocsPartial && count($collContentAssocs)) {
|
|
||||||
$this->initContentAssocs(false);
|
|
||||||
|
|
||||||
foreach ($collContentAssocs as $obj) {
|
|
||||||
if (false == $this->collContentAssocs->contains($obj)) {
|
|
||||||
$this->collContentAssocs->append($obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->collContentAssocsPartial = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$collContentAssocs->getInternalIterator()->rewind();
|
|
||||||
|
|
||||||
return $collContentAssocs;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($partial && $this->collContentAssocs) {
|
|
||||||
foreach ($this->collContentAssocs as $obj) {
|
|
||||||
if ($obj->isNew()) {
|
|
||||||
$collContentAssocs[] = $obj;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->collContentAssocs = $collContentAssocs;
|
|
||||||
$this->collContentAssocsPartial = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->collContentAssocs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets a collection of ContentAssoc objects related by a one-to-many relationship
|
|
||||||
* to the current object.
|
|
||||||
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
|
|
||||||
* and new objects from the given Propel collection.
|
|
||||||
*
|
|
||||||
* @param Collection $contentAssocs A Propel collection.
|
|
||||||
* @param ConnectionInterface $con Optional connection object
|
|
||||||
* @return ChildCategory The current object (for fluent API support)
|
|
||||||
*/
|
|
||||||
public function setContentAssocs(Collection $contentAssocs, ConnectionInterface $con = null)
|
|
||||||
{
|
|
||||||
$contentAssocsToDelete = $this->getContentAssocs(new Criteria(), $con)->diff($contentAssocs);
|
|
||||||
|
|
||||||
|
|
||||||
$this->contentAssocsScheduledForDeletion = $contentAssocsToDelete;
|
|
||||||
|
|
||||||
foreach ($contentAssocsToDelete as $contentAssocRemoved) {
|
|
||||||
$contentAssocRemoved->setCategory(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->collContentAssocs = null;
|
|
||||||
foreach ($contentAssocs as $contentAssoc) {
|
|
||||||
$this->addContentAssoc($contentAssoc);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->collContentAssocs = $contentAssocs;
|
|
||||||
$this->collContentAssocsPartial = false;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the number of related ContentAssoc objects.
|
|
||||||
*
|
|
||||||
* @param Criteria $criteria
|
|
||||||
* @param boolean $distinct
|
|
||||||
* @param ConnectionInterface $con
|
|
||||||
* @return int Count of related ContentAssoc objects.
|
|
||||||
* @throws PropelException
|
|
||||||
*/
|
|
||||||
public function countContentAssocs(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
|
||||||
{
|
|
||||||
$partial = $this->collContentAssocsPartial && !$this->isNew();
|
|
||||||
if (null === $this->collContentAssocs || null !== $criteria || $partial) {
|
|
||||||
if ($this->isNew() && null === $this->collContentAssocs) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($partial && !$criteria) {
|
|
||||||
return count($this->getContentAssocs());
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = ChildContentAssocQuery::create(null, $criteria);
|
|
||||||
if ($distinct) {
|
|
||||||
$query->distinct();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $query
|
|
||||||
->filterByCategory($this)
|
|
||||||
->count($con);
|
|
||||||
}
|
|
||||||
|
|
||||||
return count($this->collContentAssocs);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method called to associate a ChildContentAssoc object to this object
|
|
||||||
* through the ChildContentAssoc foreign key attribute.
|
|
||||||
*
|
|
||||||
* @param ChildContentAssoc $l ChildContentAssoc
|
|
||||||
* @return \Thelia\Model\Category The current object (for fluent API support)
|
|
||||||
*/
|
|
||||||
public function addContentAssoc(ChildContentAssoc $l)
|
|
||||||
{
|
|
||||||
if ($this->collContentAssocs === null) {
|
|
||||||
$this->initContentAssocs();
|
|
||||||
$this->collContentAssocsPartial = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!in_array($l, $this->collContentAssocs->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
|
||||||
$this->doAddContentAssoc($l);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ContentAssoc $contentAssoc The contentAssoc object to add.
|
|
||||||
*/
|
|
||||||
protected function doAddContentAssoc($contentAssoc)
|
|
||||||
{
|
|
||||||
$this->collContentAssocs[]= $contentAssoc;
|
|
||||||
$contentAssoc->setCategory($this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ContentAssoc $contentAssoc The contentAssoc object to remove.
|
|
||||||
* @return ChildCategory The current object (for fluent API support)
|
|
||||||
*/
|
|
||||||
public function removeContentAssoc($contentAssoc)
|
|
||||||
{
|
|
||||||
if ($this->getContentAssocs()->contains($contentAssoc)) {
|
|
||||||
$this->collContentAssocs->remove($this->collContentAssocs->search($contentAssoc));
|
|
||||||
if (null === $this->contentAssocsScheduledForDeletion) {
|
|
||||||
$this->contentAssocsScheduledForDeletion = clone $this->collContentAssocs;
|
|
||||||
$this->contentAssocsScheduledForDeletion->clear();
|
|
||||||
}
|
|
||||||
$this->contentAssocsScheduledForDeletion[]= $contentAssoc;
|
|
||||||
$contentAssoc->setCategory(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If this collection has already been initialized with
|
|
||||||
* an identical criteria, it returns the collection.
|
|
||||||
* Otherwise if this Category is new, it will return
|
|
||||||
* an empty collection; or if this Category has previously
|
|
||||||
* been saved, it will retrieve related ContentAssocs from storage.
|
|
||||||
*
|
|
||||||
* This method is protected by default in order to keep the public
|
|
||||||
* api reasonable. You can provide public methods for those you
|
|
||||||
* actually need in Category.
|
|
||||||
*
|
|
||||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
|
||||||
* @param ConnectionInterface $con optional connection object
|
|
||||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
|
||||||
* @return Collection|ChildContentAssoc[] List of ChildContentAssoc objects
|
|
||||||
*/
|
|
||||||
public function getContentAssocsJoinProduct($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
|
||||||
{
|
|
||||||
$query = ChildContentAssocQuery::create(null, $criteria);
|
|
||||||
$query->joinWith('Product', $joinBehavior);
|
|
||||||
|
|
||||||
return $this->getContentAssocs($query, $con);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If this collection has already been initialized with
|
|
||||||
* an identical criteria, it returns the collection.
|
|
||||||
* Otherwise if this Category is new, it will return
|
|
||||||
* an empty collection; or if this Category has previously
|
|
||||||
* been saved, it will retrieve related ContentAssocs from storage.
|
|
||||||
*
|
|
||||||
* This method is protected by default in order to keep the public
|
|
||||||
* api reasonable. You can provide public methods for those you
|
|
||||||
* actually need in Category.
|
|
||||||
*
|
|
||||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
|
||||||
* @param ConnectionInterface $con optional connection object
|
|
||||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
|
||||||
* @return Collection|ChildContentAssoc[] List of ChildContentAssoc objects
|
|
||||||
*/
|
|
||||||
public function getContentAssocsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
|
||||||
{
|
|
||||||
$query = ChildContentAssocQuery::create(null, $criteria);
|
|
||||||
$query->joinWith('Content', $joinBehavior);
|
|
||||||
|
|
||||||
return $this->getContentAssocs($query, $con);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears out the collRewritings collection
|
* Clears out the collRewritings collection
|
||||||
*
|
*
|
||||||
@@ -3730,6 +3462,249 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears out the collCategoryAssociatedContents collection
|
||||||
|
*
|
||||||
|
* This does not modify the database; however, it will remove any associated objects, causing
|
||||||
|
* them to be refetched by subsequent calls to accessor method.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @see addCategoryAssociatedContents()
|
||||||
|
*/
|
||||||
|
public function clearCategoryAssociatedContents()
|
||||||
|
{
|
||||||
|
$this->collCategoryAssociatedContents = null; // important to set this to NULL since that means it is uninitialized
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset is the collCategoryAssociatedContents collection loaded partially.
|
||||||
|
*/
|
||||||
|
public function resetPartialCategoryAssociatedContents($v = true)
|
||||||
|
{
|
||||||
|
$this->collCategoryAssociatedContentsPartial = $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the collCategoryAssociatedContents collection.
|
||||||
|
*
|
||||||
|
* By default this just sets the collCategoryAssociatedContents collection to an empty array (like clearcollCategoryAssociatedContents());
|
||||||
|
* however, you may wish to override this method in your stub class to provide setting appropriate
|
||||||
|
* to your application -- for example, setting the initial array to the values stored in database.
|
||||||
|
*
|
||||||
|
* @param boolean $overrideExisting If set to true, the method call initializes
|
||||||
|
* the collection even if it is not empty
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function initCategoryAssociatedContents($overrideExisting = true)
|
||||||
|
{
|
||||||
|
if (null !== $this->collCategoryAssociatedContents && !$overrideExisting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->collCategoryAssociatedContents = new ObjectCollection();
|
||||||
|
$this->collCategoryAssociatedContents->setModel('\Thelia\Model\CategoryAssociatedContent');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an array of ChildCategoryAssociatedContent objects which contain a foreign key that references this object.
|
||||||
|
*
|
||||||
|
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||||
|
* Otherwise the results are fetched from the database the first time, then cached.
|
||||||
|
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||||
|
* If this ChildCategory is new, it will return
|
||||||
|
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||||
|
* @param ConnectionInterface $con optional connection object
|
||||||
|
* @return Collection|ChildCategoryAssociatedContent[] List of ChildCategoryAssociatedContent objects
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function getCategoryAssociatedContents($criteria = null, ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collCategoryAssociatedContentsPartial && !$this->isNew();
|
||||||
|
if (null === $this->collCategoryAssociatedContents || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collCategoryAssociatedContents) {
|
||||||
|
// return empty collection
|
||||||
|
$this->initCategoryAssociatedContents();
|
||||||
|
} else {
|
||||||
|
$collCategoryAssociatedContents = ChildCategoryAssociatedContentQuery::create(null, $criteria)
|
||||||
|
->filterByCategory($this)
|
||||||
|
->find($con);
|
||||||
|
|
||||||
|
if (null !== $criteria) {
|
||||||
|
if (false !== $this->collCategoryAssociatedContentsPartial && count($collCategoryAssociatedContents)) {
|
||||||
|
$this->initCategoryAssociatedContents(false);
|
||||||
|
|
||||||
|
foreach ($collCategoryAssociatedContents as $obj) {
|
||||||
|
if (false == $this->collCategoryAssociatedContents->contains($obj)) {
|
||||||
|
$this->collCategoryAssociatedContents->append($obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collCategoryAssociatedContentsPartial = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$collCategoryAssociatedContents->getInternalIterator()->rewind();
|
||||||
|
|
||||||
|
return $collCategoryAssociatedContents;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($partial && $this->collCategoryAssociatedContents) {
|
||||||
|
foreach ($this->collCategoryAssociatedContents as $obj) {
|
||||||
|
if ($obj->isNew()) {
|
||||||
|
$collCategoryAssociatedContents[] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collCategoryAssociatedContents = $collCategoryAssociatedContents;
|
||||||
|
$this->collCategoryAssociatedContentsPartial = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->collCategoryAssociatedContents;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a collection of CategoryAssociatedContent objects related by a one-to-many relationship
|
||||||
|
* to the current object.
|
||||||
|
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
|
||||||
|
* and new objects from the given Propel collection.
|
||||||
|
*
|
||||||
|
* @param Collection $categoryAssociatedContents A Propel collection.
|
||||||
|
* @param ConnectionInterface $con Optional connection object
|
||||||
|
* @return ChildCategory The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setCategoryAssociatedContents(Collection $categoryAssociatedContents, ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$categoryAssociatedContentsToDelete = $this->getCategoryAssociatedContents(new Criteria(), $con)->diff($categoryAssociatedContents);
|
||||||
|
|
||||||
|
|
||||||
|
$this->categoryAssociatedContentsScheduledForDeletion = $categoryAssociatedContentsToDelete;
|
||||||
|
|
||||||
|
foreach ($categoryAssociatedContentsToDelete as $categoryAssociatedContentRemoved) {
|
||||||
|
$categoryAssociatedContentRemoved->setCategory(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collCategoryAssociatedContents = null;
|
||||||
|
foreach ($categoryAssociatedContents as $categoryAssociatedContent) {
|
||||||
|
$this->addCategoryAssociatedContent($categoryAssociatedContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collCategoryAssociatedContents = $categoryAssociatedContents;
|
||||||
|
$this->collCategoryAssociatedContentsPartial = false;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of related CategoryAssociatedContent objects.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct
|
||||||
|
* @param ConnectionInterface $con
|
||||||
|
* @return int Count of related CategoryAssociatedContent objects.
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function countCategoryAssociatedContents(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collCategoryAssociatedContentsPartial && !$this->isNew();
|
||||||
|
if (null === $this->collCategoryAssociatedContents || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collCategoryAssociatedContents) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($partial && !$criteria) {
|
||||||
|
return count($this->getCategoryAssociatedContents());
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = ChildCategoryAssociatedContentQuery::create(null, $criteria);
|
||||||
|
if ($distinct) {
|
||||||
|
$query->distinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query
|
||||||
|
->filterByCategory($this)
|
||||||
|
->count($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
return count($this->collCategoryAssociatedContents);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method called to associate a ChildCategoryAssociatedContent object to this object
|
||||||
|
* through the ChildCategoryAssociatedContent foreign key attribute.
|
||||||
|
*
|
||||||
|
* @param ChildCategoryAssociatedContent $l ChildCategoryAssociatedContent
|
||||||
|
* @return \Thelia\Model\Category The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function addCategoryAssociatedContent(ChildCategoryAssociatedContent $l)
|
||||||
|
{
|
||||||
|
if ($this->collCategoryAssociatedContents === null) {
|
||||||
|
$this->initCategoryAssociatedContents();
|
||||||
|
$this->collCategoryAssociatedContentsPartial = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!in_array($l, $this->collCategoryAssociatedContents->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||||
|
$this->doAddCategoryAssociatedContent($l);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CategoryAssociatedContent $categoryAssociatedContent The categoryAssociatedContent object to add.
|
||||||
|
*/
|
||||||
|
protected function doAddCategoryAssociatedContent($categoryAssociatedContent)
|
||||||
|
{
|
||||||
|
$this->collCategoryAssociatedContents[]= $categoryAssociatedContent;
|
||||||
|
$categoryAssociatedContent->setCategory($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CategoryAssociatedContent $categoryAssociatedContent The categoryAssociatedContent object to remove.
|
||||||
|
* @return ChildCategory The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function removeCategoryAssociatedContent($categoryAssociatedContent)
|
||||||
|
{
|
||||||
|
if ($this->getCategoryAssociatedContents()->contains($categoryAssociatedContent)) {
|
||||||
|
$this->collCategoryAssociatedContents->remove($this->collCategoryAssociatedContents->search($categoryAssociatedContent));
|
||||||
|
if (null === $this->categoryAssociatedContentsScheduledForDeletion) {
|
||||||
|
$this->categoryAssociatedContentsScheduledForDeletion = clone $this->collCategoryAssociatedContents;
|
||||||
|
$this->categoryAssociatedContentsScheduledForDeletion->clear();
|
||||||
|
}
|
||||||
|
$this->categoryAssociatedContentsScheduledForDeletion[]= clone $categoryAssociatedContent;
|
||||||
|
$categoryAssociatedContent->setCategory(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If this collection has already been initialized with
|
||||||
|
* an identical criteria, it returns the collection.
|
||||||
|
* Otherwise if this Category is new, it will return
|
||||||
|
* an empty collection; or if this Category has previously
|
||||||
|
* been saved, it will retrieve related CategoryAssociatedContents from storage.
|
||||||
|
*
|
||||||
|
* This method is protected by default in order to keep the public
|
||||||
|
* api reasonable. You can provide public methods for those you
|
||||||
|
* actually need in Category.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||||
|
* @param ConnectionInterface $con optional connection object
|
||||||
|
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||||
|
* @return Collection|ChildCategoryAssociatedContent[] List of ChildCategoryAssociatedContent objects
|
||||||
|
*/
|
||||||
|
public function getCategoryAssociatedContentsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$query = ChildCategoryAssociatedContentQuery::create(null, $criteria);
|
||||||
|
$query->joinWith('Content', $joinBehavior);
|
||||||
|
|
||||||
|
return $this->getCategoryAssociatedContents($query, $con);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears out the collCategoryI18ns collection
|
* Clears out the collCategoryI18ns collection
|
||||||
*
|
*
|
||||||
@@ -4774,11 +4749,6 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
$o->clearAllReferences($deep);
|
$o->clearAllReferences($deep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($this->collContentAssocs) {
|
|
||||||
foreach ($this->collContentAssocs as $o) {
|
|
||||||
$o->clearAllReferences($deep);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($this->collRewritings) {
|
if ($this->collRewritings) {
|
||||||
foreach ($this->collRewritings as $o) {
|
foreach ($this->collRewritings as $o) {
|
||||||
$o->clearAllReferences($deep);
|
$o->clearAllReferences($deep);
|
||||||
@@ -4794,6 +4764,11 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
$o->clearAllReferences($deep);
|
$o->clearAllReferences($deep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->collCategoryAssociatedContents) {
|
||||||
|
foreach ($this->collCategoryAssociatedContents as $o) {
|
||||||
|
$o->clearAllReferences($deep);
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($this->collCategoryI18ns) {
|
if ($this->collCategoryI18ns) {
|
||||||
foreach ($this->collCategoryI18ns as $o) {
|
foreach ($this->collCategoryI18ns as $o) {
|
||||||
$o->clearAllReferences($deep);
|
$o->clearAllReferences($deep);
|
||||||
@@ -4837,10 +4812,6 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
$this->collAttributeCategories->clearIterator();
|
$this->collAttributeCategories->clearIterator();
|
||||||
}
|
}
|
||||||
$this->collAttributeCategories = null;
|
$this->collAttributeCategories = null;
|
||||||
if ($this->collContentAssocs instanceof Collection) {
|
|
||||||
$this->collContentAssocs->clearIterator();
|
|
||||||
}
|
|
||||||
$this->collContentAssocs = null;
|
|
||||||
if ($this->collRewritings instanceof Collection) {
|
if ($this->collRewritings instanceof Collection) {
|
||||||
$this->collRewritings->clearIterator();
|
$this->collRewritings->clearIterator();
|
||||||
}
|
}
|
||||||
@@ -4853,6 +4824,10 @@ abstract class Category implements ActiveRecordInterface
|
|||||||
$this->collCategoryDocuments->clearIterator();
|
$this->collCategoryDocuments->clearIterator();
|
||||||
}
|
}
|
||||||
$this->collCategoryDocuments = null;
|
$this->collCategoryDocuments = null;
|
||||||
|
if ($this->collCategoryAssociatedContents instanceof Collection) {
|
||||||
|
$this->collCategoryAssociatedContents->clearIterator();
|
||||||
|
}
|
||||||
|
$this->collCategoryAssociatedContents = null;
|
||||||
if ($this->collCategoryI18ns instanceof Collection) {
|
if ($this->collCategoryI18ns instanceof Collection) {
|
||||||
$this->collCategoryI18ns->clearIterator();
|
$this->collCategoryI18ns->clearIterator();
|
||||||
}
|
}
|
||||||
|
|||||||
1553
core/lib/Thelia/Model/Base/CategoryAssociatedContent.php
Normal file
1553
core/lib/Thelia/Model/Base/CategoryAssociatedContent.php
Normal file
File diff suppressed because it is too large
Load Diff
804
core/lib/Thelia/Model/Base/CategoryAssociatedContentQuery.php
Normal file
804
core/lib/Thelia/Model/Base/CategoryAssociatedContentQuery.php
Normal file
@@ -0,0 +1,804 @@
|
|||||||
|
<?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\CategoryAssociatedContent as ChildCategoryAssociatedContent;
|
||||||
|
use Thelia\Model\CategoryAssociatedContentQuery as ChildCategoryAssociatedContentQuery;
|
||||||
|
use Thelia\Model\Map\CategoryAssociatedContentTableMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a query for the 'category_associated_content' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @method ChildCategoryAssociatedContentQuery orderById($order = Criteria::ASC) Order by the id column
|
||||||
|
* @method ChildCategoryAssociatedContentQuery orderByCategoryId($order = Criteria::ASC) Order by the category_id column
|
||||||
|
* @method ChildCategoryAssociatedContentQuery orderByContentId($order = Criteria::ASC) Order by the content_id column
|
||||||
|
* @method ChildCategoryAssociatedContentQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
||||||
|
* @method ChildCategoryAssociatedContentQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||||
|
* @method ChildCategoryAssociatedContentQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||||
|
*
|
||||||
|
* @method ChildCategoryAssociatedContentQuery groupById() Group by the id column
|
||||||
|
* @method ChildCategoryAssociatedContentQuery groupByCategoryId() Group by the category_id column
|
||||||
|
* @method ChildCategoryAssociatedContentQuery groupByContentId() Group by the content_id column
|
||||||
|
* @method ChildCategoryAssociatedContentQuery groupByPosition() Group by the position column
|
||||||
|
* @method ChildCategoryAssociatedContentQuery groupByCreatedAt() Group by the created_at column
|
||||||
|
* @method ChildCategoryAssociatedContentQuery groupByUpdatedAt() Group by the updated_at column
|
||||||
|
*
|
||||||
|
* @method ChildCategoryAssociatedContentQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
|
* @method ChildCategoryAssociatedContentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
|
* @method ChildCategoryAssociatedContentQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||||
|
*
|
||||||
|
* @method ChildCategoryAssociatedContentQuery leftJoinCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the Category relation
|
||||||
|
* @method ChildCategoryAssociatedContentQuery rightJoinCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Category relation
|
||||||
|
* @method ChildCategoryAssociatedContentQuery innerJoinCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the Category relation
|
||||||
|
*
|
||||||
|
* @method ChildCategoryAssociatedContentQuery leftJoinContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the Content relation
|
||||||
|
* @method ChildCategoryAssociatedContentQuery rightJoinContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Content relation
|
||||||
|
* @method ChildCategoryAssociatedContentQuery innerJoinContent($relationAlias = null) Adds a INNER JOIN clause to the query using the Content relation
|
||||||
|
*
|
||||||
|
* @method ChildCategoryAssociatedContent findOne(ConnectionInterface $con = null) Return the first ChildCategoryAssociatedContent matching the query
|
||||||
|
* @method ChildCategoryAssociatedContent findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCategoryAssociatedContent matching the query, or a new ChildCategoryAssociatedContent object populated from the query conditions when no match is found
|
||||||
|
*
|
||||||
|
* @method ChildCategoryAssociatedContent findOneById(int $id) Return the first ChildCategoryAssociatedContent filtered by the id column
|
||||||
|
* @method ChildCategoryAssociatedContent findOneByCategoryId(int $category_id) Return the first ChildCategoryAssociatedContent filtered by the category_id column
|
||||||
|
* @method ChildCategoryAssociatedContent findOneByContentId(int $content_id) Return the first ChildCategoryAssociatedContent filtered by the content_id column
|
||||||
|
* @method ChildCategoryAssociatedContent findOneByPosition(int $position) Return the first ChildCategoryAssociatedContent filtered by the position column
|
||||||
|
* @method ChildCategoryAssociatedContent findOneByCreatedAt(string $created_at) Return the first ChildCategoryAssociatedContent filtered by the created_at column
|
||||||
|
* @method ChildCategoryAssociatedContent findOneByUpdatedAt(string $updated_at) Return the first ChildCategoryAssociatedContent filtered by the updated_at column
|
||||||
|
*
|
||||||
|
* @method array findById(int $id) Return ChildCategoryAssociatedContent objects filtered by the id column
|
||||||
|
* @method array findByCategoryId(int $category_id) Return ChildCategoryAssociatedContent objects filtered by the category_id column
|
||||||
|
* @method array findByContentId(int $content_id) Return ChildCategoryAssociatedContent objects filtered by the content_id column
|
||||||
|
* @method array findByPosition(int $position) Return ChildCategoryAssociatedContent objects filtered by the position column
|
||||||
|
* @method array findByCreatedAt(string $created_at) Return ChildCategoryAssociatedContent objects filtered by the created_at column
|
||||||
|
* @method array findByUpdatedAt(string $updated_at) Return ChildCategoryAssociatedContent objects filtered by the updated_at column
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
abstract class CategoryAssociatedContentQuery extends ModelCriteria
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes internal state of \Thelia\Model\Base\CategoryAssociatedContentQuery 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\\CategoryAssociatedContent', $modelAlias = null)
|
||||||
|
{
|
||||||
|
parent::__construct($dbName, $modelName, $modelAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new ChildCategoryAssociatedContentQuery object.
|
||||||
|
*
|
||||||
|
* @param string $modelAlias The alias of a model in the query
|
||||||
|
* @param Criteria $criteria Optional Criteria to build the query from
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery
|
||||||
|
*/
|
||||||
|
public static function create($modelAlias = null, $criteria = null)
|
||||||
|
{
|
||||||
|
if ($criteria instanceof \Thelia\Model\CategoryAssociatedContentQuery) {
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
$query = new \Thelia\Model\CategoryAssociatedContentQuery();
|
||||||
|
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 ChildCategoryAssociatedContent|array|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
public function findPk($key, $con = null)
|
||||||
|
{
|
||||||
|
if ($key === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ((null !== ($obj = CategoryAssociatedContentTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||||
|
// the object is already in the instance pool
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getServiceContainer()->getReadConnection(CategoryAssociatedContentTableMap::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 ChildCategoryAssociatedContent A model object, or null if the key is not found
|
||||||
|
*/
|
||||||
|
protected function findPkSimple($key, $con)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT ID, CATEGORY_ID, CONTENT_ID, POSITION, CREATED_AT, UPDATED_AT FROM category_associated_content WHERE ID = :p0';
|
||||||
|
try {
|
||||||
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Propel::log($e->getMessage(), Propel::LOG_ERR);
|
||||||
|
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
|
||||||
|
}
|
||||||
|
$obj = null;
|
||||||
|
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
|
||||||
|
$obj = new ChildCategoryAssociatedContent();
|
||||||
|
$obj->hydrate($row);
|
||||||
|
CategoryAssociatedContentTableMap::addInstanceToPool($obj, (string) $key);
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key.
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
* @param ConnectionInterface $con A connection object
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContent|array|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
protected function findPkComplex($key, $con)
|
||||||
|
{
|
||||||
|
// As the query uses a PK condition, no limit(1) is necessary.
|
||||||
|
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||||
|
$dataFetcher = $criteria
|
||||||
|
->filterByPrimaryKey($key)
|
||||||
|
->doSelect($con);
|
||||||
|
|
||||||
|
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find objects by primary key
|
||||||
|
* <code>
|
||||||
|
* $objs = $c->findPks(array(12, 56, 832), $con);
|
||||||
|
* </code>
|
||||||
|
* @param array $keys Primary keys to use for the query
|
||||||
|
* @param ConnectionInterface $con an optional connection object
|
||||||
|
*
|
||||||
|
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
public function findPks($keys, $con = null)
|
||||||
|
{
|
||||||
|
if (null === $con) {
|
||||||
|
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
|
||||||
|
}
|
||||||
|
$this->basePreSelect($con);
|
||||||
|
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||||
|
$dataFetcher = $criteria
|
||||||
|
->filterByPrimaryKeys($keys)
|
||||||
|
->doSelect($con);
|
||||||
|
|
||||||
|
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by primary key
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKey($key)
|
||||||
|
{
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryAssociatedContentTableMap::ID, $key, Criteria::EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a list of primary keys
|
||||||
|
*
|
||||||
|
* @param array $keys The list of primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKeys($keys)
|
||||||
|
{
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryAssociatedContentTableMap::ID, $keys, Criteria::IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the id column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterById(1234); // WHERE id = 1234
|
||||||
|
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
|
||||||
|
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $id The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterById($id = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($id)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($id['min'])) {
|
||||||
|
$this->addUsingAlias(CategoryAssociatedContentTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($id['max'])) {
|
||||||
|
$this->addUsingAlias(CategoryAssociatedContentTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryAssociatedContentTableMap::ID, $id, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the category_id column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByCategoryId(1234); // WHERE category_id = 1234
|
||||||
|
* $query->filterByCategoryId(array(12, 34)); // WHERE category_id IN (12, 34)
|
||||||
|
* $query->filterByCategoryId(array('min' => 12)); // WHERE category_id > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @see filterByCategory()
|
||||||
|
*
|
||||||
|
* @param mixed $categoryId The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCategoryId($categoryId = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($categoryId)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($categoryId['min'])) {
|
||||||
|
$this->addUsingAlias(CategoryAssociatedContentTableMap::CATEGORY_ID, $categoryId['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($categoryId['max'])) {
|
||||||
|
$this->addUsingAlias(CategoryAssociatedContentTableMap::CATEGORY_ID, $categoryId['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryAssociatedContentTableMap::CATEGORY_ID, $categoryId, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the content_id column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByContentId(1234); // WHERE content_id = 1234
|
||||||
|
* $query->filterByContentId(array(12, 34)); // WHERE content_id IN (12, 34)
|
||||||
|
* $query->filterByContentId(array('min' => 12)); // WHERE content_id > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @see filterByContent()
|
||||||
|
*
|
||||||
|
* @param mixed $contentId The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByContentId($contentId = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($contentId)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($contentId['min'])) {
|
||||||
|
$this->addUsingAlias(CategoryAssociatedContentTableMap::CONTENT_ID, $contentId['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($contentId['max'])) {
|
||||||
|
$this->addUsingAlias(CategoryAssociatedContentTableMap::CONTENT_ID, $contentId['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryAssociatedContentTableMap::CONTENT_ID, $contentId, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the position column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByPosition(1234); // WHERE position = 1234
|
||||||
|
* $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
|
||||||
|
* $query->filterByPosition(array('min' => 12)); // WHERE position > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $position The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPosition($position = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($position)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($position['min'])) {
|
||||||
|
$this->addUsingAlias(CategoryAssociatedContentTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($position['max'])) {
|
||||||
|
$this->addUsingAlias(CategoryAssociatedContentTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryAssociatedContentTableMap::POSITION, $position, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the created_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
|
||||||
|
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
|
||||||
|
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $createdAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCreatedAt($createdAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($createdAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($createdAt['min'])) {
|
||||||
|
$this->addUsingAlias(CategoryAssociatedContentTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($createdAt['max'])) {
|
||||||
|
$this->addUsingAlias(CategoryAssociatedContentTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryAssociatedContentTableMap::CREATED_AT, $createdAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the updated_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
|
||||||
|
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
|
||||||
|
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $updatedAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($updatedAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($updatedAt['min'])) {
|
||||||
|
$this->addUsingAlias(CategoryAssociatedContentTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($updatedAt['max'])) {
|
||||||
|
$this->addUsingAlias(CategoryAssociatedContentTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryAssociatedContentTableMap::UPDATED_AT, $updatedAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related \Thelia\Model\Category object
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\Category|ObjectCollection $category The related object(s) to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCategory($category, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($category instanceof \Thelia\Model\Category) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CategoryAssociatedContentTableMap::CATEGORY_ID, $category->getId(), $comparison);
|
||||||
|
} elseif ($category instanceof ObjectCollection) {
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CategoryAssociatedContentTableMap::CATEGORY_ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByCategory() only accepts arguments of type \Thelia\Model\Category or Collection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the Category relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('Category');
|
||||||
|
|
||||||
|
// create a ModelJoin object for this join
|
||||||
|
$join = new ModelJoin();
|
||||||
|
$join->setJoinType($joinType);
|
||||||
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||||
|
if ($previousJoin = $this->getPreviousJoin()) {
|
||||||
|
$join->setPreviousJoin($previousJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the ModelJoin to the current object
|
||||||
|
if ($relationAlias) {
|
||||||
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||||
|
$this->addJoinObject($join, $relationAlias);
|
||||||
|
} else {
|
||||||
|
$this->addJoinObject($join, 'Category');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the Category relation Category object
|
||||||
|
*
|
||||||
|
* @see useQuery()
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation,
|
||||||
|
* to be used as main alias in the secondary query
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return \Thelia\Model\CategoryQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinCategory($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'Category', '\Thelia\Model\CategoryQuery');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related \Thelia\Model\Content object
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\Content|ObjectCollection $content The related object(s) to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByContent($content, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($content instanceof \Thelia\Model\Content) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CategoryAssociatedContentTableMap::CONTENT_ID, $content->getId(), $comparison);
|
||||||
|
} elseif ($content instanceof ObjectCollection) {
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CategoryAssociatedContentTableMap::CONTENT_ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByContent() only accepts arguments of type \Thelia\Model\Content or Collection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the Content relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinContent($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('Content');
|
||||||
|
|
||||||
|
// create a ModelJoin object for this join
|
||||||
|
$join = new ModelJoin();
|
||||||
|
$join->setJoinType($joinType);
|
||||||
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||||
|
if ($previousJoin = $this->getPreviousJoin()) {
|
||||||
|
$join->setPreviousJoin($previousJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the ModelJoin to the current object
|
||||||
|
if ($relationAlias) {
|
||||||
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||||
|
$this->addJoinObject($join, $relationAlias);
|
||||||
|
} else {
|
||||||
|
$this->addJoinObject($join, 'Content');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the Content relation Content object
|
||||||
|
*
|
||||||
|
* @see useQuery()
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation,
|
||||||
|
* to be used as main alias in the secondary query
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return \Thelia\Model\ContentQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinContent($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'Content', '\Thelia\Model\ContentQuery');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exclude object from result
|
||||||
|
*
|
||||||
|
* @param ChildCategoryAssociatedContent $categoryAssociatedContent Object to remove from the list of results
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function prune($categoryAssociatedContent = null)
|
||||||
|
{
|
||||||
|
if ($categoryAssociatedContent) {
|
||||||
|
$this->addUsingAlias(CategoryAssociatedContentTableMap::ID, $categoryAssociatedContent->getId(), Criteria::NOT_EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all rows from the category_associated_content 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(CategoryAssociatedContentTableMap::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).
|
||||||
|
CategoryAssociatedContentTableMap::clearInstancePool();
|
||||||
|
CategoryAssociatedContentTableMap::clearRelatedInstancePool();
|
||||||
|
|
||||||
|
$con->commit();
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $affectedRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs a DELETE on the database, given a ChildCategoryAssociatedContent or Criteria object OR a primary key value.
|
||||||
|
*
|
||||||
|
* @param mixed $values Criteria or ChildCategoryAssociatedContent 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(CategoryAssociatedContentTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria = $this;
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$criteria->setDbName(CategoryAssociatedContentTableMap::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();
|
||||||
|
|
||||||
|
|
||||||
|
CategoryAssociatedContentTableMap::removeInstanceFromPool($criteria);
|
||||||
|
|
||||||
|
$affectedRows += ModelCriteria::delete($con);
|
||||||
|
CategoryAssociatedContentTableMap::clearRelatedInstancePool();
|
||||||
|
$con->commit();
|
||||||
|
|
||||||
|
return $affectedRows;
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// timestampable behavior
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter by the latest updated
|
||||||
|
*
|
||||||
|
* @param int $nbDays Maximum age of the latest update in days
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function recentlyUpdated($nbDays = 7)
|
||||||
|
{
|
||||||
|
return $this->addUsingAlias(CategoryAssociatedContentTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter by the latest created
|
||||||
|
*
|
||||||
|
* @param int $nbDays Maximum age of in days
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function recentlyCreated($nbDays = 7)
|
||||||
|
{
|
||||||
|
return $this->addUsingAlias(CategoryAssociatedContentTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Order by update date desc
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function lastUpdatedFirst()
|
||||||
|
{
|
||||||
|
return $this->addDescendingOrderByColumn(CategoryAssociatedContentTableMap::UPDATED_AT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Order by update date asc
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function firstUpdatedFirst()
|
||||||
|
{
|
||||||
|
return $this->addAscendingOrderByColumn(CategoryAssociatedContentTableMap::UPDATED_AT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Order by create date desc
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function lastCreatedFirst()
|
||||||
|
{
|
||||||
|
return $this->addDescendingOrderByColumn(CategoryAssociatedContentTableMap::CREATED_AT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Order by create date asc
|
||||||
|
*
|
||||||
|
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function firstCreatedFirst()
|
||||||
|
{
|
||||||
|
return $this->addAscendingOrderByColumn(CategoryAssociatedContentTableMap::CREATED_AT);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // CategoryAssociatedContentQuery
|
||||||
@@ -58,10 +58,6 @@ use Thelia\Model\Map\CategoryTableMap;
|
|||||||
* @method ChildCategoryQuery rightJoinAttributeCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCategory relation
|
* @method ChildCategoryQuery rightJoinAttributeCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCategory relation
|
||||||
* @method ChildCategoryQuery innerJoinAttributeCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCategory relation
|
* @method ChildCategoryQuery innerJoinAttributeCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCategory relation
|
||||||
*
|
*
|
||||||
* @method ChildCategoryQuery leftJoinContentAssoc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentAssoc relation
|
|
||||||
* @method ChildCategoryQuery rightJoinContentAssoc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentAssoc relation
|
|
||||||
* @method ChildCategoryQuery innerJoinContentAssoc($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentAssoc relation
|
|
||||||
*
|
|
||||||
* @method ChildCategoryQuery leftJoinRewriting($relationAlias = null) Adds a LEFT JOIN clause to the query using the Rewriting relation
|
* @method ChildCategoryQuery leftJoinRewriting($relationAlias = null) Adds a LEFT JOIN clause to the query using the Rewriting relation
|
||||||
* @method ChildCategoryQuery rightJoinRewriting($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rewriting relation
|
* @method ChildCategoryQuery rightJoinRewriting($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rewriting relation
|
||||||
* @method ChildCategoryQuery innerJoinRewriting($relationAlias = null) Adds a INNER JOIN clause to the query using the Rewriting relation
|
* @method ChildCategoryQuery innerJoinRewriting($relationAlias = null) Adds a INNER JOIN clause to the query using the Rewriting relation
|
||||||
@@ -74,6 +70,10 @@ use Thelia\Model\Map\CategoryTableMap;
|
|||||||
* @method ChildCategoryQuery rightJoinCategoryDocument($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryDocument relation
|
* @method ChildCategoryQuery rightJoinCategoryDocument($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryDocument relation
|
||||||
* @method ChildCategoryQuery innerJoinCategoryDocument($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryDocument relation
|
* @method ChildCategoryQuery innerJoinCategoryDocument($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryDocument relation
|
||||||
*
|
*
|
||||||
|
* @method ChildCategoryQuery leftJoinCategoryAssociatedContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryAssociatedContent relation
|
||||||
|
* @method ChildCategoryQuery rightJoinCategoryAssociatedContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryAssociatedContent relation
|
||||||
|
* @method ChildCategoryQuery innerJoinCategoryAssociatedContent($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryAssociatedContent relation
|
||||||
|
*
|
||||||
* @method ChildCategoryQuery leftJoinCategoryI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryI18n relation
|
* @method ChildCategoryQuery leftJoinCategoryI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryI18n relation
|
||||||
* @method ChildCategoryQuery rightJoinCategoryI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryI18n relation
|
* @method ChildCategoryQuery rightJoinCategoryI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryI18n relation
|
||||||
* @method ChildCategoryQuery innerJoinCategoryI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryI18n relation
|
* @method ChildCategoryQuery innerJoinCategoryI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryI18n relation
|
||||||
@@ -870,79 +870,6 @@ abstract class CategoryQuery extends ModelCriteria
|
|||||||
->useQuery($relationAlias ? $relationAlias : 'AttributeCategory', '\Thelia\Model\AttributeCategoryQuery');
|
->useQuery($relationAlias ? $relationAlias : 'AttributeCategory', '\Thelia\Model\AttributeCategoryQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query by a related \Thelia\Model\ContentAssoc object
|
|
||||||
*
|
|
||||||
* @param \Thelia\Model\ContentAssoc|ObjectCollection $contentAssoc the related object to use as filter
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildCategoryQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByContentAssoc($contentAssoc, $comparison = null)
|
|
||||||
{
|
|
||||||
if ($contentAssoc instanceof \Thelia\Model\ContentAssoc) {
|
|
||||||
return $this
|
|
||||||
->addUsingAlias(CategoryTableMap::ID, $contentAssoc->getCategoryId(), $comparison);
|
|
||||||
} elseif ($contentAssoc instanceof ObjectCollection) {
|
|
||||||
return $this
|
|
||||||
->useContentAssocQuery()
|
|
||||||
->filterByPrimaryKeys($contentAssoc->getPrimaryKeys())
|
|
||||||
->endUse();
|
|
||||||
} else {
|
|
||||||
throw new PropelException('filterByContentAssoc() only accepts arguments of type \Thelia\Model\ContentAssoc or Collection');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a JOIN clause to the query using the ContentAssoc relation
|
|
||||||
*
|
|
||||||
* @param string $relationAlias optional alias for the relation
|
|
||||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
|
||||||
*
|
|
||||||
* @return ChildCategoryQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function joinContentAssoc($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
|
||||||
{
|
|
||||||
$tableMap = $this->getTableMap();
|
|
||||||
$relationMap = $tableMap->getRelation('ContentAssoc');
|
|
||||||
|
|
||||||
// create a ModelJoin object for this join
|
|
||||||
$join = new ModelJoin();
|
|
||||||
$join->setJoinType($joinType);
|
|
||||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
|
||||||
if ($previousJoin = $this->getPreviousJoin()) {
|
|
||||||
$join->setPreviousJoin($previousJoin);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add the ModelJoin to the current object
|
|
||||||
if ($relationAlias) {
|
|
||||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
|
||||||
$this->addJoinObject($join, $relationAlias);
|
|
||||||
} else {
|
|
||||||
$this->addJoinObject($join, 'ContentAssoc');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use the ContentAssoc relation ContentAssoc object
|
|
||||||
*
|
|
||||||
* @see useQuery()
|
|
||||||
*
|
|
||||||
* @param string $relationAlias optional alias for the relation,
|
|
||||||
* to be used as main alias in the secondary query
|
|
||||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
|
||||||
*
|
|
||||||
* @return \Thelia\Model\ContentAssocQuery A secondary query class using the current class as primary query
|
|
||||||
*/
|
|
||||||
public function useContentAssocQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
|
||||||
{
|
|
||||||
return $this
|
|
||||||
->joinContentAssoc($relationAlias, $joinType)
|
|
||||||
->useQuery($relationAlias ? $relationAlias : 'ContentAssoc', '\Thelia\Model\ContentAssocQuery');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query by a related \Thelia\Model\Rewriting object
|
* Filter the query by a related \Thelia\Model\Rewriting object
|
||||||
*
|
*
|
||||||
@@ -1162,6 +1089,79 @@ abstract class CategoryQuery extends ModelCriteria
|
|||||||
->useQuery($relationAlias ? $relationAlias : 'CategoryDocument', '\Thelia\Model\CategoryDocumentQuery');
|
->useQuery($relationAlias ? $relationAlias : 'CategoryDocument', '\Thelia\Model\CategoryDocumentQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related \Thelia\Model\CategoryAssociatedContent object
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\CategoryAssociatedContent|ObjectCollection $categoryAssociatedContent the related object to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildCategoryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCategoryAssociatedContent($categoryAssociatedContent, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($categoryAssociatedContent instanceof \Thelia\Model\CategoryAssociatedContent) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CategoryTableMap::ID, $categoryAssociatedContent->getCategoryId(), $comparison);
|
||||||
|
} elseif ($categoryAssociatedContent instanceof ObjectCollection) {
|
||||||
|
return $this
|
||||||
|
->useCategoryAssociatedContentQuery()
|
||||||
|
->filterByPrimaryKeys($categoryAssociatedContent->getPrimaryKeys())
|
||||||
|
->endUse();
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByCategoryAssociatedContent() only accepts arguments of type \Thelia\Model\CategoryAssociatedContent or Collection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the CategoryAssociatedContent relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return ChildCategoryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinCategoryAssociatedContent($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('CategoryAssociatedContent');
|
||||||
|
|
||||||
|
// create a ModelJoin object for this join
|
||||||
|
$join = new ModelJoin();
|
||||||
|
$join->setJoinType($joinType);
|
||||||
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||||
|
if ($previousJoin = $this->getPreviousJoin()) {
|
||||||
|
$join->setPreviousJoin($previousJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the ModelJoin to the current object
|
||||||
|
if ($relationAlias) {
|
||||||
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||||
|
$this->addJoinObject($join, $relationAlias);
|
||||||
|
} else {
|
||||||
|
$this->addJoinObject($join, 'CategoryAssociatedContent');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the CategoryAssociatedContent relation CategoryAssociatedContent object
|
||||||
|
*
|
||||||
|
* @see useQuery()
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation,
|
||||||
|
* to be used as main alias in the secondary query
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return \Thelia\Model\CategoryAssociatedContentQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useCategoryAssociatedContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinCategoryAssociatedContent($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'CategoryAssociatedContent', '\Thelia\Model\CategoryAssociatedContentQuery');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query by a related \Thelia\Model\CategoryI18n object
|
* Filter the query by a related \Thelia\Model\CategoryI18n object
|
||||||
*
|
*
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -44,10 +44,6 @@ use Thelia\Model\Map\ContentTableMap;
|
|||||||
* @method ChildContentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
* @method ChildContentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
* @method ChildContentQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
* @method ChildContentQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||||
*
|
*
|
||||||
* @method ChildContentQuery leftJoinContentAssoc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentAssoc relation
|
|
||||||
* @method ChildContentQuery rightJoinContentAssoc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentAssoc relation
|
|
||||||
* @method ChildContentQuery innerJoinContentAssoc($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentAssoc relation
|
|
||||||
*
|
|
||||||
* @method ChildContentQuery leftJoinRewriting($relationAlias = null) Adds a LEFT JOIN clause to the query using the Rewriting relation
|
* @method ChildContentQuery leftJoinRewriting($relationAlias = null) Adds a LEFT JOIN clause to the query using the Rewriting relation
|
||||||
* @method ChildContentQuery rightJoinRewriting($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rewriting relation
|
* @method ChildContentQuery rightJoinRewriting($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rewriting relation
|
||||||
* @method ChildContentQuery innerJoinRewriting($relationAlias = null) Adds a INNER JOIN clause to the query using the Rewriting relation
|
* @method ChildContentQuery innerJoinRewriting($relationAlias = null) Adds a INNER JOIN clause to the query using the Rewriting relation
|
||||||
@@ -64,6 +60,14 @@ use Thelia\Model\Map\ContentTableMap;
|
|||||||
* @method ChildContentQuery rightJoinContentDocument($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentDocument relation
|
* @method ChildContentQuery rightJoinContentDocument($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentDocument relation
|
||||||
* @method ChildContentQuery innerJoinContentDocument($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentDocument relation
|
* @method ChildContentQuery innerJoinContentDocument($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentDocument relation
|
||||||
*
|
*
|
||||||
|
* @method ChildContentQuery leftJoinProductAssociatedContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductAssociatedContent relation
|
||||||
|
* @method ChildContentQuery rightJoinProductAssociatedContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductAssociatedContent relation
|
||||||
|
* @method ChildContentQuery innerJoinProductAssociatedContent($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductAssociatedContent relation
|
||||||
|
*
|
||||||
|
* @method ChildContentQuery leftJoinCategoryAssociatedContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryAssociatedContent relation
|
||||||
|
* @method ChildContentQuery rightJoinCategoryAssociatedContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryAssociatedContent relation
|
||||||
|
* @method ChildContentQuery innerJoinCategoryAssociatedContent($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryAssociatedContent relation
|
||||||
|
*
|
||||||
* @method ChildContentQuery leftJoinContentI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentI18n relation
|
* @method ChildContentQuery leftJoinContentI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentI18n relation
|
||||||
* @method ChildContentQuery rightJoinContentI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentI18n relation
|
* @method ChildContentQuery rightJoinContentI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentI18n relation
|
||||||
* @method ChildContentQuery innerJoinContentI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentI18n relation
|
* @method ChildContentQuery innerJoinContentI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentI18n relation
|
||||||
@@ -598,79 +602,6 @@ abstract class ContentQuery extends ModelCriteria
|
|||||||
return $this->addUsingAlias(ContentTableMap::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
|
return $this->addUsingAlias(ContentTableMap::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query by a related \Thelia\Model\ContentAssoc object
|
|
||||||
*
|
|
||||||
* @param \Thelia\Model\ContentAssoc|ObjectCollection $contentAssoc the related object to use as filter
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildContentQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByContentAssoc($contentAssoc, $comparison = null)
|
|
||||||
{
|
|
||||||
if ($contentAssoc instanceof \Thelia\Model\ContentAssoc) {
|
|
||||||
return $this
|
|
||||||
->addUsingAlias(ContentTableMap::ID, $contentAssoc->getContentId(), $comparison);
|
|
||||||
} elseif ($contentAssoc instanceof ObjectCollection) {
|
|
||||||
return $this
|
|
||||||
->useContentAssocQuery()
|
|
||||||
->filterByPrimaryKeys($contentAssoc->getPrimaryKeys())
|
|
||||||
->endUse();
|
|
||||||
} else {
|
|
||||||
throw new PropelException('filterByContentAssoc() only accepts arguments of type \Thelia\Model\ContentAssoc or Collection');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a JOIN clause to the query using the ContentAssoc relation
|
|
||||||
*
|
|
||||||
* @param string $relationAlias optional alias for the relation
|
|
||||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
|
||||||
*
|
|
||||||
* @return ChildContentQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function joinContentAssoc($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
|
||||||
{
|
|
||||||
$tableMap = $this->getTableMap();
|
|
||||||
$relationMap = $tableMap->getRelation('ContentAssoc');
|
|
||||||
|
|
||||||
// create a ModelJoin object for this join
|
|
||||||
$join = new ModelJoin();
|
|
||||||
$join->setJoinType($joinType);
|
|
||||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
|
||||||
if ($previousJoin = $this->getPreviousJoin()) {
|
|
||||||
$join->setPreviousJoin($previousJoin);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add the ModelJoin to the current object
|
|
||||||
if ($relationAlias) {
|
|
||||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
|
||||||
$this->addJoinObject($join, $relationAlias);
|
|
||||||
} else {
|
|
||||||
$this->addJoinObject($join, 'ContentAssoc');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use the ContentAssoc relation ContentAssoc object
|
|
||||||
*
|
|
||||||
* @see useQuery()
|
|
||||||
*
|
|
||||||
* @param string $relationAlias optional alias for the relation,
|
|
||||||
* to be used as main alias in the secondary query
|
|
||||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
|
||||||
*
|
|
||||||
* @return \Thelia\Model\ContentAssocQuery A secondary query class using the current class as primary query
|
|
||||||
*/
|
|
||||||
public function useContentAssocQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
|
||||||
{
|
|
||||||
return $this
|
|
||||||
->joinContentAssoc($relationAlias, $joinType)
|
|
||||||
->useQuery($relationAlias ? $relationAlias : 'ContentAssoc', '\Thelia\Model\ContentAssocQuery');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query by a related \Thelia\Model\Rewriting object
|
* Filter the query by a related \Thelia\Model\Rewriting object
|
||||||
*
|
*
|
||||||
@@ -963,6 +894,152 @@ abstract class ContentQuery extends ModelCriteria
|
|||||||
->useQuery($relationAlias ? $relationAlias : 'ContentDocument', '\Thelia\Model\ContentDocumentQuery');
|
->useQuery($relationAlias ? $relationAlias : 'ContentDocument', '\Thelia\Model\ContentDocumentQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related \Thelia\Model\ProductAssociatedContent object
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\ProductAssociatedContent|ObjectCollection $productAssociatedContent the related object to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByProductAssociatedContent($productAssociatedContent, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($productAssociatedContent instanceof \Thelia\Model\ProductAssociatedContent) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(ContentTableMap::ID, $productAssociatedContent->getContentId(), $comparison);
|
||||||
|
} elseif ($productAssociatedContent instanceof ObjectCollection) {
|
||||||
|
return $this
|
||||||
|
->useProductAssociatedContentQuery()
|
||||||
|
->filterByPrimaryKeys($productAssociatedContent->getPrimaryKeys())
|
||||||
|
->endUse();
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByProductAssociatedContent() only accepts arguments of type \Thelia\Model\ProductAssociatedContent or Collection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the ProductAssociatedContent relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return ChildContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinProductAssociatedContent($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('ProductAssociatedContent');
|
||||||
|
|
||||||
|
// create a ModelJoin object for this join
|
||||||
|
$join = new ModelJoin();
|
||||||
|
$join->setJoinType($joinType);
|
||||||
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||||
|
if ($previousJoin = $this->getPreviousJoin()) {
|
||||||
|
$join->setPreviousJoin($previousJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the ModelJoin to the current object
|
||||||
|
if ($relationAlias) {
|
||||||
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||||
|
$this->addJoinObject($join, $relationAlias);
|
||||||
|
} else {
|
||||||
|
$this->addJoinObject($join, 'ProductAssociatedContent');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the ProductAssociatedContent relation ProductAssociatedContent object
|
||||||
|
*
|
||||||
|
* @see useQuery()
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation,
|
||||||
|
* to be used as main alias in the secondary query
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return \Thelia\Model\ProductAssociatedContentQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useProductAssociatedContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinProductAssociatedContent($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'ProductAssociatedContent', '\Thelia\Model\ProductAssociatedContentQuery');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related \Thelia\Model\CategoryAssociatedContent object
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\CategoryAssociatedContent|ObjectCollection $categoryAssociatedContent the related object to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCategoryAssociatedContent($categoryAssociatedContent, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($categoryAssociatedContent instanceof \Thelia\Model\CategoryAssociatedContent) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(ContentTableMap::ID, $categoryAssociatedContent->getContentId(), $comparison);
|
||||||
|
} elseif ($categoryAssociatedContent instanceof ObjectCollection) {
|
||||||
|
return $this
|
||||||
|
->useCategoryAssociatedContentQuery()
|
||||||
|
->filterByPrimaryKeys($categoryAssociatedContent->getPrimaryKeys())
|
||||||
|
->endUse();
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByCategoryAssociatedContent() only accepts arguments of type \Thelia\Model\CategoryAssociatedContent or Collection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the CategoryAssociatedContent relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return ChildContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinCategoryAssociatedContent($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('CategoryAssociatedContent');
|
||||||
|
|
||||||
|
// create a ModelJoin object for this join
|
||||||
|
$join = new ModelJoin();
|
||||||
|
$join->setJoinType($joinType);
|
||||||
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||||
|
if ($previousJoin = $this->getPreviousJoin()) {
|
||||||
|
$join->setPreviousJoin($previousJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the ModelJoin to the current object
|
||||||
|
if ($relationAlias) {
|
||||||
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||||
|
$this->addJoinObject($join, $relationAlias);
|
||||||
|
} else {
|
||||||
|
$this->addJoinObject($join, 'CategoryAssociatedContent');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the CategoryAssociatedContent relation CategoryAssociatedContent object
|
||||||
|
*
|
||||||
|
* @see useQuery()
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation,
|
||||||
|
* to be used as main alias in the secondary query
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return \Thelia\Model\CategoryAssociatedContentQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useCategoryAssociatedContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinCategoryAssociatedContent($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'CategoryAssociatedContent', '\Thelia\Model\CategoryAssociatedContentQuery');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query by a related \Thelia\Model\ContentI18n object
|
* Filter the query by a related \Thelia\Model\ContentI18n object
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -99,10 +99,10 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
protected $description;
|
protected $description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the value field.
|
* The value for the amount field.
|
||||||
* @var double
|
* @var double
|
||||||
*/
|
*/
|
||||||
protected $value;
|
protected $amount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the is_used field.
|
* The value for the is_used field.
|
||||||
@@ -123,10 +123,28 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
protected $expiration_date;
|
protected $expiration_date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the serialized_rules field.
|
* The value for the serialized_rules_type field.
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $serialized_rules;
|
protected $serialized_rules_type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the serialized_rules_content field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $serialized_rules_content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the is_cumulative field.
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $is_cumulative;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the is_removing_postage field.
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $is_removing_postage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the created_at field.
|
* The value for the created_at field.
|
||||||
@@ -547,14 +565,14 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [value] column value.
|
* Get the [amount] column value.
|
||||||
*
|
*
|
||||||
* @return double
|
* @return double
|
||||||
*/
|
*/
|
||||||
public function getValue()
|
public function getAmount()
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->value;
|
return $this->amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -600,14 +618,47 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [serialized_rules] column value.
|
* Get the [serialized_rules_type] column value.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSerializedRules()
|
public function getSerializedRulesType()
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->serialized_rules;
|
return $this->serialized_rules_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [serialized_rules_content] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getSerializedRulesContent()
|
||||||
|
{
|
||||||
|
|
||||||
|
return $this->serialized_rules_content;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [is_cumulative] column value.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getIsCumulative()
|
||||||
|
{
|
||||||
|
|
||||||
|
return $this->is_cumulative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [is_removing_postage] column value.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getIsRemovingPostage()
|
||||||
|
{
|
||||||
|
|
||||||
|
return $this->is_removing_postage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -788,25 +839,25 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
} // setDescription()
|
} // setDescription()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [value] column.
|
* Set the value of [amount] column.
|
||||||
*
|
*
|
||||||
* @param double $v new value
|
* @param double $v new value
|
||||||
* @return \Thelia\Model\Coupon The current object (for fluent API support)
|
* @return \Thelia\Model\Coupon The current object (for fluent API support)
|
||||||
*/
|
*/
|
||||||
public function setValue($v)
|
public function setAmount($v)
|
||||||
{
|
{
|
||||||
if ($v !== null) {
|
if ($v !== null) {
|
||||||
$v = (double) $v;
|
$v = (double) $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->value !== $v) {
|
if ($this->amount !== $v) {
|
||||||
$this->value = $v;
|
$this->amount = $v;
|
||||||
$this->modifiedColumns[] = CouponTableMap::VALUE;
|
$this->modifiedColumns[] = CouponTableMap::AMOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
} // setValue()
|
} // setAmount()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [is_used] column.
|
* Set the value of [is_used] column.
|
||||||
@@ -872,25 +923,88 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
} // setExpirationDate()
|
} // setExpirationDate()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [serialized_rules] column.
|
* Set the value of [serialized_rules_type] column.
|
||||||
*
|
*
|
||||||
* @param string $v new value
|
* @param string $v new value
|
||||||
* @return \Thelia\Model\Coupon The current object (for fluent API support)
|
* @return \Thelia\Model\Coupon The current object (for fluent API support)
|
||||||
*/
|
*/
|
||||||
public function setSerializedRules($v)
|
public function setSerializedRulesType($v)
|
||||||
{
|
{
|
||||||
if ($v !== null) {
|
if ($v !== null) {
|
||||||
$v = (string) $v;
|
$v = (string) $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->serialized_rules !== $v) {
|
if ($this->serialized_rules_type !== $v) {
|
||||||
$this->serialized_rules = $v;
|
$this->serialized_rules_type = $v;
|
||||||
$this->modifiedColumns[] = CouponTableMap::SERIALIZED_RULES;
|
$this->modifiedColumns[] = CouponTableMap::SERIALIZED_RULES_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
} // setSerializedRules()
|
} // setSerializedRulesType()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [serialized_rules_content] column.
|
||||||
|
*
|
||||||
|
* @param string $v new value
|
||||||
|
* @return \Thelia\Model\Coupon The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setSerializedRulesContent($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (string) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->serialized_rules_content !== $v) {
|
||||||
|
$this->serialized_rules_content = $v;
|
||||||
|
$this->modifiedColumns[] = CouponTableMap::SERIALIZED_RULES_CONTENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setSerializedRulesContent()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [is_cumulative] column.
|
||||||
|
*
|
||||||
|
* @param int $v new value
|
||||||
|
* @return \Thelia\Model\Coupon The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setIsCumulative($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (int) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->is_cumulative !== $v) {
|
||||||
|
$this->is_cumulative = $v;
|
||||||
|
$this->modifiedColumns[] = CouponTableMap::IS_CUMULATIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setIsCumulative()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [is_removing_postage] column.
|
||||||
|
*
|
||||||
|
* @param int $v new value
|
||||||
|
* @return \Thelia\Model\Coupon The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setIsRemovingPostage($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (int) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->is_removing_postage !== $v) {
|
||||||
|
$this->is_removing_postage = $v;
|
||||||
|
$this->modifiedColumns[] = CouponTableMap::IS_REMOVING_POSTAGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setIsRemovingPostage()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||||
@@ -1014,8 +1128,8 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)];
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
$this->description = (null !== $col) ? (string) $col : null;
|
$this->description = (null !== $col) ? (string) $col : null;
|
||||||
|
|
||||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponTableMap::translateFieldName('Value', TableMap::TYPE_PHPNAME, $indexType)];
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
$this->value = (null !== $col) ? (double) $col : null;
|
$this->amount = (null !== $col) ? (double) $col : null;
|
||||||
|
|
||||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CouponTableMap::translateFieldName('IsUsed', TableMap::TYPE_PHPNAME, $indexType)];
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CouponTableMap::translateFieldName('IsUsed', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
$this->is_used = (null !== $col) ? (int) $col : null;
|
$this->is_used = (null !== $col) ? (int) $col : null;
|
||||||
@@ -1029,22 +1143,31 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
}
|
}
|
||||||
$this->expiration_date = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
$this->expiration_date = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||||
|
|
||||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CouponTableMap::translateFieldName('SerializedRules', TableMap::TYPE_PHPNAME, $indexType)];
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CouponTableMap::translateFieldName('SerializedRulesType', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
$this->serialized_rules = (null !== $col) ? (string) $col : null;
|
$this->serialized_rules_type = (null !== $col) ? (string) $col : null;
|
||||||
|
|
||||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponTableMap::translateFieldName('SerializedRulesContent', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
|
$this->serialized_rules_content = (null !== $col) ? (string) $col : null;
|
||||||
|
|
||||||
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponTableMap::translateFieldName('IsCumulative', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
|
$this->is_cumulative = (null !== $col) ? (int) $col : null;
|
||||||
|
|
||||||
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponTableMap::translateFieldName('IsRemovingPostage', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
|
$this->is_removing_postage = (null !== $col) ? (int) $col : null;
|
||||||
|
|
||||||
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
if ($col === '0000-00-00 00:00:00') {
|
if ($col === '0000-00-00 00:00:00') {
|
||||||
$col = null;
|
$col = null;
|
||||||
}
|
}
|
||||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||||
|
|
||||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CouponTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
if ($col === '0000-00-00 00:00:00') {
|
if ($col === '0000-00-00 00:00:00') {
|
||||||
$col = null;
|
$col = null;
|
||||||
}
|
}
|
||||||
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||||
|
|
||||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : CouponTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
$this->version = (null !== $col) ? (int) $col : null;
|
$this->version = (null !== $col) ? (int) $col : null;
|
||||||
$this->resetModified();
|
$this->resetModified();
|
||||||
|
|
||||||
@@ -1054,7 +1177,7 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
$this->ensureConsistency();
|
$this->ensureConsistency();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $startcol + 14; // 14 = CouponTableMap::NUM_HYDRATE_COLUMNS.
|
return $startcol + 17; // 17 = CouponTableMap::NUM_HYDRATE_COLUMNS.
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new PropelException("Error populating \Thelia\Model\Coupon object", 0, $e);
|
throw new PropelException("Error populating \Thelia\Model\Coupon object", 0, $e);
|
||||||
@@ -1358,8 +1481,8 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
if ($this->isColumnModified(CouponTableMap::DESCRIPTION)) {
|
if ($this->isColumnModified(CouponTableMap::DESCRIPTION)) {
|
||||||
$modifiedColumns[':p' . $index++] = 'DESCRIPTION';
|
$modifiedColumns[':p' . $index++] = 'DESCRIPTION';
|
||||||
}
|
}
|
||||||
if ($this->isColumnModified(CouponTableMap::VALUE)) {
|
if ($this->isColumnModified(CouponTableMap::AMOUNT)) {
|
||||||
$modifiedColumns[':p' . $index++] = 'VALUE';
|
$modifiedColumns[':p' . $index++] = 'AMOUNT';
|
||||||
}
|
}
|
||||||
if ($this->isColumnModified(CouponTableMap::IS_USED)) {
|
if ($this->isColumnModified(CouponTableMap::IS_USED)) {
|
||||||
$modifiedColumns[':p' . $index++] = 'IS_USED';
|
$modifiedColumns[':p' . $index++] = 'IS_USED';
|
||||||
@@ -1370,8 +1493,17 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
if ($this->isColumnModified(CouponTableMap::EXPIRATION_DATE)) {
|
if ($this->isColumnModified(CouponTableMap::EXPIRATION_DATE)) {
|
||||||
$modifiedColumns[':p' . $index++] = 'EXPIRATION_DATE';
|
$modifiedColumns[':p' . $index++] = 'EXPIRATION_DATE';
|
||||||
}
|
}
|
||||||
if ($this->isColumnModified(CouponTableMap::SERIALIZED_RULES)) {
|
if ($this->isColumnModified(CouponTableMap::SERIALIZED_RULES_TYPE)) {
|
||||||
$modifiedColumns[':p' . $index++] = 'SERIALIZED_RULES';
|
$modifiedColumns[':p' . $index++] = 'SERIALIZED_RULES_TYPE';
|
||||||
|
}
|
||||||
|
if ($this->isColumnModified(CouponTableMap::SERIALIZED_RULES_CONTENT)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = 'SERIALIZED_RULES_CONTENT';
|
||||||
|
}
|
||||||
|
if ($this->isColumnModified(CouponTableMap::IS_CUMULATIVE)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = 'IS_CUMULATIVE';
|
||||||
|
}
|
||||||
|
if ($this->isColumnModified(CouponTableMap::IS_REMOVING_POSTAGE)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = 'IS_REMOVING_POSTAGE';
|
||||||
}
|
}
|
||||||
if ($this->isColumnModified(CouponTableMap::CREATED_AT)) {
|
if ($this->isColumnModified(CouponTableMap::CREATED_AT)) {
|
||||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||||
@@ -1411,8 +1543,8 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
case 'DESCRIPTION':
|
case 'DESCRIPTION':
|
||||||
$stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
|
$stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
|
||||||
break;
|
break;
|
||||||
case 'VALUE':
|
case 'AMOUNT':
|
||||||
$stmt->bindValue($identifier, $this->value, PDO::PARAM_STR);
|
$stmt->bindValue($identifier, $this->amount, PDO::PARAM_STR);
|
||||||
break;
|
break;
|
||||||
case 'IS_USED':
|
case 'IS_USED':
|
||||||
$stmt->bindValue($identifier, $this->is_used, PDO::PARAM_INT);
|
$stmt->bindValue($identifier, $this->is_used, PDO::PARAM_INT);
|
||||||
@@ -1423,8 +1555,17 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
case 'EXPIRATION_DATE':
|
case 'EXPIRATION_DATE':
|
||||||
$stmt->bindValue($identifier, $this->expiration_date ? $this->expiration_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
$stmt->bindValue($identifier, $this->expiration_date ? $this->expiration_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||||
break;
|
break;
|
||||||
case 'SERIALIZED_RULES':
|
case 'SERIALIZED_RULES_TYPE':
|
||||||
$stmt->bindValue($identifier, $this->serialized_rules, PDO::PARAM_STR);
|
$stmt->bindValue($identifier, $this->serialized_rules_type, PDO::PARAM_STR);
|
||||||
|
break;
|
||||||
|
case 'SERIALIZED_RULES_CONTENT':
|
||||||
|
$stmt->bindValue($identifier, $this->serialized_rules_content, PDO::PARAM_STR);
|
||||||
|
break;
|
||||||
|
case 'IS_CUMULATIVE':
|
||||||
|
$stmt->bindValue($identifier, $this->is_cumulative, PDO::PARAM_INT);
|
||||||
|
break;
|
||||||
|
case 'IS_REMOVING_POSTAGE':
|
||||||
|
$stmt->bindValue($identifier, $this->is_removing_postage, PDO::PARAM_INT);
|
||||||
break;
|
break;
|
||||||
case 'CREATED_AT':
|
case 'CREATED_AT':
|
||||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||||
@@ -1516,7 +1657,7 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
return $this->getDescription();
|
return $this->getDescription();
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
return $this->getValue();
|
return $this->getAmount();
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
return $this->getIsUsed();
|
return $this->getIsUsed();
|
||||||
@@ -1528,15 +1669,24 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
return $this->getExpirationDate();
|
return $this->getExpirationDate();
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
return $this->getSerializedRules();
|
return $this->getSerializedRulesType();
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
return $this->getCreatedAt();
|
return $this->getSerializedRulesContent();
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
return $this->getUpdatedAt();
|
return $this->getIsCumulative();
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
|
return $this->getIsRemovingPostage();
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
return $this->getCreatedAt();
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
return $this->getUpdatedAt();
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
return $this->getVersion();
|
return $this->getVersion();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -1574,14 +1724,17 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
$keys[3] => $this->getTitle(),
|
$keys[3] => $this->getTitle(),
|
||||||
$keys[4] => $this->getShortDescription(),
|
$keys[4] => $this->getShortDescription(),
|
||||||
$keys[5] => $this->getDescription(),
|
$keys[5] => $this->getDescription(),
|
||||||
$keys[6] => $this->getValue(),
|
$keys[6] => $this->getAmount(),
|
||||||
$keys[7] => $this->getIsUsed(),
|
$keys[7] => $this->getIsUsed(),
|
||||||
$keys[8] => $this->getIsEnabled(),
|
$keys[8] => $this->getIsEnabled(),
|
||||||
$keys[9] => $this->getExpirationDate(),
|
$keys[9] => $this->getExpirationDate(),
|
||||||
$keys[10] => $this->getSerializedRules(),
|
$keys[10] => $this->getSerializedRulesType(),
|
||||||
$keys[11] => $this->getCreatedAt(),
|
$keys[11] => $this->getSerializedRulesContent(),
|
||||||
$keys[12] => $this->getUpdatedAt(),
|
$keys[12] => $this->getIsCumulative(),
|
||||||
$keys[13] => $this->getVersion(),
|
$keys[13] => $this->getIsRemovingPostage(),
|
||||||
|
$keys[14] => $this->getCreatedAt(),
|
||||||
|
$keys[15] => $this->getUpdatedAt(),
|
||||||
|
$keys[16] => $this->getVersion(),
|
||||||
);
|
);
|
||||||
$virtualColumns = $this->virtualColumns;
|
$virtualColumns = $this->virtualColumns;
|
||||||
foreach($virtualColumns as $key => $virtualColumn)
|
foreach($virtualColumns as $key => $virtualColumn)
|
||||||
@@ -1652,7 +1805,7 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
$this->setDescription($value);
|
$this->setDescription($value);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
$this->setValue($value);
|
$this->setAmount($value);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
$this->setIsUsed($value);
|
$this->setIsUsed($value);
|
||||||
@@ -1664,15 +1817,24 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
$this->setExpirationDate($value);
|
$this->setExpirationDate($value);
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
$this->setSerializedRules($value);
|
$this->setSerializedRulesType($value);
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
$this->setCreatedAt($value);
|
$this->setSerializedRulesContent($value);
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
$this->setUpdatedAt($value);
|
$this->setIsCumulative($value);
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
|
$this->setIsRemovingPostage($value);
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
$this->setCreatedAt($value);
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
$this->setUpdatedAt($value);
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
$this->setVersion($value);
|
$this->setVersion($value);
|
||||||
break;
|
break;
|
||||||
} // switch()
|
} // switch()
|
||||||
@@ -1705,14 +1867,17 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]);
|
if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]);
|
||||||
if (array_key_exists($keys[4], $arr)) $this->setShortDescription($arr[$keys[4]]);
|
if (array_key_exists($keys[4], $arr)) $this->setShortDescription($arr[$keys[4]]);
|
||||||
if (array_key_exists($keys[5], $arr)) $this->setDescription($arr[$keys[5]]);
|
if (array_key_exists($keys[5], $arr)) $this->setDescription($arr[$keys[5]]);
|
||||||
if (array_key_exists($keys[6], $arr)) $this->setValue($arr[$keys[6]]);
|
if (array_key_exists($keys[6], $arr)) $this->setAmount($arr[$keys[6]]);
|
||||||
if (array_key_exists($keys[7], $arr)) $this->setIsUsed($arr[$keys[7]]);
|
if (array_key_exists($keys[7], $arr)) $this->setIsUsed($arr[$keys[7]]);
|
||||||
if (array_key_exists($keys[8], $arr)) $this->setIsEnabled($arr[$keys[8]]);
|
if (array_key_exists($keys[8], $arr)) $this->setIsEnabled($arr[$keys[8]]);
|
||||||
if (array_key_exists($keys[9], $arr)) $this->setExpirationDate($arr[$keys[9]]);
|
if (array_key_exists($keys[9], $arr)) $this->setExpirationDate($arr[$keys[9]]);
|
||||||
if (array_key_exists($keys[10], $arr)) $this->setSerializedRules($arr[$keys[10]]);
|
if (array_key_exists($keys[10], $arr)) $this->setSerializedRulesType($arr[$keys[10]]);
|
||||||
if (array_key_exists($keys[11], $arr)) $this->setCreatedAt($arr[$keys[11]]);
|
if (array_key_exists($keys[11], $arr)) $this->setSerializedRulesContent($arr[$keys[11]]);
|
||||||
if (array_key_exists($keys[12], $arr)) $this->setUpdatedAt($arr[$keys[12]]);
|
if (array_key_exists($keys[12], $arr)) $this->setIsCumulative($arr[$keys[12]]);
|
||||||
if (array_key_exists($keys[13], $arr)) $this->setVersion($arr[$keys[13]]);
|
if (array_key_exists($keys[13], $arr)) $this->setIsRemovingPostage($arr[$keys[13]]);
|
||||||
|
if (array_key_exists($keys[14], $arr)) $this->setCreatedAt($arr[$keys[14]]);
|
||||||
|
if (array_key_exists($keys[15], $arr)) $this->setUpdatedAt($arr[$keys[15]]);
|
||||||
|
if (array_key_exists($keys[16], $arr)) $this->setVersion($arr[$keys[16]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1730,11 +1895,14 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
if ($this->isColumnModified(CouponTableMap::TITLE)) $criteria->add(CouponTableMap::TITLE, $this->title);
|
if ($this->isColumnModified(CouponTableMap::TITLE)) $criteria->add(CouponTableMap::TITLE, $this->title);
|
||||||
if ($this->isColumnModified(CouponTableMap::SHORT_DESCRIPTION)) $criteria->add(CouponTableMap::SHORT_DESCRIPTION, $this->short_description);
|
if ($this->isColumnModified(CouponTableMap::SHORT_DESCRIPTION)) $criteria->add(CouponTableMap::SHORT_DESCRIPTION, $this->short_description);
|
||||||
if ($this->isColumnModified(CouponTableMap::DESCRIPTION)) $criteria->add(CouponTableMap::DESCRIPTION, $this->description);
|
if ($this->isColumnModified(CouponTableMap::DESCRIPTION)) $criteria->add(CouponTableMap::DESCRIPTION, $this->description);
|
||||||
if ($this->isColumnModified(CouponTableMap::VALUE)) $criteria->add(CouponTableMap::VALUE, $this->value);
|
if ($this->isColumnModified(CouponTableMap::AMOUNT)) $criteria->add(CouponTableMap::AMOUNT, $this->amount);
|
||||||
if ($this->isColumnModified(CouponTableMap::IS_USED)) $criteria->add(CouponTableMap::IS_USED, $this->is_used);
|
if ($this->isColumnModified(CouponTableMap::IS_USED)) $criteria->add(CouponTableMap::IS_USED, $this->is_used);
|
||||||
if ($this->isColumnModified(CouponTableMap::IS_ENABLED)) $criteria->add(CouponTableMap::IS_ENABLED, $this->is_enabled);
|
if ($this->isColumnModified(CouponTableMap::IS_ENABLED)) $criteria->add(CouponTableMap::IS_ENABLED, $this->is_enabled);
|
||||||
if ($this->isColumnModified(CouponTableMap::EXPIRATION_DATE)) $criteria->add(CouponTableMap::EXPIRATION_DATE, $this->expiration_date);
|
if ($this->isColumnModified(CouponTableMap::EXPIRATION_DATE)) $criteria->add(CouponTableMap::EXPIRATION_DATE, $this->expiration_date);
|
||||||
if ($this->isColumnModified(CouponTableMap::SERIALIZED_RULES)) $criteria->add(CouponTableMap::SERIALIZED_RULES, $this->serialized_rules);
|
if ($this->isColumnModified(CouponTableMap::SERIALIZED_RULES_TYPE)) $criteria->add(CouponTableMap::SERIALIZED_RULES_TYPE, $this->serialized_rules_type);
|
||||||
|
if ($this->isColumnModified(CouponTableMap::SERIALIZED_RULES_CONTENT)) $criteria->add(CouponTableMap::SERIALIZED_RULES_CONTENT, $this->serialized_rules_content);
|
||||||
|
if ($this->isColumnModified(CouponTableMap::IS_CUMULATIVE)) $criteria->add(CouponTableMap::IS_CUMULATIVE, $this->is_cumulative);
|
||||||
|
if ($this->isColumnModified(CouponTableMap::IS_REMOVING_POSTAGE)) $criteria->add(CouponTableMap::IS_REMOVING_POSTAGE, $this->is_removing_postage);
|
||||||
if ($this->isColumnModified(CouponTableMap::CREATED_AT)) $criteria->add(CouponTableMap::CREATED_AT, $this->created_at);
|
if ($this->isColumnModified(CouponTableMap::CREATED_AT)) $criteria->add(CouponTableMap::CREATED_AT, $this->created_at);
|
||||||
if ($this->isColumnModified(CouponTableMap::UPDATED_AT)) $criteria->add(CouponTableMap::UPDATED_AT, $this->updated_at);
|
if ($this->isColumnModified(CouponTableMap::UPDATED_AT)) $criteria->add(CouponTableMap::UPDATED_AT, $this->updated_at);
|
||||||
if ($this->isColumnModified(CouponTableMap::VERSION)) $criteria->add(CouponTableMap::VERSION, $this->version);
|
if ($this->isColumnModified(CouponTableMap::VERSION)) $criteria->add(CouponTableMap::VERSION, $this->version);
|
||||||
@@ -1806,11 +1974,14 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
$copyObj->setTitle($this->getTitle());
|
$copyObj->setTitle($this->getTitle());
|
||||||
$copyObj->setShortDescription($this->getShortDescription());
|
$copyObj->setShortDescription($this->getShortDescription());
|
||||||
$copyObj->setDescription($this->getDescription());
|
$copyObj->setDescription($this->getDescription());
|
||||||
$copyObj->setValue($this->getValue());
|
$copyObj->setAmount($this->getAmount());
|
||||||
$copyObj->setIsUsed($this->getIsUsed());
|
$copyObj->setIsUsed($this->getIsUsed());
|
||||||
$copyObj->setIsEnabled($this->getIsEnabled());
|
$copyObj->setIsEnabled($this->getIsEnabled());
|
||||||
$copyObj->setExpirationDate($this->getExpirationDate());
|
$copyObj->setExpirationDate($this->getExpirationDate());
|
||||||
$copyObj->setSerializedRules($this->getSerializedRules());
|
$copyObj->setSerializedRulesType($this->getSerializedRulesType());
|
||||||
|
$copyObj->setSerializedRulesContent($this->getSerializedRulesContent());
|
||||||
|
$copyObj->setIsCumulative($this->getIsCumulative());
|
||||||
|
$copyObj->setIsRemovingPostage($this->getIsRemovingPostage());
|
||||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||||
$copyObj->setVersion($this->getVersion());
|
$copyObj->setVersion($this->getVersion());
|
||||||
@@ -2590,11 +2761,14 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
$this->title = null;
|
$this->title = null;
|
||||||
$this->short_description = null;
|
$this->short_description = null;
|
||||||
$this->description = null;
|
$this->description = null;
|
||||||
$this->value = null;
|
$this->amount = null;
|
||||||
$this->is_used = null;
|
$this->is_used = null;
|
||||||
$this->is_enabled = null;
|
$this->is_enabled = null;
|
||||||
$this->expiration_date = null;
|
$this->expiration_date = null;
|
||||||
$this->serialized_rules = null;
|
$this->serialized_rules_type = null;
|
||||||
|
$this->serialized_rules_content = null;
|
||||||
|
$this->is_cumulative = null;
|
||||||
|
$this->is_removing_postage = null;
|
||||||
$this->created_at = null;
|
$this->created_at = null;
|
||||||
$this->updated_at = null;
|
$this->updated_at = null;
|
||||||
$this->version = null;
|
$this->version = null;
|
||||||
@@ -2830,11 +3004,14 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
$version->setTitle($this->getTitle());
|
$version->setTitle($this->getTitle());
|
||||||
$version->setShortDescription($this->getShortDescription());
|
$version->setShortDescription($this->getShortDescription());
|
||||||
$version->setDescription($this->getDescription());
|
$version->setDescription($this->getDescription());
|
||||||
$version->setValue($this->getValue());
|
$version->setAmount($this->getAmount());
|
||||||
$version->setIsUsed($this->getIsUsed());
|
$version->setIsUsed($this->getIsUsed());
|
||||||
$version->setIsEnabled($this->getIsEnabled());
|
$version->setIsEnabled($this->getIsEnabled());
|
||||||
$version->setExpirationDate($this->getExpirationDate());
|
$version->setExpirationDate($this->getExpirationDate());
|
||||||
$version->setSerializedRules($this->getSerializedRules());
|
$version->setSerializedRulesType($this->getSerializedRulesType());
|
||||||
|
$version->setSerializedRulesContent($this->getSerializedRulesContent());
|
||||||
|
$version->setIsCumulative($this->getIsCumulative());
|
||||||
|
$version->setIsRemovingPostage($this->getIsRemovingPostage());
|
||||||
$version->setCreatedAt($this->getCreatedAt());
|
$version->setCreatedAt($this->getCreatedAt());
|
||||||
$version->setUpdatedAt($this->getUpdatedAt());
|
$version->setUpdatedAt($this->getUpdatedAt());
|
||||||
$version->setVersion($this->getVersion());
|
$version->setVersion($this->getVersion());
|
||||||
@@ -2881,11 +3058,14 @@ abstract class Coupon implements ActiveRecordInterface
|
|||||||
$this->setTitle($version->getTitle());
|
$this->setTitle($version->getTitle());
|
||||||
$this->setShortDescription($version->getShortDescription());
|
$this->setShortDescription($version->getShortDescription());
|
||||||
$this->setDescription($version->getDescription());
|
$this->setDescription($version->getDescription());
|
||||||
$this->setValue($version->getValue());
|
$this->setAmount($version->getAmount());
|
||||||
$this->setIsUsed($version->getIsUsed());
|
$this->setIsUsed($version->getIsUsed());
|
||||||
$this->setIsEnabled($version->getIsEnabled());
|
$this->setIsEnabled($version->getIsEnabled());
|
||||||
$this->setExpirationDate($version->getExpirationDate());
|
$this->setExpirationDate($version->getExpirationDate());
|
||||||
$this->setSerializedRules($version->getSerializedRules());
|
$this->setSerializedRulesType($version->getSerializedRulesType());
|
||||||
|
$this->setSerializedRulesContent($version->getSerializedRulesContent());
|
||||||
|
$this->setIsCumulative($version->getIsCumulative());
|
||||||
|
$this->setIsRemovingPostage($version->getIsRemovingPostage());
|
||||||
$this->setCreatedAt($version->getCreatedAt());
|
$this->setCreatedAt($version->getCreatedAt());
|
||||||
$this->setUpdatedAt($version->getUpdatedAt());
|
$this->setUpdatedAt($version->getUpdatedAt());
|
||||||
$this->setVersion($version->getVersion());
|
$this->setVersion($version->getVersion());
|
||||||
|
|||||||
1207
core/lib/Thelia/Model/Base/CouponI18n.php
Normal file
1207
core/lib/Thelia/Model/Base/CouponI18n.php
Normal file
File diff suppressed because it is too large
Load Diff
475
core/lib/Thelia/Model/Base/CouponI18nQuery.php
Normal file
475
core/lib/Thelia/Model/Base/CouponI18nQuery.php
Normal file
@@ -0,0 +1,475 @@
|
|||||||
|
<?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\CouponI18n as ChildCouponI18n;
|
||||||
|
use Thelia\Model\CouponI18nQuery as ChildCouponI18nQuery;
|
||||||
|
use Thelia\Model\Map\CouponI18nTableMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a query for the 'coupon_i18n' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @method ChildCouponI18nQuery orderById($order = Criteria::ASC) Order by the id column
|
||||||
|
* @method ChildCouponI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
|
||||||
|
*
|
||||||
|
* @method ChildCouponI18nQuery groupById() Group by the id column
|
||||||
|
* @method ChildCouponI18nQuery groupByLocale() Group by the locale column
|
||||||
|
*
|
||||||
|
* @method ChildCouponI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
|
* @method ChildCouponI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
|
* @method ChildCouponI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||||
|
*
|
||||||
|
* @method ChildCouponI18nQuery leftJoinCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the Coupon relation
|
||||||
|
* @method ChildCouponI18nQuery rightJoinCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Coupon relation
|
||||||
|
* @method ChildCouponI18nQuery innerJoinCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the Coupon relation
|
||||||
|
*
|
||||||
|
* @method ChildCouponI18n findOne(ConnectionInterface $con = null) Return the first ChildCouponI18n matching the query
|
||||||
|
* @method ChildCouponI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCouponI18n matching the query, or a new ChildCouponI18n object populated from the query conditions when no match is found
|
||||||
|
*
|
||||||
|
* @method ChildCouponI18n findOneById(int $id) Return the first ChildCouponI18n filtered by the id column
|
||||||
|
* @method ChildCouponI18n findOneByLocale(string $locale) Return the first ChildCouponI18n filtered by the locale column
|
||||||
|
*
|
||||||
|
* @method array findById(int $id) Return ChildCouponI18n objects filtered by the id column
|
||||||
|
* @method array findByLocale(string $locale) Return ChildCouponI18n objects filtered by the locale column
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
abstract class CouponI18nQuery extends ModelCriteria
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes internal state of \Thelia\Model\Base\CouponI18nQuery 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\\CouponI18n', $modelAlias = null)
|
||||||
|
{
|
||||||
|
parent::__construct($dbName, $modelName, $modelAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new ChildCouponI18nQuery object.
|
||||||
|
*
|
||||||
|
* @param string $modelAlias The alias of a model in the query
|
||||||
|
* @param Criteria $criteria Optional Criteria to build the query from
|
||||||
|
*
|
||||||
|
* @return ChildCouponI18nQuery
|
||||||
|
*/
|
||||||
|
public static function create($modelAlias = null, $criteria = null)
|
||||||
|
{
|
||||||
|
if ($criteria instanceof \Thelia\Model\CouponI18nQuery) {
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
$query = new \Thelia\Model\CouponI18nQuery();
|
||||||
|
if (null !== $modelAlias) {
|
||||||
|
$query->setModelAlias($modelAlias);
|
||||||
|
}
|
||||||
|
if ($criteria instanceof Criteria) {
|
||||||
|
$query->mergeWith($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key.
|
||||||
|
* Propel uses the instance pool to skip the database if the object exists.
|
||||||
|
* Go fast if the query is untouched.
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* $obj = $c->findPk(array(12, 34), $con);
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param array[$id, $locale] $key Primary key to use for the query
|
||||||
|
* @param ConnectionInterface $con an optional connection object
|
||||||
|
*
|
||||||
|
* @return ChildCouponI18n|array|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
public function findPk($key, $con = null)
|
||||||
|
{
|
||||||
|
if ($key === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ((null !== ($obj = CouponI18nTableMap::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(CouponI18nTableMap::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 ChildCouponI18n A model object, or null if the key is not found
|
||||||
|
*/
|
||||||
|
protected function findPkSimple($key, $con)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT ID, LOCALE FROM coupon_i18n WHERE ID = :p0 AND LOCALE = :p1';
|
||||||
|
try {
|
||||||
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
|
||||||
|
$stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
|
||||||
|
$stmt->execute();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Propel::log($e->getMessage(), Propel::LOG_ERR);
|
||||||
|
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
|
||||||
|
}
|
||||||
|
$obj = null;
|
||||||
|
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
|
||||||
|
$obj = new ChildCouponI18n();
|
||||||
|
$obj->hydrate($row);
|
||||||
|
CouponI18nTableMap::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 ChildCouponI18n|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 ChildCouponI18nQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKey($key)
|
||||||
|
{
|
||||||
|
$this->addUsingAlias(CouponI18nTableMap::ID, $key[0], Criteria::EQUAL);
|
||||||
|
$this->addUsingAlias(CouponI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a list of primary keys
|
||||||
|
*
|
||||||
|
* @param array $keys The list of primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return ChildCouponI18nQuery 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(CouponI18nTableMap::ID, $key[0], Criteria::EQUAL);
|
||||||
|
$cton1 = $this->getNewCriterion(CouponI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
|
||||||
|
$cton0->addAnd($cton1);
|
||||||
|
$this->addOr($cton0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the id column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterById(1234); // WHERE id = 1234
|
||||||
|
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
|
||||||
|
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @see filterByCoupon()
|
||||||
|
*
|
||||||
|
* @param mixed $id The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildCouponI18nQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterById($id = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($id)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($id['min'])) {
|
||||||
|
$this->addUsingAlias(CouponI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($id['max'])) {
|
||||||
|
$this->addUsingAlias(CouponI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CouponI18nTableMap::ID, $id, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the locale column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
|
||||||
|
* $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $locale The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildCouponI18nQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByLocale($locale = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($locale)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $locale)) {
|
||||||
|
$locale = str_replace('*', '%', $locale);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CouponI18nTableMap::LOCALE, $locale, $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 ChildCouponI18nQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCoupon($coupon, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($coupon instanceof \Thelia\Model\Coupon) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CouponI18nTableMap::ID, $coupon->getId(), $comparison);
|
||||||
|
} elseif ($coupon instanceof ObjectCollection) {
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CouponI18nTableMap::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 ChildCouponI18nQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinCoupon($relationAlias = null, $joinType = 'LEFT 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 = 'LEFT JOIN')
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinCoupon($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'Coupon', '\Thelia\Model\CouponQuery');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exclude object from result
|
||||||
|
*
|
||||||
|
* @param ChildCouponI18n $couponI18n Object to remove from the list of results
|
||||||
|
*
|
||||||
|
* @return ChildCouponI18nQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function prune($couponI18n = null)
|
||||||
|
{
|
||||||
|
if ($couponI18n) {
|
||||||
|
$this->addCond('pruneCond0', $this->getAliasedColName(CouponI18nTableMap::ID), $couponI18n->getId(), Criteria::NOT_EQUAL);
|
||||||
|
$this->addCond('pruneCond1', $this->getAliasedColName(CouponI18nTableMap::LOCALE), $couponI18n->getLocale(), Criteria::NOT_EQUAL);
|
||||||
|
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all rows from the coupon_i18n table.
|
||||||
|
*
|
||||||
|
* @param ConnectionInterface $con the connection to use
|
||||||
|
* @return int The number of affected rows (if supported by underlying database driver).
|
||||||
|
*/
|
||||||
|
public function doDeleteAll(ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
if (null === $con) {
|
||||||
|
$con = Propel::getServiceContainer()->getWriteConnection(CouponI18nTableMap::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).
|
||||||
|
CouponI18nTableMap::clearInstancePool();
|
||||||
|
CouponI18nTableMap::clearRelatedInstancePool();
|
||||||
|
|
||||||
|
$con->commit();
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $affectedRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs a DELETE on the database, given a ChildCouponI18n or Criteria object OR a primary key value.
|
||||||
|
*
|
||||||
|
* @param mixed $values Criteria or ChildCouponI18n 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(CouponI18nTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria = $this;
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$criteria->setDbName(CouponI18nTableMap::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();
|
||||||
|
|
||||||
|
|
||||||
|
CouponI18nTableMap::removeInstanceFromPool($criteria);
|
||||||
|
|
||||||
|
$affectedRows += ModelCriteria::delete($con);
|
||||||
|
CouponI18nTableMap::clearRelatedInstancePool();
|
||||||
|
$con->commit();
|
||||||
|
|
||||||
|
return $affectedRows;
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // CouponI18nQuery
|
||||||
@@ -28,11 +28,14 @@ use Thelia\Model\Map\CouponTableMap;
|
|||||||
* @method ChildCouponQuery orderByTitle($order = Criteria::ASC) Order by the title column
|
* @method ChildCouponQuery orderByTitle($order = Criteria::ASC) Order by the title column
|
||||||
* @method ChildCouponQuery orderByShortDescription($order = Criteria::ASC) Order by the short_description column
|
* @method ChildCouponQuery orderByShortDescription($order = Criteria::ASC) Order by the short_description column
|
||||||
* @method ChildCouponQuery orderByDescription($order = Criteria::ASC) Order by the description column
|
* @method ChildCouponQuery orderByDescription($order = Criteria::ASC) Order by the description column
|
||||||
* @method ChildCouponQuery orderByValue($order = Criteria::ASC) Order by the value column
|
* @method ChildCouponQuery orderByAmount($order = Criteria::ASC) Order by the amount column
|
||||||
* @method ChildCouponQuery orderByIsUsed($order = Criteria::ASC) Order by the is_used column
|
* @method ChildCouponQuery orderByIsUsed($order = Criteria::ASC) Order by the is_used column
|
||||||
* @method ChildCouponQuery orderByIsEnabled($order = Criteria::ASC) Order by the is_enabled column
|
* @method ChildCouponQuery orderByIsEnabled($order = Criteria::ASC) Order by the is_enabled column
|
||||||
* @method ChildCouponQuery orderByExpirationDate($order = Criteria::ASC) Order by the expiration_date column
|
* @method ChildCouponQuery orderByExpirationDate($order = Criteria::ASC) Order by the expiration_date column
|
||||||
* @method ChildCouponQuery orderBySerializedRules($order = Criteria::ASC) Order by the serialized_rules column
|
* @method ChildCouponQuery orderBySerializedRulesType($order = Criteria::ASC) Order by the serialized_rules_type column
|
||||||
|
* @method ChildCouponQuery orderBySerializedRulesContent($order = Criteria::ASC) Order by the serialized_rules_content column
|
||||||
|
* @method ChildCouponQuery orderByIsCumulative($order = Criteria::ASC) Order by the is_cumulative column
|
||||||
|
* @method ChildCouponQuery orderByIsRemovingPostage($order = Criteria::ASC) Order by the is_removing_postage column
|
||||||
* @method ChildCouponQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at 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 orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||||
* @method ChildCouponQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
* @method ChildCouponQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
||||||
@@ -43,11 +46,14 @@ use Thelia\Model\Map\CouponTableMap;
|
|||||||
* @method ChildCouponQuery groupByTitle() Group by the title column
|
* @method ChildCouponQuery groupByTitle() Group by the title column
|
||||||
* @method ChildCouponQuery groupByShortDescription() Group by the short_description column
|
* @method ChildCouponQuery groupByShortDescription() Group by the short_description column
|
||||||
* @method ChildCouponQuery groupByDescription() Group by the description column
|
* @method ChildCouponQuery groupByDescription() Group by the description column
|
||||||
* @method ChildCouponQuery groupByValue() Group by the value column
|
* @method ChildCouponQuery groupByAmount() Group by the amount column
|
||||||
* @method ChildCouponQuery groupByIsUsed() Group by the is_used column
|
* @method ChildCouponQuery groupByIsUsed() Group by the is_used column
|
||||||
* @method ChildCouponQuery groupByIsEnabled() Group by the is_enabled column
|
* @method ChildCouponQuery groupByIsEnabled() Group by the is_enabled column
|
||||||
* @method ChildCouponQuery groupByExpirationDate() Group by the expiration_date column
|
* @method ChildCouponQuery groupByExpirationDate() Group by the expiration_date column
|
||||||
* @method ChildCouponQuery groupBySerializedRules() Group by the serialized_rules column
|
* @method ChildCouponQuery groupBySerializedRulesType() Group by the serialized_rules_type column
|
||||||
|
* @method ChildCouponQuery groupBySerializedRulesContent() Group by the serialized_rules_content column
|
||||||
|
* @method ChildCouponQuery groupByIsCumulative() Group by the is_cumulative column
|
||||||
|
* @method ChildCouponQuery groupByIsRemovingPostage() Group by the is_removing_postage column
|
||||||
* @method ChildCouponQuery groupByCreatedAt() Group by the created_at column
|
* @method ChildCouponQuery groupByCreatedAt() Group by the created_at column
|
||||||
* @method ChildCouponQuery groupByUpdatedAt() Group by the updated_at column
|
* @method ChildCouponQuery groupByUpdatedAt() Group by the updated_at column
|
||||||
* @method ChildCouponQuery groupByVersion() Group by the version column
|
* @method ChildCouponQuery groupByVersion() Group by the version column
|
||||||
@@ -77,11 +83,14 @@ use Thelia\Model\Map\CouponTableMap;
|
|||||||
* @method ChildCoupon findOneByTitle(string $title) Return the first ChildCoupon filtered by the title column
|
* @method ChildCoupon findOneByTitle(string $title) Return the first ChildCoupon filtered by the title column
|
||||||
* @method ChildCoupon findOneByShortDescription(string $short_description) Return the first ChildCoupon filtered by the short_description column
|
* @method ChildCoupon findOneByShortDescription(string $short_description) Return the first ChildCoupon filtered by the short_description column
|
||||||
* @method ChildCoupon findOneByDescription(string $description) Return the first ChildCoupon filtered by the description column
|
* @method ChildCoupon findOneByDescription(string $description) Return the first ChildCoupon filtered by the description column
|
||||||
* @method ChildCoupon findOneByValue(double $value) Return the first ChildCoupon filtered by the value column
|
* @method ChildCoupon findOneByAmount(double $amount) Return the first ChildCoupon filtered by the amount column
|
||||||
* @method ChildCoupon findOneByIsUsed(int $is_used) Return the first ChildCoupon filtered by the is_used column
|
* @method ChildCoupon findOneByIsUsed(int $is_used) Return the first ChildCoupon filtered by the is_used column
|
||||||
* @method ChildCoupon findOneByIsEnabled(int $is_enabled) Return the first ChildCoupon filtered by the is_enabled column
|
* @method ChildCoupon findOneByIsEnabled(int $is_enabled) Return the first ChildCoupon filtered by the is_enabled column
|
||||||
* @method ChildCoupon findOneByExpirationDate(string $expiration_date) Return the first ChildCoupon filtered by the expiration_date column
|
* @method ChildCoupon findOneByExpirationDate(string $expiration_date) Return the first ChildCoupon filtered by the expiration_date column
|
||||||
* @method ChildCoupon findOneBySerializedRules(string $serialized_rules) Return the first ChildCoupon filtered by the serialized_rules column
|
* @method ChildCoupon findOneBySerializedRulesType(string $serialized_rules_type) Return the first ChildCoupon filtered by the serialized_rules_type column
|
||||||
|
* @method ChildCoupon findOneBySerializedRulesContent(string $serialized_rules_content) Return the first ChildCoupon filtered by the serialized_rules_content column
|
||||||
|
* @method ChildCoupon findOneByIsCumulative(int $is_cumulative) Return the first ChildCoupon filtered by the is_cumulative column
|
||||||
|
* @method ChildCoupon findOneByIsRemovingPostage(int $is_removing_postage) Return the first ChildCoupon filtered by the is_removing_postage column
|
||||||
* @method ChildCoupon findOneByCreatedAt(string $created_at) Return the first ChildCoupon filtered by the created_at 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 findOneByUpdatedAt(string $updated_at) Return the first ChildCoupon filtered by the updated_at column
|
||||||
* @method ChildCoupon findOneByVersion(int $version) Return the first ChildCoupon filtered by the version column
|
* @method ChildCoupon findOneByVersion(int $version) Return the first ChildCoupon filtered by the version column
|
||||||
@@ -92,11 +101,14 @@ use Thelia\Model\Map\CouponTableMap;
|
|||||||
* @method array findByTitle(string $title) Return ChildCoupon objects filtered by the title column
|
* @method array findByTitle(string $title) Return ChildCoupon objects filtered by the title column
|
||||||
* @method array findByShortDescription(string $short_description) Return ChildCoupon objects filtered by the short_description column
|
* @method array findByShortDescription(string $short_description) Return ChildCoupon objects filtered by the short_description column
|
||||||
* @method array findByDescription(string $description) Return ChildCoupon objects filtered by the description column
|
* @method array findByDescription(string $description) Return ChildCoupon objects filtered by the description column
|
||||||
* @method array findByValue(double $value) Return ChildCoupon objects filtered by the value column
|
* @method array findByAmount(double $amount) Return ChildCoupon objects filtered by the amount column
|
||||||
* @method array findByIsUsed(int $is_used) Return ChildCoupon objects filtered by the is_used column
|
* @method array findByIsUsed(int $is_used) Return ChildCoupon objects filtered by the is_used column
|
||||||
* @method array findByIsEnabled(int $is_enabled) Return ChildCoupon objects filtered by the is_enabled column
|
* @method array findByIsEnabled(int $is_enabled) Return ChildCoupon objects filtered by the is_enabled column
|
||||||
* @method array findByExpirationDate(string $expiration_date) Return ChildCoupon objects filtered by the expiration_date column
|
* @method array findByExpirationDate(string $expiration_date) Return ChildCoupon objects filtered by the expiration_date column
|
||||||
* @method array findBySerializedRules(string $serialized_rules) Return ChildCoupon objects filtered by the serialized_rules column
|
* @method array findBySerializedRulesType(string $serialized_rules_type) Return ChildCoupon objects filtered by the serialized_rules_type column
|
||||||
|
* @method array findBySerializedRulesContent(string $serialized_rules_content) Return ChildCoupon objects filtered by the serialized_rules_content column
|
||||||
|
* @method array findByIsCumulative(int $is_cumulative) Return ChildCoupon objects filtered by the is_cumulative column
|
||||||
|
* @method array findByIsRemovingPostage(int $is_removing_postage) Return ChildCoupon objects filtered by the is_removing_postage column
|
||||||
* @method array findByCreatedAt(string $created_at) Return ChildCoupon objects filtered by the created_at 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 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
|
* @method array findByVersion(int $version) Return ChildCoupon objects filtered by the version column
|
||||||
@@ -195,7 +207,7 @@ abstract class CouponQuery extends ModelCriteria
|
|||||||
*/
|
*/
|
||||||
protected function findPkSimple($key, $con)
|
protected function findPkSimple($key, $con)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT ID, CODE, TYPE, TITLE, SHORT_DESCRIPTION, DESCRIPTION, VALUE, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES, CREATED_AT, UPDATED_AT, VERSION FROM coupon WHERE ID = :p0';
|
$sql = 'SELECT ID, CODE, TYPE, TITLE, SHORT_DESCRIPTION, DESCRIPTION, AMOUNT, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES_TYPE, SERIALIZED_RULES_CONTENT, IS_CUMULATIVE, IS_REMOVING_POSTAGE, CREATED_AT, UPDATED_AT, VERSION FROM coupon WHERE ID = :p0';
|
||||||
try {
|
try {
|
||||||
$stmt = $con->prepare($sql);
|
$stmt = $con->prepare($sql);
|
||||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||||
@@ -471,16 +483,16 @@ abstract class CouponQuery extends ModelCriteria
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query on the value column
|
* Filter the query on the amount column
|
||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
* <code>
|
* <code>
|
||||||
* $query->filterByValue(1234); // WHERE value = 1234
|
* $query->filterByAmount(1234); // WHERE amount = 1234
|
||||||
* $query->filterByValue(array(12, 34)); // WHERE value IN (12, 34)
|
* $query->filterByAmount(array(12, 34)); // WHERE amount IN (12, 34)
|
||||||
* $query->filterByValue(array('min' => 12)); // WHERE value > 12
|
* $query->filterByAmount(array('min' => 12)); // WHERE amount > 12
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* @param mixed $value The value to use as filter.
|
* @param mixed $amount The value to use as filter.
|
||||||
* Use scalar values for equality.
|
* Use scalar values for equality.
|
||||||
* Use array values for in_array() equivalent.
|
* Use array values for in_array() equivalent.
|
||||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
@@ -488,16 +500,16 @@ abstract class CouponQuery extends ModelCriteria
|
|||||||
*
|
*
|
||||||
* @return ChildCouponQuery The current query, for fluid interface
|
* @return ChildCouponQuery The current query, for fluid interface
|
||||||
*/
|
*/
|
||||||
public function filterByValue($value = null, $comparison = null)
|
public function filterByAmount($amount = null, $comparison = null)
|
||||||
{
|
{
|
||||||
if (is_array($value)) {
|
if (is_array($amount)) {
|
||||||
$useMinMax = false;
|
$useMinMax = false;
|
||||||
if (isset($value['min'])) {
|
if (isset($amount['min'])) {
|
||||||
$this->addUsingAlias(CouponTableMap::VALUE, $value['min'], Criteria::GREATER_EQUAL);
|
$this->addUsingAlias(CouponTableMap::AMOUNT, $amount['min'], Criteria::GREATER_EQUAL);
|
||||||
$useMinMax = true;
|
$useMinMax = true;
|
||||||
}
|
}
|
||||||
if (isset($value['max'])) {
|
if (isset($amount['max'])) {
|
||||||
$this->addUsingAlias(CouponTableMap::VALUE, $value['max'], Criteria::LESS_EQUAL);
|
$this->addUsingAlias(CouponTableMap::AMOUNT, $amount['max'], Criteria::LESS_EQUAL);
|
||||||
$useMinMax = true;
|
$useMinMax = true;
|
||||||
}
|
}
|
||||||
if ($useMinMax) {
|
if ($useMinMax) {
|
||||||
@@ -508,7 +520,7 @@ abstract class CouponQuery extends ModelCriteria
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->addUsingAlias(CouponTableMap::VALUE, $value, $comparison);
|
return $this->addUsingAlias(CouponTableMap::AMOUNT, $amount, $comparison);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -637,32 +649,143 @@ abstract class CouponQuery extends ModelCriteria
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query on the serialized_rules column
|
* Filter the query on the serialized_rules_type column
|
||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
* <code>
|
* <code>
|
||||||
* $query->filterBySerializedRules('fooValue'); // WHERE serialized_rules = 'fooValue'
|
* $query->filterBySerializedRulesType('fooValue'); // WHERE serialized_rules_type = 'fooValue'
|
||||||
* $query->filterBySerializedRules('%fooValue%'); // WHERE serialized_rules LIKE '%fooValue%'
|
* $query->filterBySerializedRulesType('%fooValue%'); // WHERE serialized_rules_type LIKE '%fooValue%'
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* @param string $serializedRules The value to use as filter.
|
* @param string $serializedRulesType The value to use as filter.
|
||||||
* Accepts wildcards (* and % trigger a LIKE)
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
*
|
*
|
||||||
* @return ChildCouponQuery The current query, for fluid interface
|
* @return ChildCouponQuery The current query, for fluid interface
|
||||||
*/
|
*/
|
||||||
public function filterBySerializedRules($serializedRules = null, $comparison = null)
|
public function filterBySerializedRulesType($serializedRulesType = null, $comparison = null)
|
||||||
{
|
{
|
||||||
if (null === $comparison) {
|
if (null === $comparison) {
|
||||||
if (is_array($serializedRules)) {
|
if (is_array($serializedRulesType)) {
|
||||||
$comparison = Criteria::IN;
|
$comparison = Criteria::IN;
|
||||||
} elseif (preg_match('/[\%\*]/', $serializedRules)) {
|
} elseif (preg_match('/[\%\*]/', $serializedRulesType)) {
|
||||||
$serializedRules = str_replace('*', '%', $serializedRules);
|
$serializedRulesType = str_replace('*', '%', $serializedRulesType);
|
||||||
$comparison = Criteria::LIKE;
|
$comparison = Criteria::LIKE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->addUsingAlias(CouponTableMap::SERIALIZED_RULES, $serializedRules, $comparison);
|
return $this->addUsingAlias(CouponTableMap::SERIALIZED_RULES_TYPE, $serializedRulesType, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the serialized_rules_content column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterBySerializedRulesContent('fooValue'); // WHERE serialized_rules_content = 'fooValue'
|
||||||
|
* $query->filterBySerializedRulesContent('%fooValue%'); // WHERE serialized_rules_content LIKE '%fooValue%'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $serializedRulesContent The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildCouponQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterBySerializedRulesContent($serializedRulesContent = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($serializedRulesContent)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $serializedRulesContent)) {
|
||||||
|
$serializedRulesContent = str_replace('*', '%', $serializedRulesContent);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CouponTableMap::SERIALIZED_RULES_CONTENT, $serializedRulesContent, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the is_cumulative column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByIsCumulative(1234); // WHERE is_cumulative = 1234
|
||||||
|
* $query->filterByIsCumulative(array(12, 34)); // WHERE is_cumulative IN (12, 34)
|
||||||
|
* $query->filterByIsCumulative(array('min' => 12)); // WHERE is_cumulative > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $isCumulative The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildCouponQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByIsCumulative($isCumulative = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($isCumulative)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($isCumulative['min'])) {
|
||||||
|
$this->addUsingAlias(CouponTableMap::IS_CUMULATIVE, $isCumulative['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($isCumulative['max'])) {
|
||||||
|
$this->addUsingAlias(CouponTableMap::IS_CUMULATIVE, $isCumulative['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CouponTableMap::IS_CUMULATIVE, $isCumulative, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the is_removing_postage column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByIsRemovingPostage(1234); // WHERE is_removing_postage = 1234
|
||||||
|
* $query->filterByIsRemovingPostage(array(12, 34)); // WHERE is_removing_postage IN (12, 34)
|
||||||
|
* $query->filterByIsRemovingPostage(array('min' => 12)); // WHERE is_removing_postage > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $isRemovingPostage The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildCouponQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByIsRemovingPostage($isRemovingPostage = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($isRemovingPostage)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($isRemovingPostage['min'])) {
|
||||||
|
$this->addUsingAlias(CouponTableMap::IS_REMOVING_POSTAGE, $isRemovingPostage['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($isRemovingPostage['max'])) {
|
||||||
|
$this->addUsingAlias(CouponTableMap::IS_REMOVING_POSTAGE, $isRemovingPostage['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CouponTableMap::IS_REMOVING_POSTAGE, $isRemovingPostage, $comparison);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
2115
core/lib/Thelia/Model/Base/CouponVersion.php
Normal file
2115
core/lib/Thelia/Model/Base/CouponVersion.php
Normal file
File diff suppressed because it is too large
Load Diff
1084
core/lib/Thelia/Model/Base/CouponVersionQuery.php
Normal file
1084
core/lib/Thelia/Model/Base/CouponVersionQuery.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -23,11 +23,11 @@ use Thelia\Model\CartItem as ChildCartItem;
|
|||||||
use Thelia\Model\CartItemQuery as ChildCartItemQuery;
|
use Thelia\Model\CartItemQuery as ChildCartItemQuery;
|
||||||
use Thelia\Model\Category as ChildCategory;
|
use Thelia\Model\Category as ChildCategory;
|
||||||
use Thelia\Model\CategoryQuery as ChildCategoryQuery;
|
use Thelia\Model\CategoryQuery as ChildCategoryQuery;
|
||||||
use Thelia\Model\ContentAssoc as ChildContentAssoc;
|
|
||||||
use Thelia\Model\ContentAssocQuery as ChildContentAssocQuery;
|
|
||||||
use Thelia\Model\FeatureProduct as ChildFeatureProduct;
|
use Thelia\Model\FeatureProduct as ChildFeatureProduct;
|
||||||
use Thelia\Model\FeatureProductQuery as ChildFeatureProductQuery;
|
use Thelia\Model\FeatureProductQuery as ChildFeatureProductQuery;
|
||||||
use Thelia\Model\Product as ChildProduct;
|
use Thelia\Model\Product as ChildProduct;
|
||||||
|
use Thelia\Model\ProductAssociatedContent as ChildProductAssociatedContent;
|
||||||
|
use Thelia\Model\ProductAssociatedContentQuery as ChildProductAssociatedContentQuery;
|
||||||
use Thelia\Model\ProductCategory as ChildProductCategory;
|
use Thelia\Model\ProductCategory as ChildProductCategory;
|
||||||
use Thelia\Model\ProductCategoryQuery as ChildProductCategoryQuery;
|
use Thelia\Model\ProductCategoryQuery as ChildProductCategoryQuery;
|
||||||
use Thelia\Model\ProductDocument as ChildProductDocument;
|
use Thelia\Model\ProductDocument as ChildProductDocument;
|
||||||
@@ -167,12 +167,6 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
protected $collProductSaleElementss;
|
protected $collProductSaleElementss;
|
||||||
protected $collProductSaleElementssPartial;
|
protected $collProductSaleElementssPartial;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var ObjectCollection|ChildContentAssoc[] Collection to store aggregation of ChildContentAssoc objects.
|
|
||||||
*/
|
|
||||||
protected $collContentAssocs;
|
|
||||||
protected $collContentAssocsPartial;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ObjectCollection|ChildProductImage[] Collection to store aggregation of ChildProductImage objects.
|
* @var ObjectCollection|ChildProductImage[] Collection to store aggregation of ChildProductImage objects.
|
||||||
*/
|
*/
|
||||||
@@ -209,6 +203,12 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
protected $collCartItems;
|
protected $collCartItems;
|
||||||
protected $collCartItemsPartial;
|
protected $collCartItemsPartial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ObjectCollection|ChildProductAssociatedContent[] Collection to store aggregation of ChildProductAssociatedContent objects.
|
||||||
|
*/
|
||||||
|
protected $collProductAssociatedContents;
|
||||||
|
protected $collProductAssociatedContentsPartial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ObjectCollection|ChildProductI18n[] Collection to store aggregation of ChildProductI18n objects.
|
* @var ObjectCollection|ChildProductI18n[] Collection to store aggregation of ChildProductI18n objects.
|
||||||
*/
|
*/
|
||||||
@@ -302,12 +302,6 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
*/
|
*/
|
||||||
protected $productSaleElementssScheduledForDeletion = null;
|
protected $productSaleElementssScheduledForDeletion = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* An array of objects scheduled for deletion.
|
|
||||||
* @var ObjectCollection
|
|
||||||
*/
|
|
||||||
protected $contentAssocsScheduledForDeletion = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of objects scheduled for deletion.
|
* An array of objects scheduled for deletion.
|
||||||
* @var ObjectCollection
|
* @var ObjectCollection
|
||||||
@@ -344,6 +338,12 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
*/
|
*/
|
||||||
protected $cartItemsScheduledForDeletion = null;
|
protected $cartItemsScheduledForDeletion = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of objects scheduled for deletion.
|
||||||
|
* @var ObjectCollection
|
||||||
|
*/
|
||||||
|
protected $productAssociatedContentsScheduledForDeletion = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of objects scheduled for deletion.
|
* An array of objects scheduled for deletion.
|
||||||
* @var ObjectCollection
|
* @var ObjectCollection
|
||||||
@@ -1137,8 +1137,6 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
|
|
||||||
$this->collProductSaleElementss = null;
|
$this->collProductSaleElementss = null;
|
||||||
|
|
||||||
$this->collContentAssocs = null;
|
|
||||||
|
|
||||||
$this->collProductImages = null;
|
$this->collProductImages = null;
|
||||||
|
|
||||||
$this->collProductDocuments = null;
|
$this->collProductDocuments = null;
|
||||||
@@ -1151,6 +1149,8 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
|
|
||||||
$this->collCartItems = null;
|
$this->collCartItems = null;
|
||||||
|
|
||||||
|
$this->collProductAssociatedContents = null;
|
||||||
|
|
||||||
$this->collProductI18ns = null;
|
$this->collProductI18ns = null;
|
||||||
|
|
||||||
$this->collProductVersions = null;
|
$this->collProductVersions = null;
|
||||||
@@ -1447,23 +1447,6 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->contentAssocsScheduledForDeletion !== null) {
|
|
||||||
if (!$this->contentAssocsScheduledForDeletion->isEmpty()) {
|
|
||||||
\Thelia\Model\ContentAssocQuery::create()
|
|
||||||
->filterByPrimaryKeys($this->contentAssocsScheduledForDeletion->getPrimaryKeys(false))
|
|
||||||
->delete($con);
|
|
||||||
$this->contentAssocsScheduledForDeletion = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->collContentAssocs !== null) {
|
|
||||||
foreach ($this->collContentAssocs as $referrerFK) {
|
|
||||||
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
|
||||||
$affectedRows += $referrerFK->save($con);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->productImagesScheduledForDeletion !== null) {
|
if ($this->productImagesScheduledForDeletion !== null) {
|
||||||
if (!$this->productImagesScheduledForDeletion->isEmpty()) {
|
if (!$this->productImagesScheduledForDeletion->isEmpty()) {
|
||||||
\Thelia\Model\ProductImageQuery::create()
|
\Thelia\Model\ProductImageQuery::create()
|
||||||
@@ -1566,6 +1549,23 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->productAssociatedContentsScheduledForDeletion !== null) {
|
||||||
|
if (!$this->productAssociatedContentsScheduledForDeletion->isEmpty()) {
|
||||||
|
\Thelia\Model\ProductAssociatedContentQuery::create()
|
||||||
|
->filterByPrimaryKeys($this->productAssociatedContentsScheduledForDeletion->getPrimaryKeys(false))
|
||||||
|
->delete($con);
|
||||||
|
$this->productAssociatedContentsScheduledForDeletion = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->collProductAssociatedContents !== null) {
|
||||||
|
foreach ($this->collProductAssociatedContents as $referrerFK) {
|
||||||
|
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
||||||
|
$affectedRows += $referrerFK->save($con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->productI18nsScheduledForDeletion !== null) {
|
if ($this->productI18nsScheduledForDeletion !== null) {
|
||||||
if (!$this->productI18nsScheduledForDeletion->isEmpty()) {
|
if (!$this->productI18nsScheduledForDeletion->isEmpty()) {
|
||||||
\Thelia\Model\ProductI18nQuery::create()
|
\Thelia\Model\ProductI18nQuery::create()
|
||||||
@@ -1848,9 +1848,6 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
if (null !== $this->collProductSaleElementss) {
|
if (null !== $this->collProductSaleElementss) {
|
||||||
$result['ProductSaleElementss'] = $this->collProductSaleElementss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
$result['ProductSaleElementss'] = $this->collProductSaleElementss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
}
|
}
|
||||||
if (null !== $this->collContentAssocs) {
|
|
||||||
$result['ContentAssocs'] = $this->collContentAssocs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
|
||||||
}
|
|
||||||
if (null !== $this->collProductImages) {
|
if (null !== $this->collProductImages) {
|
||||||
$result['ProductImages'] = $this->collProductImages->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
$result['ProductImages'] = $this->collProductImages->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
}
|
}
|
||||||
@@ -1869,6 +1866,9 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
if (null !== $this->collCartItems) {
|
if (null !== $this->collCartItems) {
|
||||||
$result['CartItems'] = $this->collCartItems->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
$result['CartItems'] = $this->collCartItems->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
}
|
}
|
||||||
|
if (null !== $this->collProductAssociatedContents) {
|
||||||
|
$result['ProductAssociatedContents'] = $this->collProductAssociatedContents->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
|
}
|
||||||
if (null !== $this->collProductI18ns) {
|
if (null !== $this->collProductI18ns) {
|
||||||
$result['ProductI18ns'] = $this->collProductI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
$result['ProductI18ns'] = $this->collProductI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
}
|
}
|
||||||
@@ -2090,12 +2090,6 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->getContentAssocs() as $relObj) {
|
|
||||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
|
||||||
$copyObj->addContentAssoc($relObj->copy($deepCopy));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($this->getProductImages() as $relObj) {
|
foreach ($this->getProductImages() as $relObj) {
|
||||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||||
$copyObj->addProductImage($relObj->copy($deepCopy));
|
$copyObj->addProductImage($relObj->copy($deepCopy));
|
||||||
@@ -2132,6 +2126,12 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($this->getProductAssociatedContents() as $relObj) {
|
||||||
|
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||||
|
$copyObj->addProductAssociatedContent($relObj->copy($deepCopy));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->getProductI18ns() as $relObj) {
|
foreach ($this->getProductI18ns() as $relObj) {
|
||||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||||
$copyObj->addProductI18n($relObj->copy($deepCopy));
|
$copyObj->addProductI18n($relObj->copy($deepCopy));
|
||||||
@@ -2245,9 +2245,6 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
if ('ProductSaleElements' == $relationName) {
|
if ('ProductSaleElements' == $relationName) {
|
||||||
return $this->initProductSaleElementss();
|
return $this->initProductSaleElementss();
|
||||||
}
|
}
|
||||||
if ('ContentAssoc' == $relationName) {
|
|
||||||
return $this->initContentAssocs();
|
|
||||||
}
|
|
||||||
if ('ProductImage' == $relationName) {
|
if ('ProductImage' == $relationName) {
|
||||||
return $this->initProductImages();
|
return $this->initProductImages();
|
||||||
}
|
}
|
||||||
@@ -2266,6 +2263,9 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
if ('CartItem' == $relationName) {
|
if ('CartItem' == $relationName) {
|
||||||
return $this->initCartItems();
|
return $this->initCartItems();
|
||||||
}
|
}
|
||||||
|
if ('ProductAssociatedContent' == $relationName) {
|
||||||
|
return $this->initProductAssociatedContents();
|
||||||
|
}
|
||||||
if ('ProductI18n' == $relationName) {
|
if ('ProductI18n' == $relationName) {
|
||||||
return $this->initProductI18ns();
|
return $this->initProductI18ns();
|
||||||
}
|
}
|
||||||
@@ -3006,274 +3006,6 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears out the collContentAssocs collection
|
|
||||||
*
|
|
||||||
* This does not modify the database; however, it will remove any associated objects, causing
|
|
||||||
* them to be refetched by subsequent calls to accessor method.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @see addContentAssocs()
|
|
||||||
*/
|
|
||||||
public function clearContentAssocs()
|
|
||||||
{
|
|
||||||
$this->collContentAssocs = null; // important to set this to NULL since that means it is uninitialized
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset is the collContentAssocs collection loaded partially.
|
|
||||||
*/
|
|
||||||
public function resetPartialContentAssocs($v = true)
|
|
||||||
{
|
|
||||||
$this->collContentAssocsPartial = $v;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the collContentAssocs collection.
|
|
||||||
*
|
|
||||||
* By default this just sets the collContentAssocs collection to an empty array (like clearcollContentAssocs());
|
|
||||||
* however, you may wish to override this method in your stub class to provide setting appropriate
|
|
||||||
* to your application -- for example, setting the initial array to the values stored in database.
|
|
||||||
*
|
|
||||||
* @param boolean $overrideExisting If set to true, the method call initializes
|
|
||||||
* the collection even if it is not empty
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function initContentAssocs($overrideExisting = true)
|
|
||||||
{
|
|
||||||
if (null !== $this->collContentAssocs && !$overrideExisting) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$this->collContentAssocs = new ObjectCollection();
|
|
||||||
$this->collContentAssocs->setModel('\Thelia\Model\ContentAssoc');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets an array of ChildContentAssoc objects which contain a foreign key that references this object.
|
|
||||||
*
|
|
||||||
* If the $criteria is not null, it is used to always fetch the results from the database.
|
|
||||||
* Otherwise the results are fetched from the database the first time, then cached.
|
|
||||||
* Next time the same method is called without $criteria, the cached collection is returned.
|
|
||||||
* If this ChildProduct is new, it will return
|
|
||||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
|
||||||
*
|
|
||||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
|
||||||
* @param ConnectionInterface $con optional connection object
|
|
||||||
* @return Collection|ChildContentAssoc[] List of ChildContentAssoc objects
|
|
||||||
* @throws PropelException
|
|
||||||
*/
|
|
||||||
public function getContentAssocs($criteria = null, ConnectionInterface $con = null)
|
|
||||||
{
|
|
||||||
$partial = $this->collContentAssocsPartial && !$this->isNew();
|
|
||||||
if (null === $this->collContentAssocs || null !== $criteria || $partial) {
|
|
||||||
if ($this->isNew() && null === $this->collContentAssocs) {
|
|
||||||
// return empty collection
|
|
||||||
$this->initContentAssocs();
|
|
||||||
} else {
|
|
||||||
$collContentAssocs = ChildContentAssocQuery::create(null, $criteria)
|
|
||||||
->filterByProduct($this)
|
|
||||||
->find($con);
|
|
||||||
|
|
||||||
if (null !== $criteria) {
|
|
||||||
if (false !== $this->collContentAssocsPartial && count($collContentAssocs)) {
|
|
||||||
$this->initContentAssocs(false);
|
|
||||||
|
|
||||||
foreach ($collContentAssocs as $obj) {
|
|
||||||
if (false == $this->collContentAssocs->contains($obj)) {
|
|
||||||
$this->collContentAssocs->append($obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->collContentAssocsPartial = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$collContentAssocs->getInternalIterator()->rewind();
|
|
||||||
|
|
||||||
return $collContentAssocs;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($partial && $this->collContentAssocs) {
|
|
||||||
foreach ($this->collContentAssocs as $obj) {
|
|
||||||
if ($obj->isNew()) {
|
|
||||||
$collContentAssocs[] = $obj;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->collContentAssocs = $collContentAssocs;
|
|
||||||
$this->collContentAssocsPartial = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->collContentAssocs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets a collection of ContentAssoc objects related by a one-to-many relationship
|
|
||||||
* to the current object.
|
|
||||||
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
|
|
||||||
* and new objects from the given Propel collection.
|
|
||||||
*
|
|
||||||
* @param Collection $contentAssocs A Propel collection.
|
|
||||||
* @param ConnectionInterface $con Optional connection object
|
|
||||||
* @return ChildProduct The current object (for fluent API support)
|
|
||||||
*/
|
|
||||||
public function setContentAssocs(Collection $contentAssocs, ConnectionInterface $con = null)
|
|
||||||
{
|
|
||||||
$contentAssocsToDelete = $this->getContentAssocs(new Criteria(), $con)->diff($contentAssocs);
|
|
||||||
|
|
||||||
|
|
||||||
$this->contentAssocsScheduledForDeletion = $contentAssocsToDelete;
|
|
||||||
|
|
||||||
foreach ($contentAssocsToDelete as $contentAssocRemoved) {
|
|
||||||
$contentAssocRemoved->setProduct(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->collContentAssocs = null;
|
|
||||||
foreach ($contentAssocs as $contentAssoc) {
|
|
||||||
$this->addContentAssoc($contentAssoc);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->collContentAssocs = $contentAssocs;
|
|
||||||
$this->collContentAssocsPartial = false;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the number of related ContentAssoc objects.
|
|
||||||
*
|
|
||||||
* @param Criteria $criteria
|
|
||||||
* @param boolean $distinct
|
|
||||||
* @param ConnectionInterface $con
|
|
||||||
* @return int Count of related ContentAssoc objects.
|
|
||||||
* @throws PropelException
|
|
||||||
*/
|
|
||||||
public function countContentAssocs(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
|
||||||
{
|
|
||||||
$partial = $this->collContentAssocsPartial && !$this->isNew();
|
|
||||||
if (null === $this->collContentAssocs || null !== $criteria || $partial) {
|
|
||||||
if ($this->isNew() && null === $this->collContentAssocs) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($partial && !$criteria) {
|
|
||||||
return count($this->getContentAssocs());
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = ChildContentAssocQuery::create(null, $criteria);
|
|
||||||
if ($distinct) {
|
|
||||||
$query->distinct();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $query
|
|
||||||
->filterByProduct($this)
|
|
||||||
->count($con);
|
|
||||||
}
|
|
||||||
|
|
||||||
return count($this->collContentAssocs);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method called to associate a ChildContentAssoc object to this object
|
|
||||||
* through the ChildContentAssoc foreign key attribute.
|
|
||||||
*
|
|
||||||
* @param ChildContentAssoc $l ChildContentAssoc
|
|
||||||
* @return \Thelia\Model\Product The current object (for fluent API support)
|
|
||||||
*/
|
|
||||||
public function addContentAssoc(ChildContentAssoc $l)
|
|
||||||
{
|
|
||||||
if ($this->collContentAssocs === null) {
|
|
||||||
$this->initContentAssocs();
|
|
||||||
$this->collContentAssocsPartial = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!in_array($l, $this->collContentAssocs->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
|
||||||
$this->doAddContentAssoc($l);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ContentAssoc $contentAssoc The contentAssoc object to add.
|
|
||||||
*/
|
|
||||||
protected function doAddContentAssoc($contentAssoc)
|
|
||||||
{
|
|
||||||
$this->collContentAssocs[]= $contentAssoc;
|
|
||||||
$contentAssoc->setProduct($this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ContentAssoc $contentAssoc The contentAssoc object to remove.
|
|
||||||
* @return ChildProduct The current object (for fluent API support)
|
|
||||||
*/
|
|
||||||
public function removeContentAssoc($contentAssoc)
|
|
||||||
{
|
|
||||||
if ($this->getContentAssocs()->contains($contentAssoc)) {
|
|
||||||
$this->collContentAssocs->remove($this->collContentAssocs->search($contentAssoc));
|
|
||||||
if (null === $this->contentAssocsScheduledForDeletion) {
|
|
||||||
$this->contentAssocsScheduledForDeletion = clone $this->collContentAssocs;
|
|
||||||
$this->contentAssocsScheduledForDeletion->clear();
|
|
||||||
}
|
|
||||||
$this->contentAssocsScheduledForDeletion[]= $contentAssoc;
|
|
||||||
$contentAssoc->setProduct(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If this collection has already been initialized with
|
|
||||||
* an identical criteria, it returns the collection.
|
|
||||||
* Otherwise if this Product is new, it will return
|
|
||||||
* an empty collection; or if this Product has previously
|
|
||||||
* been saved, it will retrieve related ContentAssocs from storage.
|
|
||||||
*
|
|
||||||
* This method is protected by default in order to keep the public
|
|
||||||
* api reasonable. You can provide public methods for those you
|
|
||||||
* actually need in Product.
|
|
||||||
*
|
|
||||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
|
||||||
* @param ConnectionInterface $con optional connection object
|
|
||||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
|
||||||
* @return Collection|ChildContentAssoc[] List of ChildContentAssoc objects
|
|
||||||
*/
|
|
||||||
public function getContentAssocsJoinCategory($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
|
||||||
{
|
|
||||||
$query = ChildContentAssocQuery::create(null, $criteria);
|
|
||||||
$query->joinWith('Category', $joinBehavior);
|
|
||||||
|
|
||||||
return $this->getContentAssocs($query, $con);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If this collection has already been initialized with
|
|
||||||
* an identical criteria, it returns the collection.
|
|
||||||
* Otherwise if this Product is new, it will return
|
|
||||||
* an empty collection; or if this Product has previously
|
|
||||||
* been saved, it will retrieve related ContentAssocs from storage.
|
|
||||||
*
|
|
||||||
* This method is protected by default in order to keep the public
|
|
||||||
* api reasonable. You can provide public methods for those you
|
|
||||||
* actually need in Product.
|
|
||||||
*
|
|
||||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
|
||||||
* @param ConnectionInterface $con optional connection object
|
|
||||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
|
||||||
* @return Collection|ChildContentAssoc[] List of ChildContentAssoc objects
|
|
||||||
*/
|
|
||||||
public function getContentAssocsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
|
||||||
{
|
|
||||||
$query = ChildContentAssocQuery::create(null, $criteria);
|
|
||||||
$query->joinWith('Content', $joinBehavior);
|
|
||||||
|
|
||||||
return $this->getContentAssocs($query, $con);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears out the collProductImages collection
|
* Clears out the collProductImages collection
|
||||||
*
|
*
|
||||||
@@ -4707,6 +4439,249 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
return $this->getCartItems($query, $con);
|
return $this->getCartItems($query, $con);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears out the collProductAssociatedContents collection
|
||||||
|
*
|
||||||
|
* This does not modify the database; however, it will remove any associated objects, causing
|
||||||
|
* them to be refetched by subsequent calls to accessor method.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @see addProductAssociatedContents()
|
||||||
|
*/
|
||||||
|
public function clearProductAssociatedContents()
|
||||||
|
{
|
||||||
|
$this->collProductAssociatedContents = null; // important to set this to NULL since that means it is uninitialized
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset is the collProductAssociatedContents collection loaded partially.
|
||||||
|
*/
|
||||||
|
public function resetPartialProductAssociatedContents($v = true)
|
||||||
|
{
|
||||||
|
$this->collProductAssociatedContentsPartial = $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the collProductAssociatedContents collection.
|
||||||
|
*
|
||||||
|
* By default this just sets the collProductAssociatedContents collection to an empty array (like clearcollProductAssociatedContents());
|
||||||
|
* however, you may wish to override this method in your stub class to provide setting appropriate
|
||||||
|
* to your application -- for example, setting the initial array to the values stored in database.
|
||||||
|
*
|
||||||
|
* @param boolean $overrideExisting If set to true, the method call initializes
|
||||||
|
* the collection even if it is not empty
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function initProductAssociatedContents($overrideExisting = true)
|
||||||
|
{
|
||||||
|
if (null !== $this->collProductAssociatedContents && !$overrideExisting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->collProductAssociatedContents = new ObjectCollection();
|
||||||
|
$this->collProductAssociatedContents->setModel('\Thelia\Model\ProductAssociatedContent');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an array of ChildProductAssociatedContent objects which contain a foreign key that references this object.
|
||||||
|
*
|
||||||
|
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||||
|
* Otherwise the results are fetched from the database the first time, then cached.
|
||||||
|
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||||
|
* If this ChildProduct is new, it will return
|
||||||
|
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||||
|
* @param ConnectionInterface $con optional connection object
|
||||||
|
* @return Collection|ChildProductAssociatedContent[] List of ChildProductAssociatedContent objects
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function getProductAssociatedContents($criteria = null, ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collProductAssociatedContentsPartial && !$this->isNew();
|
||||||
|
if (null === $this->collProductAssociatedContents || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collProductAssociatedContents) {
|
||||||
|
// return empty collection
|
||||||
|
$this->initProductAssociatedContents();
|
||||||
|
} else {
|
||||||
|
$collProductAssociatedContents = ChildProductAssociatedContentQuery::create(null, $criteria)
|
||||||
|
->filterByProduct($this)
|
||||||
|
->find($con);
|
||||||
|
|
||||||
|
if (null !== $criteria) {
|
||||||
|
if (false !== $this->collProductAssociatedContentsPartial && count($collProductAssociatedContents)) {
|
||||||
|
$this->initProductAssociatedContents(false);
|
||||||
|
|
||||||
|
foreach ($collProductAssociatedContents as $obj) {
|
||||||
|
if (false == $this->collProductAssociatedContents->contains($obj)) {
|
||||||
|
$this->collProductAssociatedContents->append($obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collProductAssociatedContentsPartial = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$collProductAssociatedContents->getInternalIterator()->rewind();
|
||||||
|
|
||||||
|
return $collProductAssociatedContents;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($partial && $this->collProductAssociatedContents) {
|
||||||
|
foreach ($this->collProductAssociatedContents as $obj) {
|
||||||
|
if ($obj->isNew()) {
|
||||||
|
$collProductAssociatedContents[] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collProductAssociatedContents = $collProductAssociatedContents;
|
||||||
|
$this->collProductAssociatedContentsPartial = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->collProductAssociatedContents;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a collection of ProductAssociatedContent objects related by a one-to-many relationship
|
||||||
|
* to the current object.
|
||||||
|
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
|
||||||
|
* and new objects from the given Propel collection.
|
||||||
|
*
|
||||||
|
* @param Collection $productAssociatedContents A Propel collection.
|
||||||
|
* @param ConnectionInterface $con Optional connection object
|
||||||
|
* @return ChildProduct The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setProductAssociatedContents(Collection $productAssociatedContents, ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$productAssociatedContentsToDelete = $this->getProductAssociatedContents(new Criteria(), $con)->diff($productAssociatedContents);
|
||||||
|
|
||||||
|
|
||||||
|
$this->productAssociatedContentsScheduledForDeletion = $productAssociatedContentsToDelete;
|
||||||
|
|
||||||
|
foreach ($productAssociatedContentsToDelete as $productAssociatedContentRemoved) {
|
||||||
|
$productAssociatedContentRemoved->setProduct(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collProductAssociatedContents = null;
|
||||||
|
foreach ($productAssociatedContents as $productAssociatedContent) {
|
||||||
|
$this->addProductAssociatedContent($productAssociatedContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collProductAssociatedContents = $productAssociatedContents;
|
||||||
|
$this->collProductAssociatedContentsPartial = false;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of related ProductAssociatedContent objects.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct
|
||||||
|
* @param ConnectionInterface $con
|
||||||
|
* @return int Count of related ProductAssociatedContent objects.
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function countProductAssociatedContents(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collProductAssociatedContentsPartial && !$this->isNew();
|
||||||
|
if (null === $this->collProductAssociatedContents || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collProductAssociatedContents) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($partial && !$criteria) {
|
||||||
|
return count($this->getProductAssociatedContents());
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = ChildProductAssociatedContentQuery::create(null, $criteria);
|
||||||
|
if ($distinct) {
|
||||||
|
$query->distinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query
|
||||||
|
->filterByProduct($this)
|
||||||
|
->count($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
return count($this->collProductAssociatedContents);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method called to associate a ChildProductAssociatedContent object to this object
|
||||||
|
* through the ChildProductAssociatedContent foreign key attribute.
|
||||||
|
*
|
||||||
|
* @param ChildProductAssociatedContent $l ChildProductAssociatedContent
|
||||||
|
* @return \Thelia\Model\Product The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function addProductAssociatedContent(ChildProductAssociatedContent $l)
|
||||||
|
{
|
||||||
|
if ($this->collProductAssociatedContents === null) {
|
||||||
|
$this->initProductAssociatedContents();
|
||||||
|
$this->collProductAssociatedContentsPartial = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!in_array($l, $this->collProductAssociatedContents->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||||
|
$this->doAddProductAssociatedContent($l);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ProductAssociatedContent $productAssociatedContent The productAssociatedContent object to add.
|
||||||
|
*/
|
||||||
|
protected function doAddProductAssociatedContent($productAssociatedContent)
|
||||||
|
{
|
||||||
|
$this->collProductAssociatedContents[]= $productAssociatedContent;
|
||||||
|
$productAssociatedContent->setProduct($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ProductAssociatedContent $productAssociatedContent The productAssociatedContent object to remove.
|
||||||
|
* @return ChildProduct The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function removeProductAssociatedContent($productAssociatedContent)
|
||||||
|
{
|
||||||
|
if ($this->getProductAssociatedContents()->contains($productAssociatedContent)) {
|
||||||
|
$this->collProductAssociatedContents->remove($this->collProductAssociatedContents->search($productAssociatedContent));
|
||||||
|
if (null === $this->productAssociatedContentsScheduledForDeletion) {
|
||||||
|
$this->productAssociatedContentsScheduledForDeletion = clone $this->collProductAssociatedContents;
|
||||||
|
$this->productAssociatedContentsScheduledForDeletion->clear();
|
||||||
|
}
|
||||||
|
$this->productAssociatedContentsScheduledForDeletion[]= clone $productAssociatedContent;
|
||||||
|
$productAssociatedContent->setProduct(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If this collection has already been initialized with
|
||||||
|
* an identical criteria, it returns the collection.
|
||||||
|
* Otherwise if this Product is new, it will return
|
||||||
|
* an empty collection; or if this Product has previously
|
||||||
|
* been saved, it will retrieve related ProductAssociatedContents from storage.
|
||||||
|
*
|
||||||
|
* This method is protected by default in order to keep the public
|
||||||
|
* api reasonable. You can provide public methods for those you
|
||||||
|
* actually need in Product.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||||
|
* @param ConnectionInterface $con optional connection object
|
||||||
|
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||||
|
* @return Collection|ChildProductAssociatedContent[] List of ChildProductAssociatedContent objects
|
||||||
|
*/
|
||||||
|
public function getProductAssociatedContentsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$query = ChildProductAssociatedContentQuery::create(null, $criteria);
|
||||||
|
$query->joinWith('Content', $joinBehavior);
|
||||||
|
|
||||||
|
return $this->getProductAssociatedContents($query, $con);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears out the collProductI18ns collection
|
* Clears out the collProductI18ns collection
|
||||||
*
|
*
|
||||||
@@ -5752,11 +5727,6 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
$o->clearAllReferences($deep);
|
$o->clearAllReferences($deep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($this->collContentAssocs) {
|
|
||||||
foreach ($this->collContentAssocs as $o) {
|
|
||||||
$o->clearAllReferences($deep);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($this->collProductImages) {
|
if ($this->collProductImages) {
|
||||||
foreach ($this->collProductImages as $o) {
|
foreach ($this->collProductImages as $o) {
|
||||||
$o->clearAllReferences($deep);
|
$o->clearAllReferences($deep);
|
||||||
@@ -5787,6 +5757,11 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
$o->clearAllReferences($deep);
|
$o->clearAllReferences($deep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->collProductAssociatedContents) {
|
||||||
|
foreach ($this->collProductAssociatedContents as $o) {
|
||||||
|
$o->clearAllReferences($deep);
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($this->collProductI18ns) {
|
if ($this->collProductI18ns) {
|
||||||
foreach ($this->collProductI18ns as $o) {
|
foreach ($this->collProductI18ns as $o) {
|
||||||
$o->clearAllReferences($deep);
|
$o->clearAllReferences($deep);
|
||||||
@@ -5830,10 +5805,6 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
$this->collProductSaleElementss->clearIterator();
|
$this->collProductSaleElementss->clearIterator();
|
||||||
}
|
}
|
||||||
$this->collProductSaleElementss = null;
|
$this->collProductSaleElementss = null;
|
||||||
if ($this->collContentAssocs instanceof Collection) {
|
|
||||||
$this->collContentAssocs->clearIterator();
|
|
||||||
}
|
|
||||||
$this->collContentAssocs = null;
|
|
||||||
if ($this->collProductImages instanceof Collection) {
|
if ($this->collProductImages instanceof Collection) {
|
||||||
$this->collProductImages->clearIterator();
|
$this->collProductImages->clearIterator();
|
||||||
}
|
}
|
||||||
@@ -5858,6 +5829,10 @@ abstract class Product implements ActiveRecordInterface
|
|||||||
$this->collCartItems->clearIterator();
|
$this->collCartItems->clearIterator();
|
||||||
}
|
}
|
||||||
$this->collCartItems = null;
|
$this->collCartItems = null;
|
||||||
|
if ($this->collProductAssociatedContents instanceof Collection) {
|
||||||
|
$this->collProductAssociatedContents->clearIterator();
|
||||||
|
}
|
||||||
|
$this->collProductAssociatedContents = null;
|
||||||
if ($this->collProductI18ns instanceof Collection) {
|
if ($this->collProductI18ns instanceof Collection) {
|
||||||
$this->collProductI18ns->clearIterator();
|
$this->collProductI18ns->clearIterator();
|
||||||
}
|
}
|
||||||
|
|||||||
1553
core/lib/Thelia/Model/Base/ProductAssociatedContent.php
Normal file
1553
core/lib/Thelia/Model/Base/ProductAssociatedContent.php
Normal file
File diff suppressed because it is too large
Load Diff
804
core/lib/Thelia/Model/Base/ProductAssociatedContentQuery.php
Normal file
804
core/lib/Thelia/Model/Base/ProductAssociatedContentQuery.php
Normal file
@@ -0,0 +1,804 @@
|
|||||||
|
<?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\ProductAssociatedContent as ChildProductAssociatedContent;
|
||||||
|
use Thelia\Model\ProductAssociatedContentQuery as ChildProductAssociatedContentQuery;
|
||||||
|
use Thelia\Model\Map\ProductAssociatedContentTableMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a query for the 'product_associated_content' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @method ChildProductAssociatedContentQuery orderById($order = Criteria::ASC) Order by the id column
|
||||||
|
* @method ChildProductAssociatedContentQuery orderByProductId($order = Criteria::ASC) Order by the product_id column
|
||||||
|
* @method ChildProductAssociatedContentQuery orderByContentId($order = Criteria::ASC) Order by the content_id column
|
||||||
|
* @method ChildProductAssociatedContentQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
||||||
|
* @method ChildProductAssociatedContentQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||||
|
* @method ChildProductAssociatedContentQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||||
|
*
|
||||||
|
* @method ChildProductAssociatedContentQuery groupById() Group by the id column
|
||||||
|
* @method ChildProductAssociatedContentQuery groupByProductId() Group by the product_id column
|
||||||
|
* @method ChildProductAssociatedContentQuery groupByContentId() Group by the content_id column
|
||||||
|
* @method ChildProductAssociatedContentQuery groupByPosition() Group by the position column
|
||||||
|
* @method ChildProductAssociatedContentQuery groupByCreatedAt() Group by the created_at column
|
||||||
|
* @method ChildProductAssociatedContentQuery groupByUpdatedAt() Group by the updated_at column
|
||||||
|
*
|
||||||
|
* @method ChildProductAssociatedContentQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
|
* @method ChildProductAssociatedContentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
|
* @method ChildProductAssociatedContentQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||||
|
*
|
||||||
|
* @method ChildProductAssociatedContentQuery leftJoinProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the Product relation
|
||||||
|
* @method ChildProductAssociatedContentQuery rightJoinProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Product relation
|
||||||
|
* @method ChildProductAssociatedContentQuery innerJoinProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the Product relation
|
||||||
|
*
|
||||||
|
* @method ChildProductAssociatedContentQuery leftJoinContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the Content relation
|
||||||
|
* @method ChildProductAssociatedContentQuery rightJoinContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Content relation
|
||||||
|
* @method ChildProductAssociatedContentQuery innerJoinContent($relationAlias = null) Adds a INNER JOIN clause to the query using the Content relation
|
||||||
|
*
|
||||||
|
* @method ChildProductAssociatedContent findOne(ConnectionInterface $con = null) Return the first ChildProductAssociatedContent matching the query
|
||||||
|
* @method ChildProductAssociatedContent findOneOrCreate(ConnectionInterface $con = null) Return the first ChildProductAssociatedContent matching the query, or a new ChildProductAssociatedContent object populated from the query conditions when no match is found
|
||||||
|
*
|
||||||
|
* @method ChildProductAssociatedContent findOneById(int $id) Return the first ChildProductAssociatedContent filtered by the id column
|
||||||
|
* @method ChildProductAssociatedContent findOneByProductId(int $product_id) Return the first ChildProductAssociatedContent filtered by the product_id column
|
||||||
|
* @method ChildProductAssociatedContent findOneByContentId(int $content_id) Return the first ChildProductAssociatedContent filtered by the content_id column
|
||||||
|
* @method ChildProductAssociatedContent findOneByPosition(int $position) Return the first ChildProductAssociatedContent filtered by the position column
|
||||||
|
* @method ChildProductAssociatedContent findOneByCreatedAt(string $created_at) Return the first ChildProductAssociatedContent filtered by the created_at column
|
||||||
|
* @method ChildProductAssociatedContent findOneByUpdatedAt(string $updated_at) Return the first ChildProductAssociatedContent filtered by the updated_at column
|
||||||
|
*
|
||||||
|
* @method array findById(int $id) Return ChildProductAssociatedContent objects filtered by the id column
|
||||||
|
* @method array findByProductId(int $product_id) Return ChildProductAssociatedContent objects filtered by the product_id column
|
||||||
|
* @method array findByContentId(int $content_id) Return ChildProductAssociatedContent objects filtered by the content_id column
|
||||||
|
* @method array findByPosition(int $position) Return ChildProductAssociatedContent objects filtered by the position column
|
||||||
|
* @method array findByCreatedAt(string $created_at) Return ChildProductAssociatedContent objects filtered by the created_at column
|
||||||
|
* @method array findByUpdatedAt(string $updated_at) Return ChildProductAssociatedContent objects filtered by the updated_at column
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
abstract class ProductAssociatedContentQuery extends ModelCriteria
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes internal state of \Thelia\Model\Base\ProductAssociatedContentQuery 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\\ProductAssociatedContent', $modelAlias = null)
|
||||||
|
{
|
||||||
|
parent::__construct($dbName, $modelName, $modelAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new ChildProductAssociatedContentQuery object.
|
||||||
|
*
|
||||||
|
* @param string $modelAlias The alias of a model in the query
|
||||||
|
* @param Criteria $criteria Optional Criteria to build the query from
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery
|
||||||
|
*/
|
||||||
|
public static function create($modelAlias = null, $criteria = null)
|
||||||
|
{
|
||||||
|
if ($criteria instanceof \Thelia\Model\ProductAssociatedContentQuery) {
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
$query = new \Thelia\Model\ProductAssociatedContentQuery();
|
||||||
|
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 ChildProductAssociatedContent|array|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
public function findPk($key, $con = null)
|
||||||
|
{
|
||||||
|
if ($key === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ((null !== ($obj = ProductAssociatedContentTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||||
|
// the object is already in the instance pool
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getServiceContainer()->getReadConnection(ProductAssociatedContentTableMap::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 ChildProductAssociatedContent A model object, or null if the key is not found
|
||||||
|
*/
|
||||||
|
protected function findPkSimple($key, $con)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT ID, PRODUCT_ID, CONTENT_ID, POSITION, CREATED_AT, UPDATED_AT FROM product_associated_content WHERE ID = :p0';
|
||||||
|
try {
|
||||||
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Propel::log($e->getMessage(), Propel::LOG_ERR);
|
||||||
|
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
|
||||||
|
}
|
||||||
|
$obj = null;
|
||||||
|
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
|
||||||
|
$obj = new ChildProductAssociatedContent();
|
||||||
|
$obj->hydrate($row);
|
||||||
|
ProductAssociatedContentTableMap::addInstanceToPool($obj, (string) $key);
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key.
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
* @param ConnectionInterface $con A connection object
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContent|array|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
protected function findPkComplex($key, $con)
|
||||||
|
{
|
||||||
|
// As the query uses a PK condition, no limit(1) is necessary.
|
||||||
|
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||||
|
$dataFetcher = $criteria
|
||||||
|
->filterByPrimaryKey($key)
|
||||||
|
->doSelect($con);
|
||||||
|
|
||||||
|
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find objects by primary key
|
||||||
|
* <code>
|
||||||
|
* $objs = $c->findPks(array(12, 56, 832), $con);
|
||||||
|
* </code>
|
||||||
|
* @param array $keys Primary keys to use for the query
|
||||||
|
* @param ConnectionInterface $con an optional connection object
|
||||||
|
*
|
||||||
|
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
public function findPks($keys, $con = null)
|
||||||
|
{
|
||||||
|
if (null === $con) {
|
||||||
|
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
|
||||||
|
}
|
||||||
|
$this->basePreSelect($con);
|
||||||
|
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||||
|
$dataFetcher = $criteria
|
||||||
|
->filterByPrimaryKeys($keys)
|
||||||
|
->doSelect($con);
|
||||||
|
|
||||||
|
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by primary key
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKey($key)
|
||||||
|
{
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ProductAssociatedContentTableMap::ID, $key, Criteria::EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a list of primary keys
|
||||||
|
*
|
||||||
|
* @param array $keys The list of primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKeys($keys)
|
||||||
|
{
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ProductAssociatedContentTableMap::ID, $keys, Criteria::IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the id column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterById(1234); // WHERE id = 1234
|
||||||
|
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
|
||||||
|
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $id The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterById($id = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($id)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($id['min'])) {
|
||||||
|
$this->addUsingAlias(ProductAssociatedContentTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($id['max'])) {
|
||||||
|
$this->addUsingAlias(ProductAssociatedContentTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ProductAssociatedContentTableMap::ID, $id, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the product_id column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByProductId(1234); // WHERE product_id = 1234
|
||||||
|
* $query->filterByProductId(array(12, 34)); // WHERE product_id IN (12, 34)
|
||||||
|
* $query->filterByProductId(array('min' => 12)); // WHERE product_id > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @see filterByProduct()
|
||||||
|
*
|
||||||
|
* @param mixed $productId The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByProductId($productId = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($productId)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($productId['min'])) {
|
||||||
|
$this->addUsingAlias(ProductAssociatedContentTableMap::PRODUCT_ID, $productId['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($productId['max'])) {
|
||||||
|
$this->addUsingAlias(ProductAssociatedContentTableMap::PRODUCT_ID, $productId['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ProductAssociatedContentTableMap::PRODUCT_ID, $productId, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the content_id column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByContentId(1234); // WHERE content_id = 1234
|
||||||
|
* $query->filterByContentId(array(12, 34)); // WHERE content_id IN (12, 34)
|
||||||
|
* $query->filterByContentId(array('min' => 12)); // WHERE content_id > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @see filterByContent()
|
||||||
|
*
|
||||||
|
* @param mixed $contentId The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByContentId($contentId = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($contentId)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($contentId['min'])) {
|
||||||
|
$this->addUsingAlias(ProductAssociatedContentTableMap::CONTENT_ID, $contentId['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($contentId['max'])) {
|
||||||
|
$this->addUsingAlias(ProductAssociatedContentTableMap::CONTENT_ID, $contentId['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ProductAssociatedContentTableMap::CONTENT_ID, $contentId, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the position column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByPosition(1234); // WHERE position = 1234
|
||||||
|
* $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
|
||||||
|
* $query->filterByPosition(array('min' => 12)); // WHERE position > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $position The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPosition($position = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($position)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($position['min'])) {
|
||||||
|
$this->addUsingAlias(ProductAssociatedContentTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($position['max'])) {
|
||||||
|
$this->addUsingAlias(ProductAssociatedContentTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ProductAssociatedContentTableMap::POSITION, $position, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the created_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
|
||||||
|
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
|
||||||
|
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $createdAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCreatedAt($createdAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($createdAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($createdAt['min'])) {
|
||||||
|
$this->addUsingAlias(ProductAssociatedContentTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($createdAt['max'])) {
|
||||||
|
$this->addUsingAlias(ProductAssociatedContentTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ProductAssociatedContentTableMap::CREATED_AT, $createdAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the updated_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
|
||||||
|
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
|
||||||
|
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $updatedAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($updatedAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($updatedAt['min'])) {
|
||||||
|
$this->addUsingAlias(ProductAssociatedContentTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($updatedAt['max'])) {
|
||||||
|
$this->addUsingAlias(ProductAssociatedContentTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ProductAssociatedContentTableMap::UPDATED_AT, $updatedAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related \Thelia\Model\Product object
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\Product|ObjectCollection $product The related object(s) to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByProduct($product, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($product instanceof \Thelia\Model\Product) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(ProductAssociatedContentTableMap::PRODUCT_ID, $product->getId(), $comparison);
|
||||||
|
} elseif ($product instanceof ObjectCollection) {
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(ProductAssociatedContentTableMap::PRODUCT_ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByProduct() only accepts arguments of type \Thelia\Model\Product or Collection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the Product relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('Product');
|
||||||
|
|
||||||
|
// create a ModelJoin object for this join
|
||||||
|
$join = new ModelJoin();
|
||||||
|
$join->setJoinType($joinType);
|
||||||
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||||
|
if ($previousJoin = $this->getPreviousJoin()) {
|
||||||
|
$join->setPreviousJoin($previousJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the ModelJoin to the current object
|
||||||
|
if ($relationAlias) {
|
||||||
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||||
|
$this->addJoinObject($join, $relationAlias);
|
||||||
|
} else {
|
||||||
|
$this->addJoinObject($join, 'Product');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the Product relation Product object
|
||||||
|
*
|
||||||
|
* @see useQuery()
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation,
|
||||||
|
* to be used as main alias in the secondary query
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinProduct($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related \Thelia\Model\Content object
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\Content|ObjectCollection $content The related object(s) to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByContent($content, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($content instanceof \Thelia\Model\Content) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(ProductAssociatedContentTableMap::CONTENT_ID, $content->getId(), $comparison);
|
||||||
|
} elseif ($content instanceof ObjectCollection) {
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(ProductAssociatedContentTableMap::CONTENT_ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByContent() only accepts arguments of type \Thelia\Model\Content or Collection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the Content relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinContent($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('Content');
|
||||||
|
|
||||||
|
// create a ModelJoin object for this join
|
||||||
|
$join = new ModelJoin();
|
||||||
|
$join->setJoinType($joinType);
|
||||||
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||||
|
if ($previousJoin = $this->getPreviousJoin()) {
|
||||||
|
$join->setPreviousJoin($previousJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the ModelJoin to the current object
|
||||||
|
if ($relationAlias) {
|
||||||
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||||
|
$this->addJoinObject($join, $relationAlias);
|
||||||
|
} else {
|
||||||
|
$this->addJoinObject($join, 'Content');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the Content relation Content object
|
||||||
|
*
|
||||||
|
* @see useQuery()
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation,
|
||||||
|
* to be used as main alias in the secondary query
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return \Thelia\Model\ContentQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinContent($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'Content', '\Thelia\Model\ContentQuery');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exclude object from result
|
||||||
|
*
|
||||||
|
* @param ChildProductAssociatedContent $productAssociatedContent Object to remove from the list of results
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function prune($productAssociatedContent = null)
|
||||||
|
{
|
||||||
|
if ($productAssociatedContent) {
|
||||||
|
$this->addUsingAlias(ProductAssociatedContentTableMap::ID, $productAssociatedContent->getId(), Criteria::NOT_EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all rows from the product_associated_content 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(ProductAssociatedContentTableMap::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).
|
||||||
|
ProductAssociatedContentTableMap::clearInstancePool();
|
||||||
|
ProductAssociatedContentTableMap::clearRelatedInstancePool();
|
||||||
|
|
||||||
|
$con->commit();
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $affectedRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs a DELETE on the database, given a ChildProductAssociatedContent or Criteria object OR a primary key value.
|
||||||
|
*
|
||||||
|
* @param mixed $values Criteria or ChildProductAssociatedContent 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(ProductAssociatedContentTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria = $this;
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$criteria->setDbName(ProductAssociatedContentTableMap::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();
|
||||||
|
|
||||||
|
|
||||||
|
ProductAssociatedContentTableMap::removeInstanceFromPool($criteria);
|
||||||
|
|
||||||
|
$affectedRows += ModelCriteria::delete($con);
|
||||||
|
ProductAssociatedContentTableMap::clearRelatedInstancePool();
|
||||||
|
$con->commit();
|
||||||
|
|
||||||
|
return $affectedRows;
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// timestampable behavior
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter by the latest updated
|
||||||
|
*
|
||||||
|
* @param int $nbDays Maximum age of the latest update in days
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function recentlyUpdated($nbDays = 7)
|
||||||
|
{
|
||||||
|
return $this->addUsingAlias(ProductAssociatedContentTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter by the latest created
|
||||||
|
*
|
||||||
|
* @param int $nbDays Maximum age of in days
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function recentlyCreated($nbDays = 7)
|
||||||
|
{
|
||||||
|
return $this->addUsingAlias(ProductAssociatedContentTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Order by update date desc
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function lastUpdatedFirst()
|
||||||
|
{
|
||||||
|
return $this->addDescendingOrderByColumn(ProductAssociatedContentTableMap::UPDATED_AT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Order by update date asc
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function firstUpdatedFirst()
|
||||||
|
{
|
||||||
|
return $this->addAscendingOrderByColumn(ProductAssociatedContentTableMap::UPDATED_AT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Order by create date desc
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function lastCreatedFirst()
|
||||||
|
{
|
||||||
|
return $this->addDescendingOrderByColumn(ProductAssociatedContentTableMap::CREATED_AT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Order by create date asc
|
||||||
|
*
|
||||||
|
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function firstCreatedFirst()
|
||||||
|
{
|
||||||
|
return $this->addAscendingOrderByColumn(ProductAssociatedContentTableMap::CREATED_AT);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // ProductAssociatedContentQuery
|
||||||
@@ -64,10 +64,6 @@ use Thelia\Model\Map\ProductTableMap;
|
|||||||
* @method ChildProductQuery rightJoinProductSaleElements($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductSaleElements relation
|
* @method ChildProductQuery rightJoinProductSaleElements($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductSaleElements relation
|
||||||
* @method ChildProductQuery innerJoinProductSaleElements($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductSaleElements relation
|
* @method ChildProductQuery innerJoinProductSaleElements($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductSaleElements relation
|
||||||
*
|
*
|
||||||
* @method ChildProductQuery leftJoinContentAssoc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentAssoc relation
|
|
||||||
* @method ChildProductQuery rightJoinContentAssoc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentAssoc relation
|
|
||||||
* @method ChildProductQuery innerJoinContentAssoc($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentAssoc relation
|
|
||||||
*
|
|
||||||
* @method ChildProductQuery leftJoinProductImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductImage relation
|
* @method ChildProductQuery leftJoinProductImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductImage relation
|
||||||
* @method ChildProductQuery rightJoinProductImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductImage relation
|
* @method ChildProductQuery rightJoinProductImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductImage relation
|
||||||
* @method ChildProductQuery innerJoinProductImage($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductImage relation
|
* @method ChildProductQuery innerJoinProductImage($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductImage relation
|
||||||
@@ -92,6 +88,10 @@ use Thelia\Model\Map\ProductTableMap;
|
|||||||
* @method ChildProductQuery rightJoinCartItem($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CartItem relation
|
* @method ChildProductQuery rightJoinCartItem($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CartItem relation
|
||||||
* @method ChildProductQuery innerJoinCartItem($relationAlias = null) Adds a INNER JOIN clause to the query using the CartItem relation
|
* @method ChildProductQuery innerJoinCartItem($relationAlias = null) Adds a INNER JOIN clause to the query using the CartItem relation
|
||||||
*
|
*
|
||||||
|
* @method ChildProductQuery leftJoinProductAssociatedContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductAssociatedContent relation
|
||||||
|
* @method ChildProductQuery rightJoinProductAssociatedContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductAssociatedContent relation
|
||||||
|
* @method ChildProductQuery innerJoinProductAssociatedContent($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductAssociatedContent relation
|
||||||
|
*
|
||||||
* @method ChildProductQuery leftJoinProductI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductI18n relation
|
* @method ChildProductQuery leftJoinProductI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductI18n relation
|
||||||
* @method ChildProductQuery rightJoinProductI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductI18n relation
|
* @method ChildProductQuery rightJoinProductI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductI18n relation
|
||||||
* @method ChildProductQuery innerJoinProductI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductI18n relation
|
* @method ChildProductQuery innerJoinProductI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductI18n relation
|
||||||
@@ -996,79 +996,6 @@ abstract class ProductQuery extends ModelCriteria
|
|||||||
->useQuery($relationAlias ? $relationAlias : 'ProductSaleElements', '\Thelia\Model\ProductSaleElementsQuery');
|
->useQuery($relationAlias ? $relationAlias : 'ProductSaleElements', '\Thelia\Model\ProductSaleElementsQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query by a related \Thelia\Model\ContentAssoc object
|
|
||||||
*
|
|
||||||
* @param \Thelia\Model\ContentAssoc|ObjectCollection $contentAssoc the related object to use as filter
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildProductQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByContentAssoc($contentAssoc, $comparison = null)
|
|
||||||
{
|
|
||||||
if ($contentAssoc instanceof \Thelia\Model\ContentAssoc) {
|
|
||||||
return $this
|
|
||||||
->addUsingAlias(ProductTableMap::ID, $contentAssoc->getProductId(), $comparison);
|
|
||||||
} elseif ($contentAssoc instanceof ObjectCollection) {
|
|
||||||
return $this
|
|
||||||
->useContentAssocQuery()
|
|
||||||
->filterByPrimaryKeys($contentAssoc->getPrimaryKeys())
|
|
||||||
->endUse();
|
|
||||||
} else {
|
|
||||||
throw new PropelException('filterByContentAssoc() only accepts arguments of type \Thelia\Model\ContentAssoc or Collection');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a JOIN clause to the query using the ContentAssoc relation
|
|
||||||
*
|
|
||||||
* @param string $relationAlias optional alias for the relation
|
|
||||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
|
||||||
*
|
|
||||||
* @return ChildProductQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function joinContentAssoc($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
|
||||||
{
|
|
||||||
$tableMap = $this->getTableMap();
|
|
||||||
$relationMap = $tableMap->getRelation('ContentAssoc');
|
|
||||||
|
|
||||||
// create a ModelJoin object for this join
|
|
||||||
$join = new ModelJoin();
|
|
||||||
$join->setJoinType($joinType);
|
|
||||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
|
||||||
if ($previousJoin = $this->getPreviousJoin()) {
|
|
||||||
$join->setPreviousJoin($previousJoin);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add the ModelJoin to the current object
|
|
||||||
if ($relationAlias) {
|
|
||||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
|
||||||
$this->addJoinObject($join, $relationAlias);
|
|
||||||
} else {
|
|
||||||
$this->addJoinObject($join, 'ContentAssoc');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use the ContentAssoc relation ContentAssoc object
|
|
||||||
*
|
|
||||||
* @see useQuery()
|
|
||||||
*
|
|
||||||
* @param string $relationAlias optional alias for the relation,
|
|
||||||
* to be used as main alias in the secondary query
|
|
||||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
|
||||||
*
|
|
||||||
* @return \Thelia\Model\ContentAssocQuery A secondary query class using the current class as primary query
|
|
||||||
*/
|
|
||||||
public function useContentAssocQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
|
||||||
{
|
|
||||||
return $this
|
|
||||||
->joinContentAssoc($relationAlias, $joinType)
|
|
||||||
->useQuery($relationAlias ? $relationAlias : 'ContentAssoc', '\Thelia\Model\ContentAssocQuery');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query by a related \Thelia\Model\ProductImage object
|
* Filter the query by a related \Thelia\Model\ProductImage object
|
||||||
*
|
*
|
||||||
@@ -1507,6 +1434,79 @@ abstract class ProductQuery extends ModelCriteria
|
|||||||
->useQuery($relationAlias ? $relationAlias : 'CartItem', '\Thelia\Model\CartItemQuery');
|
->useQuery($relationAlias ? $relationAlias : 'CartItem', '\Thelia\Model\CartItemQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related \Thelia\Model\ProductAssociatedContent object
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\ProductAssociatedContent|ObjectCollection $productAssociatedContent the related object to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildProductQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByProductAssociatedContent($productAssociatedContent, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($productAssociatedContent instanceof \Thelia\Model\ProductAssociatedContent) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(ProductTableMap::ID, $productAssociatedContent->getProductId(), $comparison);
|
||||||
|
} elseif ($productAssociatedContent instanceof ObjectCollection) {
|
||||||
|
return $this
|
||||||
|
->useProductAssociatedContentQuery()
|
||||||
|
->filterByPrimaryKeys($productAssociatedContent->getPrimaryKeys())
|
||||||
|
->endUse();
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByProductAssociatedContent() only accepts arguments of type \Thelia\Model\ProductAssociatedContent or Collection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the ProductAssociatedContent relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return ChildProductQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinProductAssociatedContent($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('ProductAssociatedContent');
|
||||||
|
|
||||||
|
// create a ModelJoin object for this join
|
||||||
|
$join = new ModelJoin();
|
||||||
|
$join->setJoinType($joinType);
|
||||||
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||||
|
if ($previousJoin = $this->getPreviousJoin()) {
|
||||||
|
$join->setPreviousJoin($previousJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the ModelJoin to the current object
|
||||||
|
if ($relationAlias) {
|
||||||
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||||
|
$this->addJoinObject($join, $relationAlias);
|
||||||
|
} else {
|
||||||
|
$this->addJoinObject($join, 'ProductAssociatedContent');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the ProductAssociatedContent relation ProductAssociatedContent object
|
||||||
|
*
|
||||||
|
* @see useQuery()
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation,
|
||||||
|
* to be used as main alias in the secondary query
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return \Thelia\Model\ProductAssociatedContentQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useProductAssociatedContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinProductAssociatedContent($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'ProductAssociatedContent', '\Thelia\Model\ProductAssociatedContentQuery');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query by a related \Thelia\Model\ProductI18n object
|
* Filter the query by a related \Thelia\Model\ProductI18n object
|
||||||
*
|
*
|
||||||
|
|||||||
9
core/lib/Thelia/Model/CategoryAssociatedContent.php
Normal file
9
core/lib/Thelia/Model/CategoryAssociatedContent.php
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\Base\CategoryAssociatedContent as BaseCategoryAssociatedContent;
|
||||||
|
|
||||||
|
class CategoryAssociatedContent extends BaseCategoryAssociatedContent {
|
||||||
|
|
||||||
|
}
|
||||||
20
core/lib/Thelia/Model/CategoryAssociatedContentQuery.php
Normal file
20
core/lib/Thelia/Model/CategoryAssociatedContentQuery.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\Base\CategoryAssociatedContentQuery as BaseCategoryAssociatedContentQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'category_associated_content' 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 CategoryAssociatedContentQuery extends BaseCategoryAssociatedContentQuery {
|
||||||
|
|
||||||
|
} // CategoryAssociatedContentQuery
|
||||||
9
core/lib/Thelia/Model/CouponI18n.php
Normal file
9
core/lib/Thelia/Model/CouponI18n.php
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\Base\CouponI18n as BaseCouponI18n;
|
||||||
|
|
||||||
|
class CouponI18n extends BaseCouponI18n {
|
||||||
|
|
||||||
|
}
|
||||||
20
core/lib/Thelia/Model/CouponI18nQuery.php
Normal file
20
core/lib/Thelia/Model/CouponI18nQuery.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\Base\CouponI18nQuery as BaseCouponI18nQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'coupon_i18n' 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 CouponI18nQuery extends BaseCouponI18nQuery {
|
||||||
|
|
||||||
|
} // CouponI18nQuery
|
||||||
9
core/lib/Thelia/Model/CouponVersion.php
Normal file
9
core/lib/Thelia/Model/CouponVersion.php
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\Base\CouponVersion as BaseCouponVersion;
|
||||||
|
|
||||||
|
class CouponVersion extends BaseCouponVersion {
|
||||||
|
|
||||||
|
}
|
||||||
20
core/lib/Thelia/Model/CouponVersionQuery.php
Normal file
20
core/lib/Thelia/Model/CouponVersionQuery.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\Base\CouponVersionQuery as BaseCouponVersionQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'coupon_version' 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 CouponVersionQuery extends BaseCouponVersionQuery {
|
||||||
|
|
||||||
|
} // CouponVersionQuery
|
||||||
@@ -148,7 +148,7 @@ class AccessoryTableMap extends TableMap
|
|||||||
$this->setPhpName('Accessory');
|
$this->setPhpName('Accessory');
|
||||||
$this->setClassName('\\Thelia\\Model\\Accessory');
|
$this->setClassName('\\Thelia\\Model\\Accessory');
|
||||||
$this->setPackage('Thelia.Model');
|
$this->setPackage('Thelia.Model');
|
||||||
$this->setUseIdGenerator(false);
|
$this->setUseIdGenerator(true);
|
||||||
$this->setIsCrossRef(true);
|
$this->setIsCrossRef(true);
|
||||||
// columns
|
// columns
|
||||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||||
@@ -429,6 +429,10 @@ class AccessoryTableMap extends TableMap
|
|||||||
$criteria = $criteria->buildCriteria(); // build Criteria from Accessory object
|
$criteria = $criteria->buildCriteria(); // build Criteria from Accessory object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($criteria->containsKey(AccessoryTableMap::ID) && $criteria->keyContainsValue(AccessoryTableMap::ID) ) {
|
||||||
|
throw new PropelException('Cannot insert a value for auto-increment primary key ('.AccessoryTableMap::ID.')');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set the correct dbName
|
// Set the correct dbName
|
||||||
$query = AccessoryQuery::create()->mergeWith($criteria);
|
$query = AccessoryQuery::create()->mergeWith($criteria);
|
||||||
|
|||||||
456
core/lib/Thelia/Model/Map/CategoryAssociatedContentTableMap.php
Normal file
456
core/lib/Thelia/Model/Map/CategoryAssociatedContentTableMap.php
Normal file
@@ -0,0 +1,456 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model\Map;
|
||||||
|
|
||||||
|
use Propel\Runtime\Propel;
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
|
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||||
|
use Propel\Runtime\Connection\ConnectionInterface;
|
||||||
|
use Propel\Runtime\Exception\PropelException;
|
||||||
|
use Propel\Runtime\Map\RelationMap;
|
||||||
|
use Propel\Runtime\Map\TableMap;
|
||||||
|
use Propel\Runtime\Map\TableMapTrait;
|
||||||
|
use Thelia\Model\CategoryAssociatedContent;
|
||||||
|
use Thelia\Model\CategoryAssociatedContentQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class defines the structure of the 'category_associated_content' 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 CategoryAssociatedContentTableMap extends TableMap
|
||||||
|
{
|
||||||
|
use InstancePoolTrait;
|
||||||
|
use TableMapTrait;
|
||||||
|
/**
|
||||||
|
* The (dot-path) name of this class
|
||||||
|
*/
|
||||||
|
const CLASS_NAME = 'Thelia.Model.Map.CategoryAssociatedContentTableMap';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default database name for this class
|
||||||
|
*/
|
||||||
|
const DATABASE_NAME = 'thelia';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table name for this class
|
||||||
|
*/
|
||||||
|
const TABLE_NAME = 'category_associated_content';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The related Propel class for this table
|
||||||
|
*/
|
||||||
|
const OM_CLASS = '\\Thelia\\Model\\CategoryAssociatedContent';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class that can be returned by this tableMap
|
||||||
|
*/
|
||||||
|
const CLASS_DEFAULT = 'Thelia.Model.CategoryAssociatedContent';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The total number of columns
|
||||||
|
*/
|
||||||
|
const NUM_COLUMNS = 6;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 = 6;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the ID field
|
||||||
|
*/
|
||||||
|
const ID = 'category_associated_content.ID';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the CATEGORY_ID field
|
||||||
|
*/
|
||||||
|
const CATEGORY_ID = 'category_associated_content.CATEGORY_ID';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the CONTENT_ID field
|
||||||
|
*/
|
||||||
|
const CONTENT_ID = 'category_associated_content.CONTENT_ID';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the POSITION field
|
||||||
|
*/
|
||||||
|
const POSITION = 'category_associated_content.POSITION';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the CREATED_AT field
|
||||||
|
*/
|
||||||
|
const CREATED_AT = 'category_associated_content.CREATED_AT';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the UPDATED_AT field
|
||||||
|
*/
|
||||||
|
const UPDATED_AT = 'category_associated_content.UPDATED_AT';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default string format for model objects of the related table
|
||||||
|
*/
|
||||||
|
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* holds an array of fieldnames
|
||||||
|
*
|
||||||
|
* first dimension keys are the type constants
|
||||||
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
|
*/
|
||||||
|
protected static $fieldNames = array (
|
||||||
|
self::TYPE_PHPNAME => array('Id', 'CategoryId', 'ContentId', 'Position', 'CreatedAt', 'UpdatedAt', ),
|
||||||
|
self::TYPE_STUDLYPHPNAME => array('id', 'categoryId', 'contentId', 'position', 'createdAt', 'updatedAt', ),
|
||||||
|
self::TYPE_COLNAME => array(CategoryAssociatedContentTableMap::ID, CategoryAssociatedContentTableMap::CATEGORY_ID, CategoryAssociatedContentTableMap::CONTENT_ID, CategoryAssociatedContentTableMap::POSITION, CategoryAssociatedContentTableMap::CREATED_AT, CategoryAssociatedContentTableMap::UPDATED_AT, ),
|
||||||
|
self::TYPE_RAW_COLNAME => array('ID', 'CATEGORY_ID', 'CONTENT_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
|
||||||
|
self::TYPE_FIELDNAME => array('id', 'category_id', 'content_id', 'position', 'created_at', 'updated_at', ),
|
||||||
|
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* holds an array of keys for quick access to the fieldnames array
|
||||||
|
*
|
||||||
|
* first dimension keys are the type constants
|
||||||
|
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||||
|
*/
|
||||||
|
protected static $fieldKeys = array (
|
||||||
|
self::TYPE_PHPNAME => array('Id' => 0, 'CategoryId' => 1, 'ContentId' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
|
||||||
|
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'categoryId' => 1, 'contentId' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
|
||||||
|
self::TYPE_COLNAME => array(CategoryAssociatedContentTableMap::ID => 0, CategoryAssociatedContentTableMap::CATEGORY_ID => 1, CategoryAssociatedContentTableMap::CONTENT_ID => 2, CategoryAssociatedContentTableMap::POSITION => 3, CategoryAssociatedContentTableMap::CREATED_AT => 4, CategoryAssociatedContentTableMap::UPDATED_AT => 5, ),
|
||||||
|
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CATEGORY_ID' => 1, 'CONTENT_ID' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
|
||||||
|
self::TYPE_FIELDNAME => array('id' => 0, 'category_id' => 1, 'content_id' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, ),
|
||||||
|
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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('category_associated_content');
|
||||||
|
$this->setPhpName('CategoryAssociatedContent');
|
||||||
|
$this->setClassName('\\Thelia\\Model\\CategoryAssociatedContent');
|
||||||
|
$this->setPackage('Thelia.Model');
|
||||||
|
$this->setUseIdGenerator(true);
|
||||||
|
// columns
|
||||||
|
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||||
|
$this->addForeignKey('CATEGORY_ID', 'CategoryId', 'INTEGER', 'category', 'ID', true, null, null);
|
||||||
|
$this->addForeignKey('CONTENT_ID', 'ContentId', 'INTEGER', 'content', 'ID', true, null, null);
|
||||||
|
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
|
||||||
|
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
} // initialize()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the RelationMap objects for this table relationships
|
||||||
|
*/
|
||||||
|
public function buildRelations()
|
||||||
|
{
|
||||||
|
$this->addRelation('Category', '\\Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||||
|
$this->addRelation('Content', '\\Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('content_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||||
|
} // buildRelations()
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Gets the list of behaviors registered for this table
|
||||||
|
*
|
||||||
|
* @return array Associative array (name => parameters) of behaviors
|
||||||
|
*/
|
||||||
|
public function getBehaviors()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
|
||||||
|
);
|
||||||
|
} // getBehaviors()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||||
|
*
|
||||||
|
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||||
|
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||||
|
*
|
||||||
|
* @param array $row resultset row.
|
||||||
|
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||||
|
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||||
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||||
|
*/
|
||||||
|
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||||
|
{
|
||||||
|
// If the PK cannot be derived from the row, return NULL.
|
||||||
|
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the primary key from the DB resultset row
|
||||||
|
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||||
|
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||||
|
*
|
||||||
|
* @param array $row resultset row.
|
||||||
|
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||||
|
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||||
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||||
|
*
|
||||||
|
* @return mixed The primary key of the row
|
||||||
|
*/
|
||||||
|
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (int) $row[
|
||||||
|
$indexType == TableMap::TYPE_NUM
|
||||||
|
? 0 + $offset
|
||||||
|
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class that the tableMap will make instances of.
|
||||||
|
*
|
||||||
|
* If $withPrefix is true, the returned path
|
||||||
|
* uses a dot-path notation which is translated into a path
|
||||||
|
* relative to a location on the PHP include_path.
|
||||||
|
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||||
|
*
|
||||||
|
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||||
|
* @return string path.to.ClassName
|
||||||
|
*/
|
||||||
|
public static function getOMClass($withPrefix = true)
|
||||||
|
{
|
||||||
|
return $withPrefix ? CategoryAssociatedContentTableMap::CLASS_DEFAULT : CategoryAssociatedContentTableMap::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 (CategoryAssociatedContent object, last column rank)
|
||||||
|
*/
|
||||||
|
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||||
|
{
|
||||||
|
$key = CategoryAssociatedContentTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||||
|
if (null !== ($obj = CategoryAssociatedContentTableMap::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 + CategoryAssociatedContentTableMap::NUM_HYDRATE_COLUMNS;
|
||||||
|
} else {
|
||||||
|
$cls = CategoryAssociatedContentTableMap::OM_CLASS;
|
||||||
|
$obj = new $cls();
|
||||||
|
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||||
|
CategoryAssociatedContentTableMap::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 = CategoryAssociatedContentTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||||
|
if (null !== ($obj = CategoryAssociatedContentTableMap::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;
|
||||||
|
CategoryAssociatedContentTableMap::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(CategoryAssociatedContentTableMap::ID);
|
||||||
|
$criteria->addSelectColumn(CategoryAssociatedContentTableMap::CATEGORY_ID);
|
||||||
|
$criteria->addSelectColumn(CategoryAssociatedContentTableMap::CONTENT_ID);
|
||||||
|
$criteria->addSelectColumn(CategoryAssociatedContentTableMap::POSITION);
|
||||||
|
$criteria->addSelectColumn(CategoryAssociatedContentTableMap::CREATED_AT);
|
||||||
|
$criteria->addSelectColumn(CategoryAssociatedContentTableMap::UPDATED_AT);
|
||||||
|
} else {
|
||||||
|
$criteria->addSelectColumn($alias . '.ID');
|
||||||
|
$criteria->addSelectColumn($alias . '.CATEGORY_ID');
|
||||||
|
$criteria->addSelectColumn($alias . '.CONTENT_ID');
|
||||||
|
$criteria->addSelectColumn($alias . '.POSITION');
|
||||||
|
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||||
|
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the TableMap related to this object.
|
||||||
|
* This method is not needed for general use but a specific application could have a need.
|
||||||
|
* @return TableMap
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function getTableMap()
|
||||||
|
{
|
||||||
|
return Propel::getServiceContainer()->getDatabaseMap(CategoryAssociatedContentTableMap::DATABASE_NAME)->getTable(CategoryAssociatedContentTableMap::TABLE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a TableMap instance to the database for this tableMap class.
|
||||||
|
*/
|
||||||
|
public static function buildTableMap()
|
||||||
|
{
|
||||||
|
$dbMap = Propel::getServiceContainer()->getDatabaseMap(CategoryAssociatedContentTableMap::DATABASE_NAME);
|
||||||
|
if (!$dbMap->hasTable(CategoryAssociatedContentTableMap::TABLE_NAME)) {
|
||||||
|
$dbMap->addTableObject(new CategoryAssociatedContentTableMap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs a DELETE on the database, given a CategoryAssociatedContent or Criteria object OR a primary key value.
|
||||||
|
*
|
||||||
|
* @param mixed $values Criteria or CategoryAssociatedContent 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(CategoryAssociatedContentTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($values instanceof Criteria) {
|
||||||
|
// rename for clarity
|
||||||
|
$criteria = $values;
|
||||||
|
} elseif ($values instanceof \Thelia\Model\CategoryAssociatedContent) { // 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(CategoryAssociatedContentTableMap::DATABASE_NAME);
|
||||||
|
$criteria->add(CategoryAssociatedContentTableMap::ID, (array) $values, Criteria::IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = CategoryAssociatedContentQuery::create()->mergeWith($criteria);
|
||||||
|
|
||||||
|
if ($values instanceof Criteria) { CategoryAssociatedContentTableMap::clearInstancePool();
|
||||||
|
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||||
|
foreach ((array) $values as $singleval) { CategoryAssociatedContentTableMap::removeInstanceFromPool($singleval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query->delete($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all rows from the category_associated_content 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 CategoryAssociatedContentQuery::create()->doDeleteAll($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs an INSERT on the database, given a CategoryAssociatedContent or Criteria object.
|
||||||
|
*
|
||||||
|
* @param mixed $criteria Criteria or CategoryAssociatedContent 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(CategoryAssociatedContentTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($criteria instanceof Criteria) {
|
||||||
|
$criteria = clone $criteria; // rename for clarity
|
||||||
|
} else {
|
||||||
|
$criteria = $criteria->buildCriteria(); // build Criteria from CategoryAssociatedContent object
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($criteria->containsKey(CategoryAssociatedContentTableMap::ID) && $criteria->keyContainsValue(CategoryAssociatedContentTableMap::ID) ) {
|
||||||
|
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CategoryAssociatedContentTableMap::ID.')');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$query = CategoryAssociatedContentQuery::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;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // CategoryAssociatedContentTableMap
|
||||||
|
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||||
|
//
|
||||||
|
CategoryAssociatedContentTableMap::buildTableMap();
|
||||||
@@ -193,10 +193,10 @@ class CategoryTableMap extends TableMap
|
|||||||
$this->addRelation('ProductCategory', '\\Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'ProductCategories');
|
$this->addRelation('ProductCategory', '\\Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'ProductCategories');
|
||||||
$this->addRelation('FeatureCategory', '\\Thelia\\Model\\FeatureCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'FeatureCategories');
|
$this->addRelation('FeatureCategory', '\\Thelia\\Model\\FeatureCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'FeatureCategories');
|
||||||
$this->addRelation('AttributeCategory', '\\Thelia\\Model\\AttributeCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'AttributeCategories');
|
$this->addRelation('AttributeCategory', '\\Thelia\\Model\\AttributeCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'AttributeCategories');
|
||||||
$this->addRelation('ContentAssoc', '\\Thelia\\Model\\ContentAssoc', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'ContentAssocs');
|
|
||||||
$this->addRelation('Rewriting', '\\Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
|
$this->addRelation('Rewriting', '\\Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
|
||||||
$this->addRelation('CategoryImage', '\\Thelia\\Model\\CategoryImage', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryImages');
|
$this->addRelation('CategoryImage', '\\Thelia\\Model\\CategoryImage', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryImages');
|
||||||
$this->addRelation('CategoryDocument', '\\Thelia\\Model\\CategoryDocument', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryDocuments');
|
$this->addRelation('CategoryDocument', '\\Thelia\\Model\\CategoryDocument', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryDocuments');
|
||||||
|
$this->addRelation('CategoryAssociatedContent', '\\Thelia\\Model\\CategoryAssociatedContent', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryAssociatedContents');
|
||||||
$this->addRelation('CategoryI18n', '\\Thelia\\Model\\CategoryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CategoryI18ns');
|
$this->addRelation('CategoryI18n', '\\Thelia\\Model\\CategoryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CategoryI18ns');
|
||||||
$this->addRelation('CategoryVersion', '\\Thelia\\Model\\CategoryVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CategoryVersions');
|
$this->addRelation('CategoryVersion', '\\Thelia\\Model\\CategoryVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CategoryVersions');
|
||||||
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Products');
|
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Products');
|
||||||
@@ -228,10 +228,10 @@ class CategoryTableMap extends TableMap
|
|||||||
ProductCategoryTableMap::clearInstancePool();
|
ProductCategoryTableMap::clearInstancePool();
|
||||||
FeatureCategoryTableMap::clearInstancePool();
|
FeatureCategoryTableMap::clearInstancePool();
|
||||||
AttributeCategoryTableMap::clearInstancePool();
|
AttributeCategoryTableMap::clearInstancePool();
|
||||||
ContentAssocTableMap::clearInstancePool();
|
|
||||||
RewritingTableMap::clearInstancePool();
|
RewritingTableMap::clearInstancePool();
|
||||||
CategoryImageTableMap::clearInstancePool();
|
CategoryImageTableMap::clearInstancePool();
|
||||||
CategoryDocumentTableMap::clearInstancePool();
|
CategoryDocumentTableMap::clearInstancePool();
|
||||||
|
CategoryAssociatedContentTableMap::clearInstancePool();
|
||||||
CategoryI18nTableMap::clearInstancePool();
|
CategoryI18nTableMap::clearInstancePool();
|
||||||
CategoryVersionTableMap::clearInstancePool();
|
CategoryVersionTableMap::clearInstancePool();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,11 +184,12 @@ class ContentTableMap extends TableMap
|
|||||||
*/
|
*/
|
||||||
public function buildRelations()
|
public function buildRelations()
|
||||||
{
|
{
|
||||||
$this->addRelation('ContentAssoc', '\\Thelia\\Model\\ContentAssoc', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentAssocs');
|
|
||||||
$this->addRelation('Rewriting', '\\Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
|
$this->addRelation('Rewriting', '\\Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
|
||||||
$this->addRelation('ContentFolder', '\\Thelia\\Model\\ContentFolder', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentFolders');
|
$this->addRelation('ContentFolder', '\\Thelia\\Model\\ContentFolder', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentFolders');
|
||||||
$this->addRelation('ContentImage', '\\Thelia\\Model\\ContentImage', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentImages');
|
$this->addRelation('ContentImage', '\\Thelia\\Model\\ContentImage', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentImages');
|
||||||
$this->addRelation('ContentDocument', '\\Thelia\\Model\\ContentDocument', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentDocuments');
|
$this->addRelation('ContentDocument', '\\Thelia\\Model\\ContentDocument', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentDocuments');
|
||||||
|
$this->addRelation('ProductAssociatedContent', '\\Thelia\\Model\\ProductAssociatedContent', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ProductAssociatedContents');
|
||||||
|
$this->addRelation('CategoryAssociatedContent', '\\Thelia\\Model\\CategoryAssociatedContent', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'CategoryAssociatedContents');
|
||||||
$this->addRelation('ContentI18n', '\\Thelia\\Model\\ContentI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ContentI18ns');
|
$this->addRelation('ContentI18n', '\\Thelia\\Model\\ContentI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ContentI18ns');
|
||||||
$this->addRelation('ContentVersion', '\\Thelia\\Model\\ContentVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ContentVersions');
|
$this->addRelation('ContentVersion', '\\Thelia\\Model\\ContentVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ContentVersions');
|
||||||
$this->addRelation('Folder', '\\Thelia\\Model\\Folder', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Folders');
|
$this->addRelation('Folder', '\\Thelia\\Model\\Folder', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Folders');
|
||||||
@@ -215,11 +216,12 @@ class ContentTableMap extends TableMap
|
|||||||
{
|
{
|
||||||
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
||||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
ContentAssocTableMap::clearInstancePool();
|
|
||||||
RewritingTableMap::clearInstancePool();
|
RewritingTableMap::clearInstancePool();
|
||||||
ContentFolderTableMap::clearInstancePool();
|
ContentFolderTableMap::clearInstancePool();
|
||||||
ContentImageTableMap::clearInstancePool();
|
ContentImageTableMap::clearInstancePool();
|
||||||
ContentDocumentTableMap::clearInstancePool();
|
ContentDocumentTableMap::clearInstancePool();
|
||||||
|
ProductAssociatedContentTableMap::clearInstancePool();
|
||||||
|
CategoryAssociatedContentTableMap::clearInstancePool();
|
||||||
ContentI18nTableMap::clearInstancePool();
|
ContentI18nTableMap::clearInstancePool();
|
||||||
ContentVersionTableMap::clearInstancePool();
|
ContentVersionTableMap::clearInstancePool();
|
||||||
}
|
}
|
||||||
|
|||||||
465
core/lib/Thelia/Model/Map/CouponI18nTableMap.php
Normal file
465
core/lib/Thelia/Model/Map/CouponI18nTableMap.php
Normal file
@@ -0,0 +1,465 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model\Map;
|
||||||
|
|
||||||
|
use Propel\Runtime\Propel;
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
|
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||||
|
use Propel\Runtime\Connection\ConnectionInterface;
|
||||||
|
use Propel\Runtime\Exception\PropelException;
|
||||||
|
use Propel\Runtime\Map\RelationMap;
|
||||||
|
use Propel\Runtime\Map\TableMap;
|
||||||
|
use Propel\Runtime\Map\TableMapTrait;
|
||||||
|
use Thelia\Model\CouponI18n;
|
||||||
|
use Thelia\Model\CouponI18nQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class defines the structure of the 'coupon_i18n' 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 CouponI18nTableMap extends TableMap
|
||||||
|
{
|
||||||
|
use InstancePoolTrait;
|
||||||
|
use TableMapTrait;
|
||||||
|
/**
|
||||||
|
* The (dot-path) name of this class
|
||||||
|
*/
|
||||||
|
const CLASS_NAME = 'Thelia.Model.Map.CouponI18nTableMap';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default database name for this class
|
||||||
|
*/
|
||||||
|
const DATABASE_NAME = 'thelia';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table name for this class
|
||||||
|
*/
|
||||||
|
const TABLE_NAME = 'coupon_i18n';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The related Propel class for this table
|
||||||
|
*/
|
||||||
|
const OM_CLASS = '\\Thelia\\Model\\CouponI18n';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class that can be returned by this tableMap
|
||||||
|
*/
|
||||||
|
const CLASS_DEFAULT = 'Thelia.Model.CouponI18n';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 ID field
|
||||||
|
*/
|
||||||
|
const ID = 'coupon_i18n.ID';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the LOCALE field
|
||||||
|
*/
|
||||||
|
const LOCALE = 'coupon_i18n.LOCALE';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default string format for model objects of the related table
|
||||||
|
*/
|
||||||
|
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* holds an array of fieldnames
|
||||||
|
*
|
||||||
|
* first dimension keys are the type constants
|
||||||
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
|
*/
|
||||||
|
protected static $fieldNames = array (
|
||||||
|
self::TYPE_PHPNAME => array('Id', 'Locale', ),
|
||||||
|
self::TYPE_STUDLYPHPNAME => array('id', 'locale', ),
|
||||||
|
self::TYPE_COLNAME => array(CouponI18nTableMap::ID, CouponI18nTableMap::LOCALE, ),
|
||||||
|
self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', ),
|
||||||
|
self::TYPE_FIELDNAME => array('id', 'locale', ),
|
||||||
|
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('Id' => 0, 'Locale' => 1, ),
|
||||||
|
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, ),
|
||||||
|
self::TYPE_COLNAME => array(CouponI18nTableMap::ID => 0, CouponI18nTableMap::LOCALE => 1, ),
|
||||||
|
self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, ),
|
||||||
|
self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 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_i18n');
|
||||||
|
$this->setPhpName('CouponI18n');
|
||||||
|
$this->setClassName('\\Thelia\\Model\\CouponI18n');
|
||||||
|
$this->setPackage('Thelia.Model');
|
||||||
|
$this->setUseIdGenerator(false);
|
||||||
|
// columns
|
||||||
|
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'coupon', 'ID', true, null, null);
|
||||||
|
$this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
|
||||||
|
} // initialize()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the RelationMap objects for this table relationships
|
||||||
|
*/
|
||||||
|
public function buildRelations()
|
||||||
|
{
|
||||||
|
$this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
|
||||||
|
} // buildRelations()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an object to the instance pool.
|
||||||
|
*
|
||||||
|
* Propel keeps cached copies of objects in an instance pool when they are retrieved
|
||||||
|
* from the database. In some cases you may need to explicitly add objects
|
||||||
|
* to the cache in order to ensure that the same objects are always returned by find*()
|
||||||
|
* and findPk*() calls.
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\CouponI18n $obj A \Thelia\Model\CouponI18n object.
|
||||||
|
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
|
||||||
|
*/
|
||||||
|
public static function addInstanceToPool($obj, $key = null)
|
||||||
|
{
|
||||||
|
if (Propel::isInstancePoolingEnabled()) {
|
||||||
|
if (null === $key) {
|
||||||
|
$key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
|
||||||
|
} // if key === null
|
||||||
|
self::$instances[$key] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes an object from the instance pool.
|
||||||
|
*
|
||||||
|
* Propel keeps cached copies of objects in an instance pool when they are retrieved
|
||||||
|
* from the database. In some cases -- especially when you override doDelete
|
||||||
|
* methods in your stub classes -- you may need to explicitly remove objects
|
||||||
|
* from the cache in order to prevent returning objects that no longer exist.
|
||||||
|
*
|
||||||
|
* @param mixed $value A \Thelia\Model\CouponI18n object or a primary key value.
|
||||||
|
*/
|
||||||
|
public static function removeInstanceFromPool($value)
|
||||||
|
{
|
||||||
|
if (Propel::isInstancePoolingEnabled() && null !== $value) {
|
||||||
|
if (is_object($value) && $value instanceof \Thelia\Model\CouponI18n) {
|
||||||
|
$key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
|
||||||
|
|
||||||
|
} elseif (is_array($value) && count($value) === 2) {
|
||||||
|
// assume we've been passed a primary key";
|
||||||
|
$key = serialize(array((string) $value[0], (string) $value[1]));
|
||||||
|
} elseif ($value instanceof Criteria) {
|
||||||
|
self::$instances = [];
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\CouponI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
unset(self::$instances[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||||
|
*
|
||||||
|
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||||
|
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||||
|
*
|
||||||
|
* @param array $row resultset row.
|
||||||
|
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||||
|
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||||
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||||
|
*/
|
||||||
|
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||||
|
{
|
||||||
|
// If the PK cannot be derived from the row, return NULL.
|
||||||
|
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the primary key from the DB resultset row
|
||||||
|
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||||
|
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||||
|
*
|
||||||
|
* @param array $row resultset row.
|
||||||
|
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||||
|
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||||
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||||
|
*
|
||||||
|
* @return mixed The primary key of the row
|
||||||
|
*/
|
||||||
|
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||||
|
{
|
||||||
|
|
||||||
|
return $pks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class that the tableMap will make instances of.
|
||||||
|
*
|
||||||
|
* If $withPrefix is true, the returned path
|
||||||
|
* uses a dot-path notation which is translated into a path
|
||||||
|
* relative to a location on the PHP include_path.
|
||||||
|
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||||
|
*
|
||||||
|
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||||
|
* @return string path.to.ClassName
|
||||||
|
*/
|
||||||
|
public static function getOMClass($withPrefix = true)
|
||||||
|
{
|
||||||
|
return $withPrefix ? CouponI18nTableMap::CLASS_DEFAULT : CouponI18nTableMap::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 (CouponI18n object, last column rank)
|
||||||
|
*/
|
||||||
|
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||||
|
{
|
||||||
|
$key = CouponI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||||
|
if (null !== ($obj = CouponI18nTableMap::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 + CouponI18nTableMap::NUM_HYDRATE_COLUMNS;
|
||||||
|
} else {
|
||||||
|
$cls = CouponI18nTableMap::OM_CLASS;
|
||||||
|
$obj = new $cls();
|
||||||
|
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||||
|
CouponI18nTableMap::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 = CouponI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||||
|
if (null !== ($obj = CouponI18nTableMap::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;
|
||||||
|
CouponI18nTableMap::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(CouponI18nTableMap::ID);
|
||||||
|
$criteria->addSelectColumn(CouponI18nTableMap::LOCALE);
|
||||||
|
} else {
|
||||||
|
$criteria->addSelectColumn($alias . '.ID');
|
||||||
|
$criteria->addSelectColumn($alias . '.LOCALE');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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(CouponI18nTableMap::DATABASE_NAME)->getTable(CouponI18nTableMap::TABLE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a TableMap instance to the database for this tableMap class.
|
||||||
|
*/
|
||||||
|
public static function buildTableMap()
|
||||||
|
{
|
||||||
|
$dbMap = Propel::getServiceContainer()->getDatabaseMap(CouponI18nTableMap::DATABASE_NAME);
|
||||||
|
if (!$dbMap->hasTable(CouponI18nTableMap::TABLE_NAME)) {
|
||||||
|
$dbMap->addTableObject(new CouponI18nTableMap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs a DELETE on the database, given a CouponI18n or Criteria object OR a primary key value.
|
||||||
|
*
|
||||||
|
* @param mixed $values Criteria or CouponI18n 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(CouponI18nTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($values instanceof Criteria) {
|
||||||
|
// rename for clarity
|
||||||
|
$criteria = $values;
|
||||||
|
} elseif ($values instanceof \Thelia\Model\CouponI18n) { // 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(CouponI18nTableMap::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(CouponI18nTableMap::ID, $value[0]);
|
||||||
|
$criterion->addAnd($criteria->getNewCriterion(CouponI18nTableMap::LOCALE, $value[1]));
|
||||||
|
$criteria->addOr($criterion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = CouponI18nQuery::create()->mergeWith($criteria);
|
||||||
|
|
||||||
|
if ($values instanceof Criteria) { CouponI18nTableMap::clearInstancePool();
|
||||||
|
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||||
|
foreach ((array) $values as $singleval) { CouponI18nTableMap::removeInstanceFromPool($singleval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query->delete($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all rows from the coupon_i18n table.
|
||||||
|
*
|
||||||
|
* @param ConnectionInterface $con the connection to use
|
||||||
|
* @return int The number of affected rows (if supported by underlying database driver).
|
||||||
|
*/
|
||||||
|
public static function doDeleteAll(ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
return CouponI18nQuery::create()->doDeleteAll($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs an INSERT on the database, given a CouponI18n or Criteria object.
|
||||||
|
*
|
||||||
|
* @param mixed $criteria Criteria or CouponI18n 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(CouponI18nTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($criteria instanceof Criteria) {
|
||||||
|
$criteria = clone $criteria; // rename for clarity
|
||||||
|
} else {
|
||||||
|
$criteria = $criteria->buildCriteria(); // build Criteria from CouponI18n object
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$query = CouponI18nQuery::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;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // CouponI18nTableMap
|
||||||
|
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||||
|
//
|
||||||
|
CouponI18nTableMap::buildTableMap();
|
||||||
@@ -57,7 +57,7 @@ class CouponTableMap extends TableMap
|
|||||||
/**
|
/**
|
||||||
* The total number of columns
|
* The total number of columns
|
||||||
*/
|
*/
|
||||||
const NUM_COLUMNS = 14;
|
const NUM_COLUMNS = 17;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of lazy-loaded columns
|
* The number of lazy-loaded columns
|
||||||
@@ -67,7 +67,7 @@ class CouponTableMap extends TableMap
|
|||||||
/**
|
/**
|
||||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||||
*/
|
*/
|
||||||
const NUM_HYDRATE_COLUMNS = 14;
|
const NUM_HYDRATE_COLUMNS = 17;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the column name for the ID field
|
* the column name for the ID field
|
||||||
@@ -100,9 +100,9 @@ class CouponTableMap extends TableMap
|
|||||||
const DESCRIPTION = 'coupon.DESCRIPTION';
|
const DESCRIPTION = 'coupon.DESCRIPTION';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the column name for the VALUE field
|
* the column name for the AMOUNT field
|
||||||
*/
|
*/
|
||||||
const VALUE = 'coupon.VALUE';
|
const AMOUNT = 'coupon.AMOUNT';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the column name for the IS_USED field
|
* the column name for the IS_USED field
|
||||||
@@ -120,9 +120,24 @@ class CouponTableMap extends TableMap
|
|||||||
const EXPIRATION_DATE = 'coupon.EXPIRATION_DATE';
|
const EXPIRATION_DATE = 'coupon.EXPIRATION_DATE';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the column name for the SERIALIZED_RULES field
|
* the column name for the SERIALIZED_RULES_TYPE field
|
||||||
*/
|
*/
|
||||||
const SERIALIZED_RULES = 'coupon.SERIALIZED_RULES';
|
const SERIALIZED_RULES_TYPE = 'coupon.SERIALIZED_RULES_TYPE';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the SERIALIZED_RULES_CONTENT field
|
||||||
|
*/
|
||||||
|
const SERIALIZED_RULES_CONTENT = 'coupon.SERIALIZED_RULES_CONTENT';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the IS_CUMULATIVE field
|
||||||
|
*/
|
||||||
|
const IS_CUMULATIVE = 'coupon.IS_CUMULATIVE';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the IS_REMOVING_POSTAGE field
|
||||||
|
*/
|
||||||
|
const IS_REMOVING_POSTAGE = 'coupon.IS_REMOVING_POSTAGE';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the column name for the CREATED_AT field
|
* the column name for the CREATED_AT field
|
||||||
@@ -160,12 +175,12 @@ class CouponTableMap extends TableMap
|
|||||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
*/
|
*/
|
||||||
protected static $fieldNames = array (
|
protected static $fieldNames = array (
|
||||||
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Title', 'ShortDescription', 'Description', 'Value', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRules', 'CreatedAt', 'UpdatedAt', 'Version', ),
|
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Title', 'ShortDescription', 'Description', 'Amount', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRulesType', 'SerializedRulesContent', 'IsCumulative', 'IsRemovingPostage', 'CreatedAt', 'UpdatedAt', 'Version', ),
|
||||||
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'title', 'shortDescription', 'description', 'value', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRules', 'createdAt', 'updatedAt', 'version', ),
|
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'title', 'shortDescription', 'description', 'amount', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRulesType', 'serializedRulesContent', 'isCumulative', 'isRemovingPostage', 'createdAt', 'updatedAt', 'version', ),
|
||||||
self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::TYPE, CouponTableMap::TITLE, CouponTableMap::SHORT_DESCRIPTION, CouponTableMap::DESCRIPTION, CouponTableMap::VALUE, CouponTableMap::IS_USED, CouponTableMap::IS_ENABLED, CouponTableMap::EXPIRATION_DATE, CouponTableMap::SERIALIZED_RULES, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, CouponTableMap::VERSION, ),
|
self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::TYPE, CouponTableMap::TITLE, CouponTableMap::SHORT_DESCRIPTION, CouponTableMap::DESCRIPTION, CouponTableMap::AMOUNT, CouponTableMap::IS_USED, CouponTableMap::IS_ENABLED, CouponTableMap::EXPIRATION_DATE, CouponTableMap::SERIALIZED_RULES_TYPE, CouponTableMap::SERIALIZED_RULES_CONTENT, CouponTableMap::IS_CUMULATIVE, CouponTableMap::IS_REMOVING_POSTAGE, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, CouponTableMap::VERSION, ),
|
||||||
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', 'VALUE', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ),
|
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', 'AMOUNT', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES_TYPE', 'SERIALIZED_RULES_CONTENT', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ),
|
||||||
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'title', 'short_description', 'description', 'value', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules', 'created_at', 'updated_at', 'version', ),
|
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'title', 'short_description', 'description', 'amount', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules_type', 'serialized_rules_content', 'is_cumulative', 'is_removing_postage', 'created_at', 'updated_at', 'version', ),
|
||||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
|
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -175,12 +190,12 @@ class CouponTableMap extends TableMap
|
|||||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||||
*/
|
*/
|
||||||
protected static $fieldKeys = array (
|
protected static $fieldKeys = array (
|
||||||
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Title' => 3, 'ShortDescription' => 4, 'Description' => 5, 'Value' => 6, 'IsUsed' => 7, 'IsEnabled' => 8, 'ExpirationDate' => 9, 'SerializedRules' => 10, 'CreatedAt' => 11, 'UpdatedAt' => 12, 'Version' => 13, ),
|
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Title' => 3, 'ShortDescription' => 4, 'Description' => 5, 'Amount' => 6, 'IsUsed' => 7, 'IsEnabled' => 8, 'ExpirationDate' => 9, 'SerializedRulesType' => 10, 'SerializedRulesContent' => 11, 'IsCumulative' => 12, 'IsRemovingPostage' => 13, 'CreatedAt' => 14, 'UpdatedAt' => 15, 'Version' => 16, ),
|
||||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'shortDescription' => 4, 'description' => 5, 'value' => 6, 'isUsed' => 7, 'isEnabled' => 8, 'expirationDate' => 9, 'serializedRules' => 10, 'createdAt' => 11, 'updatedAt' => 12, 'version' => 13, ),
|
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'shortDescription' => 4, 'description' => 5, 'amount' => 6, 'isUsed' => 7, 'isEnabled' => 8, 'expirationDate' => 9, 'serializedRulesType' => 10, 'serializedRulesContent' => 11, 'isCumulative' => 12, 'isRemovingPostage' => 13, 'createdAt' => 14, 'updatedAt' => 15, 'version' => 16, ),
|
||||||
self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::TYPE => 2, CouponTableMap::TITLE => 3, CouponTableMap::SHORT_DESCRIPTION => 4, CouponTableMap::DESCRIPTION => 5, CouponTableMap::VALUE => 6, CouponTableMap::IS_USED => 7, CouponTableMap::IS_ENABLED => 8, CouponTableMap::EXPIRATION_DATE => 9, CouponTableMap::SERIALIZED_RULES => 10, CouponTableMap::CREATED_AT => 11, CouponTableMap::UPDATED_AT => 12, CouponTableMap::VERSION => 13, ),
|
self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::TYPE => 2, CouponTableMap::TITLE => 3, CouponTableMap::SHORT_DESCRIPTION => 4, CouponTableMap::DESCRIPTION => 5, CouponTableMap::AMOUNT => 6, CouponTableMap::IS_USED => 7, CouponTableMap::IS_ENABLED => 8, CouponTableMap::EXPIRATION_DATE => 9, CouponTableMap::SERIALIZED_RULES_TYPE => 10, CouponTableMap::SERIALIZED_RULES_CONTENT => 11, CouponTableMap::IS_CUMULATIVE => 12, CouponTableMap::IS_REMOVING_POSTAGE => 13, CouponTableMap::CREATED_AT => 14, CouponTableMap::UPDATED_AT => 15, CouponTableMap::VERSION => 16, ),
|
||||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'TITLE' => 3, 'SHORT_DESCRIPTION' => 4, 'DESCRIPTION' => 5, 'VALUE' => 6, 'IS_USED' => 7, 'IS_ENABLED' => 8, 'EXPIRATION_DATE' => 9, 'SERIALIZED_RULES' => 10, 'CREATED_AT' => 11, 'UPDATED_AT' => 12, 'VERSION' => 13, ),
|
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'TITLE' => 3, 'SHORT_DESCRIPTION' => 4, 'DESCRIPTION' => 5, 'AMOUNT' => 6, 'IS_USED' => 7, 'IS_ENABLED' => 8, 'EXPIRATION_DATE' => 9, 'SERIALIZED_RULES_TYPE' => 10, 'SERIALIZED_RULES_CONTENT' => 11, 'IS_CUMULATIVE' => 12, 'IS_REMOVING_POSTAGE' => 13, 'CREATED_AT' => 14, 'UPDATED_AT' => 15, 'VERSION' => 16, ),
|
||||||
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'short_description' => 4, 'description' => 5, 'value' => 6, 'is_used' => 7, 'is_enabled' => 8, 'expiration_date' => 9, 'serialized_rules' => 10, 'created_at' => 11, 'updated_at' => 12, 'version' => 13, ),
|
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'short_description' => 4, 'description' => 5, 'amount' => 6, 'is_used' => 7, 'is_enabled' => 8, 'expiration_date' => 9, 'serialized_rules_type' => 10, 'serialized_rules_content' => 11, 'is_cumulative' => 12, 'is_removing_postage' => 13, 'created_at' => 14, 'updated_at' => 15, 'version' => 16, ),
|
||||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
|
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -205,11 +220,14 @@ class CouponTableMap extends TableMap
|
|||||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null);
|
$this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null);
|
||||||
$this->addColumn('SHORT_DESCRIPTION', 'ShortDescription', 'LONGVARCHAR', true, null, null);
|
$this->addColumn('SHORT_DESCRIPTION', 'ShortDescription', 'LONGVARCHAR', true, null, null);
|
||||||
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', true, null, null);
|
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', true, null, null);
|
||||||
$this->addColumn('VALUE', 'Value', 'FLOAT', true, null, null);
|
$this->addColumn('AMOUNT', 'Amount', 'FLOAT', true, null, null);
|
||||||
$this->addColumn('IS_USED', 'IsUsed', 'TINYINT', true, null, null);
|
$this->addColumn('IS_USED', 'IsUsed', 'TINYINT', true, null, null);
|
||||||
$this->addColumn('IS_ENABLED', 'IsEnabled', 'TINYINT', true, null, null);
|
$this->addColumn('IS_ENABLED', 'IsEnabled', 'TINYINT', true, null, null);
|
||||||
$this->addColumn('EXPIRATION_DATE', 'ExpirationDate', 'TIMESTAMP', true, null, null);
|
$this->addColumn('EXPIRATION_DATE', 'ExpirationDate', 'TIMESTAMP', true, null, null);
|
||||||
$this->addColumn('SERIALIZED_RULES', 'SerializedRules', 'LONGVARCHAR', true, null, null);
|
$this->addColumn('SERIALIZED_RULES_TYPE', 'SerializedRulesType', 'LONGVARCHAR', true, null, null);
|
||||||
|
$this->addColumn('SERIALIZED_RULES_CONTENT', 'SerializedRulesContent', 'LONGVARCHAR', true, null, null);
|
||||||
|
$this->addColumn('IS_CUMULATIVE', 'IsCumulative', 'TINYINT', true, null, null);
|
||||||
|
$this->addColumn('IS_REMOVING_POSTAGE', 'IsRemovingPostage', 'TINYINT', true, null, null);
|
||||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||||
$this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0);
|
$this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0);
|
||||||
@@ -394,11 +412,14 @@ class CouponTableMap extends TableMap
|
|||||||
$criteria->addSelectColumn(CouponTableMap::TITLE);
|
$criteria->addSelectColumn(CouponTableMap::TITLE);
|
||||||
$criteria->addSelectColumn(CouponTableMap::SHORT_DESCRIPTION);
|
$criteria->addSelectColumn(CouponTableMap::SHORT_DESCRIPTION);
|
||||||
$criteria->addSelectColumn(CouponTableMap::DESCRIPTION);
|
$criteria->addSelectColumn(CouponTableMap::DESCRIPTION);
|
||||||
$criteria->addSelectColumn(CouponTableMap::VALUE);
|
$criteria->addSelectColumn(CouponTableMap::AMOUNT);
|
||||||
$criteria->addSelectColumn(CouponTableMap::IS_USED);
|
$criteria->addSelectColumn(CouponTableMap::IS_USED);
|
||||||
$criteria->addSelectColumn(CouponTableMap::IS_ENABLED);
|
$criteria->addSelectColumn(CouponTableMap::IS_ENABLED);
|
||||||
$criteria->addSelectColumn(CouponTableMap::EXPIRATION_DATE);
|
$criteria->addSelectColumn(CouponTableMap::EXPIRATION_DATE);
|
||||||
$criteria->addSelectColumn(CouponTableMap::SERIALIZED_RULES);
|
$criteria->addSelectColumn(CouponTableMap::SERIALIZED_RULES_TYPE);
|
||||||
|
$criteria->addSelectColumn(CouponTableMap::SERIALIZED_RULES_CONTENT);
|
||||||
|
$criteria->addSelectColumn(CouponTableMap::IS_CUMULATIVE);
|
||||||
|
$criteria->addSelectColumn(CouponTableMap::IS_REMOVING_POSTAGE);
|
||||||
$criteria->addSelectColumn(CouponTableMap::CREATED_AT);
|
$criteria->addSelectColumn(CouponTableMap::CREATED_AT);
|
||||||
$criteria->addSelectColumn(CouponTableMap::UPDATED_AT);
|
$criteria->addSelectColumn(CouponTableMap::UPDATED_AT);
|
||||||
$criteria->addSelectColumn(CouponTableMap::VERSION);
|
$criteria->addSelectColumn(CouponTableMap::VERSION);
|
||||||
@@ -409,11 +430,14 @@ class CouponTableMap extends TableMap
|
|||||||
$criteria->addSelectColumn($alias . '.TITLE');
|
$criteria->addSelectColumn($alias . '.TITLE');
|
||||||
$criteria->addSelectColumn($alias . '.SHORT_DESCRIPTION');
|
$criteria->addSelectColumn($alias . '.SHORT_DESCRIPTION');
|
||||||
$criteria->addSelectColumn($alias . '.DESCRIPTION');
|
$criteria->addSelectColumn($alias . '.DESCRIPTION');
|
||||||
$criteria->addSelectColumn($alias . '.VALUE');
|
$criteria->addSelectColumn($alias . '.AMOUNT');
|
||||||
$criteria->addSelectColumn($alias . '.IS_USED');
|
$criteria->addSelectColumn($alias . '.IS_USED');
|
||||||
$criteria->addSelectColumn($alias . '.IS_ENABLED');
|
$criteria->addSelectColumn($alias . '.IS_ENABLED');
|
||||||
$criteria->addSelectColumn($alias . '.EXPIRATION_DATE');
|
$criteria->addSelectColumn($alias . '.EXPIRATION_DATE');
|
||||||
$criteria->addSelectColumn($alias . '.SERIALIZED_RULES');
|
$criteria->addSelectColumn($alias . '.SERIALIZED_RULES_TYPE');
|
||||||
|
$criteria->addSelectColumn($alias . '.SERIALIZED_RULES_CONTENT');
|
||||||
|
$criteria->addSelectColumn($alias . '.IS_CUMULATIVE');
|
||||||
|
$criteria->addSelectColumn($alias . '.IS_REMOVING_POSTAGE');
|
||||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||||
$criteria->addSelectColumn($alias . '.VERSION');
|
$criteria->addSelectColumn($alias . '.VERSION');
|
||||||
|
|||||||
585
core/lib/Thelia/Model/Map/CouponVersionTableMap.php
Normal file
585
core/lib/Thelia/Model/Map/CouponVersionTableMap.php
Normal file
@@ -0,0 +1,585 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model\Map;
|
||||||
|
|
||||||
|
use Propel\Runtime\Propel;
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
|
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||||
|
use Propel\Runtime\Connection\ConnectionInterface;
|
||||||
|
use Propel\Runtime\Exception\PropelException;
|
||||||
|
use Propel\Runtime\Map\RelationMap;
|
||||||
|
use Propel\Runtime\Map\TableMap;
|
||||||
|
use Propel\Runtime\Map\TableMapTrait;
|
||||||
|
use Thelia\Model\CouponVersion;
|
||||||
|
use Thelia\Model\CouponVersionQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class defines the structure of the 'coupon_version' 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 CouponVersionTableMap extends TableMap
|
||||||
|
{
|
||||||
|
use InstancePoolTrait;
|
||||||
|
use TableMapTrait;
|
||||||
|
/**
|
||||||
|
* The (dot-path) name of this class
|
||||||
|
*/
|
||||||
|
const CLASS_NAME = 'Thelia.Model.Map.CouponVersionTableMap';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default database name for this class
|
||||||
|
*/
|
||||||
|
const DATABASE_NAME = 'thelia';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table name for this class
|
||||||
|
*/
|
||||||
|
const TABLE_NAME = 'coupon_version';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The related Propel class for this table
|
||||||
|
*/
|
||||||
|
const OM_CLASS = '\\Thelia\\Model\\CouponVersion';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class that can be returned by this tableMap
|
||||||
|
*/
|
||||||
|
const CLASS_DEFAULT = 'Thelia.Model.CouponVersion';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The total number of columns
|
||||||
|
*/
|
||||||
|
const NUM_COLUMNS = 17;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 = 17;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the ID field
|
||||||
|
*/
|
||||||
|
const ID = 'coupon_version.ID';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the CODE field
|
||||||
|
*/
|
||||||
|
const CODE = 'coupon_version.CODE';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the TYPE field
|
||||||
|
*/
|
||||||
|
const TYPE = 'coupon_version.TYPE';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the TITLE field
|
||||||
|
*/
|
||||||
|
const TITLE = 'coupon_version.TITLE';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the SHORT_DESCRIPTION field
|
||||||
|
*/
|
||||||
|
const SHORT_DESCRIPTION = 'coupon_version.SHORT_DESCRIPTION';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the DESCRIPTION field
|
||||||
|
*/
|
||||||
|
const DESCRIPTION = 'coupon_version.DESCRIPTION';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the AMOUNT field
|
||||||
|
*/
|
||||||
|
const AMOUNT = 'coupon_version.AMOUNT';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the IS_USED field
|
||||||
|
*/
|
||||||
|
const IS_USED = 'coupon_version.IS_USED';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the IS_ENABLED field
|
||||||
|
*/
|
||||||
|
const IS_ENABLED = 'coupon_version.IS_ENABLED';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the EXPIRATION_DATE field
|
||||||
|
*/
|
||||||
|
const EXPIRATION_DATE = 'coupon_version.EXPIRATION_DATE';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the SERIALIZED_RULES_TYPE field
|
||||||
|
*/
|
||||||
|
const SERIALIZED_RULES_TYPE = 'coupon_version.SERIALIZED_RULES_TYPE';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the SERIALIZED_RULES_CONTENT field
|
||||||
|
*/
|
||||||
|
const SERIALIZED_RULES_CONTENT = 'coupon_version.SERIALIZED_RULES_CONTENT';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the IS_CUMULATIVE field
|
||||||
|
*/
|
||||||
|
const IS_CUMULATIVE = 'coupon_version.IS_CUMULATIVE';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the IS_REMOVING_POSTAGE field
|
||||||
|
*/
|
||||||
|
const IS_REMOVING_POSTAGE = 'coupon_version.IS_REMOVING_POSTAGE';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the CREATED_AT field
|
||||||
|
*/
|
||||||
|
const CREATED_AT = 'coupon_version.CREATED_AT';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the UPDATED_AT field
|
||||||
|
*/
|
||||||
|
const UPDATED_AT = 'coupon_version.UPDATED_AT';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the VERSION field
|
||||||
|
*/
|
||||||
|
const VERSION = 'coupon_version.VERSION';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default string format for model objects of the related table
|
||||||
|
*/
|
||||||
|
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* holds an array of fieldnames
|
||||||
|
*
|
||||||
|
* first dimension keys are the type constants
|
||||||
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
|
*/
|
||||||
|
protected static $fieldNames = array (
|
||||||
|
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Title', 'ShortDescription', 'Description', 'Amount', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRulesType', 'SerializedRulesContent', 'IsCumulative', 'IsRemovingPostage', 'CreatedAt', 'UpdatedAt', 'Version', ),
|
||||||
|
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'title', 'shortDescription', 'description', 'amount', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRulesType', 'serializedRulesContent', 'isCumulative', 'isRemovingPostage', 'createdAt', 'updatedAt', 'version', ),
|
||||||
|
self::TYPE_COLNAME => array(CouponVersionTableMap::ID, CouponVersionTableMap::CODE, CouponVersionTableMap::TYPE, CouponVersionTableMap::TITLE, CouponVersionTableMap::SHORT_DESCRIPTION, CouponVersionTableMap::DESCRIPTION, CouponVersionTableMap::AMOUNT, CouponVersionTableMap::IS_USED, CouponVersionTableMap::IS_ENABLED, CouponVersionTableMap::EXPIRATION_DATE, CouponVersionTableMap::SERIALIZED_RULES_TYPE, CouponVersionTableMap::SERIALIZED_RULES_CONTENT, CouponVersionTableMap::IS_CUMULATIVE, CouponVersionTableMap::IS_REMOVING_POSTAGE, CouponVersionTableMap::CREATED_AT, CouponVersionTableMap::UPDATED_AT, CouponVersionTableMap::VERSION, ),
|
||||||
|
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', 'AMOUNT', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES_TYPE', 'SERIALIZED_RULES_CONTENT', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ),
|
||||||
|
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'title', 'short_description', 'description', 'amount', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules_type', 'serialized_rules_content', 'is_cumulative', 'is_removing_postage', '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, 16, )
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* holds an array of keys for quick access to the fieldnames array
|
||||||
|
*
|
||||||
|
* first dimension keys are the type constants
|
||||||
|
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||||
|
*/
|
||||||
|
protected static $fieldKeys = array (
|
||||||
|
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Title' => 3, 'ShortDescription' => 4, 'Description' => 5, 'Amount' => 6, 'IsUsed' => 7, 'IsEnabled' => 8, 'ExpirationDate' => 9, 'SerializedRulesType' => 10, 'SerializedRulesContent' => 11, 'IsCumulative' => 12, 'IsRemovingPostage' => 13, 'CreatedAt' => 14, 'UpdatedAt' => 15, 'Version' => 16, ),
|
||||||
|
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'shortDescription' => 4, 'description' => 5, 'amount' => 6, 'isUsed' => 7, 'isEnabled' => 8, 'expirationDate' => 9, 'serializedRulesType' => 10, 'serializedRulesContent' => 11, 'isCumulative' => 12, 'isRemovingPostage' => 13, 'createdAt' => 14, 'updatedAt' => 15, 'version' => 16, ),
|
||||||
|
self::TYPE_COLNAME => array(CouponVersionTableMap::ID => 0, CouponVersionTableMap::CODE => 1, CouponVersionTableMap::TYPE => 2, CouponVersionTableMap::TITLE => 3, CouponVersionTableMap::SHORT_DESCRIPTION => 4, CouponVersionTableMap::DESCRIPTION => 5, CouponVersionTableMap::AMOUNT => 6, CouponVersionTableMap::IS_USED => 7, CouponVersionTableMap::IS_ENABLED => 8, CouponVersionTableMap::EXPIRATION_DATE => 9, CouponVersionTableMap::SERIALIZED_RULES_TYPE => 10, CouponVersionTableMap::SERIALIZED_RULES_CONTENT => 11, CouponVersionTableMap::IS_CUMULATIVE => 12, CouponVersionTableMap::IS_REMOVING_POSTAGE => 13, CouponVersionTableMap::CREATED_AT => 14, CouponVersionTableMap::UPDATED_AT => 15, CouponVersionTableMap::VERSION => 16, ),
|
||||||
|
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'TITLE' => 3, 'SHORT_DESCRIPTION' => 4, 'DESCRIPTION' => 5, 'AMOUNT' => 6, 'IS_USED' => 7, 'IS_ENABLED' => 8, 'EXPIRATION_DATE' => 9, 'SERIALIZED_RULES_TYPE' => 10, 'SERIALIZED_RULES_CONTENT' => 11, 'IS_CUMULATIVE' => 12, 'IS_REMOVING_POSTAGE' => 13, 'CREATED_AT' => 14, 'UPDATED_AT' => 15, 'VERSION' => 16, ),
|
||||||
|
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'short_description' => 4, 'description' => 5, 'amount' => 6, 'is_used' => 7, 'is_enabled' => 8, 'expiration_date' => 9, 'serialized_rules_type' => 10, 'serialized_rules_content' => 11, 'is_cumulative' => 12, 'is_removing_postage' => 13, 'created_at' => 14, 'updated_at' => 15, 'version' => 16, ),
|
||||||
|
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, )
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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_version');
|
||||||
|
$this->setPhpName('CouponVersion');
|
||||||
|
$this->setClassName('\\Thelia\\Model\\CouponVersion');
|
||||||
|
$this->setPackage('Thelia.Model');
|
||||||
|
$this->setUseIdGenerator(false);
|
||||||
|
// columns
|
||||||
|
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'coupon', 'ID', true, null, null);
|
||||||
|
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null);
|
||||||
|
$this->addColumn('TYPE', 'Type', 'VARCHAR', true, 255, null);
|
||||||
|
$this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null);
|
||||||
|
$this->addColumn('SHORT_DESCRIPTION', 'ShortDescription', 'LONGVARCHAR', true, null, null);
|
||||||
|
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', true, null, null);
|
||||||
|
$this->addColumn('AMOUNT', 'Amount', 'FLOAT', true, null, null);
|
||||||
|
$this->addColumn('IS_USED', 'IsUsed', 'TINYINT', true, null, null);
|
||||||
|
$this->addColumn('IS_ENABLED', 'IsEnabled', 'TINYINT', true, null, null);
|
||||||
|
$this->addColumn('EXPIRATION_DATE', 'ExpirationDate', 'TIMESTAMP', true, null, null);
|
||||||
|
$this->addColumn('SERIALIZED_RULES_TYPE', 'SerializedRulesType', 'LONGVARCHAR', true, null, null);
|
||||||
|
$this->addColumn('SERIALIZED_RULES_CONTENT', 'SerializedRulesContent', 'LONGVARCHAR', true, null, null);
|
||||||
|
$this->addColumn('IS_CUMULATIVE', 'IsCumulative', 'TINYINT', true, null, null);
|
||||||
|
$this->addColumn('IS_REMOVING_POSTAGE', 'IsRemovingPostage', 'TINYINT', true, null, null);
|
||||||
|
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0);
|
||||||
|
} // initialize()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the RelationMap objects for this table relationships
|
||||||
|
*/
|
||||||
|
public function buildRelations()
|
||||||
|
{
|
||||||
|
$this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
|
||||||
|
} // buildRelations()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an object to the instance pool.
|
||||||
|
*
|
||||||
|
* Propel keeps cached copies of objects in an instance pool when they are retrieved
|
||||||
|
* from the database. In some cases you may need to explicitly add objects
|
||||||
|
* to the cache in order to ensure that the same objects are always returned by find*()
|
||||||
|
* and findPk*() calls.
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\CouponVersion $obj A \Thelia\Model\CouponVersion object.
|
||||||
|
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
|
||||||
|
*/
|
||||||
|
public static function addInstanceToPool($obj, $key = null)
|
||||||
|
{
|
||||||
|
if (Propel::isInstancePoolingEnabled()) {
|
||||||
|
if (null === $key) {
|
||||||
|
$key = serialize(array((string) $obj->getId(), (string) $obj->getVersion()));
|
||||||
|
} // 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\CouponVersion object or a primary key value.
|
||||||
|
*/
|
||||||
|
public static function removeInstanceFromPool($value)
|
||||||
|
{
|
||||||
|
if (Propel::isInstancePoolingEnabled() && null !== $value) {
|
||||||
|
if (is_object($value) && $value instanceof \Thelia\Model\CouponVersion) {
|
||||||
|
$key = serialize(array((string) $value->getId(), (string) $value->getVersion()));
|
||||||
|
|
||||||
|
} 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\CouponVersion object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
unset(self::$instances[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||||
|
*
|
||||||
|
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||||
|
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||||
|
*
|
||||||
|
* @param array $row resultset row.
|
||||||
|
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||||
|
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||||
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||||
|
*/
|
||||||
|
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||||
|
{
|
||||||
|
// If the PK cannot be derived from the row, return NULL.
|
||||||
|
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 16 + $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 ? 16 + $offset : static::translateFieldName('Version', 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 ? CouponVersionTableMap::CLASS_DEFAULT : CouponVersionTableMap::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 (CouponVersion object, last column rank)
|
||||||
|
*/
|
||||||
|
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||||
|
{
|
||||||
|
$key = CouponVersionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||||
|
if (null !== ($obj = CouponVersionTableMap::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 + CouponVersionTableMap::NUM_HYDRATE_COLUMNS;
|
||||||
|
} else {
|
||||||
|
$cls = CouponVersionTableMap::OM_CLASS;
|
||||||
|
$obj = new $cls();
|
||||||
|
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||||
|
CouponVersionTableMap::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 = CouponVersionTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||||
|
if (null !== ($obj = CouponVersionTableMap::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;
|
||||||
|
CouponVersionTableMap::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(CouponVersionTableMap::ID);
|
||||||
|
$criteria->addSelectColumn(CouponVersionTableMap::CODE);
|
||||||
|
$criteria->addSelectColumn(CouponVersionTableMap::TYPE);
|
||||||
|
$criteria->addSelectColumn(CouponVersionTableMap::TITLE);
|
||||||
|
$criteria->addSelectColumn(CouponVersionTableMap::SHORT_DESCRIPTION);
|
||||||
|
$criteria->addSelectColumn(CouponVersionTableMap::DESCRIPTION);
|
||||||
|
$criteria->addSelectColumn(CouponVersionTableMap::AMOUNT);
|
||||||
|
$criteria->addSelectColumn(CouponVersionTableMap::IS_USED);
|
||||||
|
$criteria->addSelectColumn(CouponVersionTableMap::IS_ENABLED);
|
||||||
|
$criteria->addSelectColumn(CouponVersionTableMap::EXPIRATION_DATE);
|
||||||
|
$criteria->addSelectColumn(CouponVersionTableMap::SERIALIZED_RULES_TYPE);
|
||||||
|
$criteria->addSelectColumn(CouponVersionTableMap::SERIALIZED_RULES_CONTENT);
|
||||||
|
$criteria->addSelectColumn(CouponVersionTableMap::IS_CUMULATIVE);
|
||||||
|
$criteria->addSelectColumn(CouponVersionTableMap::IS_REMOVING_POSTAGE);
|
||||||
|
$criteria->addSelectColumn(CouponVersionTableMap::CREATED_AT);
|
||||||
|
$criteria->addSelectColumn(CouponVersionTableMap::UPDATED_AT);
|
||||||
|
$criteria->addSelectColumn(CouponVersionTableMap::VERSION);
|
||||||
|
} else {
|
||||||
|
$criteria->addSelectColumn($alias . '.ID');
|
||||||
|
$criteria->addSelectColumn($alias . '.CODE');
|
||||||
|
$criteria->addSelectColumn($alias . '.TYPE');
|
||||||
|
$criteria->addSelectColumn($alias . '.TITLE');
|
||||||
|
$criteria->addSelectColumn($alias . '.SHORT_DESCRIPTION');
|
||||||
|
$criteria->addSelectColumn($alias . '.DESCRIPTION');
|
||||||
|
$criteria->addSelectColumn($alias . '.AMOUNT');
|
||||||
|
$criteria->addSelectColumn($alias . '.IS_USED');
|
||||||
|
$criteria->addSelectColumn($alias . '.IS_ENABLED');
|
||||||
|
$criteria->addSelectColumn($alias . '.EXPIRATION_DATE');
|
||||||
|
$criteria->addSelectColumn($alias . '.SERIALIZED_RULES_TYPE');
|
||||||
|
$criteria->addSelectColumn($alias . '.SERIALIZED_RULES_CONTENT');
|
||||||
|
$criteria->addSelectColumn($alias . '.IS_CUMULATIVE');
|
||||||
|
$criteria->addSelectColumn($alias . '.IS_REMOVING_POSTAGE');
|
||||||
|
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||||
|
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||||
|
$criteria->addSelectColumn($alias . '.VERSION');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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(CouponVersionTableMap::DATABASE_NAME)->getTable(CouponVersionTableMap::TABLE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a TableMap instance to the database for this tableMap class.
|
||||||
|
*/
|
||||||
|
public static function buildTableMap()
|
||||||
|
{
|
||||||
|
$dbMap = Propel::getServiceContainer()->getDatabaseMap(CouponVersionTableMap::DATABASE_NAME);
|
||||||
|
if (!$dbMap->hasTable(CouponVersionTableMap::TABLE_NAME)) {
|
||||||
|
$dbMap->addTableObject(new CouponVersionTableMap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs a DELETE on the database, given a CouponVersion or Criteria object OR a primary key value.
|
||||||
|
*
|
||||||
|
* @param mixed $values Criteria or CouponVersion 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(CouponVersionTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($values instanceof Criteria) {
|
||||||
|
// rename for clarity
|
||||||
|
$criteria = $values;
|
||||||
|
} elseif ($values instanceof \Thelia\Model\CouponVersion) { // 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(CouponVersionTableMap::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(CouponVersionTableMap::ID, $value[0]);
|
||||||
|
$criterion->addAnd($criteria->getNewCriterion(CouponVersionTableMap::VERSION, $value[1]));
|
||||||
|
$criteria->addOr($criterion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = CouponVersionQuery::create()->mergeWith($criteria);
|
||||||
|
|
||||||
|
if ($values instanceof Criteria) { CouponVersionTableMap::clearInstancePool();
|
||||||
|
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||||
|
foreach ((array) $values as $singleval) { CouponVersionTableMap::removeInstanceFromPool($singleval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query->delete($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all rows from the coupon_version 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 CouponVersionQuery::create()->doDeleteAll($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs an INSERT on the database, given a CouponVersion or Criteria object.
|
||||||
|
*
|
||||||
|
* @param mixed $criteria Criteria or CouponVersion 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(CouponVersionTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($criteria instanceof Criteria) {
|
||||||
|
$criteria = clone $criteria; // rename for clarity
|
||||||
|
} else {
|
||||||
|
$criteria = $criteria->buildCriteria(); // build Criteria from CouponVersion object
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$query = CouponVersionQuery::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;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // CouponVersionTableMap
|
||||||
|
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||||
|
//
|
||||||
|
CouponVersionTableMap::buildTableMap();
|
||||||
456
core/lib/Thelia/Model/Map/ProductAssociatedContentTableMap.php
Normal file
456
core/lib/Thelia/Model/Map/ProductAssociatedContentTableMap.php
Normal file
@@ -0,0 +1,456 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model\Map;
|
||||||
|
|
||||||
|
use Propel\Runtime\Propel;
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
|
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||||
|
use Propel\Runtime\Connection\ConnectionInterface;
|
||||||
|
use Propel\Runtime\Exception\PropelException;
|
||||||
|
use Propel\Runtime\Map\RelationMap;
|
||||||
|
use Propel\Runtime\Map\TableMap;
|
||||||
|
use Propel\Runtime\Map\TableMapTrait;
|
||||||
|
use Thelia\Model\ProductAssociatedContent;
|
||||||
|
use Thelia\Model\ProductAssociatedContentQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class defines the structure of the 'product_associated_content' 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 ProductAssociatedContentTableMap extends TableMap
|
||||||
|
{
|
||||||
|
use InstancePoolTrait;
|
||||||
|
use TableMapTrait;
|
||||||
|
/**
|
||||||
|
* The (dot-path) name of this class
|
||||||
|
*/
|
||||||
|
const CLASS_NAME = 'Thelia.Model.Map.ProductAssociatedContentTableMap';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default database name for this class
|
||||||
|
*/
|
||||||
|
const DATABASE_NAME = 'thelia';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table name for this class
|
||||||
|
*/
|
||||||
|
const TABLE_NAME = 'product_associated_content';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The related Propel class for this table
|
||||||
|
*/
|
||||||
|
const OM_CLASS = '\\Thelia\\Model\\ProductAssociatedContent';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class that can be returned by this tableMap
|
||||||
|
*/
|
||||||
|
const CLASS_DEFAULT = 'Thelia.Model.ProductAssociatedContent';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The total number of columns
|
||||||
|
*/
|
||||||
|
const NUM_COLUMNS = 6;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 = 6;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the ID field
|
||||||
|
*/
|
||||||
|
const ID = 'product_associated_content.ID';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the PRODUCT_ID field
|
||||||
|
*/
|
||||||
|
const PRODUCT_ID = 'product_associated_content.PRODUCT_ID';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the CONTENT_ID field
|
||||||
|
*/
|
||||||
|
const CONTENT_ID = 'product_associated_content.CONTENT_ID';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the POSITION field
|
||||||
|
*/
|
||||||
|
const POSITION = 'product_associated_content.POSITION';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the CREATED_AT field
|
||||||
|
*/
|
||||||
|
const CREATED_AT = 'product_associated_content.CREATED_AT';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the UPDATED_AT field
|
||||||
|
*/
|
||||||
|
const UPDATED_AT = 'product_associated_content.UPDATED_AT';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default string format for model objects of the related table
|
||||||
|
*/
|
||||||
|
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* holds an array of fieldnames
|
||||||
|
*
|
||||||
|
* first dimension keys are the type constants
|
||||||
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
|
*/
|
||||||
|
protected static $fieldNames = array (
|
||||||
|
self::TYPE_PHPNAME => array('Id', 'ProductId', 'ContentId', 'Position', 'CreatedAt', 'UpdatedAt', ),
|
||||||
|
self::TYPE_STUDLYPHPNAME => array('id', 'productId', 'contentId', 'position', 'createdAt', 'updatedAt', ),
|
||||||
|
self::TYPE_COLNAME => array(ProductAssociatedContentTableMap::ID, ProductAssociatedContentTableMap::PRODUCT_ID, ProductAssociatedContentTableMap::CONTENT_ID, ProductAssociatedContentTableMap::POSITION, ProductAssociatedContentTableMap::CREATED_AT, ProductAssociatedContentTableMap::UPDATED_AT, ),
|
||||||
|
self::TYPE_RAW_COLNAME => array('ID', 'PRODUCT_ID', 'CONTENT_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
|
||||||
|
self::TYPE_FIELDNAME => array('id', 'product_id', 'content_id', 'position', 'created_at', 'updated_at', ),
|
||||||
|
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* holds an array of keys for quick access to the fieldnames array
|
||||||
|
*
|
||||||
|
* first dimension keys are the type constants
|
||||||
|
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||||
|
*/
|
||||||
|
protected static $fieldKeys = array (
|
||||||
|
self::TYPE_PHPNAME => array('Id' => 0, 'ProductId' => 1, 'ContentId' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
|
||||||
|
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'productId' => 1, 'contentId' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
|
||||||
|
self::TYPE_COLNAME => array(ProductAssociatedContentTableMap::ID => 0, ProductAssociatedContentTableMap::PRODUCT_ID => 1, ProductAssociatedContentTableMap::CONTENT_ID => 2, ProductAssociatedContentTableMap::POSITION => 3, ProductAssociatedContentTableMap::CREATED_AT => 4, ProductAssociatedContentTableMap::UPDATED_AT => 5, ),
|
||||||
|
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PRODUCT_ID' => 1, 'CONTENT_ID' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
|
||||||
|
self::TYPE_FIELDNAME => array('id' => 0, 'product_id' => 1, 'content_id' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, ),
|
||||||
|
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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('product_associated_content');
|
||||||
|
$this->setPhpName('ProductAssociatedContent');
|
||||||
|
$this->setClassName('\\Thelia\\Model\\ProductAssociatedContent');
|
||||||
|
$this->setPackage('Thelia.Model');
|
||||||
|
$this->setUseIdGenerator(true);
|
||||||
|
// columns
|
||||||
|
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||||
|
$this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', true, null, null);
|
||||||
|
$this->addForeignKey('CONTENT_ID', 'ContentId', 'INTEGER', 'content', 'ID', true, null, null);
|
||||||
|
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
|
||||||
|
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
} // initialize()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the RelationMap objects for this table relationships
|
||||||
|
*/
|
||||||
|
public function buildRelations()
|
||||||
|
{
|
||||||
|
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||||
|
$this->addRelation('Content', '\\Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('content_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||||
|
} // buildRelations()
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Gets the list of behaviors registered for this table
|
||||||
|
*
|
||||||
|
* @return array Associative array (name => parameters) of behaviors
|
||||||
|
*/
|
||||||
|
public function getBehaviors()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
|
||||||
|
);
|
||||||
|
} // getBehaviors()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||||
|
*
|
||||||
|
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||||
|
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||||
|
*
|
||||||
|
* @param array $row resultset row.
|
||||||
|
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||||
|
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||||
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||||
|
*/
|
||||||
|
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||||
|
{
|
||||||
|
// If the PK cannot be derived from the row, return NULL.
|
||||||
|
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the primary key from the DB resultset row
|
||||||
|
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||||
|
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||||
|
*
|
||||||
|
* @param array $row resultset row.
|
||||||
|
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||||
|
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||||
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||||
|
*
|
||||||
|
* @return mixed The primary key of the row
|
||||||
|
*/
|
||||||
|
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (int) $row[
|
||||||
|
$indexType == TableMap::TYPE_NUM
|
||||||
|
? 0 + $offset
|
||||||
|
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class that the tableMap will make instances of.
|
||||||
|
*
|
||||||
|
* If $withPrefix is true, the returned path
|
||||||
|
* uses a dot-path notation which is translated into a path
|
||||||
|
* relative to a location on the PHP include_path.
|
||||||
|
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||||
|
*
|
||||||
|
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||||
|
* @return string path.to.ClassName
|
||||||
|
*/
|
||||||
|
public static function getOMClass($withPrefix = true)
|
||||||
|
{
|
||||||
|
return $withPrefix ? ProductAssociatedContentTableMap::CLASS_DEFAULT : ProductAssociatedContentTableMap::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 (ProductAssociatedContent object, last column rank)
|
||||||
|
*/
|
||||||
|
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||||
|
{
|
||||||
|
$key = ProductAssociatedContentTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||||
|
if (null !== ($obj = ProductAssociatedContentTableMap::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 + ProductAssociatedContentTableMap::NUM_HYDRATE_COLUMNS;
|
||||||
|
} else {
|
||||||
|
$cls = ProductAssociatedContentTableMap::OM_CLASS;
|
||||||
|
$obj = new $cls();
|
||||||
|
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||||
|
ProductAssociatedContentTableMap::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 = ProductAssociatedContentTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||||
|
if (null !== ($obj = ProductAssociatedContentTableMap::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;
|
||||||
|
ProductAssociatedContentTableMap::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(ProductAssociatedContentTableMap::ID);
|
||||||
|
$criteria->addSelectColumn(ProductAssociatedContentTableMap::PRODUCT_ID);
|
||||||
|
$criteria->addSelectColumn(ProductAssociatedContentTableMap::CONTENT_ID);
|
||||||
|
$criteria->addSelectColumn(ProductAssociatedContentTableMap::POSITION);
|
||||||
|
$criteria->addSelectColumn(ProductAssociatedContentTableMap::CREATED_AT);
|
||||||
|
$criteria->addSelectColumn(ProductAssociatedContentTableMap::UPDATED_AT);
|
||||||
|
} else {
|
||||||
|
$criteria->addSelectColumn($alias . '.ID');
|
||||||
|
$criteria->addSelectColumn($alias . '.PRODUCT_ID');
|
||||||
|
$criteria->addSelectColumn($alias . '.CONTENT_ID');
|
||||||
|
$criteria->addSelectColumn($alias . '.POSITION');
|
||||||
|
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||||
|
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the TableMap related to this object.
|
||||||
|
* This method is not needed for general use but a specific application could have a need.
|
||||||
|
* @return TableMap
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function getTableMap()
|
||||||
|
{
|
||||||
|
return Propel::getServiceContainer()->getDatabaseMap(ProductAssociatedContentTableMap::DATABASE_NAME)->getTable(ProductAssociatedContentTableMap::TABLE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a TableMap instance to the database for this tableMap class.
|
||||||
|
*/
|
||||||
|
public static function buildTableMap()
|
||||||
|
{
|
||||||
|
$dbMap = Propel::getServiceContainer()->getDatabaseMap(ProductAssociatedContentTableMap::DATABASE_NAME);
|
||||||
|
if (!$dbMap->hasTable(ProductAssociatedContentTableMap::TABLE_NAME)) {
|
||||||
|
$dbMap->addTableObject(new ProductAssociatedContentTableMap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs a DELETE on the database, given a ProductAssociatedContent or Criteria object OR a primary key value.
|
||||||
|
*
|
||||||
|
* @param mixed $values Criteria or ProductAssociatedContent 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(ProductAssociatedContentTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($values instanceof Criteria) {
|
||||||
|
// rename for clarity
|
||||||
|
$criteria = $values;
|
||||||
|
} elseif ($values instanceof \Thelia\Model\ProductAssociatedContent) { // 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(ProductAssociatedContentTableMap::DATABASE_NAME);
|
||||||
|
$criteria->add(ProductAssociatedContentTableMap::ID, (array) $values, Criteria::IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = ProductAssociatedContentQuery::create()->mergeWith($criteria);
|
||||||
|
|
||||||
|
if ($values instanceof Criteria) { ProductAssociatedContentTableMap::clearInstancePool();
|
||||||
|
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||||
|
foreach ((array) $values as $singleval) { ProductAssociatedContentTableMap::removeInstanceFromPool($singleval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query->delete($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all rows from the product_associated_content 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 ProductAssociatedContentQuery::create()->doDeleteAll($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs an INSERT on the database, given a ProductAssociatedContent or Criteria object.
|
||||||
|
*
|
||||||
|
* @param mixed $criteria Criteria or ProductAssociatedContent 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(ProductAssociatedContentTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($criteria instanceof Criteria) {
|
||||||
|
$criteria = clone $criteria; // rename for clarity
|
||||||
|
} else {
|
||||||
|
$criteria = $criteria->buildCriteria(); // build Criteria from ProductAssociatedContent object
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($criteria->containsKey(ProductAssociatedContentTableMap::ID) && $criteria->keyContainsValue(ProductAssociatedContentTableMap::ID) ) {
|
||||||
|
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ProductAssociatedContentTableMap::ID.')');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$query = ProductAssociatedContentQuery::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;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // ProductAssociatedContentTableMap
|
||||||
|
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||||
|
//
|
||||||
|
ProductAssociatedContentTableMap::buildTableMap();
|
||||||
@@ -200,13 +200,13 @@ class ProductTableMap extends TableMap
|
|||||||
$this->addRelation('ProductCategory', '\\Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductCategories');
|
$this->addRelation('ProductCategory', '\\Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductCategories');
|
||||||
$this->addRelation('FeatureProduct', '\\Thelia\\Model\\FeatureProduct', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'FeatureProducts');
|
$this->addRelation('FeatureProduct', '\\Thelia\\Model\\FeatureProduct', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'FeatureProducts');
|
||||||
$this->addRelation('ProductSaleElements', '\\Thelia\\Model\\ProductSaleElements', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductSaleElementss');
|
$this->addRelation('ProductSaleElements', '\\Thelia\\Model\\ProductSaleElements', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductSaleElementss');
|
||||||
$this->addRelation('ContentAssoc', '\\Thelia\\Model\\ContentAssoc', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ContentAssocs');
|
|
||||||
$this->addRelation('ProductImage', '\\Thelia\\Model\\ProductImage', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductImages');
|
$this->addRelation('ProductImage', '\\Thelia\\Model\\ProductImage', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductImages');
|
||||||
$this->addRelation('ProductDocument', '\\Thelia\\Model\\ProductDocument', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductDocuments');
|
$this->addRelation('ProductDocument', '\\Thelia\\Model\\ProductDocument', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductDocuments');
|
||||||
$this->addRelation('AccessoryRelatedByProductId', '\\Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'AccessoriesRelatedByProductId');
|
$this->addRelation('AccessoryRelatedByProductId', '\\Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'AccessoriesRelatedByProductId');
|
||||||
$this->addRelation('AccessoryRelatedByAccessory', '\\Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'accessory', ), 'CASCADE', 'RESTRICT', 'AccessoriesRelatedByAccessory');
|
$this->addRelation('AccessoryRelatedByAccessory', '\\Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'accessory', ), 'CASCADE', 'RESTRICT', 'AccessoriesRelatedByAccessory');
|
||||||
$this->addRelation('Rewriting', '\\Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
|
$this->addRelation('Rewriting', '\\Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
|
||||||
$this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), null, null, 'CartItems');
|
$this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), null, null, 'CartItems');
|
||||||
|
$this->addRelation('ProductAssociatedContent', '\\Thelia\\Model\\ProductAssociatedContent', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductAssociatedContents');
|
||||||
$this->addRelation('ProductI18n', '\\Thelia\\Model\\ProductI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductI18ns');
|
$this->addRelation('ProductI18n', '\\Thelia\\Model\\ProductI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductI18ns');
|
||||||
$this->addRelation('ProductVersion', '\\Thelia\\Model\\ProductVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductVersions');
|
$this->addRelation('ProductVersion', '\\Thelia\\Model\\ProductVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductVersions');
|
||||||
$this->addRelation('Category', '\\Thelia\\Model\\Category', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Categories');
|
$this->addRelation('Category', '\\Thelia\\Model\\Category', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Categories');
|
||||||
@@ -238,11 +238,11 @@ class ProductTableMap extends TableMap
|
|||||||
ProductCategoryTableMap::clearInstancePool();
|
ProductCategoryTableMap::clearInstancePool();
|
||||||
FeatureProductTableMap::clearInstancePool();
|
FeatureProductTableMap::clearInstancePool();
|
||||||
ProductSaleElementsTableMap::clearInstancePool();
|
ProductSaleElementsTableMap::clearInstancePool();
|
||||||
ContentAssocTableMap::clearInstancePool();
|
|
||||||
ProductImageTableMap::clearInstancePool();
|
ProductImageTableMap::clearInstancePool();
|
||||||
ProductDocumentTableMap::clearInstancePool();
|
ProductDocumentTableMap::clearInstancePool();
|
||||||
AccessoryTableMap::clearInstancePool();
|
AccessoryTableMap::clearInstancePool();
|
||||||
RewritingTableMap::clearInstancePool();
|
RewritingTableMap::clearInstancePool();
|
||||||
|
ProductAssociatedContentTableMap::clearInstancePool();
|
||||||
ProductI18nTableMap::clearInstancePool();
|
ProductI18nTableMap::clearInstancePool();
|
||||||
ProductVersionTableMap::clearInstancePool();
|
ProductVersionTableMap::clearInstancePool();
|
||||||
}
|
}
|
||||||
|
|||||||
9
core/lib/Thelia/Model/ProductAssociatedContent.php
Normal file
9
core/lib/Thelia/Model/ProductAssociatedContent.php
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\Base\ProductAssociatedContent as BaseProductAssociatedContent;
|
||||||
|
|
||||||
|
class ProductAssociatedContent extends BaseProductAssociatedContent {
|
||||||
|
|
||||||
|
}
|
||||||
20
core/lib/Thelia/Model/ProductAssociatedContentQuery.php
Normal file
20
core/lib/Thelia/Model/ProductAssociatedContentQuery.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\Base\ProductAssociatedContentQuery as BaseProductAssociatedContentQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'product_associated_content' 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 ProductAssociatedContentQuery extends BaseProductAssociatedContentQuery {
|
||||||
|
|
||||||
|
} // ProductAssociatedContentQuery
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
namespace Thelia\Coupon;
|
namespace Thelia\Coupon;
|
||||||
|
|
||||||
use Thelia\Coupon\Parameter\PriceParam;
|
use Thelia\Coupon\Parameter\PriceParam;
|
||||||
|
use Thelia\Coupon\Parameter\RuleValidator;
|
||||||
use Thelia\Coupon\Rule\AvailableForTotalAmount;
|
use Thelia\Coupon\Rule\AvailableForTotalAmount;
|
||||||
use Thelia\Coupon\Rule\Operators;
|
use Thelia\Coupon\Rule\Operators;
|
||||||
use Thelia\Exception\InvalidRuleOperatorException;
|
use Thelia\Exception\InvalidRuleOperatorException;
|
||||||
@@ -77,9 +78,12 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
$stubTheliaAdapter = $this->generateValidCouponBaseAdapterMock();
|
$stubTheliaAdapter = $this->generateValidCouponBaseAdapterMock();
|
||||||
|
|
||||||
$validators = array(
|
$validators = array(
|
||||||
AvailableForTotalAmount::PARAM1_PRICE => array(
|
AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||||
AvailableForTotalAmount::OPERATOR => Operators::SUPERIOR,
|
Operators::SUPERIOR,
|
||||||
AvailableForTotalAmount::VALUE => new PriceParam(421.23, 'EUR')
|
new PriceParam(
|
||||||
|
421.23,
|
||||||
|
'EUR'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$validated = array(
|
$validated = array(
|
||||||
@@ -104,9 +108,12 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
$stubTheliaAdapter = $this->generateValidCouponBaseAdapterMock();
|
$stubTheliaAdapter = $this->generateValidCouponBaseAdapterMock();
|
||||||
|
|
||||||
$validators = array(
|
$validators = array(
|
||||||
AvailableForTotalAmount::PARAM1_PRICE => array(
|
AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||||
AvailableForTotalAmount::OPERATOR => 'X',
|
'X',
|
||||||
AvailableForTotalAmount::VALUE => new PriceParam(421.23, 'EUR')
|
new PriceParam(
|
||||||
|
421.23,
|
||||||
|
'EUR'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -123,7 +130,7 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @covers Thelia\Coupon\Rule\AvailableForTotalAmount::checkBackOfficeInput
|
* @covers Thelia\Coupon\Rule\AvailableForTotalAmount::checkBackOfficeInput
|
||||||
* @expectedException \Thelia\Exception\InvalidRuleValueException
|
* @expectedException ErrorException
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testInValidBackOfficeInputValue()
|
public function testInValidBackOfficeInputValue()
|
||||||
@@ -132,9 +139,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
$stubTheliaAdapter = $this->generateValidCouponBaseAdapterMock();
|
$stubTheliaAdapter = $this->generateValidCouponBaseAdapterMock();
|
||||||
|
|
||||||
$validators = array(
|
$validators = array(
|
||||||
AvailableForTotalAmount::PARAM1_PRICE => array(
|
AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||||
AvailableForTotalAmount::OPERATOR => Operators::SUPERIOR,
|
Operators::SUPERIOR,
|
||||||
AvailableForTotalAmount::VALUE => 421
|
421
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -161,9 +168,12 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
$stubTheliaAdapter = $this->generateValidCouponBaseAdapterMock();
|
$stubTheliaAdapter = $this->generateValidCouponBaseAdapterMock();
|
||||||
|
|
||||||
$validators = array(
|
$validators = array(
|
||||||
AvailableForTotalAmount::PARAM1_PRICE => array(
|
AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||||
AvailableForTotalAmount::OPERATOR => Operators::SUPERIOR,
|
Operators::SUPERIOR,
|
||||||
AvailableForTotalAmount::VALUE => new PriceParam(421.23, 'EUR')
|
new PriceParam(
|
||||||
|
421.23,
|
||||||
|
'EUR'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -186,9 +196,12 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testInValidCheckoutInputValue()
|
public function testInValidCheckoutInputValue()
|
||||||
{
|
{
|
||||||
$validators = array(
|
$validators = array(
|
||||||
AvailableForTotalAmount::PARAM1_PRICE => array(
|
AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||||
AvailableForTotalAmount::OPERATOR => Operators::SUPERIOR,
|
Operators::SUPERIOR,
|
||||||
AvailableForTotalAmount::VALUE => new PriceParam(421.23, 'EUR')
|
new PriceParam(
|
||||||
|
421.23,
|
||||||
|
'EUR'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -211,9 +224,12 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testInValidCheckoutInputType()
|
public function testInValidCheckoutInputType()
|
||||||
{
|
{
|
||||||
$validators = array(
|
$validators = array(
|
||||||
AvailableForTotalAmount::PARAM1_PRICE => array(
|
AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||||
AvailableForTotalAmount::OPERATOR => Operators::SUPERIOR,
|
Operators::SUPERIOR,
|
||||||
AvailableForTotalAmount::VALUE => new PriceParam(421.23, 'EUR')
|
new PriceParam(
|
||||||
|
421.23,
|
||||||
|
'EUR'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -227,6 +243,60 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals($expected, $actual);
|
$this->assertEquals($expected, $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @covers Thelia\Coupon\Rule\AvailableForTotalAmount::isMatching
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function testMatchingRuleInferior()
|
||||||
|
{
|
||||||
|
$validators = array(
|
||||||
|
AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||||
|
Operators::INFERIOR,
|
||||||
|
new PriceParam(
|
||||||
|
421.23,
|
||||||
|
'EUR'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$validated = array(
|
||||||
|
AvailableForTotalAmount::PARAM1_PRICE => 421.22
|
||||||
|
);
|
||||||
|
$rule = new AvailableForTotalAmount($validators, $validated);
|
||||||
|
|
||||||
|
$expected = true;
|
||||||
|
$actual = $rule->isMatching();
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @covers Thelia\Coupon\Rule\AvailableForTotalAmount::isMatching
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function testNotMatchingRuleInferior()
|
||||||
|
{
|
||||||
|
$validators = array(
|
||||||
|
AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||||
|
Operators::INFERIOR,
|
||||||
|
new PriceParam(
|
||||||
|
421.23,
|
||||||
|
'EUR'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$validated = array(
|
||||||
|
AvailableForTotalAmount::PARAM1_PRICE => 421.23
|
||||||
|
);
|
||||||
|
$rule = new AvailableForTotalAmount($validators, $validated);
|
||||||
|
|
||||||
|
$expected = false;
|
||||||
|
$actual = $rule->isMatching();
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @covers Thelia\Coupon\Rule\AvailableForTotalAmount::isMatching
|
* @covers Thelia\Coupon\Rule\AvailableForTotalAmount::isMatching
|
||||||
@@ -238,9 +308,12 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
$stubTheliaAdapter = $this->generateValidCouponBaseAdapterMock();
|
$stubTheliaAdapter = $this->generateValidCouponBaseAdapterMock();
|
||||||
|
|
||||||
$validators = array(
|
$validators = array(
|
||||||
AvailableForTotalAmount::PARAM1_PRICE => array(
|
AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||||
AvailableForTotalAmount::OPERATOR => Operators::EQUAL,
|
Operators::EQUAL,
|
||||||
AvailableForTotalAmount::VALUE => new PriceParam(421.23, 'EUR')
|
new PriceParam(
|
||||||
|
421.23,
|
||||||
|
'EUR'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -262,9 +335,12 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testNotMatchingRuleEqual()
|
public function testNotMatchingRuleEqual()
|
||||||
{
|
{
|
||||||
$validators = array(
|
$validators = array(
|
||||||
AvailableForTotalAmount::PARAM1_PRICE => array(
|
AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||||
AvailableForTotalAmount::OPERATOR => Operators::EQUAL,
|
Operators::EQUAL,
|
||||||
AvailableForTotalAmount::VALUE => new PriceParam(421.23, 'EUR')
|
new PriceParam(
|
||||||
|
421.23,
|
||||||
|
'EUR'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -286,9 +362,12 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testMatchingRuleSuperior()
|
public function testMatchingRuleSuperior()
|
||||||
{
|
{
|
||||||
$validators = array(
|
$validators = array(
|
||||||
AvailableForTotalAmount::PARAM1_PRICE => array(
|
AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||||
AvailableForTotalAmount::OPERATOR => Operators::SUPERIOR,
|
Operators::SUPERIOR,
|
||||||
AvailableForTotalAmount::VALUE => new PriceParam(421.23, 'EUR')
|
new PriceParam(
|
||||||
|
421.23,
|
||||||
|
'EUR'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -310,9 +389,12 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testNotMatchingRuleSuperior()
|
public function testNotMatchingRuleSuperior()
|
||||||
{
|
{
|
||||||
$validators = array(
|
$validators = array(
|
||||||
AvailableForTotalAmount::PARAM1_PRICE => array(
|
AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||||
AvailableForTotalAmount::OPERATOR => Operators::SUPERIOR,
|
Operators::SUPERIOR,
|
||||||
AvailableForTotalAmount::VALUE => new PriceParam(421.23, 'EUR')
|
new PriceParam(
|
||||||
|
421.23,
|
||||||
|
'EUR'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -6,13 +6,19 @@ use Thelia\Model\FolderImage;
|
|||||||
use Thelia\Model\ContentImage;
|
use Thelia\Model\ContentImage;
|
||||||
use Imagine\Image\Color;
|
use Imagine\Image\Color;
|
||||||
use Imagine\Image\Point;
|
use Imagine\Image\Point;
|
||||||
|
use Symfony\Component\Serializer\Serializer;
|
||||||
|
use Symfony\Component\Serializer\Encoder\XmlEncoder;
|
||||||
|
use Symfony\Component\Serializer\Encoder\JsonEncoder;
|
||||||
|
use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
|
||||||
require __DIR__ . '/../core/bootstrap.php';
|
require __DIR__ . '/../core/bootstrap.php';
|
||||||
|
|
||||||
$thelia = new Thelia\Core\Thelia("dev", true);
|
$thelia = new Thelia\Core\Thelia("dev", true);
|
||||||
|
|
||||||
$faker = Faker\Factory::create();
|
$faker = Faker\Factory::create();
|
||||||
|
|
||||||
$con = \Propel\Runtime\Propel::getConnection(Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
|
$con = \Propel\Runtime\Propel::getConnection(
|
||||||
|
Thelia\Model\Map\ProductTableMap::DATABASE_NAME
|
||||||
|
);
|
||||||
$con->beginTransaction();
|
$con->beginTransaction();
|
||||||
|
|
||||||
$currency = \Thelia\Model\CurrencyQuery::create()->filterByCode('EUR')->findOne();
|
$currency = \Thelia\Model\CurrencyQuery::create()->filterByCode('EUR')->findOne();
|
||||||
@@ -282,6 +288,8 @@ try {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generateCouponFixtures();
|
||||||
|
|
||||||
$con->commit();
|
$con->commit();
|
||||||
}
|
}
|
||||||
catch (PropelException $pe) {
|
catch (PropelException $pe) {
|
||||||
@@ -294,4 +302,69 @@ catch (Exception $e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate Coupon fixtures
|
||||||
|
*/
|
||||||
|
function generateCouponFixtures()
|
||||||
|
{
|
||||||
|
// Coupons
|
||||||
|
$coupon1 = new Thelia\Model\Coupon();
|
||||||
|
$coupon1->setCode('XMAS');
|
||||||
|
$coupon1->setType('Thelia\Coupon\Type\RemoveXAmount');
|
||||||
|
$coupon1->setTitle('Christmas coupon');
|
||||||
|
$coupon1->setShortDescription('Coupon for Christmas removing 10€ if your total checkout is more than 40€');
|
||||||
|
$coupon1->setDescription('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras at luctus tellus. Integer turpis mauris, aliquet vitae risus tristique, pellentesque vestibulum urna. Vestibulum sodales laoreet lectus dictum suscipit. Praesent vulputate, sem id varius condimentum, quam magna tempor elit, quis venenatis ligula nulla eget libero. Cras egestas euismod tellus, id pharetra leo suscipit quis. Donec lacinia ac lacus et ultricies. Nunc in porttitor neque. Proin at quam congue, consectetur orci sed, congue nulla. Nulla eleifend nunc ligula, nec pharetra elit tempus quis. Vivamus vel mauris sed est dictum blandit. Maecenas blandit dapibus velit ut sollicitudin. In in euismod mauris, consequat viverra magna. Cras velit velit, sollicitudin commodo tortor gravida, tempus varius nulla.
|
||||||
|
|
||||||
|
Donec rhoncus leo mauris, id porttitor ante luctus tempus. Curabitur quis augue feugiat, ullamcorper mauris ac, interdum mi. Quisque aliquam lorem vitae felis lobortis, id interdum turpis mattis. Vestibulum diam massa, ornare congue blandit quis, facilisis at nisl. In tortor metus, venenatis non arcu nec, sollicitudin ornare nisl. Nunc erat risus, varius nec urna at, iaculis lacinia elit. Aenean ut felis tempus, tincidunt odio non, sagittis nisl. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec vitae hendrerit elit. Nunc sit amet gravida risus, euismod lobortis massa. Nam a erat mauris. Nam a malesuada lorem. Nulla id accumsan dolor, sed rhoncus tellus. Quisque dictum felis sed leo auctor, at volutpat lectus viverra. Morbi rutrum, est ac aliquam imperdiet, nibh sem sagittis justo, ac mattis magna lacus eu nulla.
|
||||||
|
|
||||||
|
Duis interdum lectus nulla, nec pellentesque sapien condimentum at. Suspendisse potenti. Sed eu purus tellus. Nunc quis rhoncus metus. Fusce vitae tellus enim. Interdum et malesuada fames ac ante ipsum primis in faucibus. Etiam tempor porttitor erat vitae iaculis. Sed est elit, consequat non ornare vitae, vehicula eget lectus. Etiam consequat sapien mauris, eget consectetur magna imperdiet eget. Nunc sollicitudin luctus velit, in commodo nulla adipiscing fermentum. Fusce nisi sapien, posuere vitae metus sit amet, facilisis sollicitudin dui. Fusce ultricies auctor enim sit amet iaculis. Morbi at vestibulum enim, eget adipiscing eros.
|
||||||
|
|
||||||
|
Praesent ligula lorem, faucibus ut metus quis, fermentum iaculis erat. Pellentesque elit erat, lacinia sed semper ac, sagittis vel elit. Nam eu convallis est. Curabitur rhoncus odio vitae consectetur pellentesque. Nam vitae arcu nec ante scelerisque dignissim vel nec neque. Suspendisse augue nulla, mollis eget dui et, tempor facilisis erat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ac diam ipsum. Donec convallis dui ultricies velit auctor, non lobortis nulla ultrices. Morbi vitae dignissim ante, sit amet lobortis tortor. Nunc dapibus condimentum augue, in molestie neque congue non.
|
||||||
|
|
||||||
|
Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesuada tortor vel erat volutpat tincidunt. In vehicula diam est, a convallis eros scelerisque ut. Donec aliquet venenatis iaculis. Ut a arcu gravida, placerat dui eu, iaculis nisl. Quisque adipiscing orci sit amet dui dignissim lacinia. Sed vulputate lorem non dolor adipiscing ornare. Morbi ornare id nisl id aliquam. Ut fringilla elit ante, nec lacinia enim fermentum sit amet. Aenean rutrum lorem eu convallis pharetra. Cras malesuada varius metus, vitae gravida velit. Nam a varius ipsum, ac commodo dolor. Phasellus nec elementum elit. Etiam vel adipiscing leo.');
|
||||||
|
$coupon1->setAmount(10.00);
|
||||||
|
$coupon1->setIsUsed(1);
|
||||||
|
$coupon1->setIsEnabled(1);
|
||||||
|
$date = new \DateTime();
|
||||||
|
$coupon1->setExpirationDate($date->setTimestamp(strtotime("today + 2 months")));
|
||||||
|
|
||||||
|
$rule1 = new Thelia\Coupon\Rule\AvailableForTotalAmount(
|
||||||
|
array(
|
||||||
|
Thelia\Coupon\Rule\AvailableForTotalAmount::PARAM1_PRICE => new Thelia\Coupon\Parameter\RuleValidator(
|
||||||
|
Thelia\Coupon\Rule\Operators::SUPERIOR,
|
||||||
|
new Thelia\Coupon\Parameter\PriceParam(
|
||||||
|
40.00,
|
||||||
|
'EUR'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$rule2 = new Thelia\Coupon\Rule\AvailableForTotalAmount(
|
||||||
|
array(
|
||||||
|
Thelia\Coupon\Rule\AvailableForTotalAmount::PARAM1_PRICE => new Thelia\Coupon\Parameter\RuleValidator(
|
||||||
|
Thelia\Coupon\Rule\Operators::INFERIOR,
|
||||||
|
new Thelia\Coupon\Parameter\PriceParam(
|
||||||
|
400.00,
|
||||||
|
'EUR'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$rules = array($rule1, $rule2);
|
||||||
|
|
||||||
|
$encoders = array(new XmlEncoder(), new JsonEncoder());
|
||||||
|
$normalizers = array(new GetSetMethodNormalizer());
|
||||||
|
$serializer = new Serializer($normalizers, $encoders);
|
||||||
|
|
||||||
|
$ruleTypes = array();
|
||||||
|
/** @var Thelia\Coupon\Rule\CouponRuleInterface $rule */
|
||||||
|
foreach ($rules as $rule) {
|
||||||
|
$ruleTypes[] = get_class($rule);
|
||||||
|
}
|
||||||
|
$coupon1->setSerializedRulesType($serializer->serialize($ruleTypes, 'json'));
|
||||||
|
$coupon1->setSerializedRulesContent($serializer->serialize($rules, 'json'));
|
||||||
|
|
||||||
|
$coupon1->setIsCumulative(1);
|
||||||
|
$coupon1->setIsRemovingPostage(0);
|
||||||
|
$coupon1->save();
|
||||||
|
}
|
||||||
@@ -567,42 +567,6 @@ CREATE TABLE `content`
|
|||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
|
||||||
-- content_assoc
|
|
||||||
-- ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `content_assoc`;
|
|
||||||
|
|
||||||
CREATE TABLE `content_assoc`
|
|
||||||
(
|
|
||||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
|
||||||
`category_id` INTEGER,
|
|
||||||
`product_id` INTEGER,
|
|
||||||
`content_id` INTEGER,
|
|
||||||
`position` INTEGER,
|
|
||||||
`created_at` DATETIME,
|
|
||||||
`updated_at` DATETIME,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
INDEX `idx_content_assoc_category_id` (`category_id`),
|
|
||||||
INDEX `idx_content_assoc_product_id` (`product_id`),
|
|
||||||
INDEX `idx_content_assoc_content_id` (`content_id`),
|
|
||||||
CONSTRAINT `fk_content_assoc_category_id`
|
|
||||||
FOREIGN KEY (`category_id`)
|
|
||||||
REFERENCES `category` (`id`)
|
|
||||||
ON UPDATE RESTRICT
|
|
||||||
ON DELETE CASCADE,
|
|
||||||
CONSTRAINT `fk_content_assoc_product_id`
|
|
||||||
FOREIGN KEY (`product_id`)
|
|
||||||
REFERENCES `product` (`id`)
|
|
||||||
ON UPDATE RESTRICT
|
|
||||||
ON DELETE CASCADE,
|
|
||||||
CONSTRAINT `fk_content_assoc_content_id`
|
|
||||||
FOREIGN KEY (`content_id`)
|
|
||||||
REFERENCES `content` (`id`)
|
|
||||||
ON UPDATE RESTRICT
|
|
||||||
ON DELETE CASCADE
|
|
||||||
) ENGINE=InnoDB;
|
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- product_image
|
-- product_image
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
@@ -846,7 +810,7 @@ DROP TABLE IF EXISTS `accessory`;
|
|||||||
|
|
||||||
CREATE TABLE `accessory`
|
CREATE TABLE `accessory`
|
||||||
(
|
(
|
||||||
`id` INTEGER NOT NULL,
|
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||||
`product_id` INTEGER NOT NULL,
|
`product_id` INTEGER NOT NULL,
|
||||||
`accessory` INTEGER NOT NULL,
|
`accessory` INTEGER NOT NULL,
|
||||||
`position` INTEGER NOT NULL,
|
`position` INTEGER NOT NULL,
|
||||||
@@ -1121,16 +1085,26 @@ CREATE TABLE `coupon`
|
|||||||
`title` VARCHAR(255) NOT NULL,
|
`title` VARCHAR(255) NOT NULL,
|
||||||
`short_description` TEXT NOT NULL,
|
`short_description` TEXT NOT NULL,
|
||||||
`description` LONGTEXT NOT NULL,
|
`description` LONGTEXT NOT NULL,
|
||||||
`value` FLOAT NOT NULL,
|
`amount` FLOAT NOT NULL,
|
||||||
`is_used` TINYINT NOT NULL,
|
`is_used` TINYINT NOT NULL,
|
||||||
`is_enabled` TINYINT NOT NULL,
|
`is_enabled` TINYINT NOT NULL,
|
||||||
`expiration_date` DATETIME NOT NULL,
|
`expiration_date` DATETIME NOT NULL,
|
||||||
`serialized_rules` TEXT NOT NULL,
|
`serialized_rules_type` TEXT NOT NULL,
|
||||||
|
`serialized_rules_content` TEXT NOT NULL,
|
||||||
|
`is_cumulative` TINYINT NOT NULL,
|
||||||
|
`is_removing_postage` TINYINT NOT NULL,
|
||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
`version` INTEGER DEFAULT 0,
|
`version` INTEGER DEFAULT 0,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE INDEX `code_UNIQUE` (`code`)
|
UNIQUE INDEX `code_UNIQUE` (`code`),
|
||||||
|
INDEX `idx_is_enabled` (`is_enabled`),
|
||||||
|
INDEX `idx_is_used` (`is_used`),
|
||||||
|
INDEX `idx_type` (`type`),
|
||||||
|
INDEX `idx_amount` (`amount`),
|
||||||
|
INDEX `idx_expiration_date` (`expiration_date`),
|
||||||
|
INDEX `idx_is_cumulative` (`is_cumulative`),
|
||||||
|
INDEX `idx_is_removing_postage` (`is_removing_postage`)
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
@@ -1441,6 +1415,64 @@ CREATE TABLE `folder_document`
|
|||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- product_associated_content
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `product_associated_content`;
|
||||||
|
|
||||||
|
CREATE TABLE `product_associated_content`
|
||||||
|
(
|
||||||
|
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||||
|
`product_id` INTEGER NOT NULL,
|
||||||
|
`content_id` INTEGER NOT NULL,
|
||||||
|
`position` INTEGER NOT NULL,
|
||||||
|
`created_at` DATETIME,
|
||||||
|
`updated_at` DATETIME,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
INDEX `idx_product_associated_content_product_id` (`product_id`),
|
||||||
|
INDEX `idx_product_associated_content_content_id` (`content_id`),
|
||||||
|
CONSTRAINT `fk_product_associated_content_product_id`
|
||||||
|
FOREIGN KEY (`product_id`)
|
||||||
|
REFERENCES `product` (`id`)
|
||||||
|
ON UPDATE RESTRICT
|
||||||
|
ON DELETE CASCADE,
|
||||||
|
CONSTRAINT `fk_product_associated_content_content_id`
|
||||||
|
FOREIGN KEY (`content_id`)
|
||||||
|
REFERENCES `content` (`id`)
|
||||||
|
ON UPDATE RESTRICT
|
||||||
|
ON DELETE CASCADE
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- category_associated_content
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `category_associated_content`;
|
||||||
|
|
||||||
|
CREATE TABLE `category_associated_content`
|
||||||
|
(
|
||||||
|
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||||
|
`category_id` INTEGER NOT NULL,
|
||||||
|
`content_id` INTEGER NOT NULL,
|
||||||
|
`position` INTEGER NOT NULL,
|
||||||
|
`created_at` DATETIME,
|
||||||
|
`updated_at` DATETIME,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
INDEX `idx_category_associated_content_category_id` (`category_id`),
|
||||||
|
INDEX `idx_category_associated_content_content_id` (`content_id`),
|
||||||
|
CONSTRAINT `fk_category_associated_content_category_id`
|
||||||
|
FOREIGN KEY (`category_id`)
|
||||||
|
REFERENCES `category` (`id`)
|
||||||
|
ON UPDATE RESTRICT
|
||||||
|
ON DELETE CASCADE,
|
||||||
|
CONSTRAINT `fk_category_associated_content_content_id`
|
||||||
|
FOREIGN KEY (`content_id`)
|
||||||
|
REFERENCES `content` (`id`)
|
||||||
|
ON UPDATE RESTRICT
|
||||||
|
ON DELETE CASCADE
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- category_i18n
|
-- category_i18n
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
@@ -2147,11 +2179,14 @@ CREATE TABLE `coupon_version`
|
|||||||
`title` VARCHAR(255) NOT NULL,
|
`title` VARCHAR(255) NOT NULL,
|
||||||
`short_description` TEXT NOT NULL,
|
`short_description` TEXT NOT NULL,
|
||||||
`description` LONGTEXT NOT NULL,
|
`description` LONGTEXT NOT NULL,
|
||||||
`value` FLOAT NOT NULL,
|
`amount` FLOAT NOT NULL,
|
||||||
`is_used` TINYINT NOT NULL,
|
`is_used` TINYINT NOT NULL,
|
||||||
`is_enabled` TINYINT NOT NULL,
|
`is_enabled` TINYINT NOT NULL,
|
||||||
`expiration_date` DATETIME NOT NULL,
|
`expiration_date` DATETIME NOT NULL,
|
||||||
`serialized_rules` TEXT NOT NULL,
|
`serialized_rules_type` TEXT NOT NULL,
|
||||||
|
`serialized_rules_content` TEXT NOT NULL,
|
||||||
|
`is_cumulative` TINYINT NOT NULL,
|
||||||
|
`is_removing_postage` TINYINT NOT NULL,
|
||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
`version` INTEGER DEFAULT 0 NOT NULL,
|
`version` INTEGER DEFAULT 0 NOT NULL,
|
||||||
|
|||||||
@@ -425,32 +425,6 @@
|
|||||||
<parameter name="log_created_by" value="true" />
|
<parameter name="log_created_by" value="true" />
|
||||||
</behavior>
|
</behavior>
|
||||||
</table>
|
</table>
|
||||||
<table name="content_assoc" namespace="Thelia\Model">
|
|
||||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
|
||||||
<column name="category_id" type="INTEGER" />
|
|
||||||
<column name="product_id" type="INTEGER" />
|
|
||||||
<column name="content_id" type="INTEGER" />
|
|
||||||
<column name="position" type="INTEGER" />
|
|
||||||
<foreign-key foreignTable="category" name="fk_content_assoc_category_id" onDelete="CASCADE" onUpdate="RESTRICT">
|
|
||||||
<reference foreign="id" local="category_id" />
|
|
||||||
</foreign-key>
|
|
||||||
<foreign-key foreignTable="product" name="fk_content_assoc_product_id" onDelete="CASCADE" onUpdate="RESTRICT">
|
|
||||||
<reference foreign="id" local="product_id" />
|
|
||||||
</foreign-key>
|
|
||||||
<foreign-key foreignTable="content" name="fk_content_assoc_content_id" onDelete="CASCADE" onUpdate="RESTRICT">
|
|
||||||
<reference foreign="id" local="content_id" />
|
|
||||||
</foreign-key>
|
|
||||||
<index name="idx_content_assoc_category_id">
|
|
||||||
<index-column name="category_id" />
|
|
||||||
</index>
|
|
||||||
<index name="idx_content_assoc_product_id">
|
|
||||||
<index-column name="product_id" />
|
|
||||||
</index>
|
|
||||||
<index name="idx_content_assoc_content_id">
|
|
||||||
<index-column name="content_id" />
|
|
||||||
</index>
|
|
||||||
<behavior name="timestampable" />
|
|
||||||
</table>
|
|
||||||
<table name="product_image" namespace="Thelia\Model">
|
<table name="product_image" namespace="Thelia\Model">
|
||||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||||
<column name="product_id" required="true" type="INTEGER" />
|
<column name="product_id" required="true" type="INTEGER" />
|
||||||
@@ -631,7 +605,7 @@
|
|||||||
</behavior>
|
</behavior>
|
||||||
</table>
|
</table>
|
||||||
<table isCrossRef="true" name="accessory" namespace="Thelia\Model">
|
<table isCrossRef="true" name="accessory" namespace="Thelia\Model">
|
||||||
<column name="id" primaryKey="true" required="true" type="INTEGER" />
|
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||||
<column name="product_id" required="true" type="INTEGER" />
|
<column name="product_id" required="true" type="INTEGER" />
|
||||||
<column name="accessory" required="true" type="INTEGER" />
|
<column name="accessory" required="true" type="INTEGER" />
|
||||||
<column name="position" required="true" type="INTEGER" />
|
<column name="position" required="true" type="INTEGER" />
|
||||||
@@ -821,14 +795,38 @@
|
|||||||
<column name="title" required="true" size="255" type="VARCHAR" />
|
<column name="title" required="true" size="255" type="VARCHAR" />
|
||||||
<column name="short_description" required="true" type="LONGVARCHAR" />
|
<column name="short_description" required="true" type="LONGVARCHAR" />
|
||||||
<column name="description" required="true" type="CLOB" />
|
<column name="description" required="true" type="CLOB" />
|
||||||
<column name="value" required="true" type="FLOAT" />
|
<column name="amount" required="true" type="FLOAT" />
|
||||||
<column name="is_used" required="true" type="TINYINT" />
|
<column name="is_used" required="true" type="TINYINT" />
|
||||||
<column name="is_enabled" required="true" type="TINYINT" />
|
<column name="is_enabled" required="true" type="TINYINT" />
|
||||||
<column name="expiration_date" required="true" type="TIMESTAMP" />
|
<column name="expiration_date" required="true" type="TIMESTAMP" />
|
||||||
<column name="serialized_rules" required="true" type="LONGVARCHAR" />
|
<column name="serialized_rules_type" required="true" type="LONGVARCHAR" />
|
||||||
|
<column name="serialized_rules_content" required="true" type="LONGVARCHAR" />
|
||||||
|
<column name="is_cumulative" required="true" type="TINYINT" />
|
||||||
|
<column name="is_removing_postage" required="true" type="TINYINT" />
|
||||||
<unique name="code_UNIQUE">
|
<unique name="code_UNIQUE">
|
||||||
<unique-column name="code" />
|
<unique-column name="code" />
|
||||||
</unique>
|
</unique>
|
||||||
|
<index name="idx_is_enabled">
|
||||||
|
<index-column name="is_enabled" />
|
||||||
|
</index>
|
||||||
|
<index name="idx_is_used">
|
||||||
|
<index-column name="is_used" />
|
||||||
|
</index>
|
||||||
|
<index name="idx_type">
|
||||||
|
<index-column name="type" />
|
||||||
|
</index>
|
||||||
|
<index name="idx_amount">
|
||||||
|
<index-column name="amount" />
|
||||||
|
</index>
|
||||||
|
<index name="idx_expiration_date">
|
||||||
|
<index-column name="expiration_date" />
|
||||||
|
</index>
|
||||||
|
<index name="idx_is_cumulative">
|
||||||
|
<index-column name="is_cumulative" />
|
||||||
|
</index>
|
||||||
|
<index name="idx_is_removing_postage">
|
||||||
|
<index-column name="is_removing_postage" />
|
||||||
|
</index>
|
||||||
<behavior name="timestampable" />
|
<behavior name="timestampable" />
|
||||||
<behavior name="i18n" />
|
<behavior name="i18n" />
|
||||||
<behavior name="versionable" />
|
<behavior name="versionable" />
|
||||||
@@ -1083,4 +1081,42 @@
|
|||||||
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
|
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
|
||||||
</behavior>
|
</behavior>
|
||||||
</table>
|
</table>
|
||||||
|
<table name="product_associated_content" namespace="Thelia\Model">
|
||||||
|
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||||
|
<column name="product_id" required="true" type="INTEGER" />
|
||||||
|
<column name="content_id" required="true" type="INTEGER" />
|
||||||
|
<column name="position" required="true" type="INTEGER" />
|
||||||
|
<foreign-key foreignTable="product" name="fk_product_associated_content_product_id" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||||
|
<reference foreign="id" local="product_id" />
|
||||||
|
</foreign-key>
|
||||||
|
<foreign-key foreignTable="content" name="fk_product_associated_content_content_id" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||||
|
<reference foreign="id" local="content_id" />
|
||||||
|
</foreign-key>
|
||||||
|
<index name="idx_product_associated_content_product_id">
|
||||||
|
<index-column name="product_id" />
|
||||||
|
</index>
|
||||||
|
<index name="idx_product_associated_content_content_id">
|
||||||
|
<index-column name="content_id" />
|
||||||
|
</index>
|
||||||
|
<behavior name="timestampable" />
|
||||||
|
</table>
|
||||||
|
<table name="category_associated_content" namespace="Thelia\Model">
|
||||||
|
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||||
|
<column name="category_id" required="true" type="INTEGER" />
|
||||||
|
<column name="content_id" required="true" type="INTEGER" />
|
||||||
|
<column name="position" required="true" type="INTEGER" />
|
||||||
|
<foreign-key foreignTable="category" name="fk_category_associated_content_category_id" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||||
|
<reference foreign="id" local="category_id" />
|
||||||
|
</foreign-key>
|
||||||
|
<foreign-key foreignTable="content" name="fk_category_associated_content_content_id" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||||
|
<reference foreign="id" local="content_id" />
|
||||||
|
</foreign-key>
|
||||||
|
<index name="idx_category_associated_content_category_id">
|
||||||
|
<index-column name="category_id" />
|
||||||
|
</index>
|
||||||
|
<index name="idx_category_associated_content_content_id">
|
||||||
|
<index-column name="content_id" />
|
||||||
|
</index>
|
||||||
|
<behavior name="timestampable" />
|
||||||
|
</table>
|
||||||
</database>
|
</database>
|
||||||
Reference in New Issue
Block a user