Merge branch 'template' of github.com:thelia/thelia into template
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -24,4 +24,5 @@ phpdoc*.log
|
||||
php-cs
|
||||
xhprof/
|
||||
phpunit.phar
|
||||
.DS_Store
|
||||
.DS_Store
|
||||
phpmyadmin
|
||||
@@ -39,6 +39,8 @@ use Thelia\Model\AttributeAvQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Core\Event\CategoryEvent;
|
||||
use Thelia\Core\Event\AttributeEvent;
|
||||
use Thelia\Model\AttributeTemplate;
|
||||
use Thelia\Model\AttributeTemplateQuery;
|
||||
|
||||
class Attribute extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
@@ -137,10 +139,10 @@ class Attribute extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
public function addToAllTemplates(AttributeEvent $event)
|
||||
{
|
||||
$templates = ProductTemplateAttributeQuery::create()->find();
|
||||
$templates = AttributeTemplateQuery::create()->find();
|
||||
|
||||
foreach($templates as $template) {
|
||||
$pat = new ProductTemplateAttribute();
|
||||
$pat = new AttributeTemplate();
|
||||
|
||||
$pat->setTemplate($template->getId())
|
||||
->setAttributeId($event->getAttribute()->getId())
|
||||
@@ -151,7 +153,7 @@ class Attribute extends BaseAction implements EventSubscriberInterface
|
||||
public function removeFromAllTemplates(AttributeEvent $event)
|
||||
{
|
||||
// Delete this attribute from all product templates
|
||||
ProductTemplateAttributeQuery::create()->filterByAttributeId($event->getAttribute()->getId())->delete();
|
||||
AttributeTemplateQuery::create()->filterByAttributeId($event->getAttribute()->getId())->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,10 +23,16 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Constraint\ConstraintFactory;
|
||||
use Thelia\Core\Event\Coupon\CouponConsumeEvent;
|
||||
use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Coupon\CouponFactory;
|
||||
use Thelia\Coupon\CouponManager;
|
||||
use Thelia\Coupon\Type\CouponInterface;
|
||||
use Thelia\Model\Coupon as CouponModel;
|
||||
|
||||
/**
|
||||
@@ -45,7 +51,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface
|
||||
/**
|
||||
* Occurring when a Coupon is about to be created
|
||||
*
|
||||
* @param CouponCreateOrUpdateEvent $event Event creation or update Event
|
||||
* @param CouponCreateOrUpdateEvent $event Event creation or update Coupon
|
||||
*/
|
||||
public function create(CouponCreateOrUpdateEvent $event)
|
||||
{
|
||||
@@ -57,7 +63,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface
|
||||
/**
|
||||
* Occurring when a Coupon is about to be updated
|
||||
*
|
||||
* @param CouponCreateOrUpdateEvent $event Event creation or update Event
|
||||
* @param CouponCreateOrUpdateEvent $event Event creation or update Coupon
|
||||
*/
|
||||
public function update(CouponCreateOrUpdateEvent $event)
|
||||
{
|
||||
@@ -69,7 +75,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface
|
||||
/**
|
||||
* Occurring when a Coupon rule is about to be updated
|
||||
*
|
||||
* @param CouponCreateOrUpdateEvent $event Event creation or update Event
|
||||
* @param CouponCreateOrUpdateEvent $event Event creation or update Coupon Rule
|
||||
*/
|
||||
public function updateRule(CouponCreateOrUpdateEvent $event)
|
||||
{
|
||||
@@ -81,11 +87,43 @@ class Coupon extends BaseAction implements EventSubscriberInterface
|
||||
/**
|
||||
* Occurring when a Coupon rule is about to be consumed
|
||||
*
|
||||
* @param CouponCreateOrUpdateEvent $event Event creation or update Event
|
||||
* @param CouponConsumeEvent $event Event consuming Coupon
|
||||
*/
|
||||
public function consume(CouponCreateOrUpdateEvent $event)
|
||||
public function consume(CouponConsumeEvent $event)
|
||||
{
|
||||
// @todo implements
|
||||
$totalDiscount = 0;
|
||||
|
||||
/** @var CouponFactory $couponFactory */
|
||||
$couponFactory = $this->container->get('thelia.coupon.factory');
|
||||
|
||||
/** @var CouponManager $couponManager */
|
||||
$couponManager = $this->container->get('thelia.coupon.manager');
|
||||
|
||||
/** @var CouponInterface $coupon */
|
||||
$coupon = $couponFactory->buildCouponFromCode($event->getCode());
|
||||
|
||||
$isValid = $coupon->isMatching();
|
||||
if ($isValid) {
|
||||
/** @var Request $request */
|
||||
$request = $this->container->get('request');
|
||||
$consumedCoupons = $request->getSession()->getConsumedCoupons();
|
||||
|
||||
if (!isset($consumedCoupons) || !$consumedCoupons) {
|
||||
$consumedCoupons = array();
|
||||
}
|
||||
|
||||
// Prevent accumulation of the same Coupon on a Checkout
|
||||
$consumedCoupons[$event->getCode()] = $event->getCode();
|
||||
|
||||
$request->getSession()->setConsumedCoupons($consumedCoupons);
|
||||
|
||||
$totalDiscount = $couponManager->getDiscount();
|
||||
|
||||
// @todo modify Cart total discount
|
||||
}
|
||||
|
||||
$event->setIsValid($isValid);
|
||||
$event->setDiscount($totalDiscount);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,8 +203,6 @@ class Coupon extends BaseAction implements EventSubscriberInterface
|
||||
return array(
|
||||
TheliaEvents::COUPON_CREATE => array("create", 128),
|
||||
TheliaEvents::COUPON_UPDATE => array("update", 128),
|
||||
TheliaEvents::COUPON_DISABLE => array("disable", 128),
|
||||
TheliaEvents::COUPON_ENABLE => array("enable", 128),
|
||||
TheliaEvents::COUPON_CONSUME => array("consume", 128),
|
||||
TheliaEvents::COUPON_RULE_UPDATE => array("updateRule", 128)
|
||||
);
|
||||
|
||||
127
core/lib/Thelia/Action/Template.php
Normal file
127
core/lib/Thelia/Action/Template.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?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\Action;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
use Thelia\Model\TemplateQuery;
|
||||
use Thelia\Model\Template as TemplateModel;
|
||||
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
|
||||
use Thelia\Core\Event\TemplateUpdateEvent;
|
||||
use Thelia\Core\Event\TemplateCreateEvent;
|
||||
use Thelia\Core\Event\TemplateDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\TemplateAv;
|
||||
use Thelia\Model\TemplateAvQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Core\Event\CategoryEvent;
|
||||
use Thelia\Core\Event\TemplateEvent;
|
||||
use Thelia\Model\TemplateTemplate;
|
||||
use Thelia\Model\TemplateTemplateQuery;
|
||||
use Thelia\Model\ProductQuery;
|
||||
|
||||
class Template extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
/**
|
||||
* Create a new template entry
|
||||
*
|
||||
* @param TemplateCreateEvent $event
|
||||
*/
|
||||
public function create(TemplateCreateEvent $event)
|
||||
{
|
||||
$template = new TemplateModel();
|
||||
|
||||
$template
|
||||
->setDispatcher($this->getDispatcher())
|
||||
|
||||
->setLocale($event->getLocale())
|
||||
->setName($event->getTemplateName())
|
||||
|
||||
->save()
|
||||
;
|
||||
|
||||
$event->setTemplate($template);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change a product template
|
||||
*
|
||||
* @param TemplateUpdateEvent $event
|
||||
*/
|
||||
public function update(TemplateUpdateEvent $event)
|
||||
{
|
||||
$search = TemplateQuery::create();
|
||||
|
||||
if (null !== $template = TemplateQuery::create()->findPk($event->getTemplateId())) {
|
||||
|
||||
$template
|
||||
->setDispatcher($this->getDispatcher())
|
||||
|
||||
->setLocale($event->getLocale())
|
||||
->setName($event->getTemplateName())
|
||||
->save();
|
||||
|
||||
$event->setTemplate($template);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a product template entry
|
||||
*
|
||||
* @param TemplateDeleteEvent $event
|
||||
*/
|
||||
public function delete(TemplateDeleteEvent $event)
|
||||
{
|
||||
if (null !== ($template = TemplateQuery::create()->findPk($event->getTemplateId()))) {
|
||||
|
||||
// Check if template is used by a product
|
||||
$product_count = ProductQuery::create()->findByTemplateId($template->getId())->count();
|
||||
|
||||
if ($product_count <= 0) {
|
||||
$template
|
||||
->setDispatcher($this->getDispatcher())
|
||||
->delete()
|
||||
;
|
||||
}
|
||||
|
||||
$event->setTemplate($template);
|
||||
|
||||
$event->setProductCount($product_count);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::TEMPLATE_CREATE => array("create", 128),
|
||||
TheliaEvents::TEMPLATE_UPDATE => array("update", 128),
|
||||
TheliaEvents::TEMPLATE_DELETE => array("delete", 128),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,11 @@
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.template" class="Thelia\Action\Template">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.attribute" class="Thelia\Action\Attribute">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
<loop class="Thelia\Core\Template\Loop\Coupon" name="coupon"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Message" name="message"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Delivery" name="delivery"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Template" name="template"/> <!-- This is product templates ;-) -->
|
||||
</loops>
|
||||
|
||||
<forms>
|
||||
@@ -72,6 +73,10 @@
|
||||
<form name="thelia.admin.attribute.modification" class="Thelia\Form\AttributeModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.attributeav.creation" class="Thelia\Form\AttributeAvCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.template.creation" class="Thelia\Form\TemplateCreationForm"/>
|
||||
<form name="thelia.admin.template.modification" class="Thelia\Form\TemplateModificationForm"/>
|
||||
|
||||
</forms>
|
||||
|
||||
|
||||
@@ -230,6 +235,8 @@
|
||||
<service id="thelia.constraint.factory" class="Thelia\Constraint\ConstraintFactory">
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
<service id="thelia.constraint.validator" class="Thelia\Constraint\ConstraintValidator">
|
||||
</service>
|
||||
<service id="thelia.constraint.rule.available_for_everyone" class="Thelia\Constraint\Rule\AvailableForEveryoneManager">
|
||||
<argument type="service" id="thelia.adapter" />
|
||||
<tag name="thelia.coupon.addRule"/>
|
||||
|
||||
@@ -103,25 +103,27 @@
|
||||
|
||||
<!-- Route to the Coupon controller (process Coupon browsing) -->
|
||||
|
||||
<route id="admin.coupon.list" path="/admin/coupon">
|
||||
<route id="admin.coupon.list" path="/admin/coupon/">
|
||||
<default key="_controller">Thelia\Controller\Admin\CouponController::browseAction</default>
|
||||
</route>
|
||||
<route id="admin.coupon.create" path="/admin/coupon/create">
|
||||
<route id="admin.coupon.create" path="/admin/coupon/create/">
|
||||
<default key="_controller">Thelia\Controller\Admin\CouponController::createAction</default>
|
||||
</route>
|
||||
<route id="admin.coupon.update" path="/admin/coupon/update/{couponId}">
|
||||
<route id="admin.coupon.update" path="/admin/coupon/update/{couponId}/">
|
||||
<default key="_controller">Thelia\Controller\Admin\CouponController::updateAction</default>
|
||||
</route>
|
||||
<route id="admin.coupon.read" path="/admin/coupon/read/{couponId}">
|
||||
<route id="admin.coupon.read" path="/admin/coupon/read/{couponId}/">
|
||||
<default key="_controller">Thelia\Controller\Admin\CouponController::readAction</default>
|
||||
</route>
|
||||
<route id="admin.coupon.rule.input" path="/admin/coupon/rule/{ruleId}">
|
||||
<route id="admin.coupon.rule.input" path="/admin/coupon/rule/{ruleId}/">
|
||||
<default key="_controller">Thelia\Controller\Admin\CouponController::getRuleInputAction</default>
|
||||
</route>
|
||||
<route id="admin.coupon.rule.update" path="/admin/coupon/{couponId}/rule/update/">
|
||||
<default key="_controller">Thelia\Controller\Admin\CouponController::updateRulesAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.coupon.consume" path="/admin/coupon/consume/{couponCode}/">
|
||||
<default key="_controller">Thelia\Controller\Admin\CouponController::consumeAction</default>
|
||||
</route>
|
||||
|
||||
<!-- Routes to the Config (system variables) controller -->
|
||||
|
||||
@@ -210,6 +212,29 @@
|
||||
</route>
|
||||
|
||||
|
||||
<!-- Product templates management -->
|
||||
|
||||
<route id="admin.configuration.templates.default" path="/admin/configuration/templates">
|
||||
<default key="_controller">Thelia\Controller\Admin\TemplateController::defaultAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.templates.create" path="/admin/configuration/templates/create">
|
||||
<default key="_controller">Thelia\Controller\Admin\TemplateController::createAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.templates.update" path="/admin/configuration/templates/update">
|
||||
<default key="_controller">Thelia\Controller\Admin\TemplateController::updateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.templates.save" path="/admin/configuration/templates/save">
|
||||
<default key="_controller">Thelia\Controller\Admin\TemplateController::processUpdateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.templates.delete" path="/admin/configuration/templates/delete">
|
||||
<default key="_controller">Thelia\Controller\Admin\TemplateController::deleteAction</default>
|
||||
</route>
|
||||
|
||||
|
||||
<!-- attribute and attributes value management -->
|
||||
|
||||
<route id="admin.configuration.attributes.default" path="/admin/configuration/attributes">
|
||||
|
||||
@@ -4,12 +4,28 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="home" path="/install" >
|
||||
<route id="install.step1" path="/install" >
|
||||
<default key="_controller">Thelia\Controller\Install\InstallController::index</default>
|
||||
</route>
|
||||
|
||||
<route id="home" path="/install/step/2" >
|
||||
<route id="install.step2" path="/install/step/2" >
|
||||
<default key="_controller">Thelia\Controller\Install\InstallController::checkPermission</default>
|
||||
</route>
|
||||
|
||||
<route id="install.step3" path="/install/step/3" >
|
||||
<default key="_controller">Thelia\Controller\Install\InstallController::databaseConnection</default>
|
||||
</route>
|
||||
|
||||
<route id="install.step4" path="/install/step/4" >
|
||||
<default key="_controller">Thelia\Controller\Install\InstallController::databaseSelection</default>
|
||||
</route>
|
||||
|
||||
<route id="install.step5" path="/install/step/5" >
|
||||
<default key="_controller">Thelia\Controller\Install\InstallController::generalInformation</default>
|
||||
</route>
|
||||
|
||||
<route id="install.step6" path="/install/thanks" >
|
||||
<default key="_controller">Thelia\Controller\Install\InstallController::thanks</default>
|
||||
</route>
|
||||
|
||||
</routes>
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace Thelia\Constraint;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Serializer\Encoder\JsonEncoder;
|
||||
use Thelia\Constraint\Rule\AvailableForEveryoneManager;
|
||||
use Thelia\Constraint\Rule\AvailableForTotalAmountManager;
|
||||
use Thelia\Constraint\Rule\CouponRuleInterface;
|
||||
use Thelia\Constraint\Rule\SerializableRule;
|
||||
@@ -74,11 +75,22 @@ class ConstraintFactory
|
||||
*/
|
||||
public function serializeCouponRuleCollection(CouponRuleCollection $collection)
|
||||
{
|
||||
if ($collection->isEmpty()) {
|
||||
/** @var CouponRuleInterface $ruleNoCondition */
|
||||
$ruleNoCondition = $this->container->get(
|
||||
'thelia.constraint.rule.available_for_everyone'
|
||||
);
|
||||
$collection->add($ruleNoCondition);
|
||||
}
|
||||
$serializableRules = array();
|
||||
$rules = $collection->getRules();
|
||||
if ($rules !== null) {
|
||||
/** @var $rule CouponRuleInterface */
|
||||
foreach ($rules as $rule) {
|
||||
// Remove all rule if the "no condition" rule is found
|
||||
// if ($rule->getServiceId() == 'thelia.constraint.rule.available_for_everyone') {
|
||||
// return base64_encode(json_encode(array($rule->getSerializableRule())));
|
||||
// }
|
||||
$serializableRules[] = $rule->getSerializableRule();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class ConstraintValidator
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function test(CouponRuleCollection $rules)
|
||||
public function isMatching(CouponRuleCollection $rules)
|
||||
{
|
||||
$isMatching = true;
|
||||
/** @var CouponRuleInterface $rule */
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace Thelia\Constraint\Rule;
|
||||
|
||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
use Thelia\Constraint\ConstraintValidator;
|
||||
use Thelia\Coupon\CouponAdapterInterface;
|
||||
use Thelia\Constraint\Validator\PriceParam;
|
||||
use Thelia\Constraint\Validator\RuleValidator;
|
||||
@@ -168,13 +167,12 @@ class AvailableForTotalAmountManager extends CouponRuleAbstract
|
||||
return false;
|
||||
}
|
||||
|
||||
$constrainValidator = new ConstraintValidator();
|
||||
$constraint1 =$constrainValidator->variableOpComparison(
|
||||
$constraint1 = $this->constraintValidator->variableOpComparison(
|
||||
$this->adapter->getCartTotalPrice(),
|
||||
$this->operators[self::INPUT1],
|
||||
$this->values[self::INPUT1]
|
||||
);
|
||||
$constraint2 =$constrainValidator->variableOpComparison(
|
||||
$constraint2 = $this->constraintValidator->variableOpComparison(
|
||||
$this->adapter->getCheckoutCurrency(),
|
||||
$this->operators[self::INPUT2],
|
||||
$this->values[self::INPUT2]
|
||||
|
||||
@@ -126,8 +126,7 @@ class AvailableForXArticlesManager extends CouponRuleAbstract
|
||||
*/
|
||||
public function isMatching()
|
||||
{
|
||||
$constrainValidator = new ConstraintValidator();
|
||||
$constraint1 =$constrainValidator->variableOpComparison(
|
||||
$constraint1 = $this->constraintValidator->variableOpComparison(
|
||||
$this->adapter->getNbArticlesInCart(),
|
||||
$this->operators[self::INPUT1],
|
||||
$this->values[self::INPUT1]
|
||||
|
||||
@@ -82,6 +82,7 @@ abstract class CouponRuleAbstract implements CouponRuleInterface
|
||||
{
|
||||
$this->adapter = $adapter;
|
||||
$this->translator = $adapter->getTranslator();
|
||||
$this->constraintValidator = $adapter->getConstraintValidator();
|
||||
}
|
||||
|
||||
// /**
|
||||
|
||||
@@ -133,21 +133,21 @@ abstract class Operators
|
||||
break;
|
||||
case self::INFERIOR_OR_EQUAL:
|
||||
$ret = $translator->trans(
|
||||
'inferior or equals to',
|
||||
'inferior or equal to',
|
||||
array(),
|
||||
'constraint'
|
||||
);
|
||||
break;
|
||||
case self::EQUAL:
|
||||
$ret = $translator->trans(
|
||||
'equals to',
|
||||
'equal to',
|
||||
array(),
|
||||
'constraint'
|
||||
);
|
||||
break;
|
||||
case self::SUPERIOR_OR_EQUAL:
|
||||
$ret = $translator->trans(
|
||||
'superior or equals to',
|
||||
'superior or equal to',
|
||||
array(),
|
||||
'constraint'
|
||||
);
|
||||
|
||||
@@ -210,31 +210,34 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
/**
|
||||
* Put in this method post object creation processing if required.
|
||||
*
|
||||
* @param unknown $createdObject the created object
|
||||
* @param unknown $createEvent the create event
|
||||
* @return Response a response, or null to continue normal processing
|
||||
*/
|
||||
protected function performAdditionalCreateAction($createdObject)
|
||||
protected function performAdditionalCreateAction($createEvent)
|
||||
{
|
||||
// Nothing to do
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Put in this method post object update processing if required.
|
||||
*
|
||||
* @param unknown $updatedObject the updated object
|
||||
* @param unknown $updateEvent the update event
|
||||
* @return Response a response, or null to continue normal processing
|
||||
*/
|
||||
protected function performAdditionalUpdateAction($updatedObject)
|
||||
protected function performAdditionalUpdateAction($updateeEvent)
|
||||
{
|
||||
// Nothing to do
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Put in this method post object delete processing if required.
|
||||
*
|
||||
* @param unknown $deletedObject the deleted object
|
||||
* @param unknown $deleteEvent the delete event
|
||||
* @return Response a response, or null to continue normal processing
|
||||
*/
|
||||
protected function performAdditionalDeleteAction($deletedObject)
|
||||
protected function performAdditionalDeleteAction($deleteEvent)
|
||||
{
|
||||
// Nothing to do
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -306,7 +309,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
$this->adminLogAppend(sprintf("%s %s (ID %s) created", ucfirst($this->objectName), $this->getObjectLabel($createdObject), $this->getObjectId($createdObject)));
|
||||
}
|
||||
|
||||
$this->performAdditionalCreateAction($createdObject);
|
||||
$this->performAdditionalCreateAction($createEvent);
|
||||
|
||||
// Substitute _ID_ in the URL with the ID of the created object
|
||||
$successUrl = str_replace('_ID_', $this->getObjectId($createdObject), $creationForm->getSuccessUrl());
|
||||
@@ -393,7 +396,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
$this->adminLogAppend(sprintf("%s %s (ID %s) modified", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
|
||||
}
|
||||
|
||||
$this->performAdditionalUpdateAction($changedObject);
|
||||
$this->performAdditionalUpdateAction($changeEvent);
|
||||
|
||||
// If we have to stay on the same page, do not redirect to the succesUrl,
|
||||
// just redirect to the edit page again.
|
||||
@@ -494,8 +497,12 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
$this->adminLogAppend(
|
||||
sprintf("%s %s (ID %s) deleted", ucfirst($this->objectName), $this->getObjectLabel($deletedObject), $this->getObjectId($deletedObject)));
|
||||
}
|
||||
$this->performAdditionalDeleteAction($deletedObject);
|
||||
|
||||
$this->redirectToListTemplate();
|
||||
$response = $this->performAdditionalDeleteAction($deleteEvent);
|
||||
|
||||
if ($response == null)
|
||||
$this->redirectToListTemplate();
|
||||
else
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Security\Authentication\AdminTokenAuthenticator;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Security\Exception\TokenAuthenticationException;
|
||||
|
||||
class AdminController extends BaseAdminController
|
||||
{
|
||||
public function indexAction()
|
||||
|
||||
@@ -107,7 +107,7 @@ class AttributeController extends AbstractCrudController
|
||||
*
|
||||
* @see \Thelia\Controller\Admin\AbstractCrudController::performAdditionalUpdateAction()
|
||||
*/
|
||||
protected function performAdditionalUpdateAction($updatedObject)
|
||||
protected function performAdditionalUpdateAction($updateEvent)
|
||||
{
|
||||
$attr_values = $this->getRequest()->get('attribute_values', null);
|
||||
|
||||
@@ -123,6 +123,8 @@ class AttributeController extends AbstractCrudController
|
||||
$this->dispatch(TheliaEvents::ATTRIBUTE_AV_UPDATE, $event);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function createUpdatePositionEvent($positionChangeMode, $positionValue)
|
||||
|
||||
@@ -40,6 +40,8 @@ use Thelia\Form\BaseForm;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Log\Tlog;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Model\Admin;
|
||||
use Thelia\Core\Security\Token\CookieTokenProvider;
|
||||
|
||||
class BaseAdminController extends BaseController
|
||||
{
|
||||
@@ -302,6 +304,46 @@ class BaseAdminController extends BaseController
|
||||
return $order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the remember me cookie for the given user.
|
||||
*/
|
||||
protected function createAdminRememberMeCookie(Admin $user)
|
||||
{
|
||||
$ctp = new CookieTokenProvider();
|
||||
|
||||
$cookieName = ConfigQuery::read('admin_remember_me_cookie_name', 'armcn');
|
||||
$cookieExpiration = ConfigQuery::read('admin_remember_me_cookie_expiration', 2592000 /* 1 month */);
|
||||
|
||||
$ctp->createCookie($user, $cookieName, $cookieExpiration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the rememberme key from the cookie.
|
||||
*
|
||||
* @return string hte key found, or null if no key was found.
|
||||
*/
|
||||
protected function getRememberMeKeyFromCookie()
|
||||
{
|
||||
// Check if we can authenticate the user with a cookie-based token
|
||||
$cookieName = ConfigQuery::read('admin_remember_me_cookie_name', 'armcn');
|
||||
|
||||
$ctp = new CookieTokenProvider();
|
||||
|
||||
return $ctp->getKeyFromCookie($this->getRequest(), $cookieName);
|
||||
}
|
||||
|
||||
/** Clear the remember me cookie.
|
||||
*
|
||||
*/
|
||||
protected function clearRememberMeCookie() {
|
||||
|
||||
$ctp = new CookieTokenProvider();
|
||||
|
||||
$cookieName = ConfigQuery::read('admin_remember_me_cookie_name', 'armcn');
|
||||
|
||||
$ctp->clearCookie($cookieName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the given template, and returns the result as an Http Response.
|
||||
*
|
||||
|
||||
@@ -30,6 +30,7 @@ use Thelia\Constraint\ConstraintFactoryTest;
|
||||
use Thelia\Constraint\Rule\AvailableForTotalAmount;
|
||||
use Thelia\Constraint\Rule\CouponRuleInterface;
|
||||
use Thelia\Constraint\Validator\PriceParam;
|
||||
use Thelia\Core\Event\Coupon\CouponConsumeEvent;
|
||||
use Thelia\Core\Event\Coupon\CouponCreateEvent;
|
||||
use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Coupon\CouponEvent;
|
||||
@@ -39,6 +40,7 @@ use Thelia\Core\Security\Exception\AuthenticationException;
|
||||
use Thelia\Core\Security\Exception\AuthorizationException;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Coupon\CouponAdapterInterface;
|
||||
use Thelia\Coupon\CouponFactory;
|
||||
use Thelia\Coupon\CouponManager;
|
||||
use Thelia\Coupon\CouponRuleCollection;
|
||||
use Thelia\Coupon\Type\CouponInterface;
|
||||
@@ -72,7 +74,54 @@ class CouponController extends BaseAdminController
|
||||
{
|
||||
$this->checkAuth('ADMIN', 'admin.coupon.view');
|
||||
|
||||
return $this->render('coupon-list');
|
||||
$args['urlReadCoupon'] = $this->getRoute(
|
||||
'admin.coupon.read',
|
||||
array('couponId' => 'couponId'),
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
|
||||
$args['urlEditCoupon'] = $this->getRoute(
|
||||
'admin.coupon.update',
|
||||
array('couponId' => 'couponId'),
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
|
||||
$args['urlCreateCoupon'] = $this->getRoute(
|
||||
'admin.coupon.create',
|
||||
array(),
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
|
||||
return $this->render('coupon-list', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage Coupons read display
|
||||
*
|
||||
* @param int $couponId Coupon Id
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function readAction($couponId)
|
||||
{
|
||||
$this->checkAuth('ADMIN', 'admin.coupon.read');
|
||||
|
||||
// Database request repeated in the loop but cached
|
||||
$search = CouponQuery::create();
|
||||
$coupon = $search->findOneById($couponId);
|
||||
|
||||
if ($coupon === null) {
|
||||
return $this->pageNotFound();
|
||||
}
|
||||
|
||||
$args['couponId'] = $couponId;
|
||||
$args['urlEditCoupon'] = $this->getRoute(
|
||||
'admin.coupon.update',
|
||||
array('couponId' => $couponId),
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
|
||||
return $this->render('coupon-read', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +142,7 @@ class CouponController extends BaseAdminController
|
||||
|
||||
$i18n = new I18n();
|
||||
/** @var Lang $lang */
|
||||
$lang = $this->getSession()->get('lang');
|
||||
$lang = $this->getSession()->getLang();
|
||||
$eventToDispatch = TheliaEvents::COUPON_CREATE;
|
||||
|
||||
if ($this->getRequest()->isMethod('POST')) {
|
||||
@@ -108,10 +157,12 @@ class CouponController extends BaseAdminController
|
||||
// If no input for expirationDate, now + 2 months
|
||||
$defaultDate = new \DateTime();
|
||||
$args['defaultDate'] = $defaultDate->modify('+2 month')
|
||||
->format($lang->getDateFormat());
|
||||
->format('Y-m-d');
|
||||
}
|
||||
|
||||
$args['formAction'] = 'admin/coupon/create';
|
||||
$args['dateFormat'] = $this->getSession()->getLang()->getDateFormat();
|
||||
$args['availableCoupons'] = $this->getAvailableCoupons();
|
||||
$args['formAction'] = 'admin/coupon/create/';
|
||||
|
||||
return $this->render(
|
||||
'coupon-create',
|
||||
@@ -135,7 +186,7 @@ class CouponController extends BaseAdminController
|
||||
}
|
||||
|
||||
/** @var Coupon $coupon */
|
||||
$coupon = CouponQuery::create()->findOneById($couponId);
|
||||
$coupon = CouponQuery::create()->findPk($couponId);
|
||||
if (!$coupon) {
|
||||
$this->pageNotFound();
|
||||
}
|
||||
@@ -148,6 +199,7 @@ class CouponController extends BaseAdminController
|
||||
$lang = $this->getSession()->getLang();
|
||||
$eventToDispatch = TheliaEvents::COUPON_UPDATE;
|
||||
|
||||
// Create
|
||||
if ($this->getRequest()->isMethod('POST')) {
|
||||
$this->validateCreateOrUpdateForm(
|
||||
$i18n,
|
||||
@@ -156,9 +208,9 @@ class CouponController extends BaseAdminController
|
||||
'updated',
|
||||
'update'
|
||||
);
|
||||
} else {
|
||||
// Prepare the data that will hydrate the form
|
||||
} else { // Update
|
||||
|
||||
// Prepare the data that will hydrate the form
|
||||
/** @var ConstraintFactory $constraintFactory */
|
||||
$constraintFactory = $this->container->get('thelia.constraint.factory');
|
||||
$rules = $constraintFactory->unserializeCouponRuleCollection(
|
||||
@@ -173,7 +225,7 @@ class CouponController extends BaseAdminController
|
||||
'shortDescription' => $coupon->getShortDescription(),
|
||||
'description' => $coupon->getDescription(),
|
||||
'isEnabled' => ($coupon->getIsEnabled() == 1),
|
||||
'expirationDate' => $coupon->getExpirationDate($lang->getDateFormat()),
|
||||
'expirationDate' => $coupon->getExpirationDate('Y-m-d'),
|
||||
'isAvailableOnSpecialOffers' => ($coupon->getIsAvailableOnSpecialOffers() == 1),
|
||||
'isCumulative' => ($coupon->getIsCumulative() == 1),
|
||||
'isRemovingPostage' => ($coupon->getIsRemovingPostage() == 1),
|
||||
@@ -202,7 +254,7 @@ class CouponController extends BaseAdminController
|
||||
// Pass it to the parser
|
||||
$this->getParserContext()->addForm($changeForm);
|
||||
}
|
||||
|
||||
$args['couponCode'] = $coupon->getCode();
|
||||
$args['availableCoupons'] = $this->getAvailableCoupons();
|
||||
$args['availableRules'] = $this->getAvailableRules();
|
||||
$args['urlAjaxGetRuleInput'] = $this->getRoute(
|
||||
@@ -222,123 +274,6 @@ class CouponController extends BaseAdminController
|
||||
return $this->render('coupon-update', $args);
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * Manage Coupons Rule creation display
|
||||
// *
|
||||
// * @param int $couponId Coupon id
|
||||
// *
|
||||
// * @return \Symfony\Component\HttpFoundation\Response
|
||||
// */
|
||||
// public function createRuleAction($couponId)
|
||||
// {
|
||||
// // Check current user authorization
|
||||
// $response = $this->checkAuth('admin.coupon.update');
|
||||
// if ($response !== null) {
|
||||
// return $response;
|
||||
// }
|
||||
//
|
||||
// /** @var Coupon $coupon */
|
||||
// $coupon = CouponQuery::create()->findOneById($couponId);
|
||||
// if (!$coupon) {
|
||||
// $this->pageNotFound();
|
||||
// }
|
||||
//
|
||||
// // Parameters given to the template
|
||||
// $args = array();
|
||||
//
|
||||
// $i18n = new I18n();
|
||||
// /** @var Lang $lang */
|
||||
// $lang = $this->getSession()->get('lang');
|
||||
// $eventToDispatch = TheliaEvents::COUPON_RULE_CREATE;
|
||||
//
|
||||
// if ($this->getRequest()->isMethod('POST')) {
|
||||
// $this->validateCreateOrUpdateForm(
|
||||
// $i18n,
|
||||
// $lang,
|
||||
// $eventToDispatch,
|
||||
// 'updated',
|
||||
// 'update'
|
||||
// );
|
||||
// } else {
|
||||
// // Prepare the data that will hydrate the form
|
||||
//
|
||||
// /** @var ConstraintFactory $constraintFactory */
|
||||
// $constraintFactory = $this->container->get('thelia.constraint.factory');
|
||||
//
|
||||
// $data = array(
|
||||
// 'code' => $coupon->getCode(),
|
||||
// 'title' => $coupon->getTitle(),
|
||||
// 'amount' => $coupon->getAmount(),
|
||||
// 'effect' => $coupon->getType(),
|
||||
// 'shortDescription' => $coupon->getShortDescription(),
|
||||
// 'description' => $coupon->getDescription(),
|
||||
// 'isEnabled' => ($coupon->getIsEnabled() == 1),
|
||||
// 'expirationDate' => $coupon->getExpirationDate($lang->getDateFormat()),
|
||||
// 'isAvailableOnSpecialOffers' => ($coupon->getIsAvailableOnSpecialOffers() == 1),
|
||||
// 'isCumulative' => ($coupon->getIsCumulative() == 1),
|
||||
// 'isRemovingPostage' => ($coupon->getIsRemovingPostage() == 1),
|
||||
// 'maxUsage' => $coupon->getMaxUsage(),
|
||||
// 'rules' => $constraintFactory->unserializeCouponRuleCollection($coupon->getSerializedRules()),
|
||||
// 'locale' => $coupon->getLocale(),
|
||||
// );
|
||||
//
|
||||
// /** @var CouponAdapterInterface $adapter */
|
||||
// $adapter = $this->container->get('thelia.adapter');
|
||||
// /** @var Translator $translator */
|
||||
// $translator = $this->container->get('thelia.translator');
|
||||
//
|
||||
// $args['rulesObject'] = array();
|
||||
// /** @var CouponRuleInterface $rule */
|
||||
// foreach ($coupon->getRules()->getRules() as $rule) {
|
||||
// $args['rulesObject'][] = array(
|
||||
// 'name' => $rule->getName($translator),
|
||||
// 'tooltip' => $rule->getToolTip($translator),
|
||||
// 'validators' => $rule->getValidators()
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// $args['rules'] = $this->cleanRuleForTemplate($coupon->getRules()->getRules());
|
||||
//
|
||||
// // Setup the object form
|
||||
// $changeForm = new CouponCreationForm($this->getRequest(), 'form', $data);
|
||||
//
|
||||
// // Pass it to the parser
|
||||
// $this->getParserContext()->addForm($changeForm);
|
||||
// }
|
||||
//
|
||||
// $args['formAction'] = 'admin/coupon/update/' . $couponId;
|
||||
//
|
||||
// return $this->render(
|
||||
// 'coupon-update',
|
||||
// $args
|
||||
// );
|
||||
// }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Manage Coupons read display
|
||||
*
|
||||
* @param int $couponId Coupon Id
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function readAction($couponId)
|
||||
{
|
||||
$this->checkAuth('ADMIN', 'admin.coupon.read');
|
||||
|
||||
// Database request repeated in the loop but cached
|
||||
$search = CouponQuery::create();
|
||||
$coupon = $search->findOneById($couponId);
|
||||
|
||||
if ($coupon === null) {
|
||||
return $this->pageNotFound();
|
||||
}
|
||||
|
||||
return $this->render('coupon-read', array('couponId' => $couponId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage Coupons read display
|
||||
*
|
||||
@@ -350,17 +285,7 @@ class CouponController extends BaseAdminController
|
||||
{
|
||||
$this->checkAuth('ADMIN', 'admin.coupon.read');
|
||||
|
||||
if ($this->isDebug()) {
|
||||
if (!$this->getRequest()->isXmlHttpRequest()) {
|
||||
$this->redirect(
|
||||
$this->getRoute(
|
||||
'admin',
|
||||
array(),
|
||||
Router::ABSOLUTE_URL
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
/** @var ConstraintFactory $constraintFactory */
|
||||
$constraintFactory = $this->container->get('thelia.constraint.factory');
|
||||
@@ -391,17 +316,7 @@ class CouponController extends BaseAdminController
|
||||
{
|
||||
$this->checkAuth('ADMIN', 'admin.coupon.read');
|
||||
|
||||
if ($this->isDebug()) {
|
||||
if (!$this->getRequest()->isXmlHttpRequest()) {
|
||||
$this->redirect(
|
||||
$this->getRoute(
|
||||
'admin',
|
||||
array(),
|
||||
Router::ABSOLUTE_URL
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
$search = CouponQuery::create();
|
||||
/** @var Coupon $coupon */
|
||||
@@ -475,6 +390,29 @@ class CouponController extends BaseAdminController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Coupon consuming
|
||||
*
|
||||
* @param string $couponCode Coupon code
|
||||
*
|
||||
*/
|
||||
public function consumeAction($couponCode)
|
||||
{
|
||||
// @todo remove (event dispatcher testing purpose)
|
||||
$couponConsumeEvent = new CouponConsumeEvent($couponCode);
|
||||
$eventToDispatch = TheliaEvents::COUPON_CONSUME;
|
||||
|
||||
// Dispatch Event to the Action
|
||||
$this->dispatch(
|
||||
$eventToDispatch,
|
||||
$couponConsumeEvent
|
||||
);
|
||||
|
||||
var_dump('test', $couponConsumeEvent->getCode(), $couponConsumeEvent->getDiscount(), $couponConsumeEvent->getIsValid());
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a Coupon from its form
|
||||
*
|
||||
@@ -535,7 +473,7 @@ class CouponController extends BaseAdminController
|
||||
/**
|
||||
* Validate the CreateOrUpdate form
|
||||
*
|
||||
* @param string $i18n Local code (fr_FR)
|
||||
* @param I18n $i18n Local code (fr_FR)
|
||||
* @param Lang $lang Local variables container
|
||||
* @param string $eventToDispatch Event which will activate actions
|
||||
* @param string $log created|edited
|
||||
@@ -543,7 +481,7 @@ class CouponController extends BaseAdminController
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function validateCreateOrUpdateForm($i18n, $lang, $eventToDispatch, $log, $action)
|
||||
protected function validateCreateOrUpdateForm(I18n $i18n, Lang $lang, $eventToDispatch, $log, $action)
|
||||
{
|
||||
// Create the form from the request
|
||||
$creationForm = new CouponCreationForm($this->getRequest());
|
||||
@@ -563,7 +501,7 @@ class CouponController extends BaseAdminController
|
||||
$data['shortDescription'],
|
||||
$data['description'],
|
||||
$data['isEnabled'],
|
||||
$i18n->getDateTimeFromForm($lang, $data['expirationDate']),
|
||||
\DateTime::createFromFormat('Y-m-d', $data['expirationDate']),
|
||||
$data['isAvailableOnSpecialOffers'],
|
||||
$data['isCumulative'],
|
||||
$data['isRemovingPostage'],
|
||||
@@ -651,17 +589,17 @@ class CouponController extends BaseAdminController
|
||||
/** @var CouponManager $couponManager */
|
||||
$couponManager = $this->container->get('thelia.coupon.manager');
|
||||
$availableCoupons = $couponManager->getAvailableCoupons();
|
||||
$cleanedRules = array();
|
||||
$cleanedCoupons = array();
|
||||
/** @var CouponInterface $availableCoupon */
|
||||
foreach ($availableCoupons as $availableCoupon) {
|
||||
$rule = array();
|
||||
$rule['serviceId'] = $availableCoupon->getServiceId();
|
||||
$rule['name'] = $availableCoupon->getName();
|
||||
$rule['toolTip'] = $availableCoupon->getToolTip();
|
||||
$cleanedRules[] = $rule;
|
||||
$cleanedCoupons[] = $rule;
|
||||
}
|
||||
|
||||
return $cleanedRules;
|
||||
return $cleanedCoupons;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,11 +30,44 @@ use Thelia\Core\Security\Exception\AuthenticationException;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Tools\Redirect;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\Authentication\AdminTokenAuthenticator;
|
||||
use Thelia\Core\Security\UserProvider\TokenProvider;
|
||||
use Symfony\Component\HttpFoundation\Cookie;
|
||||
use Thelia\Core\Security\UserProvider\CookieTokenProvider;
|
||||
use Thelia\Core\Security\Exception\TokenAuthenticationException;
|
||||
|
||||
class SessionController extends BaseAdminController
|
||||
{
|
||||
public function showLoginAction()
|
||||
{
|
||||
// Check if we can authenticate the user with a cookie-based token
|
||||
if (null !== $key = $this->getRememberMeKeyFromCookie()) {
|
||||
|
||||
// Create the authenticator
|
||||
$authenticator = new AdminTokenAuthenticator($key);
|
||||
|
||||
try {
|
||||
// If have found a user, store it in the security context
|
||||
$user = $authenticator->getAuthentifiedUser();
|
||||
|
||||
$this->getSecurityContext()->setAdminUser($user);
|
||||
|
||||
$this->adminLogAppend("Successful token authentication");
|
||||
|
||||
// Update the cookie
|
||||
$cookie = $this->createAdminRememberMeCookie($user);
|
||||
|
||||
// Render the home page
|
||||
return $this->render("home");
|
||||
}
|
||||
catch (TokenAuthenticationException $ex) {
|
||||
$this->adminLogAppend("Token based authentication failed.");
|
||||
|
||||
// Clear the cookie
|
||||
$this->clearRememberMeCookie();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render("login");
|
||||
}
|
||||
|
||||
@@ -44,6 +77,9 @@ class SessionController extends BaseAdminController
|
||||
|
||||
$this->getSecurityContext()->clearAdminUser();
|
||||
|
||||
// Clear the remember me cookie, if any
|
||||
$this->clearRememberMeCookie();
|
||||
|
||||
// Go back to login page.
|
||||
$this->redirectToRoute('admin.login');
|
||||
}
|
||||
@@ -68,10 +104,19 @@ class SessionController extends BaseAdminController
|
||||
// Log authentication success
|
||||
AdminLog::append("Authentication successful", $request, $user);
|
||||
|
||||
/**
|
||||
* FIXME: we have tou find a way to send cookie
|
||||
*/
|
||||
if (intval($adminLoginForm->getForm()->get('remember_me')->getData()) > 0) {
|
||||
// If a remember me field if present and set in the form, create
|
||||
// the cookie thant store "remember me" information
|
||||
$this->createAdminRememberMeCookie($user);
|
||||
}
|
||||
|
||||
$this->dispatch(TheliaEvents::ADMIN_LOGIN);
|
||||
|
||||
// Redirect to the success URL
|
||||
return Redirect::exec($adminLoginForm->getSuccessUrl());
|
||||
// Redirect to the success URL, passing the cookie if one exists.
|
||||
$this->redirect($adminLoginForm->getSuccessUrl());
|
||||
|
||||
} catch (FormValidationException $ex) {
|
||||
|
||||
|
||||
196
core/lib/Thelia/Controller/Admin/TemplateController.php
Normal file
196
core/lib/Thelia/Controller/Admin/TemplateController.php
Normal file
@@ -0,0 +1,196 @@
|
||||
<?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\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\TemplateDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\TemplateUpdateEvent;
|
||||
use Thelia\Core\Event\TemplateCreateEvent;
|
||||
use Thelia\Model\TemplateQuery;
|
||||
use Thelia\Form\TemplateModificationForm;
|
||||
use Thelia\Form\TemplateCreationForm;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Model\TemplateAv;
|
||||
use Thelia\Model\TemplateAvQuery;
|
||||
use Thelia\Core\Event\TemplateAvUpdateEvent;
|
||||
use Thelia\Core\Event\TemplateEvent;
|
||||
|
||||
/**
|
||||
* Manages templates sent by mail
|
||||
*
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class TemplateController extends AbstractCrudController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
'template',
|
||||
null,
|
||||
null,
|
||||
|
||||
'admin.configuration.templates.view',
|
||||
'admin.configuration.templates.create',
|
||||
'admin.configuration.templates.update',
|
||||
'admin.configuration.templates.delete',
|
||||
|
||||
TheliaEvents::TEMPLATE_CREATE,
|
||||
TheliaEvents::TEMPLATE_UPDATE,
|
||||
TheliaEvents::TEMPLATE_DELETE,
|
||||
null, // No visibility toggle
|
||||
null // No position update
|
||||
);
|
||||
}
|
||||
|
||||
protected function getCreationForm()
|
||||
{
|
||||
return new TemplateCreationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getUpdateForm()
|
||||
{
|
||||
return new TemplateModificationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getCreationEvent($formData)
|
||||
{
|
||||
$createEvent = new TemplateCreateEvent();
|
||||
|
||||
$createEvent
|
||||
->setTemplateName($formData['name'])
|
||||
->setLocale($formData["locale"])
|
||||
;
|
||||
|
||||
return $createEvent;
|
||||
}
|
||||
|
||||
protected function getUpdateEvent($formData)
|
||||
{
|
||||
$changeEvent = new TemplateUpdateEvent($formData['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
$changeEvent
|
||||
->setLocale($formData["locale"])
|
||||
->setTemplateName($formData['name'])
|
||||
;
|
||||
|
||||
// Add feature and attributes list
|
||||
|
||||
return $changeEvent;
|
||||
}
|
||||
|
||||
protected function getDeleteEvent()
|
||||
{
|
||||
return new TemplateDeleteEvent($this->getRequest()->get('template_id'));
|
||||
}
|
||||
|
||||
protected function eventContainsObject($event)
|
||||
{
|
||||
return $event->hasTemplate();
|
||||
}
|
||||
|
||||
protected function hydrateObjectForm($object)
|
||||
{
|
||||
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
'locale' => $object->getLocale(),
|
||||
'name' => $object->getName()
|
||||
);
|
||||
|
||||
// Setup the object form
|
||||
return new TemplateModificationForm($this->getRequest(), "form", $data);
|
||||
}
|
||||
|
||||
protected function getObjectFromEvent($event)
|
||||
{
|
||||
return $event->hasTemplate() ? $event->getTemplate() : null;
|
||||
}
|
||||
|
||||
protected function getExistingObject()
|
||||
{
|
||||
return TemplateQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('template_id'));
|
||||
}
|
||||
|
||||
protected function getObjectLabel($object)
|
||||
{
|
||||
return $object->getName();
|
||||
}
|
||||
|
||||
protected function getObjectId($object)
|
||||
{
|
||||
return $object->getId();
|
||||
}
|
||||
|
||||
protected function renderListTemplate($currentOrder)
|
||||
{
|
||||
return $this->render('templates', array('order' => $currentOrder));
|
||||
}
|
||||
|
||||
protected function renderEditionTemplate()
|
||||
{
|
||||
return $this->render(
|
||||
'template-edit',
|
||||
array(
|
||||
'template_id' => $this->getRequest()->get('template_id'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
protected function redirectToEditionTemplate()
|
||||
{
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.templates.update",
|
||||
array(
|
||||
'template_id' => $this->getRequest()->get('template_id'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
protected function redirectToListTemplate()
|
||||
{
|
||||
$this->redirectToRoute('admin.configuration.templates.default');
|
||||
}
|
||||
|
||||
// Process delete failure, which may occurs if template is in use.
|
||||
protected function performAdditionalDeleteAction($deleteEvent)
|
||||
{
|
||||
if ($deleteEvent->getProductCount() > 0) {
|
||||
|
||||
$this->getParserContext()->setGeneralError(
|
||||
$this->getTranslator()->trans(
|
||||
"This template is in use in some of your products, and cannot be deleted. Delete it from all your products and try again."
|
||||
)
|
||||
);
|
||||
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
// Normal delete processing
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -127,7 +127,7 @@ class BaseController extends ContainerAware
|
||||
/**
|
||||
* Returns the session from the current request
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Session\SessionInterface
|
||||
* @return \Thelia\Core\HttpFoundation\Session\Session
|
||||
*/
|
||||
protected function getSession()
|
||||
{
|
||||
@@ -198,9 +198,9 @@ class BaseController extends ContainerAware
|
||||
*
|
||||
* @param string $url
|
||||
*/
|
||||
public function redirect($url, $status = 302)
|
||||
public function redirect($url, $status = 302, $cookies = array())
|
||||
{
|
||||
Redirect::exec($url, $status);
|
||||
Redirect::exec($url, $status, $cookies);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,7 +39,7 @@ class BaseInstallController extends BaseController
|
||||
{
|
||||
$parser = $this->container->get("thelia.parser");
|
||||
|
||||
// Define the template thant shoud be used
|
||||
// Define the template that shoud be used
|
||||
$parser->setTemplate("install");
|
||||
|
||||
return $parser;
|
||||
|
||||
@@ -33,18 +33,61 @@ class InstallController extends BaseInstallController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$this->verifyStep(1);
|
||||
//$this->verifyStep(1);
|
||||
|
||||
$this->getSession()->set("step", 1);
|
||||
|
||||
$this->render("index.html");
|
||||
return $this->render("index.html");
|
||||
}
|
||||
|
||||
public function checkPermission()
|
||||
{
|
||||
$this->verifyStep(2);
|
||||
//$this->verifyStep(2);
|
||||
|
||||
$permission = new CheckPermission();
|
||||
//$permission = new CheckPermission();
|
||||
|
||||
$this->getSession()->set("step", 2);
|
||||
return $this->render("step-2.html");
|
||||
}
|
||||
|
||||
public function databaseConnection()
|
||||
{
|
||||
//$this->verifyStep(2);
|
||||
|
||||
//$permission = new CheckPermission();
|
||||
|
||||
$this->getSession()->set("step", 3);
|
||||
return $this->render("step-3.html");
|
||||
}
|
||||
|
||||
public function databaseSelection()
|
||||
{
|
||||
//$this->verifyStep(2);
|
||||
|
||||
//$permission = new CheckPermission();
|
||||
|
||||
$this->getSession()->set("step", 4);
|
||||
return $this->render("step-4.html");
|
||||
}
|
||||
|
||||
public function generalInformation()
|
||||
{
|
||||
//$this->verifyStep(2);
|
||||
|
||||
//$permission = new CheckPermission();
|
||||
|
||||
$this->getSession()->set("step", 5);
|
||||
return $this->render("step-5.html");
|
||||
}
|
||||
|
||||
public function thanks()
|
||||
{
|
||||
//$this->verifyStep(2);
|
||||
|
||||
//$permission = new CheckPermission();
|
||||
|
||||
$this->getSession()->set("step", 6);
|
||||
return $this->render("thanks.html");
|
||||
}
|
||||
|
||||
protected function verifyStep($step)
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
/**********************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event\Coupon;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Coupon\CouponRuleCollection;
|
||||
use Thelia\Model\Coupon;
|
||||
|
||||
/**
|
||||
@@ -29,75 +31,112 @@ use Thelia\Model\Coupon;
|
||||
* Date: 8/29/13
|
||||
* Time: 3:45 PM
|
||||
*
|
||||
* Occurring when a Coupon is disabled
|
||||
* Occurring when a Coupon is consumed
|
||||
*
|
||||
* @package Coupon
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class CouponDisableEvent extends ActionEvent
|
||||
class CouponConsumeEvent extends ActionEvent
|
||||
{
|
||||
/** @var int Coupon id */
|
||||
protected $couponId;
|
||||
/** @var string Coupon code */
|
||||
protected $code = null;
|
||||
|
||||
/** @var Coupon Coupon being disabled */
|
||||
protected $disabledCoupon;
|
||||
/** @var float Total discount given by this coupon */
|
||||
protected $discount = 0;
|
||||
|
||||
/** @var bool If Coupon is valid or if Customer meets coupon conditions */
|
||||
protected $isValid = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Coupon Id
|
||||
* @param string $code Coupon code
|
||||
* @param float $discount Total discount given by this coupon
|
||||
* @param bool $isValid If Coupon is valid or
|
||||
* if Customer meets coupon conditions
|
||||
*/
|
||||
public function __construct($id)
|
||||
function __construct($code, $discount = null, $isValid = null)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->code = $code;
|
||||
$this->discount = $discount;
|
||||
$this->isValid = $isValid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Coupon id
|
||||
* Set Coupon code
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Coupon id
|
||||
*
|
||||
* @param int $id Coupon id
|
||||
* @param string $code Coupon code
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
public function setCode($code)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->code = $code;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Coupon being disabled
|
||||
* Get Coupon code
|
||||
*
|
||||
* @return Coupon
|
||||
* @return string
|
||||
*/
|
||||
public function getDisabledCoupon()
|
||||
public function getCode()
|
||||
{
|
||||
return $this->disabledCoupon;
|
||||
return $this->code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Coupon to be disabled
|
||||
* Set total discount given by this coupon
|
||||
*
|
||||
* @param Coupon $disabledCoupon Coupon to disable
|
||||
* @param float $discount Total discount given by this coupon
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDisabledCoupon(Coupon $disabledCoupon)
|
||||
public function setDiscount($discount)
|
||||
{
|
||||
$this->disabledCoupon = $disabledCoupon;
|
||||
$this->discount = $discount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get total discount given by this coupon
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getDiscount()
|
||||
{
|
||||
return $this->discount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if Coupon is valid or if Customer meets coupon conditions
|
||||
*
|
||||
* @param boolean $isValid if Coupon is valid or
|
||||
* if Customer meets coupon conditions
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setIsValid($isValid)
|
||||
{
|
||||
$this->isValid = $isValid;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get if Coupon is valid or if Customer meets coupon conditions
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIsValid()
|
||||
{
|
||||
return $this->isValid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
<?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\Core\Event\Coupon;
|
||||
use Thelia\Model\Coupon;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* Date: 8/29/13
|
||||
* Time: 3:45 PM
|
||||
*
|
||||
* Occurring when a Coupon is enabled
|
||||
*
|
||||
* @package Coupon
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class CouponEnableEvent extends ActionEvent
|
||||
{
|
||||
/** @var int Coupon id */
|
||||
protected $couponId;
|
||||
|
||||
/** @var Coupon Coupon being enabled */
|
||||
protected $enabledCoupon;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Coupon Id
|
||||
*/
|
||||
public function __construct($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Coupon id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Coupon id
|
||||
*
|
||||
* @param int $id Coupon id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Coupon being enabled
|
||||
*
|
||||
* @return Coupon
|
||||
*/
|
||||
public function getEnabledCoupon()
|
||||
{
|
||||
return $this->enabledCoupon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Coupon to be enabled
|
||||
*
|
||||
* @param Coupon $enabledCoupon Coupon to enabled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setEnabledCoupon(Coupon $enabledCoupon)
|
||||
{
|
||||
$this->enabledCoupon = $enabledCoupon;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
54
core/lib/Thelia/Core/Event/TemplateCreateEvent.php
Normal file
54
core/lib/Thelia/Core/Event/TemplateCreateEvent.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?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\Core\Event;
|
||||
|
||||
class TemplateCreateEvent extends TemplateEvent
|
||||
{
|
||||
protected $template_name;
|
||||
protected $locale;
|
||||
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->locale;
|
||||
}
|
||||
|
||||
public function setLocale($locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTemplateName()
|
||||
{
|
||||
return $this->template_name;
|
||||
}
|
||||
|
||||
public function setTemplateName($template_name)
|
||||
{
|
||||
$this->template_name = $template_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
59
core/lib/Thelia/Core/Event/TemplateDeleteEvent.php
Normal file
59
core/lib/Thelia/Core/Event/TemplateDeleteEvent.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?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\Core\Event;
|
||||
|
||||
class TemplateDeleteEvent extends TemplateEvent
|
||||
{
|
||||
protected $template_id;
|
||||
protected $product_count;
|
||||
|
||||
public function __construct($template_id)
|
||||
{
|
||||
$this->setTemplateId($template_id);
|
||||
}
|
||||
|
||||
public function getTemplateId()
|
||||
{
|
||||
return $this->template_id;
|
||||
}
|
||||
|
||||
public function setTemplateId($template_id)
|
||||
{
|
||||
$this->template_id = $template_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getProductCount()
|
||||
{
|
||||
return $this->product_count;
|
||||
}
|
||||
|
||||
public function setProductCount($product_count)
|
||||
{
|
||||
$this->product_count = $product_count;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
52
core/lib/Thelia/Core/Event/TemplateEvent.php
Normal file
52
core/lib/Thelia/Core/Event/TemplateEvent.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?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\Core\Event;
|
||||
use Thelia\Model\Template;
|
||||
|
||||
class TemplateEvent extends ActionEvent
|
||||
{
|
||||
protected $template = null;
|
||||
|
||||
public function __construct(Template $template = null)
|
||||
{
|
||||
$this->template = $template;
|
||||
}
|
||||
|
||||
public function hasTemplate()
|
||||
{
|
||||
return ! is_null($this->template);
|
||||
}
|
||||
|
||||
public function getTemplate()
|
||||
{
|
||||
return $this->template;
|
||||
}
|
||||
|
||||
public function setTemplate($template)
|
||||
{
|
||||
$this->template = $template;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
71
core/lib/Thelia/Core/Event/TemplateUpdateEvent.php
Normal file
71
core/lib/Thelia/Core/Event/TemplateUpdateEvent.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?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\Core\Event;
|
||||
|
||||
class TemplateUpdateEvent extends TemplateCreateEvent
|
||||
{
|
||||
protected $template_id;
|
||||
|
||||
protected $feature_list;
|
||||
protected $attribute_list;
|
||||
|
||||
public function __construct($template_id)
|
||||
{
|
||||
$this->setTemplateId($template_id);
|
||||
}
|
||||
|
||||
public function getTemplateId()
|
||||
{
|
||||
return $this->template_id;
|
||||
}
|
||||
|
||||
public function setTemplateId($template_id)
|
||||
{
|
||||
$this->template_id = $template_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFeatureList()
|
||||
{
|
||||
return $this->feature_list;
|
||||
}
|
||||
|
||||
public function setFeatureList($feature_list)
|
||||
{
|
||||
$this->feature_list = $feature_list;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAttributeList()
|
||||
{
|
||||
return $this->attribute_list;
|
||||
}
|
||||
|
||||
public function setAttributeList($attribute_list)
|
||||
{
|
||||
$this->attribute_list = $attribute_list;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -258,36 +258,6 @@ final class TheliaEvents
|
||||
*/
|
||||
const AFTER_UPDATE_COUPON = "action.after_update_coupon";
|
||||
|
||||
/**
|
||||
* Sent when disabling a Coupon
|
||||
*/
|
||||
const COUPON_DISABLE = "action.disable_coupon";
|
||||
|
||||
/**
|
||||
* Sent just before a successful disable of a new Coupon in the database.
|
||||
*/
|
||||
const BEFORE_DISABLE_COUPON = "action.before_disable_coupon";
|
||||
|
||||
/**
|
||||
* Sent just after a successful disable of a new Coupon in the database.
|
||||
*/
|
||||
const AFTER_DISABLE_COUPON = "action.after_disable_coupon";
|
||||
|
||||
/**
|
||||
* Sent when enabling a Coupon
|
||||
*/
|
||||
const COUPON_ENABLE = "action.enable_coupon";
|
||||
|
||||
/**
|
||||
* Sent just before a successful enable of a new Coupon in the database.
|
||||
*/
|
||||
const BEFORE_ENABLE_COUPON = "action.before_enable_coupon";
|
||||
|
||||
/**
|
||||
* Sent just after a successful enable of a new Coupon in the database.
|
||||
*/
|
||||
const AFTER_ENABLE_COUPON = "action.after_enable_coupon";
|
||||
|
||||
/**
|
||||
* Sent when attempting to use a Coupon
|
||||
*/
|
||||
@@ -367,6 +337,22 @@ final class TheliaEvents
|
||||
const BEFORE_DELETECURRENCY = "action.before_deleteCurrency";
|
||||
const AFTER_DELETECURRENCY = "action.after_deleteCurrency";
|
||||
|
||||
const CHANGE_DEFAULT_CURRENCY = 'action.changeDefaultCurrency';
|
||||
// -- Product templates management -----------------------------------------
|
||||
|
||||
const TEMPLATE_CREATE = "action.createTemplate";
|
||||
const TEMPLATE_UPDATE = "action.updateTemplate";
|
||||
const TEMPLATE_DELETE = "action.deleteTemplate";
|
||||
|
||||
const BEFORE_CREATETEMPLATE = "action.before_createTemplate";
|
||||
const AFTER_CREATETEMPLATE = "action.after_createTemplate";
|
||||
|
||||
const BEFORE_UPDATETEMPLATE = "action.before_updateTemplate";
|
||||
const AFTER_UPDATETEMPLATE = "action.after_updateTemplate";
|
||||
|
||||
const BEFORE_DELETETEMPLATE = "action.before_deleteTemplate";
|
||||
const AFTER_DELETETEMPLATE = "action.after_deleteTemplate";
|
||||
|
||||
// -- Attributes management ---------------------------------------------
|
||||
|
||||
const ATTRIBUTE_CREATE = "action.createAttribute";
|
||||
|
||||
@@ -55,4 +55,15 @@ class Request extends BaseRequest
|
||||
|
||||
return $uri . $additionalQs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Session.
|
||||
*
|
||||
* @return \Thelia\Core\HttpFoundation\Session\Session The session
|
||||
* @api
|
||||
*/
|
||||
public function getSession()
|
||||
{
|
||||
return parent::getSession();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,4 +222,29 @@ class Session extends BaseSession
|
||||
{
|
||||
return $this->get("thelia.delivery_id");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set consumed coupons by the Customer
|
||||
*
|
||||
* @param array $couponsCode An array of Coupon code
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setConsumedCoupons(array $couponsCode)
|
||||
{
|
||||
$this->set('thelia.consumed_coupons', $couponsCode);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Customer consumed coupons
|
||||
*
|
||||
* @return array $couponsCode An array of Coupon code
|
||||
*/
|
||||
public function getConsumedCoupons()
|
||||
{
|
||||
return $this->get('thelia.consumed_coupons');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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\Core\Security\Authentication;
|
||||
|
||||
use Thelia\Core\Security\UserProvider\AdminTokenUserProvider;
|
||||
|
||||
class AdminTokenAuthenticator extends TokenAuthenticator
|
||||
{
|
||||
public function __construct($key)
|
||||
{
|
||||
parent::__construct(
|
||||
$key,
|
||||
new AdminTokenUserProvider()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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\Core\Security\Authentication;
|
||||
|
||||
use Thelia\Core\Security\UserProvider\CustomerTokenUserProvider;
|
||||
|
||||
class CustomerTokenAuthenticator extends TokenAuthenticator
|
||||
{
|
||||
public function __construct($key)
|
||||
{
|
||||
parent::__construct(
|
||||
$key,
|
||||
new CustomerTokenUserProvider()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?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\Core\Security\Authentication;
|
||||
|
||||
use Thelia\Core\Security\Authentication\AuthenticatorInterface;
|
||||
use Thelia\Core\Security\UserProvider\UserProviderInterface;
|
||||
use Thelia\Core\Security\UserProvider\TokenUserProvider;
|
||||
use Thelia\Core\Security\Exception\TokenAuthenticationException;
|
||||
|
||||
class TokenAuthenticator implements AuthenticatorInterface
|
||||
{
|
||||
protected $key;
|
||||
|
||||
protected $userProvider;
|
||||
|
||||
public function __construct($key, TokenUserProvider $userProvider)
|
||||
{
|
||||
$this->key = $key;
|
||||
|
||||
$this->userProvider = $userProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \Thelia\Core\Security\Authentication\AuthenticatorInterface::getAuthentifiedUser()
|
||||
*/
|
||||
public function getAuthentifiedUser()
|
||||
{
|
||||
$keyData = $this->userProvider->decodeKey($this->key);
|
||||
|
||||
$user = $this->userProvider->getUser($keyData);
|
||||
|
||||
if ($user === null) throw new TokenAuthenticationException("No user matches the provided token");
|
||||
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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\Core\Security\Exception;
|
||||
|
||||
class TokenAuthenticationException extends \Exception
|
||||
{
|
||||
}
|
||||
55
core/lib/Thelia/Core/Security/Token/CookieTokenProvider.php
Normal file
55
core/lib/Thelia/Core/Security/Token/CookieTokenProvider.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?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\Core\Security\Token;
|
||||
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Core\Security\User\UserInterface;
|
||||
|
||||
class CookieTokenProvider
|
||||
{
|
||||
public function getKeyFromCookie(Request $request, $cookieName)
|
||||
{
|
||||
if ($request->cookies->has($cookieName)) {
|
||||
|
||||
// Create the authenticator
|
||||
return $request->cookies->get($cookieName);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function createCookie(UserInterface $user, $cookieName, $cookieExpires)
|
||||
{
|
||||
$tokenProvider = new TokenProvider();
|
||||
|
||||
$key = $tokenProvider->encodeKey($user);
|
||||
|
||||
setcookie($cookieName, $key, time() + $cookieExpires, '/');
|
||||
}
|
||||
|
||||
public function clearCookie($cookieName)
|
||||
{
|
||||
setcookie($cookieName, '', time() - 3600, '/');
|
||||
}
|
||||
}
|
||||
27
core/lib/Thelia/Core/Security/Token/TokenProvider.php
Normal file
27
core/lib/Thelia/Core/Security/Token/TokenProvider.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Core\Security\Token;
|
||||
|
||||
use Thelia\Core\Security\User\UserInterface;
|
||||
|
||||
class TokenProvider
|
||||
{
|
||||
public function encodeKey(UserInterface $user) {
|
||||
|
||||
// Always set a new token in the user environment
|
||||
$user->setToken(uniqid());
|
||||
|
||||
return base64_encode(serialize(
|
||||
array($user->getUsername(), $user->getToken(), $user->getSerial())));
|
||||
}
|
||||
|
||||
public function decodeKey($key) {
|
||||
$data = unserialize(base64_decode($key));
|
||||
|
||||
return array(
|
||||
'username' => $data[0],
|
||||
'token' => $data[1],
|
||||
'serial' => $data[2]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -48,4 +48,24 @@ interface UserInterface
|
||||
* @return void
|
||||
*/
|
||||
public function eraseCredentials();
|
||||
}
|
||||
|
||||
/**
|
||||
* return the user token (used by remember me authnetication system)
|
||||
*/
|
||||
public function getToken();
|
||||
|
||||
/**
|
||||
* Set a token in the user data (used by remember me authnetication system)
|
||||
*/
|
||||
public function setToken($token);
|
||||
|
||||
/**
|
||||
* return the user serial (used by remember me authnetication system)
|
||||
*/
|
||||
public function getSerial();
|
||||
|
||||
/**
|
||||
* Set a serial number int the user data (used by remember me authnetication system)
|
||||
*/
|
||||
public function setSerial($serial);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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\Core\Security\UserProvider;
|
||||
|
||||
use Thelia\Model\Admin;
|
||||
use Thelia\Model\AdminQuery;
|
||||
|
||||
class AdminTokenUserProvider extends TokenUserProvider
|
||||
{
|
||||
public function getUser($dataArray) {
|
||||
|
||||
return AdminQuery::create()
|
||||
->filterByLogin($dataArray['username'])
|
||||
->filterByRememberMeSerial($dataArray['serial'])
|
||||
->filterByRememberMeToken($dataArray['token'])
|
||||
->findOne();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,26 @@
|
||||
<?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\Core\Security\UserProvider;
|
||||
|
||||
use Thelia\Model\Admin;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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\Core\Security\UserProvider;
|
||||
|
||||
use Thelia\Action\Customer;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
|
||||
class CustomerTokenUserProvider extends TokenUserProvider
|
||||
{
|
||||
public function getUser($dataArray) {
|
||||
|
||||
return CustomerQuery::create()
|
||||
->filterByEmail($dataArray['username'])
|
||||
->filterByRememberMeSerial($dataArray['serial'])
|
||||
->filterByRememberMeToken($dataArray['token'])
|
||||
->findOne();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,26 @@
|
||||
<?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\Core\Security\UserProvider;
|
||||
|
||||
use Thelia\Action\Customer;
|
||||
@@ -13,4 +35,4 @@ class CustomerUserProvider implements UserProviderInterface
|
||||
|
||||
return $customer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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\Core\Security\UserProvider;
|
||||
|
||||
use Thelia\Core\Security\User\UserInterface;
|
||||
use Thelia\Core\Security\Token\TokenProvider;
|
||||
|
||||
abstract class TokenUserProvider extends TokenProvider implements UserProviderInterface
|
||||
{
|
||||
public abstract function getUser($key);
|
||||
}
|
||||
@@ -1,4 +1,25 @@
|
||||
<?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\Core\Security\UserProvider;
|
||||
|
||||
|
||||
@@ -38,6 +38,9 @@ use Thelia\Model\Map\ProductCategoryTableMap;
|
||||
use Thelia\Type\TypeCollection;
|
||||
use Thelia\Type;
|
||||
use Thelia\Type\BooleanOrBothType;
|
||||
use Thelia\Model\ProductQuery;
|
||||
use Thelia\Model\TemplateQuery;
|
||||
use Thelia\Model\AttributeTemplateQuery;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -60,8 +63,7 @@ class Attribute extends BaseI18nLoop
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntListTypeArgument('id'),
|
||||
Argument::createIntListTypeArgument('product'),
|
||||
Argument::createIntListTypeArgument('category'),
|
||||
Argument::createBooleanOrBothTypeArgument('visible', 1),
|
||||
Argument::createIntListTypeArgument('template'),
|
||||
Argument::createIntListTypeArgument('exclude'),
|
||||
new Argument(
|
||||
'order',
|
||||
@@ -101,26 +103,23 @@ class Attribute extends BaseI18nLoop
|
||||
$search->filterById($exclude, Criteria::NOT_IN);
|
||||
}
|
||||
|
||||
$visible = $this->getVisible();
|
||||
|
||||
if ($visible != BooleanOrBothType::ANY) $search->filterByVisible($visible);
|
||||
|
||||
$product = $this->getProduct();
|
||||
$category = $this->getCategory();
|
||||
$template = $this->getTemplate();
|
||||
|
||||
if (null !== $product) {
|
||||
$productCategories = ProductCategoryQuery::create()->select(array(ProductCategoryTableMap::CATEGORY_ID))->filterByProductId($product, Criteria::IN)->find()->getData();
|
||||
// Find the template assigned to the product.
|
||||
$productObj = ProductQuery::create()->findPk($product);
|
||||
|
||||
if (null === $category) {
|
||||
$category = $productCategories;
|
||||
} else {
|
||||
$category = array_merge($category, $productCategories);
|
||||
}
|
||||
}
|
||||
// Ignore if the product cannot be found.
|
||||
if ($productObj !== null)
|
||||
$template = $productObj->getTemplate();
|
||||
}
|
||||
|
||||
if (null !== $category) {
|
||||
$search->filterByCategory(
|
||||
CategoryQuery::create()->filterById($category)->find(),
|
||||
|
||||
// If we have to filter by template, find all attributes assigned to this template, and filter by found IDs
|
||||
if (null !== $template) {
|
||||
$search->filterById(
|
||||
AttributeTemplateQuery::create()->filterByTemplateId($template)->select('id')->find(),
|
||||
Criteria::IN
|
||||
);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
namespace Thelia\Core\Template\Loop;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\Util\PropelModelPager;
|
||||
use Thelia\Constraint\ConstraintFactory;
|
||||
use Thelia\Constraint\Rule\CouponRuleInterface;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
@@ -34,9 +35,11 @@ use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Coupon\Type\CouponInterface;
|
||||
use Thelia\Model\CouponQuery;
|
||||
use Thelia\Model\Coupon as MCoupon;
|
||||
use Thelia\Type;
|
||||
use Thelia\Type\BooleanOrBothType;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
@@ -52,17 +55,22 @@ use Thelia\Type;
|
||||
class Coupon extends BaseI18nLoop
|
||||
{
|
||||
/**
|
||||
* Define all args used in your loop
|
||||
*
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntListTypeArgument('id')
|
||||
Argument::createIntListTypeArgument('id'),
|
||||
Argument::createBooleanOrBothTypeArgument('is_enabled', 1)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $pagination
|
||||
* Execute Loop
|
||||
*
|
||||
* @param PropelModelPager $pagination
|
||||
*
|
||||
* @return \Thelia\Core\Template\Element\LoopResult
|
||||
*/
|
||||
@@ -74,11 +82,16 @@ class Coupon extends BaseI18nLoop
|
||||
$locale = $this->configureI18nProcessing($search, array('TITLE', 'DESCRIPTION', 'SHORT_DESCRIPTION'));
|
||||
|
||||
$id = $this->getId();
|
||||
$isEnabled = $this->getIsEnabled();
|
||||
|
||||
if (null !== $id) {
|
||||
$search->filterById($id, Criteria::IN);
|
||||
}
|
||||
|
||||
if ($isEnabled != BooleanOrBothType::ANY) {
|
||||
$search->filterByIsEnabled($isEnabled ? 1 : 0);
|
||||
}
|
||||
|
||||
// Perform search
|
||||
$coupons = $this->search($search, $pagination);
|
||||
|
||||
@@ -98,9 +111,30 @@ class Coupon extends BaseI18nLoop
|
||||
$coupon->getSerializedRules()
|
||||
);
|
||||
|
||||
/** @var CouponInterface $couponManager */
|
||||
$couponManager = $this->container->get($coupon->getType());
|
||||
$couponManager->set(
|
||||
$this->container->get('thelia.adapter'),
|
||||
$coupon->getCode(),
|
||||
$coupon->getTitle(),
|
||||
$coupon->getShortDescription(),
|
||||
$coupon->getDescription(),
|
||||
$coupon->getAmount(),
|
||||
$coupon->getIsCumulative(),
|
||||
$coupon->getIsRemovingPostage(),
|
||||
$coupon->getIsAvailableOnSpecialOffers(),
|
||||
$coupon->getIsEnabled(),
|
||||
$coupon->getMaxUsage(),
|
||||
$coupon->getExpirationDate()
|
||||
);
|
||||
|
||||
$now = time();
|
||||
$datediff = $coupon->getExpirationDate()->getTimestamp() - $now;
|
||||
$daysLeftBeforeExpiration = floor($datediff/(60*60*24));
|
||||
|
||||
$cleanedRules = array();
|
||||
/** @var CouponRuleInterface $rule */
|
||||
foreach ($rules->getRules() as $key => $rule) {
|
||||
foreach ($rules->getRules() as $rule) {
|
||||
$cleanedRules[] = $rule->getToolTip();
|
||||
}
|
||||
$loopResultRow->set("ID", $coupon->getId())
|
||||
@@ -114,9 +148,13 @@ class Coupon extends BaseI18nLoop
|
||||
->set("USAGE_LEFT", $coupon->getMaxUsage())
|
||||
->set("IS_CUMULATIVE", $coupon->getIsCumulative())
|
||||
->set("IS_REMOVING_POSTAGE", $coupon->getIsRemovingPostage())
|
||||
->set("IS_AVAILABLE_ON_SPECIAL_OFFERS", $coupon->getIsAvailableOnSpecialOffers())
|
||||
->set("IS_ENABLED", $coupon->getIsEnabled())
|
||||
->set("AMOUNT", $coupon->getAmount())
|
||||
->set("APPLICATION_CONDITIONS", $cleanedRules);
|
||||
->set("APPLICATION_CONDITIONS", $cleanedRules)
|
||||
->set("TOOLTIP", $couponManager->getToolTip())
|
||||
->set("DAY_LEFT_BEFORE_EXPIRATION", $daysLeftBeforeExpiration)
|
||||
->set("SERVICE_ID", $couponManager->getServiceId());
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
|
||||
114
core/lib/Thelia/Core/Template/Loop/Template.php
Normal file
114
core/lib/Thelia/Core/Template/Loop/Template.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?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\Core\Template\Loop;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\Base\CategoryQuery;
|
||||
use Thelia\Model\Base\ProductCategoryQuery;
|
||||
use Thelia\Model\Base\TemplateQuery;
|
||||
use Thelia\Model\Map\ProductCategoryTableMap;
|
||||
use Thelia\Type\TypeCollection;
|
||||
use Thelia\Type;
|
||||
use Thelia\Type\BooleanOrBothType;
|
||||
|
||||
/**
|
||||
*
|
||||
* Template loop
|
||||
*
|
||||
*
|
||||
* Class Template
|
||||
* @package Thelia\Core\Template\Loop
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*/
|
||||
class Template extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntListTypeArgument('id'),
|
||||
Argument::createIntListTypeArgument('exclude')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $pagination
|
||||
*
|
||||
* @return \Thelia\Core\Template\Element\LoopResult
|
||||
*/
|
||||
public function exec(&$pagination)
|
||||
{
|
||||
$search = TemplateQuery::create();
|
||||
|
||||
$backendContext = $this->getBackend_context();
|
||||
|
||||
$lang = $this->getLang();
|
||||
|
||||
/* manage translations */
|
||||
$locale = $this->configureI18nProcessing($search, $columns = array('NAME'));
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
if (null !== $id) {
|
||||
$search->filterById($id, Criteria::IN);
|
||||
}
|
||||
|
||||
$exclude = $this->getExclude();
|
||||
|
||||
if (null !== $exclude) {
|
||||
$search->filterById($exclude, Criteria::NOT_IN);
|
||||
}
|
||||
|
||||
/* perform search */
|
||||
$templates = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult($templates);
|
||||
|
||||
foreach ($templates as $template) {
|
||||
$loopResultRow = new LoopResultRow($loopResult, $template, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow
|
||||
->set("ID", $template->getId())
|
||||
->set("IS_TRANSLATED" , $template->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE" , $locale)
|
||||
->set("NAME" , $template->getVirtualColumn('i18n_NAME'))
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
@@ -145,7 +145,7 @@ class Form extends AbstractSmartyPlugin
|
||||
|
||||
public function renderFormField($params, $content, \Smarty_Internal_Template $template, &$repeat)
|
||||
{
|
||||
if ($repeat) {
|
||||
if ($repeat) {
|
||||
|
||||
$formFieldView = $this->getFormFieldView($params);
|
||||
|
||||
@@ -153,25 +153,25 @@ class Form extends AbstractSmartyPlugin
|
||||
|
||||
$value = $formFieldView->vars["value"];
|
||||
/* FIXME: doesnt work. We got "This form should not contain extra fields." error.
|
||||
// We have a collection
|
||||
if (is_array($value)) {
|
||||
// We have a collection
|
||||
if (is_array($value)) {
|
||||
|
||||
$key = $this->getParam($params, 'value_key');
|
||||
$key = $this->getParam($params, 'value_key');
|
||||
|
||||
if ($key != null) {
|
||||
if ($key != null) {
|
||||
|
||||
if (isset($value[$key])) {
|
||||
if (isset($value[$key])) {
|
||||
|
||||
$name = sprintf("%s[%s]", $formFieldView->vars["full_name"], $key);
|
||||
$val = $value[$key];
|
||||
$name = sprintf("%s[%s]", $formFieldView->vars["full_name"], $key);
|
||||
$val = $value[$key];
|
||||
|
||||
$this->assignFieldValues($template, $name, $val, $formFieldView->vars);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->assignFieldValues($template, $formFieldView->vars["full_name"], $fieldVars["value"], $formFieldView->vars);
|
||||
}
|
||||
$this->assignFieldValues($template, $name, $val, $formFieldView->vars);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->assignFieldValues($template, $formFieldView->vars["full_name"], $fieldVars["value"], $formFieldView->vars);
|
||||
}
|
||||
*/
|
||||
$this->assignFieldValues($template, $formFieldView->vars["full_name"], $formFieldView->vars["value"], $formFieldView->vars);
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Session;
|
||||
|
||||
use Thelia\Core\Event\CurrencyEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model;
|
||||
|
||||
/**
|
||||
@@ -146,6 +148,9 @@ class TheliaHttpKernel extends HttpKernel
|
||||
$currency = null;
|
||||
if ($request->query->has("currency")) {
|
||||
$currency = Model\CurrencyQuery::create()->findOneByCode($request->query->get("currency"));
|
||||
if($currency) {
|
||||
$this->container->get("event_dispatcher")->dispatch(TheliaEvents::CHANGE_DEFAULT_CURRENCY, new CurrencyEvent($currency));
|
||||
}
|
||||
} else {
|
||||
$currency = $request->getSession()->getCurrency(false);
|
||||
}
|
||||
@@ -212,7 +217,7 @@ class TheliaHttpKernel extends HttpKernel
|
||||
if (Model\ConfigQuery::read("session_config.default")) {
|
||||
$storage->setSaveHandler(new Session\Storage\Handler\NativeFileSessionHandler(Model\ConfigQuery::read("session_config.save_path", THELIA_ROOT . '/local/session/')));
|
||||
} else {
|
||||
$handlerString = Model\ConfigQuery::read("session_config.handlers");
|
||||
$handlerString = Model\ConfigQuery::read("session_config.handlers", 'Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler');
|
||||
|
||||
$handler = new $handlerString;
|
||||
|
||||
|
||||
@@ -155,4 +155,18 @@ interface CouponAdapterInterface
|
||||
*/
|
||||
public function getMainCurrency();
|
||||
|
||||
/**
|
||||
* Return request
|
||||
*
|
||||
* @return Request
|
||||
*/
|
||||
public function getRequest();
|
||||
|
||||
/**
|
||||
* Return Constraint Validator
|
||||
*
|
||||
* @return ConstraintValidator
|
||||
*/
|
||||
public function getConstraintValidator();
|
||||
|
||||
}
|
||||
@@ -27,9 +27,14 @@ use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Thelia\Constraint\ConstraintValidator;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
use Thelia\Coupon\Type\CouponInterface;
|
||||
use Thelia\Model\Coupon;
|
||||
use Thelia\Model\CouponQuery;
|
||||
use Thelia\Cart\CartTrait;
|
||||
use Thelia\Model\Currency;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
@@ -43,6 +48,10 @@ use Thelia\Model\CouponQuery;
|
||||
*/
|
||||
class CouponBaseAdapter implements CouponAdapterInterface
|
||||
{
|
||||
use CartTrait {
|
||||
CartTrait::getCart as getCartFromTrait;
|
||||
}
|
||||
|
||||
/** @var ContainerInterface Service Container */
|
||||
protected $container = null;
|
||||
|
||||
@@ -66,7 +75,7 @@ class CouponBaseAdapter implements CouponAdapterInterface
|
||||
*/
|
||||
public function getCart()
|
||||
{
|
||||
// TODO: Implement getCart() method.
|
||||
return $this->getCartFromTrait($this->getRequest());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +95,7 @@ class CouponBaseAdapter implements CouponAdapterInterface
|
||||
*/
|
||||
public function getCustomer()
|
||||
{
|
||||
// TODO: Implement getCustomer() method.
|
||||
return $this->container->get('thelia.securityContext')->getCustomerUser();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,11 +131,11 @@ class CouponBaseAdapter implements CouponAdapterInterface
|
||||
/**
|
||||
* Return the Checkout currency EUR|USD
|
||||
*
|
||||
* @return string
|
||||
* @return Currency
|
||||
*/
|
||||
public function getCheckoutCurrency()
|
||||
{
|
||||
// TODO: Implement getCheckoutCurrency() method.
|
||||
$this->getRequest()->getSession()->getCurrency();
|
||||
}
|
||||
|
||||
|
||||
@@ -147,9 +156,14 @@ class CouponBaseAdapter implements CouponAdapterInterface
|
||||
*/
|
||||
public function getCurrentCoupons()
|
||||
{
|
||||
// @todo implement
|
||||
// $consumedCoupons = $this->getRequest()->getSession()->getConsumedCoupons();
|
||||
// @todo convert coupon code to coupon Interface
|
||||
|
||||
|
||||
$couponFactory = $this->container->get('thelia.coupon.factory');
|
||||
|
||||
// @todo Get from Session
|
||||
// @todo get from cart
|
||||
$couponCodes = array('XMAS', 'SPRINGBREAK');
|
||||
|
||||
$coupons = array();
|
||||
@@ -208,7 +222,7 @@ class CouponBaseAdapter implements CouponAdapterInterface
|
||||
*/
|
||||
public function getContainer()
|
||||
{
|
||||
// TODO: Implement getContainer() method.
|
||||
return $this->container;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,4 +246,24 @@ class CouponBaseAdapter implements CouponAdapterInterface
|
||||
{
|
||||
// TODO: Implement getMainCurrency() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Return request
|
||||
*
|
||||
* @return Request
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->container->get('request');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Constraint Validator
|
||||
*
|
||||
* @return ConstraintValidator
|
||||
*/
|
||||
public function getConstraintValidator()
|
||||
{
|
||||
return $this->container->get('thelia.constraint.validator');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,6 +183,7 @@ class CouponManager
|
||||
$discount = 0.00;
|
||||
/** @var CouponInterface $coupon */
|
||||
foreach ($coupons as $coupon) {
|
||||
// @todo modify Cart with discount for each cart item
|
||||
$discount += $coupon->getDiscount($this->adapter);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace Thelia\Coupon\Type;
|
||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||
use Thelia\Constraint\ConstraintManager;
|
||||
use Thelia\Constraint\ConstraintValidator;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Coupon\CouponAdapterInterface;
|
||||
use Thelia\Coupon\CouponRuleCollection;
|
||||
use Thelia\Coupon\RuleOrganizerInterface;
|
||||
@@ -44,9 +45,6 @@ use Thelia\Exception\InvalidRuleException;
|
||||
*/
|
||||
abstract class CouponAbstract implements CouponInterface
|
||||
{
|
||||
/** @var string Service Id */
|
||||
protected $serviceId = null;
|
||||
|
||||
/** @var CouponAdapterInterface Provide necessary value from Thelia */
|
||||
protected $adapter = null;
|
||||
|
||||
@@ -62,9 +60,19 @@ abstract class CouponAbstract implements CouponInterface
|
||||
/** @var ConstraintValidator Constraint validator */
|
||||
protected $constraintValidator = null;
|
||||
|
||||
|
||||
|
||||
/** @var string Service Id */
|
||||
protected $serviceId = null;
|
||||
|
||||
/** @var float Amount that will be removed from the Checkout (Coupon Effect) */
|
||||
protected $amount = 0;
|
||||
|
||||
/** @var string Coupon code (ex: XMAS) */
|
||||
protected $code = null;
|
||||
|
||||
|
||||
|
||||
/** @var string Coupon title (ex: Coupon for XMAS) */
|
||||
protected $title = null;
|
||||
|
||||
@@ -74,6 +82,8 @@ abstract class CouponAbstract implements CouponInterface
|
||||
/** @var string Coupon description */
|
||||
protected $description = null;
|
||||
|
||||
|
||||
|
||||
/** @var bool if Coupon is enabled */
|
||||
protected $isEnabled = false;
|
||||
|
||||
@@ -86,9 +96,6 @@ abstract class CouponAbstract implements CouponInterface
|
||||
/** @var bool if Coupon is removing postage */
|
||||
protected $isRemovingPostage = false;
|
||||
|
||||
/** @var float Amount that will be removed from the Checkout (Coupon Effect) */
|
||||
protected $amount = 0;
|
||||
|
||||
/** @var int Max time a Coupon can be used (-1 = unlimited) */
|
||||
protected $maxUsage = -1;
|
||||
|
||||
@@ -105,6 +112,7 @@ abstract class CouponAbstract implements CouponInterface
|
||||
{
|
||||
$this->adapter = $adapter;
|
||||
$this->translator = $adapter->getTranslator();
|
||||
$this->constraintValidator = $adapter->getConstraintValidator();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,17 +228,6 @@ abstract class CouponAbstract implements CouponInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current Coupon is matching its conditions (Rules)
|
||||
* Thelia variables are given by the CouponAdapterInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isMatching()
|
||||
{
|
||||
return $this->constraintValidator->test($this->rules);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Coupon expiration date
|
||||
*
|
||||
@@ -302,4 +299,16 @@ abstract class CouponAbstract implements CouponInterface
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the current Coupon is matching its conditions (Rules)
|
||||
* Thelia variables are given by the CouponAdapterInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isMatching()
|
||||
{
|
||||
return $this->constraintValidator->isMatching($this->rules);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -39,6 +39,27 @@ use Thelia\Coupon\CouponRuleCollection;
|
||||
*/
|
||||
interface CouponInterface
|
||||
{
|
||||
/**
|
||||
* Get I18n name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName();
|
||||
|
||||
/**
|
||||
* Get I18n tooltip
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getToolTip();
|
||||
|
||||
/**
|
||||
* Get Coupon Manager service Id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getServiceId();
|
||||
|
||||
/**
|
||||
* Set Coupon
|
||||
*
|
||||
@@ -114,18 +135,7 @@ interface CouponInterface
|
||||
*/
|
||||
public function isRemovingPostage();
|
||||
|
||||
/**
|
||||
* Return effects generated by the coupon
|
||||
* A positive value
|
||||
*
|
||||
* Effects could also affect something else than the final Checkout price
|
||||
* CouponAdapter $adapter could be use to directly pass a Session value
|
||||
* some would wish to modify
|
||||
* Hence affecting a wide variety of Thelia elements
|
||||
*
|
||||
* @return float Amount removed from the Total Checkout
|
||||
*/
|
||||
public function getDiscount();
|
||||
|
||||
|
||||
/**
|
||||
* Return condition to validate the Coupon or not
|
||||
@@ -134,14 +144,6 @@ interface CouponInterface
|
||||
*/
|
||||
public function getRules();
|
||||
|
||||
/**
|
||||
* Check if the current Coupon is matching its conditions (Rules)
|
||||
* Thelia variables are given by the CouponAdapterInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isMatching();
|
||||
|
||||
/**
|
||||
* Replace the existing Rules by those given in parameter
|
||||
* If one Rule is badly implemented, no Rule will be added
|
||||
@@ -191,25 +193,26 @@ interface CouponInterface
|
||||
*/
|
||||
public function isExpired();
|
||||
|
||||
/**
|
||||
* Get I18n name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName();
|
||||
|
||||
/**
|
||||
* Get I18n tooltip
|
||||
* Return effects generated by the coupon
|
||||
* A positive value
|
||||
*
|
||||
* @return string
|
||||
* Effects could also affect something else than the final Checkout price
|
||||
* CouponAdapter $adapter could be use to directly pass a Session value
|
||||
* some would wish to modify
|
||||
* Hence affecting a wide variety of Thelia elements
|
||||
*
|
||||
* @return float Amount removed from the Total Checkout
|
||||
*/
|
||||
public function getToolTip();
|
||||
public function getDiscount();
|
||||
|
||||
/**
|
||||
* Get Coupon Manager service Id
|
||||
* Check if the current Coupon is matching its conditions (Rules)
|
||||
* Thelia variables are given by the CouponAdapterInterface
|
||||
*
|
||||
* @return string
|
||||
* @return bool
|
||||
*/
|
||||
public function getServiceId();
|
||||
public function isMatching();
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,11 @@
|
||||
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\Date;
|
||||
use Symfony\Component\Validator\Constraints\DateTime;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Validator\Constraints\NotEqualTo;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
@@ -68,7 +72,6 @@ class CouponCreationForm extends BaseForm
|
||||
'shortDescription',
|
||||
'text',
|
||||
array(
|
||||
'invalid_message' => 'test',
|
||||
'constraints' => array(
|
||||
new NotBlank()
|
||||
)
|
||||
@@ -78,7 +81,6 @@ class CouponCreationForm extends BaseForm
|
||||
'description',
|
||||
'textarea',
|
||||
array(
|
||||
'invalid_message' => 'test',
|
||||
'constraints' => array(
|
||||
new NotBlank()
|
||||
)
|
||||
@@ -88,16 +90,23 @@ class CouponCreationForm extends BaseForm
|
||||
'effect',
|
||||
'text',
|
||||
array(
|
||||
'invalid_message' => 'test',
|
||||
'constraints' => array(
|
||||
new NotBlank()
|
||||
new NotBlank(),
|
||||
new NotEqualTo(
|
||||
array(
|
||||
'value' => -1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
->add(
|
||||
'amount',
|
||||
'money',
|
||||
array()
|
||||
array(
|
||||
'constraints' => array(
|
||||
new NotBlank()
|
||||
))
|
||||
)
|
||||
->add(
|
||||
'isEnabled',
|
||||
@@ -109,7 +118,8 @@ class CouponCreationForm extends BaseForm
|
||||
'text',
|
||||
array(
|
||||
'constraints' => array(
|
||||
new NotBlank()
|
||||
new NotBlank(),
|
||||
new Date()
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -133,7 +143,12 @@ class CouponCreationForm extends BaseForm
|
||||
'text',
|
||||
array(
|
||||
'constraints' => array(
|
||||
new NotBlank()
|
||||
new NotBlank(),
|
||||
new GreaterThanOrEqual(
|
||||
array(
|
||||
'value' => -1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
57
core/lib/Thelia/Form/TemplateCreationForm.php
Normal file
57
core/lib/Thelia/Form/TemplateCreationForm.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?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\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class TemplateCreationForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("name" , "text" , array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Template Name *"),
|
||||
"label_attr" => array(
|
||||
"for" => "name"
|
||||
))
|
||||
)
|
||||
->add("locale" , "text" , array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
))
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "thelia_template_creation";
|
||||
}
|
||||
}
|
||||
67
core/lib/Thelia/Form/TemplateModificationForm.php
Normal file
67
core/lib/Thelia/Form/TemplateModificationForm.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?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\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||
|
||||
class TemplateModificationForm extends TemplateCreationForm
|
||||
{
|
||||
use StandardDescriptionFieldsTrait;
|
||||
|
||||
protected function buildForm()
|
||||
{
|
||||
parent::buildForm();
|
||||
|
||||
$this->formBuilder
|
||||
->add("id", "hidden", array(
|
||||
"constraints" => array(
|
||||
new GreaterThan(
|
||||
array('value' => 0)
|
||||
)
|
||||
)
|
||||
))
|
||||
/*
|
||||
->add('attributes', 'collection', array(
|
||||
'type' => 'text',
|
||||
'options' => array('required' => false)
|
||||
))
|
||||
*/
|
||||
/* FIXME: doesn't work
|
||||
->add('features', 'collection', array(
|
||||
'type' => 'text',
|
||||
'options' => array('required' => false)
|
||||
))
|
||||
*/
|
||||
;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "thelia_template_modification";
|
||||
}
|
||||
}
|
||||
@@ -34,9 +34,10 @@ abstract class BaseInstall
|
||||
*/
|
||||
public function __construct($verifyInstall = true)
|
||||
{
|
||||
/* TODO : activate this part
|
||||
if (file_exists(THELIA_ROOT . '/local/config/database.yml') && $verifyInstall) {
|
||||
throw new AlreadyInstallException("Thelia is already installed");
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
$this->exec();
|
||||
|
||||
@@ -6,6 +6,7 @@ use Thelia\Core\Security\User\UserInterface;
|
||||
use Thelia\Core\Security\Role\Role;
|
||||
|
||||
use Thelia\Model\Base\Admin as BaseAdmin;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'admin' table.
|
||||
@@ -20,6 +21,16 @@ use Thelia\Model\Base\Admin as BaseAdmin;
|
||||
*/
|
||||
class Admin extends BaseAdmin implements UserInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
// Set the serial number (for auto-login)
|
||||
$this->setRememberMeSerial(uniqid());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setPassword($password)
|
||||
{
|
||||
@@ -65,4 +76,32 @@ class Admin extends BaseAdmin implements UserInterface
|
||||
public function getRoles() {
|
||||
return array(new Role('ADMIN'));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getToken() {
|
||||
return $this->getRememberMeToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setToken($token) {
|
||||
$this->setRememberMeToken($token)->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSerial() {
|
||||
return $this->getRememberMeSerial();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setSerial($serial) {
|
||||
$this->setRememberMeSerial($serial)->save();
|
||||
}
|
||||
}
|
||||
|
||||
10
core/lib/Thelia/Model/AttributeTemplate.php
Normal file
10
core/lib/Thelia/Model/AttributeTemplate.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\AttributeTemplate as BaseAttributeTemplate;
|
||||
|
||||
class AttributeTemplate extends BaseAttributeTemplate
|
||||
{
|
||||
|
||||
}
|
||||
21
core/lib/Thelia/Model/AttributeTemplateQuery.php
Normal file
21
core/lib/Thelia/Model/AttributeTemplateQuery.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\AttributeTemplateQuery as BaseAttributeTemplateQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'attribute_template' 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 AttributeTemplateQuery extends BaseAttributeTemplateQuery
|
||||
{
|
||||
|
||||
} // AttributeTemplateQuery
|
||||
@@ -101,6 +101,18 @@ abstract class Admin implements ActiveRecordInterface
|
||||
*/
|
||||
protected $salt;
|
||||
|
||||
/**
|
||||
* The value for the remember_me_token field.
|
||||
* @var string
|
||||
*/
|
||||
protected $remember_me_token;
|
||||
|
||||
/**
|
||||
* The value for the remember_me_serial field.
|
||||
* @var string
|
||||
*/
|
||||
protected $remember_me_serial;
|
||||
|
||||
/**
|
||||
* The value for the created_at field.
|
||||
* @var string
|
||||
@@ -475,6 +487,28 @@ abstract class Admin implements ActiveRecordInterface
|
||||
return $this->salt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [remember_me_token] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRememberMeToken()
|
||||
{
|
||||
|
||||
return $this->remember_me_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [remember_me_serial] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRememberMeSerial()
|
||||
{
|
||||
|
||||
return $this->remember_me_serial;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
@@ -662,6 +696,48 @@ abstract class Admin implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setSalt()
|
||||
|
||||
/**
|
||||
* Set the value of [remember_me_token] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\Admin The current object (for fluent API support)
|
||||
*/
|
||||
public function setRememberMeToken($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->remember_me_token !== $v) {
|
||||
$this->remember_me_token = $v;
|
||||
$this->modifiedColumns[] = AdminTableMap::REMEMBER_ME_TOKEN;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setRememberMeToken()
|
||||
|
||||
/**
|
||||
* Set the value of [remember_me_serial] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\Admin The current object (for fluent API support)
|
||||
*/
|
||||
public function setRememberMeSerial($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->remember_me_serial !== $v) {
|
||||
$this->remember_me_serial = $v;
|
||||
$this->modifiedColumns[] = AdminTableMap::REMEMBER_ME_SERIAL;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setRememberMeSerial()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
@@ -762,13 +838,19 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : AdminTableMap::translateFieldName('Salt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->salt = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : AdminTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : AdminTableMap::translateFieldName('RememberMeToken', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->remember_me_token = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : AdminTableMap::translateFieldName('RememberMeSerial', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->remember_me_serial = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : AdminTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : AdminTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : AdminTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -781,7 +863,7 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 9; // 9 = AdminTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 11; // 11 = AdminTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\Admin object", 0, $e);
|
||||
@@ -1069,6 +1151,12 @@ abstract class Admin implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(AdminTableMap::SALT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'SALT';
|
||||
}
|
||||
if ($this->isColumnModified(AdminTableMap::REMEMBER_ME_TOKEN)) {
|
||||
$modifiedColumns[':p' . $index++] = 'REMEMBER_ME_TOKEN';
|
||||
}
|
||||
if ($this->isColumnModified(AdminTableMap::REMEMBER_ME_SERIAL)) {
|
||||
$modifiedColumns[':p' . $index++] = 'REMEMBER_ME_SERIAL';
|
||||
}
|
||||
if ($this->isColumnModified(AdminTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||
}
|
||||
@@ -1107,6 +1195,12 @@ abstract class Admin implements ActiveRecordInterface
|
||||
case 'SALT':
|
||||
$stmt->bindValue($identifier, $this->salt, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'REMEMBER_ME_TOKEN':
|
||||
$stmt->bindValue($identifier, $this->remember_me_token, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'REMEMBER_ME_SERIAL':
|
||||
$stmt->bindValue($identifier, $this->remember_me_serial, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'CREATED_AT':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1197,9 +1291,15 @@ abstract class Admin implements ActiveRecordInterface
|
||||
return $this->getSalt();
|
||||
break;
|
||||
case 7:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getRememberMeToken();
|
||||
break;
|
||||
case 8:
|
||||
return $this->getRememberMeSerial();
|
||||
break;
|
||||
case 9:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 10:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1238,8 +1338,10 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$keys[4] => $this->getPassword(),
|
||||
$keys[5] => $this->getAlgo(),
|
||||
$keys[6] => $this->getSalt(),
|
||||
$keys[7] => $this->getCreatedAt(),
|
||||
$keys[8] => $this->getUpdatedAt(),
|
||||
$keys[7] => $this->getRememberMeToken(),
|
||||
$keys[8] => $this->getRememberMeSerial(),
|
||||
$keys[9] => $this->getCreatedAt(),
|
||||
$keys[10] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -1307,9 +1409,15 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$this->setSalt($value);
|
||||
break;
|
||||
case 7:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setRememberMeToken($value);
|
||||
break;
|
||||
case 8:
|
||||
$this->setRememberMeSerial($value);
|
||||
break;
|
||||
case 9:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 10:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1343,8 +1451,10 @@ abstract class Admin implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[4], $arr)) $this->setPassword($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setAlgo($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setSalt($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setRememberMeToken($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setRememberMeSerial($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setCreatedAt($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setUpdatedAt($arr[$keys[10]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1363,6 +1473,8 @@ abstract class Admin implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(AdminTableMap::PASSWORD)) $criteria->add(AdminTableMap::PASSWORD, $this->password);
|
||||
if ($this->isColumnModified(AdminTableMap::ALGO)) $criteria->add(AdminTableMap::ALGO, $this->algo);
|
||||
if ($this->isColumnModified(AdminTableMap::SALT)) $criteria->add(AdminTableMap::SALT, $this->salt);
|
||||
if ($this->isColumnModified(AdminTableMap::REMEMBER_ME_TOKEN)) $criteria->add(AdminTableMap::REMEMBER_ME_TOKEN, $this->remember_me_token);
|
||||
if ($this->isColumnModified(AdminTableMap::REMEMBER_ME_SERIAL)) $criteria->add(AdminTableMap::REMEMBER_ME_SERIAL, $this->remember_me_serial);
|
||||
if ($this->isColumnModified(AdminTableMap::CREATED_AT)) $criteria->add(AdminTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(AdminTableMap::UPDATED_AT)) $criteria->add(AdminTableMap::UPDATED_AT, $this->updated_at);
|
||||
|
||||
@@ -1434,6 +1546,8 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$copyObj->setPassword($this->getPassword());
|
||||
$copyObj->setAlgo($this->getAlgo());
|
||||
$copyObj->setSalt($this->getSalt());
|
||||
$copyObj->setRememberMeToken($this->getRememberMeToken());
|
||||
$copyObj->setRememberMeSerial($this->getRememberMeSerial());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
|
||||
@@ -1935,6 +2049,8 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$this->password = null;
|
||||
$this->algo = null;
|
||||
$this->salt = null;
|
||||
$this->remember_me_token = null;
|
||||
$this->remember_me_serial = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
@@ -28,6 +28,8 @@ use Thelia\Model\Map\AdminTableMap;
|
||||
* @method ChildAdminQuery orderByPassword($order = Criteria::ASC) Order by the password column
|
||||
* @method ChildAdminQuery orderByAlgo($order = Criteria::ASC) Order by the algo column
|
||||
* @method ChildAdminQuery orderBySalt($order = Criteria::ASC) Order by the salt column
|
||||
* @method ChildAdminQuery orderByRememberMeToken($order = Criteria::ASC) Order by the remember_me_token column
|
||||
* @method ChildAdminQuery orderByRememberMeSerial($order = Criteria::ASC) Order by the remember_me_serial column
|
||||
* @method ChildAdminQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildAdminQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
@@ -38,6 +40,8 @@ use Thelia\Model\Map\AdminTableMap;
|
||||
* @method ChildAdminQuery groupByPassword() Group by the password column
|
||||
* @method ChildAdminQuery groupByAlgo() Group by the algo column
|
||||
* @method ChildAdminQuery groupBySalt() Group by the salt column
|
||||
* @method ChildAdminQuery groupByRememberMeToken() Group by the remember_me_token column
|
||||
* @method ChildAdminQuery groupByRememberMeSerial() Group by the remember_me_serial column
|
||||
* @method ChildAdminQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildAdminQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
@@ -59,6 +63,8 @@ use Thelia\Model\Map\AdminTableMap;
|
||||
* @method ChildAdmin findOneByPassword(string $password) Return the first ChildAdmin filtered by the password column
|
||||
* @method ChildAdmin findOneByAlgo(string $algo) Return the first ChildAdmin filtered by the algo column
|
||||
* @method ChildAdmin findOneBySalt(string $salt) Return the first ChildAdmin filtered by the salt column
|
||||
* @method ChildAdmin findOneByRememberMeToken(string $remember_me_token) Return the first ChildAdmin filtered by the remember_me_token column
|
||||
* @method ChildAdmin findOneByRememberMeSerial(string $remember_me_serial) Return the first ChildAdmin filtered by the remember_me_serial column
|
||||
* @method ChildAdmin findOneByCreatedAt(string $created_at) Return the first ChildAdmin filtered by the created_at column
|
||||
* @method ChildAdmin findOneByUpdatedAt(string $updated_at) Return the first ChildAdmin filtered by the updated_at column
|
||||
*
|
||||
@@ -69,6 +75,8 @@ use Thelia\Model\Map\AdminTableMap;
|
||||
* @method array findByPassword(string $password) Return ChildAdmin objects filtered by the password column
|
||||
* @method array findByAlgo(string $algo) Return ChildAdmin objects filtered by the algo column
|
||||
* @method array findBySalt(string $salt) Return ChildAdmin objects filtered by the salt column
|
||||
* @method array findByRememberMeToken(string $remember_me_token) Return ChildAdmin objects filtered by the remember_me_token column
|
||||
* @method array findByRememberMeSerial(string $remember_me_serial) Return ChildAdmin objects filtered by the remember_me_serial column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildAdmin objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildAdmin objects filtered by the updated_at column
|
||||
*
|
||||
@@ -159,7 +167,7 @@ abstract class AdminQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, FIRSTNAME, LASTNAME, LOGIN, PASSWORD, ALGO, SALT, CREATED_AT, UPDATED_AT FROM admin WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, FIRSTNAME, LASTNAME, LOGIN, PASSWORD, ALGO, SALT, REMEMBER_ME_TOKEN, REMEMBER_ME_SERIAL, CREATED_AT, UPDATED_AT FROM admin WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -463,6 +471,64 @@ abstract class AdminQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(AdminTableMap::SALT, $salt, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the remember_me_token column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByRememberMeToken('fooValue'); // WHERE remember_me_token = 'fooValue'
|
||||
* $query->filterByRememberMeToken('%fooValue%'); // WHERE remember_me_token LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $rememberMeToken The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAdminQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByRememberMeToken($rememberMeToken = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($rememberMeToken)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $rememberMeToken)) {
|
||||
$rememberMeToken = str_replace('*', '%', $rememberMeToken);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AdminTableMap::REMEMBER_ME_TOKEN, $rememberMeToken, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the remember_me_serial column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByRememberMeSerial('fooValue'); // WHERE remember_me_serial = 'fooValue'
|
||||
* $query->filterByRememberMeSerial('%fooValue%'); // WHERE remember_me_serial LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $rememberMeSerial The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAdminQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByRememberMeSerial($rememberMeSerial = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($rememberMeSerial)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $rememberMeSerial)) {
|
||||
$rememberMeSerial = str_replace('*', '%', $rememberMeSerial);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AdminTableMap::REMEMBER_ME_SERIAL, $rememberMeSerial, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
|
||||
@@ -20,15 +20,15 @@ use Propel\Runtime\Util\PropelDateTime;
|
||||
use Thelia\Model\Attribute as ChildAttribute;
|
||||
use Thelia\Model\AttributeAv as ChildAttributeAv;
|
||||
use Thelia\Model\AttributeAvQuery as ChildAttributeAvQuery;
|
||||
use Thelia\Model\AttributeCategory as ChildAttributeCategory;
|
||||
use Thelia\Model\AttributeCategoryQuery as ChildAttributeCategoryQuery;
|
||||
use Thelia\Model\AttributeCombination as ChildAttributeCombination;
|
||||
use Thelia\Model\AttributeCombinationQuery as ChildAttributeCombinationQuery;
|
||||
use Thelia\Model\AttributeI18n as ChildAttributeI18n;
|
||||
use Thelia\Model\AttributeI18nQuery as ChildAttributeI18nQuery;
|
||||
use Thelia\Model\AttributeQuery as ChildAttributeQuery;
|
||||
use Thelia\Model\Category as ChildCategory;
|
||||
use Thelia\Model\CategoryQuery as ChildCategoryQuery;
|
||||
use Thelia\Model\AttributeTemplate as ChildAttributeTemplate;
|
||||
use Thelia\Model\AttributeTemplateQuery as ChildAttributeTemplateQuery;
|
||||
use Thelia\Model\Template as ChildTemplate;
|
||||
use Thelia\Model\TemplateQuery as ChildTemplateQuery;
|
||||
use Thelia\Model\Map\AttributeTableMap;
|
||||
|
||||
abstract class Attribute implements ActiveRecordInterface
|
||||
@@ -102,10 +102,10 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
protected $collAttributeCombinationsPartial;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildAttributeCategory[] Collection to store aggregation of ChildAttributeCategory objects.
|
||||
* @var ObjectCollection|ChildAttributeTemplate[] Collection to store aggregation of ChildAttributeTemplate objects.
|
||||
*/
|
||||
protected $collAttributeCategories;
|
||||
protected $collAttributeCategoriesPartial;
|
||||
protected $collAttributeTemplates;
|
||||
protected $collAttributeTemplatesPartial;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildAttributeI18n[] Collection to store aggregation of ChildAttributeI18n objects.
|
||||
@@ -114,9 +114,9 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
protected $collAttributeI18nsPartial;
|
||||
|
||||
/**
|
||||
* @var ChildCategory[] Collection to store aggregation of ChildCategory objects.
|
||||
* @var ChildTemplate[] Collection to store aggregation of ChildTemplate objects.
|
||||
*/
|
||||
protected $collCategories;
|
||||
protected $collTemplates;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
@@ -144,7 +144,7 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $categoriesScheduledForDeletion = null;
|
||||
protected $templatesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
@@ -162,7 +162,7 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $attributeCategoriesScheduledForDeletion = null;
|
||||
protected $attributeTemplatesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
@@ -697,11 +697,11 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
|
||||
$this->collAttributeCombinations = null;
|
||||
|
||||
$this->collAttributeCategories = null;
|
||||
$this->collAttributeTemplates = null;
|
||||
|
||||
$this->collAttributeI18ns = null;
|
||||
|
||||
$this->collCategories = null;
|
||||
$this->collTemplates = null;
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -835,29 +835,29 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->categoriesScheduledForDeletion !== null) {
|
||||
if (!$this->categoriesScheduledForDeletion->isEmpty()) {
|
||||
if ($this->templatesScheduledForDeletion !== null) {
|
||||
if (!$this->templatesScheduledForDeletion->isEmpty()) {
|
||||
$pks = array();
|
||||
$pk = $this->getPrimaryKey();
|
||||
foreach ($this->categoriesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
|
||||
$pks[] = array($remotePk, $pk);
|
||||
foreach ($this->templatesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
|
||||
$pks[] = array($pk, $remotePk);
|
||||
}
|
||||
|
||||
AttributeCategoryQuery::create()
|
||||
AttributeTemplateQuery::create()
|
||||
->filterByPrimaryKeys($pks)
|
||||
->delete($con);
|
||||
$this->categoriesScheduledForDeletion = null;
|
||||
$this->templatesScheduledForDeletion = null;
|
||||
}
|
||||
|
||||
foreach ($this->getCategories() as $category) {
|
||||
if ($category->isModified()) {
|
||||
$category->save($con);
|
||||
foreach ($this->getTemplates() as $template) {
|
||||
if ($template->isModified()) {
|
||||
$template->save($con);
|
||||
}
|
||||
}
|
||||
} elseif ($this->collCategories) {
|
||||
foreach ($this->collCategories as $category) {
|
||||
if ($category->isModified()) {
|
||||
$category->save($con);
|
||||
} elseif ($this->collTemplates) {
|
||||
foreach ($this->collTemplates as $template) {
|
||||
if ($template->isModified()) {
|
||||
$template->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -896,17 +896,17 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->attributeCategoriesScheduledForDeletion !== null) {
|
||||
if (!$this->attributeCategoriesScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\AttributeCategoryQuery::create()
|
||||
->filterByPrimaryKeys($this->attributeCategoriesScheduledForDeletion->getPrimaryKeys(false))
|
||||
if ($this->attributeTemplatesScheduledForDeletion !== null) {
|
||||
if (!$this->attributeTemplatesScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\AttributeTemplateQuery::create()
|
||||
->filterByPrimaryKeys($this->attributeTemplatesScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->attributeCategoriesScheduledForDeletion = null;
|
||||
$this->attributeTemplatesScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collAttributeCategories !== null) {
|
||||
foreach ($this->collAttributeCategories as $referrerFK) {
|
||||
if ($this->collAttributeTemplates !== null) {
|
||||
foreach ($this->collAttributeTemplates as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
@@ -1112,8 +1112,8 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
if (null !== $this->collAttributeCombinations) {
|
||||
$result['AttributeCombinations'] = $this->collAttributeCombinations->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->collAttributeCategories) {
|
||||
$result['AttributeCategories'] = $this->collAttributeCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
if (null !== $this->collAttributeTemplates) {
|
||||
$result['AttributeTemplates'] = $this->collAttributeTemplates->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->collAttributeI18ns) {
|
||||
$result['AttributeI18ns'] = $this->collAttributeI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
@@ -1291,9 +1291,9 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->getAttributeCategories() as $relObj) {
|
||||
foreach ($this->getAttributeTemplates() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addAttributeCategory($relObj->copy($deepCopy));
|
||||
$copyObj->addAttributeTemplate($relObj->copy($deepCopy));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1350,8 +1350,8 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
if ('AttributeCombination' == $relationName) {
|
||||
return $this->initAttributeCombinations();
|
||||
}
|
||||
if ('AttributeCategory' == $relationName) {
|
||||
return $this->initAttributeCategories();
|
||||
if ('AttributeTemplate' == $relationName) {
|
||||
return $this->initAttributeTemplates();
|
||||
}
|
||||
if ('AttributeI18n' == $relationName) {
|
||||
return $this->initAttributeI18ns();
|
||||
@@ -1848,31 +1848,31 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collAttributeCategories collection
|
||||
* Clears out the collAttributeTemplates collection
|
||||
*
|
||||
* This does not modify the database; however, it will remove any associated objects, causing
|
||||
* them to be refetched by subsequent calls to accessor method.
|
||||
*
|
||||
* @return void
|
||||
* @see addAttributeCategories()
|
||||
* @see addAttributeTemplates()
|
||||
*/
|
||||
public function clearAttributeCategories()
|
||||
public function clearAttributeTemplates()
|
||||
{
|
||||
$this->collAttributeCategories = null; // important to set this to NULL since that means it is uninitialized
|
||||
$this->collAttributeTemplates = null; // important to set this to NULL since that means it is uninitialized
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset is the collAttributeCategories collection loaded partially.
|
||||
* Reset is the collAttributeTemplates collection loaded partially.
|
||||
*/
|
||||
public function resetPartialAttributeCategories($v = true)
|
||||
public function resetPartialAttributeTemplates($v = true)
|
||||
{
|
||||
$this->collAttributeCategoriesPartial = $v;
|
||||
$this->collAttributeTemplatesPartial = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collAttributeCategories collection.
|
||||
* Initializes the collAttributeTemplates collection.
|
||||
*
|
||||
* By default this just sets the collAttributeCategories collection to an empty array (like clearcollAttributeCategories());
|
||||
* By default this just sets the collAttributeTemplates collection to an empty array (like clearcollAttributeTemplates());
|
||||
* however, you may wish to override this method in your stub class to provide setting appropriate
|
||||
* to your application -- for example, setting the initial array to the values stored in database.
|
||||
*
|
||||
@@ -1881,17 +1881,17 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initAttributeCategories($overrideExisting = true)
|
||||
public function initAttributeTemplates($overrideExisting = true)
|
||||
{
|
||||
if (null !== $this->collAttributeCategories && !$overrideExisting) {
|
||||
if (null !== $this->collAttributeTemplates && !$overrideExisting) {
|
||||
return;
|
||||
}
|
||||
$this->collAttributeCategories = new ObjectCollection();
|
||||
$this->collAttributeCategories->setModel('\Thelia\Model\AttributeCategory');
|
||||
$this->collAttributeTemplates = new ObjectCollection();
|
||||
$this->collAttributeTemplates->setModel('\Thelia\Model\AttributeTemplate');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of ChildAttributeCategory objects which contain a foreign key that references this object.
|
||||
* Gets an array of ChildAttributeTemplate objects which contain a foreign key that references this object.
|
||||
*
|
||||
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||
* Otherwise the results are fetched from the database the first time, then cached.
|
||||
@@ -1901,109 +1901,109 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @return Collection|ChildAttributeCategory[] List of ChildAttributeCategory objects
|
||||
* @return Collection|ChildAttributeTemplate[] List of ChildAttributeTemplate objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAttributeCategories($criteria = null, ConnectionInterface $con = null)
|
||||
public function getAttributeTemplates($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collAttributeCategoriesPartial && !$this->isNew();
|
||||
if (null === $this->collAttributeCategories || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAttributeCategories) {
|
||||
$partial = $this->collAttributeTemplatesPartial && !$this->isNew();
|
||||
if (null === $this->collAttributeTemplates || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAttributeTemplates) {
|
||||
// return empty collection
|
||||
$this->initAttributeCategories();
|
||||
$this->initAttributeTemplates();
|
||||
} else {
|
||||
$collAttributeCategories = ChildAttributeCategoryQuery::create(null, $criteria)
|
||||
$collAttributeTemplates = ChildAttributeTemplateQuery::create(null, $criteria)
|
||||
->filterByAttribute($this)
|
||||
->find($con);
|
||||
|
||||
if (null !== $criteria) {
|
||||
if (false !== $this->collAttributeCategoriesPartial && count($collAttributeCategories)) {
|
||||
$this->initAttributeCategories(false);
|
||||
if (false !== $this->collAttributeTemplatesPartial && count($collAttributeTemplates)) {
|
||||
$this->initAttributeTemplates(false);
|
||||
|
||||
foreach ($collAttributeCategories as $obj) {
|
||||
if (false == $this->collAttributeCategories->contains($obj)) {
|
||||
$this->collAttributeCategories->append($obj);
|
||||
foreach ($collAttributeTemplates as $obj) {
|
||||
if (false == $this->collAttributeTemplates->contains($obj)) {
|
||||
$this->collAttributeTemplates->append($obj);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collAttributeCategoriesPartial = true;
|
||||
$this->collAttributeTemplatesPartial = true;
|
||||
}
|
||||
|
||||
$collAttributeCategories->getInternalIterator()->rewind();
|
||||
$collAttributeTemplates->getInternalIterator()->rewind();
|
||||
|
||||
return $collAttributeCategories;
|
||||
return $collAttributeTemplates;
|
||||
}
|
||||
|
||||
if ($partial && $this->collAttributeCategories) {
|
||||
foreach ($this->collAttributeCategories as $obj) {
|
||||
if ($partial && $this->collAttributeTemplates) {
|
||||
foreach ($this->collAttributeTemplates as $obj) {
|
||||
if ($obj->isNew()) {
|
||||
$collAttributeCategories[] = $obj;
|
||||
$collAttributeTemplates[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->collAttributeCategories = $collAttributeCategories;
|
||||
$this->collAttributeCategoriesPartial = false;
|
||||
$this->collAttributeTemplates = $collAttributeTemplates;
|
||||
$this->collAttributeTemplatesPartial = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collAttributeCategories;
|
||||
return $this->collAttributeTemplates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of AttributeCategory objects related by a one-to-many relationship
|
||||
* Sets a collection of AttributeTemplate objects related by a one-to-many relationship
|
||||
* to the current object.
|
||||
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
|
||||
* and new objects from the given Propel collection.
|
||||
*
|
||||
* @param Collection $attributeCategories A Propel collection.
|
||||
* @param Collection $attributeTemplates A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildAttribute The current object (for fluent API support)
|
||||
*/
|
||||
public function setAttributeCategories(Collection $attributeCategories, ConnectionInterface $con = null)
|
||||
public function setAttributeTemplates(Collection $attributeTemplates, ConnectionInterface $con = null)
|
||||
{
|
||||
$attributeCategoriesToDelete = $this->getAttributeCategories(new Criteria(), $con)->diff($attributeCategories);
|
||||
$attributeTemplatesToDelete = $this->getAttributeTemplates(new Criteria(), $con)->diff($attributeTemplates);
|
||||
|
||||
|
||||
$this->attributeCategoriesScheduledForDeletion = $attributeCategoriesToDelete;
|
||||
$this->attributeTemplatesScheduledForDeletion = $attributeTemplatesToDelete;
|
||||
|
||||
foreach ($attributeCategoriesToDelete as $attributeCategoryRemoved) {
|
||||
$attributeCategoryRemoved->setAttribute(null);
|
||||
foreach ($attributeTemplatesToDelete as $attributeTemplateRemoved) {
|
||||
$attributeTemplateRemoved->setAttribute(null);
|
||||
}
|
||||
|
||||
$this->collAttributeCategories = null;
|
||||
foreach ($attributeCategories as $attributeCategory) {
|
||||
$this->addAttributeCategory($attributeCategory);
|
||||
$this->collAttributeTemplates = null;
|
||||
foreach ($attributeTemplates as $attributeTemplate) {
|
||||
$this->addAttributeTemplate($attributeTemplate);
|
||||
}
|
||||
|
||||
$this->collAttributeCategories = $attributeCategories;
|
||||
$this->collAttributeCategoriesPartial = false;
|
||||
$this->collAttributeTemplates = $attributeTemplates;
|
||||
$this->collAttributeTemplatesPartial = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related AttributeCategory objects.
|
||||
* Returns the number of related AttributeTemplate objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param ConnectionInterface $con
|
||||
* @return int Count of related AttributeCategory objects.
|
||||
* @return int Count of related AttributeTemplate objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countAttributeCategories(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
public function countAttributeTemplates(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collAttributeCategoriesPartial && !$this->isNew();
|
||||
if (null === $this->collAttributeCategories || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAttributeCategories) {
|
||||
$partial = $this->collAttributeTemplatesPartial && !$this->isNew();
|
||||
if (null === $this->collAttributeTemplates || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAttributeTemplates) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($partial && !$criteria) {
|
||||
return count($this->getAttributeCategories());
|
||||
return count($this->getAttributeTemplates());
|
||||
}
|
||||
|
||||
$query = ChildAttributeCategoryQuery::create(null, $criteria);
|
||||
$query = ChildAttributeTemplateQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
@@ -2013,53 +2013,53 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
->count($con);
|
||||
}
|
||||
|
||||
return count($this->collAttributeCategories);
|
||||
return count($this->collAttributeTemplates);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called to associate a ChildAttributeCategory object to this object
|
||||
* through the ChildAttributeCategory foreign key attribute.
|
||||
* Method called to associate a ChildAttributeTemplate object to this object
|
||||
* through the ChildAttributeTemplate foreign key attribute.
|
||||
*
|
||||
* @param ChildAttributeCategory $l ChildAttributeCategory
|
||||
* @param ChildAttributeTemplate $l ChildAttributeTemplate
|
||||
* @return \Thelia\Model\Attribute The current object (for fluent API support)
|
||||
*/
|
||||
public function addAttributeCategory(ChildAttributeCategory $l)
|
||||
public function addAttributeTemplate(ChildAttributeTemplate $l)
|
||||
{
|
||||
if ($this->collAttributeCategories === null) {
|
||||
$this->initAttributeCategories();
|
||||
$this->collAttributeCategoriesPartial = true;
|
||||
if ($this->collAttributeTemplates === null) {
|
||||
$this->initAttributeTemplates();
|
||||
$this->collAttributeTemplatesPartial = true;
|
||||
}
|
||||
|
||||
if (!in_array($l, $this->collAttributeCategories->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddAttributeCategory($l);
|
||||
if (!in_array($l, $this->collAttributeTemplates->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddAttributeTemplate($l);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AttributeCategory $attributeCategory The attributeCategory object to add.
|
||||
* @param AttributeTemplate $attributeTemplate The attributeTemplate object to add.
|
||||
*/
|
||||
protected function doAddAttributeCategory($attributeCategory)
|
||||
protected function doAddAttributeTemplate($attributeTemplate)
|
||||
{
|
||||
$this->collAttributeCategories[]= $attributeCategory;
|
||||
$attributeCategory->setAttribute($this);
|
||||
$this->collAttributeTemplates[]= $attributeTemplate;
|
||||
$attributeTemplate->setAttribute($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AttributeCategory $attributeCategory The attributeCategory object to remove.
|
||||
* @param AttributeTemplate $attributeTemplate The attributeTemplate object to remove.
|
||||
* @return ChildAttribute The current object (for fluent API support)
|
||||
*/
|
||||
public function removeAttributeCategory($attributeCategory)
|
||||
public function removeAttributeTemplate($attributeTemplate)
|
||||
{
|
||||
if ($this->getAttributeCategories()->contains($attributeCategory)) {
|
||||
$this->collAttributeCategories->remove($this->collAttributeCategories->search($attributeCategory));
|
||||
if (null === $this->attributeCategoriesScheduledForDeletion) {
|
||||
$this->attributeCategoriesScheduledForDeletion = clone $this->collAttributeCategories;
|
||||
$this->attributeCategoriesScheduledForDeletion->clear();
|
||||
if ($this->getAttributeTemplates()->contains($attributeTemplate)) {
|
||||
$this->collAttributeTemplates->remove($this->collAttributeTemplates->search($attributeTemplate));
|
||||
if (null === $this->attributeTemplatesScheduledForDeletion) {
|
||||
$this->attributeTemplatesScheduledForDeletion = clone $this->collAttributeTemplates;
|
||||
$this->attributeTemplatesScheduledForDeletion->clear();
|
||||
}
|
||||
$this->attributeCategoriesScheduledForDeletion[]= clone $attributeCategory;
|
||||
$attributeCategory->setAttribute(null);
|
||||
$this->attributeTemplatesScheduledForDeletion[]= clone $attributeTemplate;
|
||||
$attributeTemplate->setAttribute(null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -2071,7 +2071,7 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this Attribute is new, it will return
|
||||
* an empty collection; or if this Attribute has previously
|
||||
* been saved, it will retrieve related AttributeCategories from storage.
|
||||
* been saved, it will retrieve related AttributeTemplates from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
@@ -2080,14 +2080,14 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return Collection|ChildAttributeCategory[] List of ChildAttributeCategory objects
|
||||
* @return Collection|ChildAttributeTemplate[] List of ChildAttributeTemplate objects
|
||||
*/
|
||||
public function getAttributeCategoriesJoinCategory($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
public function getAttributeTemplatesJoinTemplate($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = ChildAttributeCategoryQuery::create(null, $criteria);
|
||||
$query->joinWith('Category', $joinBehavior);
|
||||
$query = ChildAttributeTemplateQuery::create(null, $criteria);
|
||||
$query->joinWith('Template', $joinBehavior);
|
||||
|
||||
return $this->getAttributeCategories($query, $con);
|
||||
return $this->getAttributeTemplates($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2316,38 +2316,38 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collCategories collection
|
||||
* Clears out the collTemplates collection
|
||||
*
|
||||
* This does not modify the database; however, it will remove any associated objects, causing
|
||||
* them to be refetched by subsequent calls to accessor method.
|
||||
*
|
||||
* @return void
|
||||
* @see addCategories()
|
||||
* @see addTemplates()
|
||||
*/
|
||||
public function clearCategories()
|
||||
public function clearTemplates()
|
||||
{
|
||||
$this->collCategories = null; // important to set this to NULL since that means it is uninitialized
|
||||
$this->collCategoriesPartial = null;
|
||||
$this->collTemplates = null; // important to set this to NULL since that means it is uninitialized
|
||||
$this->collTemplatesPartial = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collCategories collection.
|
||||
* Initializes the collTemplates collection.
|
||||
*
|
||||
* By default this just sets the collCategories collection to an empty collection (like clearCategories());
|
||||
* By default this just sets the collTemplates collection to an empty collection (like clearTemplates());
|
||||
* however, you may wish to override this method in your stub class to provide setting appropriate
|
||||
* to your application -- for example, setting the initial array to the values stored in database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initCategories()
|
||||
public function initTemplates()
|
||||
{
|
||||
$this->collCategories = new ObjectCollection();
|
||||
$this->collCategories->setModel('\Thelia\Model\Category');
|
||||
$this->collTemplates = new ObjectCollection();
|
||||
$this->collTemplates->setModel('\Thelia\Model\Template');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a collection of ChildCategory objects related by a many-to-many relationship
|
||||
* to the current object by way of the attribute_category cross-reference table.
|
||||
* Gets a collection of ChildTemplate objects related by a many-to-many relationship
|
||||
* to the current object by way of the attribute_template cross-reference table.
|
||||
*
|
||||
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||
* Otherwise the results are fetched from the database the first time, then cached.
|
||||
@@ -2358,73 +2358,73 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return ObjectCollection|ChildCategory[] List of ChildCategory objects
|
||||
* @return ObjectCollection|ChildTemplate[] List of ChildTemplate objects
|
||||
*/
|
||||
public function getCategories($criteria = null, ConnectionInterface $con = null)
|
||||
public function getTemplates($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collCategories || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collCategories) {
|
||||
if (null === $this->collTemplates || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collTemplates) {
|
||||
// return empty collection
|
||||
$this->initCategories();
|
||||
$this->initTemplates();
|
||||
} else {
|
||||
$collCategories = ChildCategoryQuery::create(null, $criteria)
|
||||
$collTemplates = ChildTemplateQuery::create(null, $criteria)
|
||||
->filterByAttribute($this)
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
return $collCategories;
|
||||
return $collTemplates;
|
||||
}
|
||||
$this->collCategories = $collCategories;
|
||||
$this->collTemplates = $collTemplates;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collCategories;
|
||||
return $this->collTemplates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of Category objects related by a many-to-many relationship
|
||||
* to the current object by way of the attribute_category cross-reference table.
|
||||
* Sets a collection of Template objects related by a many-to-many relationship
|
||||
* to the current object by way of the attribute_template cross-reference table.
|
||||
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
|
||||
* and new objects from the given Propel collection.
|
||||
*
|
||||
* @param Collection $categories A Propel collection.
|
||||
* @param Collection $templates A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildAttribute The current object (for fluent API support)
|
||||
*/
|
||||
public function setCategories(Collection $categories, ConnectionInterface $con = null)
|
||||
public function setTemplates(Collection $templates, ConnectionInterface $con = null)
|
||||
{
|
||||
$this->clearCategories();
|
||||
$currentCategories = $this->getCategories();
|
||||
$this->clearTemplates();
|
||||
$currentTemplates = $this->getTemplates();
|
||||
|
||||
$this->categoriesScheduledForDeletion = $currentCategories->diff($categories);
|
||||
$this->templatesScheduledForDeletion = $currentTemplates->diff($templates);
|
||||
|
||||
foreach ($categories as $category) {
|
||||
if (!$currentCategories->contains($category)) {
|
||||
$this->doAddCategory($category);
|
||||
foreach ($templates as $template) {
|
||||
if (!$currentTemplates->contains($template)) {
|
||||
$this->doAddTemplate($template);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collCategories = $categories;
|
||||
$this->collTemplates = $templates;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of ChildCategory objects related by a many-to-many relationship
|
||||
* to the current object by way of the attribute_category cross-reference table.
|
||||
* Gets the number of ChildTemplate objects related by a many-to-many relationship
|
||||
* to the current object by way of the attribute_template cross-reference table.
|
||||
*
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param boolean $distinct Set to true to force count distinct
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return int the number of related ChildCategory objects
|
||||
* @return int the number of related ChildTemplate objects
|
||||
*/
|
||||
public function countCategories($criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
public function countTemplates($criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collCategories || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collCategories) {
|
||||
if (null === $this->collTemplates || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collTemplates) {
|
||||
return 0;
|
||||
} else {
|
||||
$query = ChildCategoryQuery::create(null, $criteria);
|
||||
$query = ChildTemplateQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
@@ -2434,65 +2434,65 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
->count($con);
|
||||
}
|
||||
} else {
|
||||
return count($this->collCategories);
|
||||
return count($this->collTemplates);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate a ChildCategory object to this object
|
||||
* through the attribute_category cross reference table.
|
||||
* Associate a ChildTemplate object to this object
|
||||
* through the attribute_template cross reference table.
|
||||
*
|
||||
* @param ChildCategory $category The ChildAttributeCategory object to relate
|
||||
* @param ChildTemplate $template The ChildAttributeTemplate object to relate
|
||||
* @return ChildAttribute The current object (for fluent API support)
|
||||
*/
|
||||
public function addCategory(ChildCategory $category)
|
||||
public function addTemplate(ChildTemplate $template)
|
||||
{
|
||||
if ($this->collCategories === null) {
|
||||
$this->initCategories();
|
||||
if ($this->collTemplates === null) {
|
||||
$this->initTemplates();
|
||||
}
|
||||
|
||||
if (!$this->collCategories->contains($category)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddCategory($category);
|
||||
$this->collCategories[] = $category;
|
||||
if (!$this->collTemplates->contains($template)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddTemplate($template);
|
||||
$this->collTemplates[] = $template;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Category $category The category object to add.
|
||||
* @param Template $template The template object to add.
|
||||
*/
|
||||
protected function doAddCategory($category)
|
||||
protected function doAddTemplate($template)
|
||||
{
|
||||
$attributeCategory = new ChildAttributeCategory();
|
||||
$attributeCategory->setCategory($category);
|
||||
$this->addAttributeCategory($attributeCategory);
|
||||
$attributeTemplate = new ChildAttributeTemplate();
|
||||
$attributeTemplate->setTemplate($template);
|
||||
$this->addAttributeTemplate($attributeTemplate);
|
||||
// set the back reference to this object directly as using provided method either results
|
||||
// in endless loop or in multiple relations
|
||||
if (!$category->getAttributes()->contains($this)) {
|
||||
$foreignCollection = $category->getAttributes();
|
||||
if (!$template->getAttributes()->contains($this)) {
|
||||
$foreignCollection = $template->getAttributes();
|
||||
$foreignCollection[] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a ChildCategory object to this object
|
||||
* through the attribute_category cross reference table.
|
||||
* Remove a ChildTemplate object to this object
|
||||
* through the attribute_template cross reference table.
|
||||
*
|
||||
* @param ChildCategory $category The ChildAttributeCategory object to relate
|
||||
* @param ChildTemplate $template The ChildAttributeTemplate object to relate
|
||||
* @return ChildAttribute The current object (for fluent API support)
|
||||
*/
|
||||
public function removeCategory(ChildCategory $category)
|
||||
public function removeTemplate(ChildTemplate $template)
|
||||
{
|
||||
if ($this->getCategories()->contains($category)) {
|
||||
$this->collCategories->remove($this->collCategories->search($category));
|
||||
if ($this->getTemplates()->contains($template)) {
|
||||
$this->collTemplates->remove($this->collTemplates->search($template));
|
||||
|
||||
if (null === $this->categoriesScheduledForDeletion) {
|
||||
$this->categoriesScheduledForDeletion = clone $this->collCategories;
|
||||
$this->categoriesScheduledForDeletion->clear();
|
||||
if (null === $this->templatesScheduledForDeletion) {
|
||||
$this->templatesScheduledForDeletion = clone $this->collTemplates;
|
||||
$this->templatesScheduledForDeletion->clear();
|
||||
}
|
||||
|
||||
$this->categoriesScheduledForDeletion[] = $category;
|
||||
$this->templatesScheduledForDeletion[] = $template;
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -2536,8 +2536,8 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collAttributeCategories) {
|
||||
foreach ($this->collAttributeCategories as $o) {
|
||||
if ($this->collAttributeTemplates) {
|
||||
foreach ($this->collAttributeTemplates as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
@@ -2546,8 +2546,8 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collCategories) {
|
||||
foreach ($this->collCategories as $o) {
|
||||
if ($this->collTemplates) {
|
||||
foreach ($this->collTemplates as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
@@ -2565,18 +2565,18 @@ abstract class Attribute implements ActiveRecordInterface
|
||||
$this->collAttributeCombinations->clearIterator();
|
||||
}
|
||||
$this->collAttributeCombinations = null;
|
||||
if ($this->collAttributeCategories instanceof Collection) {
|
||||
$this->collAttributeCategories->clearIterator();
|
||||
if ($this->collAttributeTemplates instanceof Collection) {
|
||||
$this->collAttributeTemplates->clearIterator();
|
||||
}
|
||||
$this->collAttributeCategories = null;
|
||||
$this->collAttributeTemplates = null;
|
||||
if ($this->collAttributeI18ns instanceof Collection) {
|
||||
$this->collAttributeI18ns->clearIterator();
|
||||
}
|
||||
$this->collAttributeI18ns = null;
|
||||
if ($this->collCategories instanceof Collection) {
|
||||
$this->collCategories->clearIterator();
|
||||
if ($this->collTemplates instanceof Collection) {
|
||||
$this->collTemplates->clearIterator();
|
||||
}
|
||||
$this->collCategories = null;
|
||||
$this->collTemplates = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,9 +44,9 @@ use Thelia\Model\Map\AttributeTableMap;
|
||||
* @method ChildAttributeQuery rightJoinAttributeCombination($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCombination relation
|
||||
* @method ChildAttributeQuery innerJoinAttributeCombination($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCombination relation
|
||||
*
|
||||
* @method ChildAttributeQuery leftJoinAttributeCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeCategory relation
|
||||
* @method ChildAttributeQuery rightJoinAttributeCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCategory relation
|
||||
* @method ChildAttributeQuery innerJoinAttributeCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCategory relation
|
||||
* @method ChildAttributeQuery leftJoinAttributeTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeTemplate relation
|
||||
* @method ChildAttributeQuery rightJoinAttributeTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeTemplate relation
|
||||
* @method ChildAttributeQuery innerJoinAttributeTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeTemplate relation
|
||||
*
|
||||
* @method ChildAttributeQuery leftJoinAttributeI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeI18n relation
|
||||
* @method ChildAttributeQuery rightJoinAttributeI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeI18n relation
|
||||
@@ -556,40 +556,40 @@ abstract class AttributeQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\AttributeCategory object
|
||||
* Filter the query by a related \Thelia\Model\AttributeTemplate object
|
||||
*
|
||||
* @param \Thelia\Model\AttributeCategory|ObjectCollection $attributeCategory the related object to use as filter
|
||||
* @param \Thelia\Model\AttributeTemplate|ObjectCollection $attributeTemplate the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAttributeQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAttributeCategory($attributeCategory, $comparison = null)
|
||||
public function filterByAttributeTemplate($attributeTemplate, $comparison = null)
|
||||
{
|
||||
if ($attributeCategory instanceof \Thelia\Model\AttributeCategory) {
|
||||
if ($attributeTemplate instanceof \Thelia\Model\AttributeTemplate) {
|
||||
return $this
|
||||
->addUsingAlias(AttributeTableMap::ID, $attributeCategory->getAttributeId(), $comparison);
|
||||
} elseif ($attributeCategory instanceof ObjectCollection) {
|
||||
->addUsingAlias(AttributeTableMap::ID, $attributeTemplate->getAttributeId(), $comparison);
|
||||
} elseif ($attributeTemplate instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useAttributeCategoryQuery()
|
||||
->filterByPrimaryKeys($attributeCategory->getPrimaryKeys())
|
||||
->useAttributeTemplateQuery()
|
||||
->filterByPrimaryKeys($attributeTemplate->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByAttributeCategory() only accepts arguments of type \Thelia\Model\AttributeCategory or Collection');
|
||||
throw new PropelException('filterByAttributeTemplate() only accepts arguments of type \Thelia\Model\AttributeTemplate or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the AttributeCategory relation
|
||||
* Adds a JOIN clause to the query using the AttributeTemplate relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildAttributeQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinAttributeCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinAttributeTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('AttributeCategory');
|
||||
$relationMap = $tableMap->getRelation('AttributeTemplate');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
@@ -604,14 +604,14 @@ abstract class AttributeQuery extends ModelCriteria
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'AttributeCategory');
|
||||
$this->addJoinObject($join, 'AttributeTemplate');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the AttributeCategory relation AttributeCategory object
|
||||
* Use the AttributeTemplate relation AttributeTemplate object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
@@ -619,13 +619,13 @@ abstract class AttributeQuery extends ModelCriteria
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\AttributeCategoryQuery A secondary query class using the current class as primary query
|
||||
* @return \Thelia\Model\AttributeTemplateQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAttributeCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useAttributeTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinAttributeCategory($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'AttributeCategory', '\Thelia\Model\AttributeCategoryQuery');
|
||||
->joinAttributeTemplate($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'AttributeTemplate', '\Thelia\Model\AttributeTemplateQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -702,19 +702,19 @@ abstract class AttributeQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Category object
|
||||
* using the attribute_category table as cross reference
|
||||
* Filter the query by a related Template object
|
||||
* using the attribute_template table as cross reference
|
||||
*
|
||||
* @param Category $category the related object to use as filter
|
||||
* @param Template $template the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAttributeQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCategory($category, $comparison = Criteria::EQUAL)
|
||||
public function filterByTemplate($template, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useAttributeCategoryQuery()
|
||||
->filterByCategory($category, $comparison)
|
||||
->useAttributeTemplateQuery()
|
||||
->filterByTemplate($template, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
|
||||
1495
core/lib/Thelia/Model/Base/AttributeTemplate.php
Normal file
1495
core/lib/Thelia/Model/Base/AttributeTemplate.php
Normal file
File diff suppressed because it is too large
Load Diff
759
core/lib/Thelia/Model/Base/AttributeTemplateQuery.php
Normal file
759
core/lib/Thelia/Model/Base/AttributeTemplateQuery.php
Normal file
@@ -0,0 +1,759 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelJoin;
|
||||
use Propel\Runtime\Collection\Collection;
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Thelia\Model\AttributeTemplate as ChildAttributeTemplate;
|
||||
use Thelia\Model\AttributeTemplateQuery as ChildAttributeTemplateQuery;
|
||||
use Thelia\Model\Map\AttributeTemplateTableMap;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'attribute_template' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildAttributeTemplateQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildAttributeTemplateQuery orderByAttributeId($order = Criteria::ASC) Order by the attribute_id column
|
||||
* @method ChildAttributeTemplateQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column
|
||||
* @method ChildAttributeTemplateQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildAttributeTemplateQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
* @method ChildAttributeTemplateQuery groupById() Group by the id column
|
||||
* @method ChildAttributeTemplateQuery groupByAttributeId() Group by the attribute_id column
|
||||
* @method ChildAttributeTemplateQuery groupByTemplateId() Group by the template_id column
|
||||
* @method ChildAttributeTemplateQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildAttributeTemplateQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
* @method ChildAttributeTemplateQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildAttributeTemplateQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildAttributeTemplateQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildAttributeTemplateQuery leftJoinAttribute($relationAlias = null) Adds a LEFT JOIN clause to the query using the Attribute relation
|
||||
* @method ChildAttributeTemplateQuery rightJoinAttribute($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Attribute relation
|
||||
* @method ChildAttributeTemplateQuery innerJoinAttribute($relationAlias = null) Adds a INNER JOIN clause to the query using the Attribute relation
|
||||
*
|
||||
* @method ChildAttributeTemplateQuery leftJoinTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the Template relation
|
||||
* @method ChildAttributeTemplateQuery rightJoinTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Template relation
|
||||
* @method ChildAttributeTemplateQuery innerJoinTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the Template relation
|
||||
*
|
||||
* @method ChildAttributeTemplate findOne(ConnectionInterface $con = null) Return the first ChildAttributeTemplate matching the query
|
||||
* @method ChildAttributeTemplate findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAttributeTemplate matching the query, or a new ChildAttributeTemplate object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildAttributeTemplate findOneById(int $id) Return the first ChildAttributeTemplate filtered by the id column
|
||||
* @method ChildAttributeTemplate findOneByAttributeId(int $attribute_id) Return the first ChildAttributeTemplate filtered by the attribute_id column
|
||||
* @method ChildAttributeTemplate findOneByTemplateId(int $template_id) Return the first ChildAttributeTemplate filtered by the template_id column
|
||||
* @method ChildAttributeTemplate findOneByCreatedAt(string $created_at) Return the first ChildAttributeTemplate filtered by the created_at column
|
||||
* @method ChildAttributeTemplate findOneByUpdatedAt(string $updated_at) Return the first ChildAttributeTemplate filtered by the updated_at column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildAttributeTemplate objects filtered by the id column
|
||||
* @method array findByAttributeId(int $attribute_id) Return ChildAttributeTemplate objects filtered by the attribute_id column
|
||||
* @method array findByTemplateId(int $template_id) Return ChildAttributeTemplate objects filtered by the template_id column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildAttributeTemplate objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildAttributeTemplate objects filtered by the updated_at column
|
||||
*
|
||||
*/
|
||||
abstract class AttributeTemplateQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \Thelia\Model\Base\AttributeTemplateQuery object.
|
||||
*
|
||||
* @param string $dbName The database name
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\AttributeTemplate', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildAttributeTemplateQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \Thelia\Model\AttributeTemplateQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \Thelia\Model\AttributeTemplateQuery();
|
||||
if (null !== $modelAlias) {
|
||||
$query->setModelAlias($modelAlias);
|
||||
}
|
||||
if ($criteria instanceof Criteria) {
|
||||
$query->mergeWith($criteria);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
* Propel uses the instance pool to skip the database if the object exists.
|
||||
* Go fast if the query is untouched.
|
||||
*
|
||||
* <code>
|
||||
* $obj = $c->findPk(12, $con);
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ChildAttributeTemplate|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = AttributeTemplateTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(AttributeTemplateTableMap::DATABASE_NAME);
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|
||||
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|
||||
|| $this->map || $this->having || $this->joins) {
|
||||
return $this->findPkComplex($key, $con);
|
||||
} else {
|
||||
return $this->findPkSimple($key, $con);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key using raw SQL to go fast.
|
||||
* Bypass doSelect() and the object formatter by using generated code.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildAttributeTemplate A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, ATTRIBUTE_ID, TEMPLATE_ID, CREATED_AT, UPDATED_AT FROM attribute_template WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
} catch (Exception $e) {
|
||||
Propel::log($e->getMessage(), Propel::LOG_ERR);
|
||||
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
|
||||
}
|
||||
$obj = null;
|
||||
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
|
||||
$obj = new ChildAttributeTemplate();
|
||||
$obj->hydrate($row);
|
||||
AttributeTemplateTableMap::addInstanceToPool($obj, (string) $key);
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildAttributeTemplate|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
protected function findPkComplex($key, $con)
|
||||
{
|
||||
// As the query uses a PK condition, no limit(1) is necessary.
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKey($key)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find objects by primary key
|
||||
* <code>
|
||||
* $objs = $c->findPks(array(12, 56, 832), $con);
|
||||
* </code>
|
||||
* @param array $keys Primary keys to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
|
||||
*/
|
||||
public function findPks($keys, $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKeys($keys)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by primary key
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(AttributeTemplateTableMap::ID, $key, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a list of primary keys
|
||||
*
|
||||
* @param array $keys The list of primary key to use for the query
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(AttributeTemplateTableMap::ID, $keys, Criteria::IN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterById(1234); // WHERE id = 1234
|
||||
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
|
||||
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $id The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterById($id = null, $comparison = null)
|
||||
{
|
||||
if (is_array($id)) {
|
||||
$useMinMax = false;
|
||||
if (isset($id['min'])) {
|
||||
$this->addUsingAlias(AttributeTemplateTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(AttributeTemplateTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AttributeTemplateTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the attribute_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByAttributeId(1234); // WHERE attribute_id = 1234
|
||||
* $query->filterByAttributeId(array(12, 34)); // WHERE attribute_id IN (12, 34)
|
||||
* $query->filterByAttributeId(array('min' => 12)); // WHERE attribute_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByAttribute()
|
||||
*
|
||||
* @param mixed $attributeId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAttributeId($attributeId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($attributeId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($attributeId['min'])) {
|
||||
$this->addUsingAlias(AttributeTemplateTableMap::ATTRIBUTE_ID, $attributeId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($attributeId['max'])) {
|
||||
$this->addUsingAlias(AttributeTemplateTableMap::ATTRIBUTE_ID, $attributeId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AttributeTemplateTableMap::ATTRIBUTE_ID, $attributeId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the template_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByTemplateId(1234); // WHERE template_id = 1234
|
||||
* $query->filterByTemplateId(array(12, 34)); // WHERE template_id IN (12, 34)
|
||||
* $query->filterByTemplateId(array('min' => 12)); // WHERE template_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByTemplate()
|
||||
*
|
||||
* @param mixed $templateId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByTemplateId($templateId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($templateId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($templateId['min'])) {
|
||||
$this->addUsingAlias(AttributeTemplateTableMap::TEMPLATE_ID, $templateId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($templateId['max'])) {
|
||||
$this->addUsingAlias(AttributeTemplateTableMap::TEMPLATE_ID, $templateId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AttributeTemplateTableMap::TEMPLATE_ID, $templateId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
|
||||
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
|
||||
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $createdAt The value to use as filter.
|
||||
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||
* Empty strings are treated as NULL.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCreatedAt($createdAt = null, $comparison = null)
|
||||
{
|
||||
if (is_array($createdAt)) {
|
||||
$useMinMax = false;
|
||||
if (isset($createdAt['min'])) {
|
||||
$this->addUsingAlias(AttributeTemplateTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($createdAt['max'])) {
|
||||
$this->addUsingAlias(AttributeTemplateTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AttributeTemplateTableMap::CREATED_AT, $createdAt, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the updated_at column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
|
||||
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
|
||||
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $updatedAt The value to use as filter.
|
||||
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||
* Empty strings are treated as NULL.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
|
||||
{
|
||||
if (is_array($updatedAt)) {
|
||||
$useMinMax = false;
|
||||
if (isset($updatedAt['min'])) {
|
||||
$this->addUsingAlias(AttributeTemplateTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($updatedAt['max'])) {
|
||||
$this->addUsingAlias(AttributeTemplateTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AttributeTemplateTableMap::UPDATED_AT, $updatedAt, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Attribute object
|
||||
*
|
||||
* @param \Thelia\Model\Attribute|ObjectCollection $attribute The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAttribute($attribute, $comparison = null)
|
||||
{
|
||||
if ($attribute instanceof \Thelia\Model\Attribute) {
|
||||
return $this
|
||||
->addUsingAlias(AttributeTemplateTableMap::ATTRIBUTE_ID, $attribute->getId(), $comparison);
|
||||
} elseif ($attribute instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(AttributeTemplateTableMap::ATTRIBUTE_ID, $attribute->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByAttribute() only accepts arguments of type \Thelia\Model\Attribute or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Attribute relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinAttribute($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Attribute');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Attribute');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Attribute relation Attribute object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\AttributeQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAttributeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinAttribute($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Attribute', '\Thelia\Model\AttributeQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Template object
|
||||
*
|
||||
* @param \Thelia\Model\Template|ObjectCollection $template The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByTemplate($template, $comparison = null)
|
||||
{
|
||||
if ($template instanceof \Thelia\Model\Template) {
|
||||
return $this
|
||||
->addUsingAlias(AttributeTemplateTableMap::TEMPLATE_ID, $template->getId(), $comparison);
|
||||
} elseif ($template instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(AttributeTemplateTableMap::TEMPLATE_ID, $template->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByTemplate() only accepts arguments of type \Thelia\Model\Template or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Template relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Template');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Template');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Template relation Template object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\TemplateQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinTemplate($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Template', '\Thelia\Model\TemplateQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildAttributeTemplate $attributeTemplate Object to remove from the list of results
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($attributeTemplate = null)
|
||||
{
|
||||
if ($attributeTemplate) {
|
||||
$this->addUsingAlias(AttributeTemplateTableMap::ID, $attributeTemplate->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the attribute_template table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(AttributeTemplateTableMap::DATABASE_NAME);
|
||||
}
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
$affectedRows += parent::doDeleteAll($con);
|
||||
// Because this db requires some delete cascade/set null emulation, we have to
|
||||
// clear the cached instance *after* the emulation has happened (since
|
||||
// instances get re-added by the select statement contained therein).
|
||||
AttributeTemplateTableMap::clearInstancePool();
|
||||
AttributeTemplateTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildAttributeTemplate or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildAttributeTemplate object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public function delete(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(AttributeTemplateTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AttributeTemplateTableMap::DATABASE_NAME);
|
||||
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
|
||||
|
||||
AttributeTemplateTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
AttributeTemplateTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
// timestampable behavior
|
||||
|
||||
/**
|
||||
* Filter by the latest updated
|
||||
*
|
||||
* @param int $nbDays Maximum age of the latest update in days
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function recentlyUpdated($nbDays = 7)
|
||||
{
|
||||
return $this->addUsingAlias(AttributeTemplateTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter by the latest created
|
||||
*
|
||||
* @param int $nbDays Maximum age of in days
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function recentlyCreated($nbDays = 7)
|
||||
{
|
||||
return $this->addUsingAlias(AttributeTemplateTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by update date desc
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function lastUpdatedFirst()
|
||||
{
|
||||
return $this->addDescendingOrderByColumn(AttributeTemplateTableMap::UPDATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by update date asc
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function firstUpdatedFirst()
|
||||
{
|
||||
return $this->addAscendingOrderByColumn(AttributeTemplateTableMap::UPDATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by create date desc
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function lastCreatedFirst()
|
||||
{
|
||||
return $this->addDescendingOrderByColumn(AttributeTemplateTableMap::CREATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by create date asc
|
||||
*
|
||||
* @return ChildAttributeTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function firstCreatedFirst()
|
||||
{
|
||||
return $this->addAscendingOrderByColumn(AttributeTemplateTableMap::CREATED_AT);
|
||||
}
|
||||
|
||||
} // AttributeTemplateQuery
|
||||
@@ -116,6 +116,12 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
*/
|
||||
protected $discount;
|
||||
|
||||
/**
|
||||
* The value for the promo field.
|
||||
* @var int
|
||||
*/
|
||||
protected $promo;
|
||||
|
||||
/**
|
||||
* The value for the created_at field.
|
||||
* @var string
|
||||
@@ -527,6 +533,17 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
return $this->discount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [promo] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPromo()
|
||||
{
|
||||
|
||||
return $this->promo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
@@ -768,6 +785,27 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setDiscount()
|
||||
|
||||
/**
|
||||
* Set the value of [promo] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return \Thelia\Model\CartItem The current object (for fluent API support)
|
||||
*/
|
||||
public function setPromo($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->promo !== $v) {
|
||||
$this->promo = $v;
|
||||
$this->modifiedColumns[] = CartItemTableMap::PROMO;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setPromo()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
@@ -885,13 +923,16 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CartItemTableMap::translateFieldName('Discount', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->discount = (null !== $col) ? (double) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CartItemTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CartItemTableMap::translateFieldName('Promo', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->promo = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CartItemTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CartItemTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CartItemTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -904,7 +945,7 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 11; // 11 = CartItemTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 12; // 12 = CartItemTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\CartItem object", 0, $e);
|
||||
@@ -1189,6 +1230,9 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CartItemTableMap::DISCOUNT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'DISCOUNT';
|
||||
}
|
||||
if ($this->isColumnModified(CartItemTableMap::PROMO)) {
|
||||
$modifiedColumns[':p' . $index++] = 'PROMO';
|
||||
}
|
||||
if ($this->isColumnModified(CartItemTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||
}
|
||||
@@ -1233,6 +1277,9 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
case 'DISCOUNT':
|
||||
$stmt->bindValue($identifier, $this->discount, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'PROMO':
|
||||
$stmt->bindValue($identifier, $this->promo, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'CREATED_AT':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1329,9 +1376,12 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
return $this->getDiscount();
|
||||
break;
|
||||
case 9:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getPromo();
|
||||
break;
|
||||
case 10:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 11:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1372,8 +1422,9 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
$keys[6] => $this->getPromoPrice(),
|
||||
$keys[7] => $this->getPriceEndOfLife(),
|
||||
$keys[8] => $this->getDiscount(),
|
||||
$keys[9] => $this->getCreatedAt(),
|
||||
$keys[10] => $this->getUpdatedAt(),
|
||||
$keys[9] => $this->getPromo(),
|
||||
$keys[10] => $this->getCreatedAt(),
|
||||
$keys[11] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -1453,9 +1504,12 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
$this->setDiscount($value);
|
||||
break;
|
||||
case 9:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setPromo($value);
|
||||
break;
|
||||
case 10:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 11:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1491,8 +1545,9 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[6], $arr)) $this->setPromoPrice($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setPriceEndOfLife($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setDiscount($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setCreatedAt($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setUpdatedAt($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setPromo($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setCreatedAt($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[11], $arr)) $this->setUpdatedAt($arr[$keys[11]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1513,6 +1568,7 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CartItemTableMap::PROMO_PRICE)) $criteria->add(CartItemTableMap::PROMO_PRICE, $this->promo_price);
|
||||
if ($this->isColumnModified(CartItemTableMap::PRICE_END_OF_LIFE)) $criteria->add(CartItemTableMap::PRICE_END_OF_LIFE, $this->price_end_of_life);
|
||||
if ($this->isColumnModified(CartItemTableMap::DISCOUNT)) $criteria->add(CartItemTableMap::DISCOUNT, $this->discount);
|
||||
if ($this->isColumnModified(CartItemTableMap::PROMO)) $criteria->add(CartItemTableMap::PROMO, $this->promo);
|
||||
if ($this->isColumnModified(CartItemTableMap::CREATED_AT)) $criteria->add(CartItemTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(CartItemTableMap::UPDATED_AT)) $criteria->add(CartItemTableMap::UPDATED_AT, $this->updated_at);
|
||||
|
||||
@@ -1586,6 +1642,7 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
$copyObj->setPromoPrice($this->getPromoPrice());
|
||||
$copyObj->setPriceEndOfLife($this->getPriceEndOfLife());
|
||||
$copyObj->setDiscount($this->getDiscount());
|
||||
$copyObj->setPromo($this->getPromo());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
if ($makeNew) {
|
||||
@@ -1783,6 +1840,7 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
$this->promo_price = null;
|
||||
$this->price_end_of_life = null;
|
||||
$this->discount = null;
|
||||
$this->promo = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
@@ -30,6 +30,7 @@ use Thelia\Model\Map\CartItemTableMap;
|
||||
* @method ChildCartItemQuery orderByPromoPrice($order = Criteria::ASC) Order by the promo_price column
|
||||
* @method ChildCartItemQuery orderByPriceEndOfLife($order = Criteria::ASC) Order by the price_end_of_life column
|
||||
* @method ChildCartItemQuery orderByDiscount($order = Criteria::ASC) Order by the discount column
|
||||
* @method ChildCartItemQuery orderByPromo($order = Criteria::ASC) Order by the promo column
|
||||
* @method ChildCartItemQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildCartItemQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
@@ -42,6 +43,7 @@ use Thelia\Model\Map\CartItemTableMap;
|
||||
* @method ChildCartItemQuery groupByPromoPrice() Group by the promo_price column
|
||||
* @method ChildCartItemQuery groupByPriceEndOfLife() Group by the price_end_of_life column
|
||||
* @method ChildCartItemQuery groupByDiscount() Group by the discount column
|
||||
* @method ChildCartItemQuery groupByPromo() Group by the promo column
|
||||
* @method ChildCartItemQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildCartItemQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
@@ -73,6 +75,7 @@ use Thelia\Model\Map\CartItemTableMap;
|
||||
* @method ChildCartItem findOneByPromoPrice(double $promo_price) Return the first ChildCartItem filtered by the promo_price column
|
||||
* @method ChildCartItem findOneByPriceEndOfLife(string $price_end_of_life) Return the first ChildCartItem filtered by the price_end_of_life column
|
||||
* @method ChildCartItem findOneByDiscount(double $discount) Return the first ChildCartItem filtered by the discount column
|
||||
* @method ChildCartItem findOneByPromo(int $promo) Return the first ChildCartItem filtered by the promo column
|
||||
* @method ChildCartItem findOneByCreatedAt(string $created_at) Return the first ChildCartItem filtered by the created_at column
|
||||
* @method ChildCartItem findOneByUpdatedAt(string $updated_at) Return the first ChildCartItem filtered by the updated_at column
|
||||
*
|
||||
@@ -85,6 +88,7 @@ use Thelia\Model\Map\CartItemTableMap;
|
||||
* @method array findByPromoPrice(double $promo_price) Return ChildCartItem objects filtered by the promo_price column
|
||||
* @method array findByPriceEndOfLife(string $price_end_of_life) Return ChildCartItem objects filtered by the price_end_of_life column
|
||||
* @method array findByDiscount(double $discount) Return ChildCartItem objects filtered by the discount column
|
||||
* @method array findByPromo(int $promo) Return ChildCartItem objects filtered by the promo column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildCartItem objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildCartItem objects filtered by the updated_at column
|
||||
*
|
||||
@@ -175,7 +179,7 @@ abstract class CartItemQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, CART_ID, PRODUCT_ID, QUANTITY, PRODUCT_SALE_ELEMENTS_ID, PRICE, PROMO_PRICE, PRICE_END_OF_LIFE, DISCOUNT, CREATED_AT, UPDATED_AT FROM cart_item WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, CART_ID, PRODUCT_ID, QUANTITY, PRODUCT_SALE_ELEMENTS_ID, PRICE, PROMO_PRICE, PRICE_END_OF_LIFE, DISCOUNT, PROMO, CREATED_AT, UPDATED_AT FROM cart_item WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -641,6 +645,47 @@ abstract class CartItemQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(CartItemTableMap::DISCOUNT, $discount, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the promo column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByPromo(1234); // WHERE promo = 1234
|
||||
* $query->filterByPromo(array(12, 34)); // WHERE promo IN (12, 34)
|
||||
* $query->filterByPromo(array('min' => 12)); // WHERE promo > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $promo 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 ChildCartItemQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPromo($promo = null, $comparison = null)
|
||||
{
|
||||
if (is_array($promo)) {
|
||||
$useMinMax = false;
|
||||
if (isset($promo['min'])) {
|
||||
$this->addUsingAlias(CartItemTableMap::PROMO, $promo['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($promo['max'])) {
|
||||
$this->addUsingAlias(CartItemTableMap::PROMO, $promo['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CartItemTableMap::PROMO, $promo, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -50,14 +50,6 @@ use Thelia\Model\Map\CategoryTableMap;
|
||||
* @method ChildCategoryQuery rightJoinProductCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductCategory relation
|
||||
* @method ChildCategoryQuery innerJoinProductCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductCategory relation
|
||||
*
|
||||
* @method ChildCategoryQuery leftJoinFeatureCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureCategory relation
|
||||
* @method ChildCategoryQuery rightJoinFeatureCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureCategory relation
|
||||
* @method ChildCategoryQuery innerJoinFeatureCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureCategory relation
|
||||
*
|
||||
* @method ChildCategoryQuery leftJoinAttributeCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeCategory relation
|
||||
* @method ChildCategoryQuery rightJoinAttributeCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCategory relation
|
||||
* @method ChildCategoryQuery innerJoinAttributeCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCategory relation
|
||||
*
|
||||
* @method ChildCategoryQuery leftJoinCategoryImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryImage relation
|
||||
* @method ChildCategoryQuery rightJoinCategoryImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryImage relation
|
||||
* @method ChildCategoryQuery innerJoinCategoryImage($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryImage relation
|
||||
@@ -720,152 +712,6 @@ abstract class CategoryQuery extends ModelCriteria
|
||||
->useQuery($relationAlias ? $relationAlias : 'ProductCategory', '\Thelia\Model\ProductCategoryQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\FeatureCategory object
|
||||
*
|
||||
* @param \Thelia\Model\FeatureCategory|ObjectCollection $featureCategory the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCategoryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByFeatureCategory($featureCategory, $comparison = null)
|
||||
{
|
||||
if ($featureCategory instanceof \Thelia\Model\FeatureCategory) {
|
||||
return $this
|
||||
->addUsingAlias(CategoryTableMap::ID, $featureCategory->getCategoryId(), $comparison);
|
||||
} elseif ($featureCategory instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useFeatureCategoryQuery()
|
||||
->filterByPrimaryKeys($featureCategory->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByFeatureCategory() only accepts arguments of type \Thelia\Model\FeatureCategory or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the FeatureCategory relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCategoryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinFeatureCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('FeatureCategory');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'FeatureCategory');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the FeatureCategory relation FeatureCategory object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\FeatureCategoryQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useFeatureCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinFeatureCategory($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'FeatureCategory', '\Thelia\Model\FeatureCategoryQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\AttributeCategory object
|
||||
*
|
||||
* @param \Thelia\Model\AttributeCategory|ObjectCollection $attributeCategory the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCategoryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAttributeCategory($attributeCategory, $comparison = null)
|
||||
{
|
||||
if ($attributeCategory instanceof \Thelia\Model\AttributeCategory) {
|
||||
return $this
|
||||
->addUsingAlias(CategoryTableMap::ID, $attributeCategory->getCategoryId(), $comparison);
|
||||
} elseif ($attributeCategory instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useAttributeCategoryQuery()
|
||||
->filterByPrimaryKeys($attributeCategory->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByAttributeCategory() only accepts arguments of type \Thelia\Model\AttributeCategory or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the AttributeCategory relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCategoryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinAttributeCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('AttributeCategory');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'AttributeCategory');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the AttributeCategory relation AttributeCategory object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\AttributeCategoryQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAttributeCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinAttributeCategory($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'AttributeCategory', '\Thelia\Model\AttributeCategoryQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\CategoryImage object
|
||||
*
|
||||
@@ -1248,40 +1094,6 @@ abstract class CategoryQuery extends ModelCriteria
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Feature object
|
||||
* using the feature_category table as cross reference
|
||||
*
|
||||
* @param Feature $feature the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCategoryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByFeature($feature, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useFeatureCategoryQuery()
|
||||
->filterByFeature($feature, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Attribute object
|
||||
* using the attribute_category table as cross reference
|
||||
*
|
||||
* @param Attribute $attribute the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCategoryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAttribute($attribute, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useAttributeCategoryQuery()
|
||||
->filterByAttribute($attribute, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
|
||||
@@ -135,6 +135,18 @@ abstract class Customer implements ActiveRecordInterface
|
||||
*/
|
||||
protected $discount;
|
||||
|
||||
/**
|
||||
* The value for the remember_me_token field.
|
||||
* @var string
|
||||
*/
|
||||
protected $remember_me_token;
|
||||
|
||||
/**
|
||||
* The value for the remember_me_serial field.
|
||||
* @var string
|
||||
*/
|
||||
protected $remember_me_serial;
|
||||
|
||||
/**
|
||||
* The value for the created_at field.
|
||||
* @var string
|
||||
@@ -582,6 +594,28 @@ abstract class Customer implements ActiveRecordInterface
|
||||
return $this->discount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [remember_me_token] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRememberMeToken()
|
||||
{
|
||||
|
||||
return $this->remember_me_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [remember_me_serial] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRememberMeSerial()
|
||||
{
|
||||
|
||||
return $this->remember_me_serial;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
@@ -878,6 +912,48 @@ abstract class Customer implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setDiscount()
|
||||
|
||||
/**
|
||||
* Set the value of [remember_me_token] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\Customer The current object (for fluent API support)
|
||||
*/
|
||||
public function setRememberMeToken($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->remember_me_token !== $v) {
|
||||
$this->remember_me_token = $v;
|
||||
$this->modifiedColumns[] = CustomerTableMap::REMEMBER_ME_TOKEN;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setRememberMeToken()
|
||||
|
||||
/**
|
||||
* Set the value of [remember_me_serial] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\Customer The current object (for fluent API support)
|
||||
*/
|
||||
public function setRememberMeSerial($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->remember_me_serial !== $v) {
|
||||
$this->remember_me_serial = $v;
|
||||
$this->modifiedColumns[] = CustomerTableMap::REMEMBER_ME_SERIAL;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setRememberMeSerial()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
@@ -993,13 +1069,19 @@ abstract class Customer implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CustomerTableMap::translateFieldName('Discount', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->discount = (null !== $col) ? (double) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CustomerTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CustomerTableMap::translateFieldName('RememberMeToken', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->remember_me_token = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CustomerTableMap::translateFieldName('RememberMeSerial', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->remember_me_serial = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CustomerTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CustomerTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CustomerTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -1012,7 +1094,7 @@ abstract class Customer implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 14; // 14 = CustomerTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 16; // 16 = CustomerTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\Customer object", 0, $e);
|
||||
@@ -1342,6 +1424,12 @@ abstract class Customer implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CustomerTableMap::DISCOUNT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'DISCOUNT';
|
||||
}
|
||||
if ($this->isColumnModified(CustomerTableMap::REMEMBER_ME_TOKEN)) {
|
||||
$modifiedColumns[':p' . $index++] = 'REMEMBER_ME_TOKEN';
|
||||
}
|
||||
if ($this->isColumnModified(CustomerTableMap::REMEMBER_ME_SERIAL)) {
|
||||
$modifiedColumns[':p' . $index++] = 'REMEMBER_ME_SERIAL';
|
||||
}
|
||||
if ($this->isColumnModified(CustomerTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||
}
|
||||
@@ -1395,6 +1483,12 @@ abstract class Customer implements ActiveRecordInterface
|
||||
case 'DISCOUNT':
|
||||
$stmt->bindValue($identifier, $this->discount, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'REMEMBER_ME_TOKEN':
|
||||
$stmt->bindValue($identifier, $this->remember_me_token, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'REMEMBER_ME_SERIAL':
|
||||
$stmt->bindValue($identifier, $this->remember_me_serial, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'CREATED_AT':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1500,9 +1594,15 @@ abstract class Customer implements ActiveRecordInterface
|
||||
return $this->getDiscount();
|
||||
break;
|
||||
case 12:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getRememberMeToken();
|
||||
break;
|
||||
case 13:
|
||||
return $this->getRememberMeSerial();
|
||||
break;
|
||||
case 14:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 15:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1546,8 +1646,10 @@ abstract class Customer implements ActiveRecordInterface
|
||||
$keys[9] => $this->getLang(),
|
||||
$keys[10] => $this->getSponsor(),
|
||||
$keys[11] => $this->getDiscount(),
|
||||
$keys[12] => $this->getCreatedAt(),
|
||||
$keys[13] => $this->getUpdatedAt(),
|
||||
$keys[12] => $this->getRememberMeToken(),
|
||||
$keys[13] => $this->getRememberMeSerial(),
|
||||
$keys[14] => $this->getCreatedAt(),
|
||||
$keys[15] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -1639,9 +1741,15 @@ abstract class Customer implements ActiveRecordInterface
|
||||
$this->setDiscount($value);
|
||||
break;
|
||||
case 12:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setRememberMeToken($value);
|
||||
break;
|
||||
case 13:
|
||||
$this->setRememberMeSerial($value);
|
||||
break;
|
||||
case 14:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 15:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1680,8 +1788,10 @@ abstract class Customer implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[9], $arr)) $this->setLang($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setSponsor($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[11], $arr)) $this->setDiscount($arr[$keys[11]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setRememberMeToken($arr[$keys[12]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setRememberMeSerial($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[14], $arr)) $this->setCreatedAt($arr[$keys[14]]);
|
||||
if (array_key_exists($keys[15], $arr)) $this->setUpdatedAt($arr[$keys[15]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1705,6 +1815,8 @@ abstract class Customer implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CustomerTableMap::LANG)) $criteria->add(CustomerTableMap::LANG, $this->lang);
|
||||
if ($this->isColumnModified(CustomerTableMap::SPONSOR)) $criteria->add(CustomerTableMap::SPONSOR, $this->sponsor);
|
||||
if ($this->isColumnModified(CustomerTableMap::DISCOUNT)) $criteria->add(CustomerTableMap::DISCOUNT, $this->discount);
|
||||
if ($this->isColumnModified(CustomerTableMap::REMEMBER_ME_TOKEN)) $criteria->add(CustomerTableMap::REMEMBER_ME_TOKEN, $this->remember_me_token);
|
||||
if ($this->isColumnModified(CustomerTableMap::REMEMBER_ME_SERIAL)) $criteria->add(CustomerTableMap::REMEMBER_ME_SERIAL, $this->remember_me_serial);
|
||||
if ($this->isColumnModified(CustomerTableMap::CREATED_AT)) $criteria->add(CustomerTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(CustomerTableMap::UPDATED_AT)) $criteria->add(CustomerTableMap::UPDATED_AT, $this->updated_at);
|
||||
|
||||
@@ -1781,6 +1893,8 @@ abstract class Customer implements ActiveRecordInterface
|
||||
$copyObj->setLang($this->getLang());
|
||||
$copyObj->setSponsor($this->getSponsor());
|
||||
$copyObj->setDiscount($this->getDiscount());
|
||||
$copyObj->setRememberMeToken($this->getRememberMeToken());
|
||||
$copyObj->setRememberMeSerial($this->getRememberMeSerial());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
|
||||
@@ -2806,6 +2920,8 @@ abstract class Customer implements ActiveRecordInterface
|
||||
$this->lang = null;
|
||||
$this->sponsor = null;
|
||||
$this->discount = null;
|
||||
$this->remember_me_token = null;
|
||||
$this->remember_me_serial = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
@@ -33,6 +33,8 @@ use Thelia\Model\Map\CustomerTableMap;
|
||||
* @method ChildCustomerQuery orderByLang($order = Criteria::ASC) Order by the lang column
|
||||
* @method ChildCustomerQuery orderBySponsor($order = Criteria::ASC) Order by the sponsor column
|
||||
* @method ChildCustomerQuery orderByDiscount($order = Criteria::ASC) Order by the discount column
|
||||
* @method ChildCustomerQuery orderByRememberMeToken($order = Criteria::ASC) Order by the remember_me_token column
|
||||
* @method ChildCustomerQuery orderByRememberMeSerial($order = Criteria::ASC) Order by the remember_me_serial column
|
||||
* @method ChildCustomerQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildCustomerQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
@@ -48,6 +50,8 @@ use Thelia\Model\Map\CustomerTableMap;
|
||||
* @method ChildCustomerQuery groupByLang() Group by the lang column
|
||||
* @method ChildCustomerQuery groupBySponsor() Group by the sponsor column
|
||||
* @method ChildCustomerQuery groupByDiscount() Group by the discount column
|
||||
* @method ChildCustomerQuery groupByRememberMeToken() Group by the remember_me_token column
|
||||
* @method ChildCustomerQuery groupByRememberMeSerial() Group by the remember_me_serial column
|
||||
* @method ChildCustomerQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildCustomerQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
@@ -86,6 +90,8 @@ use Thelia\Model\Map\CustomerTableMap;
|
||||
* @method ChildCustomer findOneByLang(string $lang) Return the first ChildCustomer filtered by the lang column
|
||||
* @method ChildCustomer findOneBySponsor(string $sponsor) Return the first ChildCustomer filtered by the sponsor column
|
||||
* @method ChildCustomer findOneByDiscount(double $discount) Return the first ChildCustomer filtered by the discount column
|
||||
* @method ChildCustomer findOneByRememberMeToken(string $remember_me_token) Return the first ChildCustomer filtered by the remember_me_token column
|
||||
* @method ChildCustomer findOneByRememberMeSerial(string $remember_me_serial) Return the first ChildCustomer filtered by the remember_me_serial column
|
||||
* @method ChildCustomer findOneByCreatedAt(string $created_at) Return the first ChildCustomer filtered by the created_at column
|
||||
* @method ChildCustomer findOneByUpdatedAt(string $updated_at) Return the first ChildCustomer filtered by the updated_at column
|
||||
*
|
||||
@@ -101,6 +107,8 @@ use Thelia\Model\Map\CustomerTableMap;
|
||||
* @method array findByLang(string $lang) Return ChildCustomer objects filtered by the lang column
|
||||
* @method array findBySponsor(string $sponsor) Return ChildCustomer objects filtered by the sponsor column
|
||||
* @method array findByDiscount(double $discount) Return ChildCustomer objects filtered by the discount column
|
||||
* @method array findByRememberMeToken(string $remember_me_token) Return ChildCustomer objects filtered by the remember_me_token column
|
||||
* @method array findByRememberMeSerial(string $remember_me_serial) Return ChildCustomer objects filtered by the remember_me_serial column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildCustomer objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildCustomer objects filtered by the updated_at column
|
||||
*
|
||||
@@ -191,7 +199,7 @@ abstract class CustomerQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, REF, TITLE_ID, FIRSTNAME, LASTNAME, EMAIL, PASSWORD, ALGO, RESELLER, LANG, SPONSOR, DISCOUNT, CREATED_AT, UPDATED_AT FROM customer WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, REF, TITLE_ID, FIRSTNAME, LASTNAME, EMAIL, PASSWORD, ALGO, RESELLER, LANG, SPONSOR, DISCOUNT, REMEMBER_ME_TOKEN, REMEMBER_ME_SERIAL, CREATED_AT, UPDATED_AT FROM customer WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -678,6 +686,64 @@ abstract class CustomerQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(CustomerTableMap::DISCOUNT, $discount, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the remember_me_token column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByRememberMeToken('fooValue'); // WHERE remember_me_token = 'fooValue'
|
||||
* $query->filterByRememberMeToken('%fooValue%'); // WHERE remember_me_token LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $rememberMeToken The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCustomerQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByRememberMeToken($rememberMeToken = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($rememberMeToken)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $rememberMeToken)) {
|
||||
$rememberMeToken = str_replace('*', '%', $rememberMeToken);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CustomerTableMap::REMEMBER_ME_TOKEN, $rememberMeToken, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the remember_me_serial column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByRememberMeSerial('fooValue'); // WHERE remember_me_serial = 'fooValue'
|
||||
* $query->filterByRememberMeSerial('%fooValue%'); // WHERE remember_me_serial LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $rememberMeSerial The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCustomerQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByRememberMeSerial($rememberMeSerial = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($rememberMeSerial)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $rememberMeSerial)) {
|
||||
$rememberMeSerial = str_replace('*', '%', $rememberMeSerial);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CustomerTableMap::REMEMBER_ME_SERIAL, $rememberMeSerial, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
|
||||
@@ -17,18 +17,18 @@ use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Parser\AbstractParser;
|
||||
use Propel\Runtime\Util\PropelDateTime;
|
||||
use Thelia\Model\Category as ChildCategory;
|
||||
use Thelia\Model\CategoryQuery as ChildCategoryQuery;
|
||||
use Thelia\Model\Feature as ChildFeature;
|
||||
use Thelia\Model\FeatureAv as ChildFeatureAv;
|
||||
use Thelia\Model\FeatureAvQuery as ChildFeatureAvQuery;
|
||||
use Thelia\Model\FeatureCategory as ChildFeatureCategory;
|
||||
use Thelia\Model\FeatureCategoryQuery as ChildFeatureCategoryQuery;
|
||||
use Thelia\Model\FeatureI18n as ChildFeatureI18n;
|
||||
use Thelia\Model\FeatureI18nQuery as ChildFeatureI18nQuery;
|
||||
use Thelia\Model\FeatureProduct as ChildFeatureProduct;
|
||||
use Thelia\Model\FeatureProductQuery as ChildFeatureProductQuery;
|
||||
use Thelia\Model\FeatureQuery as ChildFeatureQuery;
|
||||
use Thelia\Model\FeatureTemplate as ChildFeatureTemplate;
|
||||
use Thelia\Model\FeatureTemplateQuery as ChildFeatureTemplateQuery;
|
||||
use Thelia\Model\Template as ChildTemplate;
|
||||
use Thelia\Model\TemplateQuery as ChildTemplateQuery;
|
||||
use Thelia\Model\Map\FeatureTableMap;
|
||||
|
||||
abstract class Feature implements ActiveRecordInterface
|
||||
@@ -109,10 +109,10 @@ abstract class Feature implements ActiveRecordInterface
|
||||
protected $collFeatureProductsPartial;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildFeatureCategory[] Collection to store aggregation of ChildFeatureCategory objects.
|
||||
* @var ObjectCollection|ChildFeatureTemplate[] Collection to store aggregation of ChildFeatureTemplate objects.
|
||||
*/
|
||||
protected $collFeatureCategories;
|
||||
protected $collFeatureCategoriesPartial;
|
||||
protected $collFeatureTemplates;
|
||||
protected $collFeatureTemplatesPartial;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildFeatureI18n[] Collection to store aggregation of ChildFeatureI18n objects.
|
||||
@@ -121,9 +121,9 @@ abstract class Feature implements ActiveRecordInterface
|
||||
protected $collFeatureI18nsPartial;
|
||||
|
||||
/**
|
||||
* @var ChildCategory[] Collection to store aggregation of ChildCategory objects.
|
||||
* @var ChildTemplate[] Collection to store aggregation of ChildTemplate objects.
|
||||
*/
|
||||
protected $collCategories;
|
||||
protected $collTemplates;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
@@ -151,7 +151,7 @@ abstract class Feature implements ActiveRecordInterface
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $categoriesScheduledForDeletion = null;
|
||||
protected $templatesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
@@ -169,7 +169,7 @@ abstract class Feature implements ActiveRecordInterface
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $featureCategoriesScheduledForDeletion = null;
|
||||
protected $featureTemplatesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
@@ -756,11 +756,11 @@ abstract class Feature implements ActiveRecordInterface
|
||||
|
||||
$this->collFeatureProducts = null;
|
||||
|
||||
$this->collFeatureCategories = null;
|
||||
$this->collFeatureTemplates = null;
|
||||
|
||||
$this->collFeatureI18ns = null;
|
||||
|
||||
$this->collCategories = null;
|
||||
$this->collTemplates = null;
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -894,29 +894,29 @@ abstract class Feature implements ActiveRecordInterface
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->categoriesScheduledForDeletion !== null) {
|
||||
if (!$this->categoriesScheduledForDeletion->isEmpty()) {
|
||||
if ($this->templatesScheduledForDeletion !== null) {
|
||||
if (!$this->templatesScheduledForDeletion->isEmpty()) {
|
||||
$pks = array();
|
||||
$pk = $this->getPrimaryKey();
|
||||
foreach ($this->categoriesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
|
||||
$pks[] = array($remotePk, $pk);
|
||||
foreach ($this->templatesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
|
||||
$pks[] = array($pk, $remotePk);
|
||||
}
|
||||
|
||||
FeatureCategoryQuery::create()
|
||||
FeatureTemplateQuery::create()
|
||||
->filterByPrimaryKeys($pks)
|
||||
->delete($con);
|
||||
$this->categoriesScheduledForDeletion = null;
|
||||
$this->templatesScheduledForDeletion = null;
|
||||
}
|
||||
|
||||
foreach ($this->getCategories() as $category) {
|
||||
if ($category->isModified()) {
|
||||
$category->save($con);
|
||||
foreach ($this->getTemplates() as $template) {
|
||||
if ($template->isModified()) {
|
||||
$template->save($con);
|
||||
}
|
||||
}
|
||||
} elseif ($this->collCategories) {
|
||||
foreach ($this->collCategories as $category) {
|
||||
if ($category->isModified()) {
|
||||
$category->save($con);
|
||||
} elseif ($this->collTemplates) {
|
||||
foreach ($this->collTemplates as $template) {
|
||||
if ($template->isModified()) {
|
||||
$template->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -955,17 +955,17 @@ abstract class Feature implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->featureCategoriesScheduledForDeletion !== null) {
|
||||
if (!$this->featureCategoriesScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\FeatureCategoryQuery::create()
|
||||
->filterByPrimaryKeys($this->featureCategoriesScheduledForDeletion->getPrimaryKeys(false))
|
||||
if ($this->featureTemplatesScheduledForDeletion !== null) {
|
||||
if (!$this->featureTemplatesScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\FeatureTemplateQuery::create()
|
||||
->filterByPrimaryKeys($this->featureTemplatesScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->featureCategoriesScheduledForDeletion = null;
|
||||
$this->featureTemplatesScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collFeatureCategories !== null) {
|
||||
foreach ($this->collFeatureCategories as $referrerFK) {
|
||||
if ($this->collFeatureTemplates !== null) {
|
||||
foreach ($this->collFeatureTemplates as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
@@ -1181,8 +1181,8 @@ abstract class Feature implements ActiveRecordInterface
|
||||
if (null !== $this->collFeatureProducts) {
|
||||
$result['FeatureProducts'] = $this->collFeatureProducts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->collFeatureCategories) {
|
||||
$result['FeatureCategories'] = $this->collFeatureCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
if (null !== $this->collFeatureTemplates) {
|
||||
$result['FeatureTemplates'] = $this->collFeatureTemplates->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->collFeatureI18ns) {
|
||||
$result['FeatureI18ns'] = $this->collFeatureI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
@@ -1366,9 +1366,9 @@ abstract class Feature implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->getFeatureCategories() as $relObj) {
|
||||
foreach ($this->getFeatureTemplates() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addFeatureCategory($relObj->copy($deepCopy));
|
||||
$copyObj->addFeatureTemplate($relObj->copy($deepCopy));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1425,8 +1425,8 @@ abstract class Feature implements ActiveRecordInterface
|
||||
if ('FeatureProduct' == $relationName) {
|
||||
return $this->initFeatureProducts();
|
||||
}
|
||||
if ('FeatureCategory' == $relationName) {
|
||||
return $this->initFeatureCategories();
|
||||
if ('FeatureTemplate' == $relationName) {
|
||||
return $this->initFeatureTemplates();
|
||||
}
|
||||
if ('FeatureI18n' == $relationName) {
|
||||
return $this->initFeatureI18ns();
|
||||
@@ -1920,31 +1920,31 @@ abstract class Feature implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collFeatureCategories collection
|
||||
* Clears out the collFeatureTemplates collection
|
||||
*
|
||||
* This does not modify the database; however, it will remove any associated objects, causing
|
||||
* them to be refetched by subsequent calls to accessor method.
|
||||
*
|
||||
* @return void
|
||||
* @see addFeatureCategories()
|
||||
* @see addFeatureTemplates()
|
||||
*/
|
||||
public function clearFeatureCategories()
|
||||
public function clearFeatureTemplates()
|
||||
{
|
||||
$this->collFeatureCategories = null; // important to set this to NULL since that means it is uninitialized
|
||||
$this->collFeatureTemplates = null; // important to set this to NULL since that means it is uninitialized
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset is the collFeatureCategories collection loaded partially.
|
||||
* Reset is the collFeatureTemplates collection loaded partially.
|
||||
*/
|
||||
public function resetPartialFeatureCategories($v = true)
|
||||
public function resetPartialFeatureTemplates($v = true)
|
||||
{
|
||||
$this->collFeatureCategoriesPartial = $v;
|
||||
$this->collFeatureTemplatesPartial = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collFeatureCategories collection.
|
||||
* Initializes the collFeatureTemplates collection.
|
||||
*
|
||||
* By default this just sets the collFeatureCategories collection to an empty array (like clearcollFeatureCategories());
|
||||
* By default this just sets the collFeatureTemplates collection to an empty array (like clearcollFeatureTemplates());
|
||||
* however, you may wish to override this method in your stub class to provide setting appropriate
|
||||
* to your application -- for example, setting the initial array to the values stored in database.
|
||||
*
|
||||
@@ -1953,17 +1953,17 @@ abstract class Feature implements ActiveRecordInterface
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initFeatureCategories($overrideExisting = true)
|
||||
public function initFeatureTemplates($overrideExisting = true)
|
||||
{
|
||||
if (null !== $this->collFeatureCategories && !$overrideExisting) {
|
||||
if (null !== $this->collFeatureTemplates && !$overrideExisting) {
|
||||
return;
|
||||
}
|
||||
$this->collFeatureCategories = new ObjectCollection();
|
||||
$this->collFeatureCategories->setModel('\Thelia\Model\FeatureCategory');
|
||||
$this->collFeatureTemplates = new ObjectCollection();
|
||||
$this->collFeatureTemplates->setModel('\Thelia\Model\FeatureTemplate');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of ChildFeatureCategory objects which contain a foreign key that references this object.
|
||||
* Gets an array of ChildFeatureTemplate objects which contain a foreign key that references this object.
|
||||
*
|
||||
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||
* Otherwise the results are fetched from the database the first time, then cached.
|
||||
@@ -1973,109 +1973,109 @@ abstract class Feature implements ActiveRecordInterface
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @return Collection|ChildFeatureCategory[] List of ChildFeatureCategory objects
|
||||
* @return Collection|ChildFeatureTemplate[] List of ChildFeatureTemplate objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getFeatureCategories($criteria = null, ConnectionInterface $con = null)
|
||||
public function getFeatureTemplates($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collFeatureCategoriesPartial && !$this->isNew();
|
||||
if (null === $this->collFeatureCategories || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collFeatureCategories) {
|
||||
$partial = $this->collFeatureTemplatesPartial && !$this->isNew();
|
||||
if (null === $this->collFeatureTemplates || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collFeatureTemplates) {
|
||||
// return empty collection
|
||||
$this->initFeatureCategories();
|
||||
$this->initFeatureTemplates();
|
||||
} else {
|
||||
$collFeatureCategories = ChildFeatureCategoryQuery::create(null, $criteria)
|
||||
$collFeatureTemplates = ChildFeatureTemplateQuery::create(null, $criteria)
|
||||
->filterByFeature($this)
|
||||
->find($con);
|
||||
|
||||
if (null !== $criteria) {
|
||||
if (false !== $this->collFeatureCategoriesPartial && count($collFeatureCategories)) {
|
||||
$this->initFeatureCategories(false);
|
||||
if (false !== $this->collFeatureTemplatesPartial && count($collFeatureTemplates)) {
|
||||
$this->initFeatureTemplates(false);
|
||||
|
||||
foreach ($collFeatureCategories as $obj) {
|
||||
if (false == $this->collFeatureCategories->contains($obj)) {
|
||||
$this->collFeatureCategories->append($obj);
|
||||
foreach ($collFeatureTemplates as $obj) {
|
||||
if (false == $this->collFeatureTemplates->contains($obj)) {
|
||||
$this->collFeatureTemplates->append($obj);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collFeatureCategoriesPartial = true;
|
||||
$this->collFeatureTemplatesPartial = true;
|
||||
}
|
||||
|
||||
$collFeatureCategories->getInternalIterator()->rewind();
|
||||
$collFeatureTemplates->getInternalIterator()->rewind();
|
||||
|
||||
return $collFeatureCategories;
|
||||
return $collFeatureTemplates;
|
||||
}
|
||||
|
||||
if ($partial && $this->collFeatureCategories) {
|
||||
foreach ($this->collFeatureCategories as $obj) {
|
||||
if ($partial && $this->collFeatureTemplates) {
|
||||
foreach ($this->collFeatureTemplates as $obj) {
|
||||
if ($obj->isNew()) {
|
||||
$collFeatureCategories[] = $obj;
|
||||
$collFeatureTemplates[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->collFeatureCategories = $collFeatureCategories;
|
||||
$this->collFeatureCategoriesPartial = false;
|
||||
$this->collFeatureTemplates = $collFeatureTemplates;
|
||||
$this->collFeatureTemplatesPartial = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collFeatureCategories;
|
||||
return $this->collFeatureTemplates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of FeatureCategory objects related by a one-to-many relationship
|
||||
* Sets a collection of FeatureTemplate objects related by a one-to-many relationship
|
||||
* to the current object.
|
||||
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
|
||||
* and new objects from the given Propel collection.
|
||||
*
|
||||
* @param Collection $featureCategories A Propel collection.
|
||||
* @param Collection $featureTemplates A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildFeature The current object (for fluent API support)
|
||||
*/
|
||||
public function setFeatureCategories(Collection $featureCategories, ConnectionInterface $con = null)
|
||||
public function setFeatureTemplates(Collection $featureTemplates, ConnectionInterface $con = null)
|
||||
{
|
||||
$featureCategoriesToDelete = $this->getFeatureCategories(new Criteria(), $con)->diff($featureCategories);
|
||||
$featureTemplatesToDelete = $this->getFeatureTemplates(new Criteria(), $con)->diff($featureTemplates);
|
||||
|
||||
|
||||
$this->featureCategoriesScheduledForDeletion = $featureCategoriesToDelete;
|
||||
$this->featureTemplatesScheduledForDeletion = $featureTemplatesToDelete;
|
||||
|
||||
foreach ($featureCategoriesToDelete as $featureCategoryRemoved) {
|
||||
$featureCategoryRemoved->setFeature(null);
|
||||
foreach ($featureTemplatesToDelete as $featureTemplateRemoved) {
|
||||
$featureTemplateRemoved->setFeature(null);
|
||||
}
|
||||
|
||||
$this->collFeatureCategories = null;
|
||||
foreach ($featureCategories as $featureCategory) {
|
||||
$this->addFeatureCategory($featureCategory);
|
||||
$this->collFeatureTemplates = null;
|
||||
foreach ($featureTemplates as $featureTemplate) {
|
||||
$this->addFeatureTemplate($featureTemplate);
|
||||
}
|
||||
|
||||
$this->collFeatureCategories = $featureCategories;
|
||||
$this->collFeatureCategoriesPartial = false;
|
||||
$this->collFeatureTemplates = $featureTemplates;
|
||||
$this->collFeatureTemplatesPartial = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related FeatureCategory objects.
|
||||
* Returns the number of related FeatureTemplate objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param ConnectionInterface $con
|
||||
* @return int Count of related FeatureCategory objects.
|
||||
* @return int Count of related FeatureTemplate objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countFeatureCategories(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
public function countFeatureTemplates(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collFeatureCategoriesPartial && !$this->isNew();
|
||||
if (null === $this->collFeatureCategories || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collFeatureCategories) {
|
||||
$partial = $this->collFeatureTemplatesPartial && !$this->isNew();
|
||||
if (null === $this->collFeatureTemplates || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collFeatureTemplates) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($partial && !$criteria) {
|
||||
return count($this->getFeatureCategories());
|
||||
return count($this->getFeatureTemplates());
|
||||
}
|
||||
|
||||
$query = ChildFeatureCategoryQuery::create(null, $criteria);
|
||||
$query = ChildFeatureTemplateQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
@@ -2085,53 +2085,53 @@ abstract class Feature implements ActiveRecordInterface
|
||||
->count($con);
|
||||
}
|
||||
|
||||
return count($this->collFeatureCategories);
|
||||
return count($this->collFeatureTemplates);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called to associate a ChildFeatureCategory object to this object
|
||||
* through the ChildFeatureCategory foreign key attribute.
|
||||
* Method called to associate a ChildFeatureTemplate object to this object
|
||||
* through the ChildFeatureTemplate foreign key attribute.
|
||||
*
|
||||
* @param ChildFeatureCategory $l ChildFeatureCategory
|
||||
* @param ChildFeatureTemplate $l ChildFeatureTemplate
|
||||
* @return \Thelia\Model\Feature The current object (for fluent API support)
|
||||
*/
|
||||
public function addFeatureCategory(ChildFeatureCategory $l)
|
||||
public function addFeatureTemplate(ChildFeatureTemplate $l)
|
||||
{
|
||||
if ($this->collFeatureCategories === null) {
|
||||
$this->initFeatureCategories();
|
||||
$this->collFeatureCategoriesPartial = true;
|
||||
if ($this->collFeatureTemplates === null) {
|
||||
$this->initFeatureTemplates();
|
||||
$this->collFeatureTemplatesPartial = true;
|
||||
}
|
||||
|
||||
if (!in_array($l, $this->collFeatureCategories->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddFeatureCategory($l);
|
||||
if (!in_array($l, $this->collFeatureTemplates->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddFeatureTemplate($l);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FeatureCategory $featureCategory The featureCategory object to add.
|
||||
* @param FeatureTemplate $featureTemplate The featureTemplate object to add.
|
||||
*/
|
||||
protected function doAddFeatureCategory($featureCategory)
|
||||
protected function doAddFeatureTemplate($featureTemplate)
|
||||
{
|
||||
$this->collFeatureCategories[]= $featureCategory;
|
||||
$featureCategory->setFeature($this);
|
||||
$this->collFeatureTemplates[]= $featureTemplate;
|
||||
$featureTemplate->setFeature($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FeatureCategory $featureCategory The featureCategory object to remove.
|
||||
* @param FeatureTemplate $featureTemplate The featureTemplate object to remove.
|
||||
* @return ChildFeature The current object (for fluent API support)
|
||||
*/
|
||||
public function removeFeatureCategory($featureCategory)
|
||||
public function removeFeatureTemplate($featureTemplate)
|
||||
{
|
||||
if ($this->getFeatureCategories()->contains($featureCategory)) {
|
||||
$this->collFeatureCategories->remove($this->collFeatureCategories->search($featureCategory));
|
||||
if (null === $this->featureCategoriesScheduledForDeletion) {
|
||||
$this->featureCategoriesScheduledForDeletion = clone $this->collFeatureCategories;
|
||||
$this->featureCategoriesScheduledForDeletion->clear();
|
||||
if ($this->getFeatureTemplates()->contains($featureTemplate)) {
|
||||
$this->collFeatureTemplates->remove($this->collFeatureTemplates->search($featureTemplate));
|
||||
if (null === $this->featureTemplatesScheduledForDeletion) {
|
||||
$this->featureTemplatesScheduledForDeletion = clone $this->collFeatureTemplates;
|
||||
$this->featureTemplatesScheduledForDeletion->clear();
|
||||
}
|
||||
$this->featureCategoriesScheduledForDeletion[]= clone $featureCategory;
|
||||
$featureCategory->setFeature(null);
|
||||
$this->featureTemplatesScheduledForDeletion[]= clone $featureTemplate;
|
||||
$featureTemplate->setFeature(null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -2143,7 +2143,7 @@ abstract class Feature implements ActiveRecordInterface
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this Feature is new, it will return
|
||||
* an empty collection; or if this Feature has previously
|
||||
* been saved, it will retrieve related FeatureCategories from storage.
|
||||
* been saved, it will retrieve related FeatureTemplates from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
@@ -2152,14 +2152,14 @@ abstract class Feature implements ActiveRecordInterface
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return Collection|ChildFeatureCategory[] List of ChildFeatureCategory objects
|
||||
* @return Collection|ChildFeatureTemplate[] List of ChildFeatureTemplate objects
|
||||
*/
|
||||
public function getFeatureCategoriesJoinCategory($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
public function getFeatureTemplatesJoinTemplate($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = ChildFeatureCategoryQuery::create(null, $criteria);
|
||||
$query->joinWith('Category', $joinBehavior);
|
||||
$query = ChildFeatureTemplateQuery::create(null, $criteria);
|
||||
$query->joinWith('Template', $joinBehavior);
|
||||
|
||||
return $this->getFeatureCategories($query, $con);
|
||||
return $this->getFeatureTemplates($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2388,38 +2388,38 @@ abstract class Feature implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collCategories collection
|
||||
* Clears out the collTemplates collection
|
||||
*
|
||||
* This does not modify the database; however, it will remove any associated objects, causing
|
||||
* them to be refetched by subsequent calls to accessor method.
|
||||
*
|
||||
* @return void
|
||||
* @see addCategories()
|
||||
* @see addTemplates()
|
||||
*/
|
||||
public function clearCategories()
|
||||
public function clearTemplates()
|
||||
{
|
||||
$this->collCategories = null; // important to set this to NULL since that means it is uninitialized
|
||||
$this->collCategoriesPartial = null;
|
||||
$this->collTemplates = null; // important to set this to NULL since that means it is uninitialized
|
||||
$this->collTemplatesPartial = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collCategories collection.
|
||||
* Initializes the collTemplates collection.
|
||||
*
|
||||
* By default this just sets the collCategories collection to an empty collection (like clearCategories());
|
||||
* By default this just sets the collTemplates collection to an empty collection (like clearTemplates());
|
||||
* however, you may wish to override this method in your stub class to provide setting appropriate
|
||||
* to your application -- for example, setting the initial array to the values stored in database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initCategories()
|
||||
public function initTemplates()
|
||||
{
|
||||
$this->collCategories = new ObjectCollection();
|
||||
$this->collCategories->setModel('\Thelia\Model\Category');
|
||||
$this->collTemplates = new ObjectCollection();
|
||||
$this->collTemplates->setModel('\Thelia\Model\Template');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a collection of ChildCategory objects related by a many-to-many relationship
|
||||
* to the current object by way of the feature_category cross-reference table.
|
||||
* Gets a collection of ChildTemplate objects related by a many-to-many relationship
|
||||
* to the current object by way of the feature_template cross-reference table.
|
||||
*
|
||||
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||
* Otherwise the results are fetched from the database the first time, then cached.
|
||||
@@ -2430,73 +2430,73 @@ abstract class Feature implements ActiveRecordInterface
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return ObjectCollection|ChildCategory[] List of ChildCategory objects
|
||||
* @return ObjectCollection|ChildTemplate[] List of ChildTemplate objects
|
||||
*/
|
||||
public function getCategories($criteria = null, ConnectionInterface $con = null)
|
||||
public function getTemplates($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collCategories || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collCategories) {
|
||||
if (null === $this->collTemplates || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collTemplates) {
|
||||
// return empty collection
|
||||
$this->initCategories();
|
||||
$this->initTemplates();
|
||||
} else {
|
||||
$collCategories = ChildCategoryQuery::create(null, $criteria)
|
||||
$collTemplates = ChildTemplateQuery::create(null, $criteria)
|
||||
->filterByFeature($this)
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
return $collCategories;
|
||||
return $collTemplates;
|
||||
}
|
||||
$this->collCategories = $collCategories;
|
||||
$this->collTemplates = $collTemplates;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collCategories;
|
||||
return $this->collTemplates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of Category objects related by a many-to-many relationship
|
||||
* to the current object by way of the feature_category cross-reference table.
|
||||
* Sets a collection of Template objects related by a many-to-many relationship
|
||||
* to the current object by way of the feature_template cross-reference table.
|
||||
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
|
||||
* and new objects from the given Propel collection.
|
||||
*
|
||||
* @param Collection $categories A Propel collection.
|
||||
* @param Collection $templates A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildFeature The current object (for fluent API support)
|
||||
*/
|
||||
public function setCategories(Collection $categories, ConnectionInterface $con = null)
|
||||
public function setTemplates(Collection $templates, ConnectionInterface $con = null)
|
||||
{
|
||||
$this->clearCategories();
|
||||
$currentCategories = $this->getCategories();
|
||||
$this->clearTemplates();
|
||||
$currentTemplates = $this->getTemplates();
|
||||
|
||||
$this->categoriesScheduledForDeletion = $currentCategories->diff($categories);
|
||||
$this->templatesScheduledForDeletion = $currentTemplates->diff($templates);
|
||||
|
||||
foreach ($categories as $category) {
|
||||
if (!$currentCategories->contains($category)) {
|
||||
$this->doAddCategory($category);
|
||||
foreach ($templates as $template) {
|
||||
if (!$currentTemplates->contains($template)) {
|
||||
$this->doAddTemplate($template);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collCategories = $categories;
|
||||
$this->collTemplates = $templates;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of ChildCategory objects related by a many-to-many relationship
|
||||
* to the current object by way of the feature_category cross-reference table.
|
||||
* Gets the number of ChildTemplate objects related by a many-to-many relationship
|
||||
* to the current object by way of the feature_template cross-reference table.
|
||||
*
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param boolean $distinct Set to true to force count distinct
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return int the number of related ChildCategory objects
|
||||
* @return int the number of related ChildTemplate objects
|
||||
*/
|
||||
public function countCategories($criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
public function countTemplates($criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collCategories || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collCategories) {
|
||||
if (null === $this->collTemplates || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collTemplates) {
|
||||
return 0;
|
||||
} else {
|
||||
$query = ChildCategoryQuery::create(null, $criteria);
|
||||
$query = ChildTemplateQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
@@ -2506,65 +2506,65 @@ abstract class Feature implements ActiveRecordInterface
|
||||
->count($con);
|
||||
}
|
||||
} else {
|
||||
return count($this->collCategories);
|
||||
return count($this->collTemplates);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate a ChildCategory object to this object
|
||||
* through the feature_category cross reference table.
|
||||
* Associate a ChildTemplate object to this object
|
||||
* through the feature_template cross reference table.
|
||||
*
|
||||
* @param ChildCategory $category The ChildFeatureCategory object to relate
|
||||
* @param ChildTemplate $template The ChildFeatureTemplate object to relate
|
||||
* @return ChildFeature The current object (for fluent API support)
|
||||
*/
|
||||
public function addCategory(ChildCategory $category)
|
||||
public function addTemplate(ChildTemplate $template)
|
||||
{
|
||||
if ($this->collCategories === null) {
|
||||
$this->initCategories();
|
||||
if ($this->collTemplates === null) {
|
||||
$this->initTemplates();
|
||||
}
|
||||
|
||||
if (!$this->collCategories->contains($category)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddCategory($category);
|
||||
$this->collCategories[] = $category;
|
||||
if (!$this->collTemplates->contains($template)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddTemplate($template);
|
||||
$this->collTemplates[] = $template;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Category $category The category object to add.
|
||||
* @param Template $template The template object to add.
|
||||
*/
|
||||
protected function doAddCategory($category)
|
||||
protected function doAddTemplate($template)
|
||||
{
|
||||
$featureCategory = new ChildFeatureCategory();
|
||||
$featureCategory->setCategory($category);
|
||||
$this->addFeatureCategory($featureCategory);
|
||||
$featureTemplate = new ChildFeatureTemplate();
|
||||
$featureTemplate->setTemplate($template);
|
||||
$this->addFeatureTemplate($featureTemplate);
|
||||
// set the back reference to this object directly as using provided method either results
|
||||
// in endless loop or in multiple relations
|
||||
if (!$category->getFeatures()->contains($this)) {
|
||||
$foreignCollection = $category->getFeatures();
|
||||
if (!$template->getFeatures()->contains($this)) {
|
||||
$foreignCollection = $template->getFeatures();
|
||||
$foreignCollection[] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a ChildCategory object to this object
|
||||
* through the feature_category cross reference table.
|
||||
* Remove a ChildTemplate object to this object
|
||||
* through the feature_template cross reference table.
|
||||
*
|
||||
* @param ChildCategory $category The ChildFeatureCategory object to relate
|
||||
* @param ChildTemplate $template The ChildFeatureTemplate object to relate
|
||||
* @return ChildFeature The current object (for fluent API support)
|
||||
*/
|
||||
public function removeCategory(ChildCategory $category)
|
||||
public function removeTemplate(ChildTemplate $template)
|
||||
{
|
||||
if ($this->getCategories()->contains($category)) {
|
||||
$this->collCategories->remove($this->collCategories->search($category));
|
||||
if ($this->getTemplates()->contains($template)) {
|
||||
$this->collTemplates->remove($this->collTemplates->search($template));
|
||||
|
||||
if (null === $this->categoriesScheduledForDeletion) {
|
||||
$this->categoriesScheduledForDeletion = clone $this->collCategories;
|
||||
$this->categoriesScheduledForDeletion->clear();
|
||||
if (null === $this->templatesScheduledForDeletion) {
|
||||
$this->templatesScheduledForDeletion = clone $this->collTemplates;
|
||||
$this->templatesScheduledForDeletion->clear();
|
||||
}
|
||||
|
||||
$this->categoriesScheduledForDeletion[] = $category;
|
||||
$this->templatesScheduledForDeletion[] = $template;
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -2610,8 +2610,8 @@ abstract class Feature implements ActiveRecordInterface
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collFeatureCategories) {
|
||||
foreach ($this->collFeatureCategories as $o) {
|
||||
if ($this->collFeatureTemplates) {
|
||||
foreach ($this->collFeatureTemplates as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
@@ -2620,8 +2620,8 @@ abstract class Feature implements ActiveRecordInterface
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collCategories) {
|
||||
foreach ($this->collCategories as $o) {
|
||||
if ($this->collTemplates) {
|
||||
foreach ($this->collTemplates as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
@@ -2639,18 +2639,18 @@ abstract class Feature implements ActiveRecordInterface
|
||||
$this->collFeatureProducts->clearIterator();
|
||||
}
|
||||
$this->collFeatureProducts = null;
|
||||
if ($this->collFeatureCategories instanceof Collection) {
|
||||
$this->collFeatureCategories->clearIterator();
|
||||
if ($this->collFeatureTemplates instanceof Collection) {
|
||||
$this->collFeatureTemplates->clearIterator();
|
||||
}
|
||||
$this->collFeatureCategories = null;
|
||||
$this->collFeatureTemplates = null;
|
||||
if ($this->collFeatureI18ns instanceof Collection) {
|
||||
$this->collFeatureI18ns->clearIterator();
|
||||
}
|
||||
$this->collFeatureI18ns = null;
|
||||
if ($this->collCategories instanceof Collection) {
|
||||
$this->collCategories->clearIterator();
|
||||
if ($this->collTemplates instanceof Collection) {
|
||||
$this->collTemplates->clearIterator();
|
||||
}
|
||||
$this->collCategories = null;
|
||||
$this->collTemplates = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,9 +46,9 @@ use Thelia\Model\Map\FeatureTableMap;
|
||||
* @method ChildFeatureQuery rightJoinFeatureProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureProduct relation
|
||||
* @method ChildFeatureQuery innerJoinFeatureProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureProduct relation
|
||||
*
|
||||
* @method ChildFeatureQuery leftJoinFeatureCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureCategory relation
|
||||
* @method ChildFeatureQuery rightJoinFeatureCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureCategory relation
|
||||
* @method ChildFeatureQuery innerJoinFeatureCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureCategory relation
|
||||
* @method ChildFeatureQuery leftJoinFeatureTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureTemplate relation
|
||||
* @method ChildFeatureQuery rightJoinFeatureTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureTemplate relation
|
||||
* @method ChildFeatureQuery innerJoinFeatureTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureTemplate relation
|
||||
*
|
||||
* @method ChildFeatureQuery leftJoinFeatureI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureI18n relation
|
||||
* @method ChildFeatureQuery rightJoinFeatureI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureI18n relation
|
||||
@@ -601,40 +601,40 @@ abstract class FeatureQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\FeatureCategory object
|
||||
* Filter the query by a related \Thelia\Model\FeatureTemplate object
|
||||
*
|
||||
* @param \Thelia\Model\FeatureCategory|ObjectCollection $featureCategory the related object to use as filter
|
||||
* @param \Thelia\Model\FeatureTemplate|ObjectCollection $featureTemplate the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildFeatureQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByFeatureCategory($featureCategory, $comparison = null)
|
||||
public function filterByFeatureTemplate($featureTemplate, $comparison = null)
|
||||
{
|
||||
if ($featureCategory instanceof \Thelia\Model\FeatureCategory) {
|
||||
if ($featureTemplate instanceof \Thelia\Model\FeatureTemplate) {
|
||||
return $this
|
||||
->addUsingAlias(FeatureTableMap::ID, $featureCategory->getFeatureId(), $comparison);
|
||||
} elseif ($featureCategory instanceof ObjectCollection) {
|
||||
->addUsingAlias(FeatureTableMap::ID, $featureTemplate->getFeatureId(), $comparison);
|
||||
} elseif ($featureTemplate instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useFeatureCategoryQuery()
|
||||
->filterByPrimaryKeys($featureCategory->getPrimaryKeys())
|
||||
->useFeatureTemplateQuery()
|
||||
->filterByPrimaryKeys($featureTemplate->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByFeatureCategory() only accepts arguments of type \Thelia\Model\FeatureCategory or Collection');
|
||||
throw new PropelException('filterByFeatureTemplate() only accepts arguments of type \Thelia\Model\FeatureTemplate or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the FeatureCategory relation
|
||||
* Adds a JOIN clause to the query using the FeatureTemplate relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildFeatureQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinFeatureCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinFeatureTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('FeatureCategory');
|
||||
$relationMap = $tableMap->getRelation('FeatureTemplate');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
@@ -649,14 +649,14 @@ abstract class FeatureQuery extends ModelCriteria
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'FeatureCategory');
|
||||
$this->addJoinObject($join, 'FeatureTemplate');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the FeatureCategory relation FeatureCategory object
|
||||
* Use the FeatureTemplate relation FeatureTemplate object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
@@ -664,13 +664,13 @@ abstract class FeatureQuery extends ModelCriteria
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\FeatureCategoryQuery A secondary query class using the current class as primary query
|
||||
* @return \Thelia\Model\FeatureTemplateQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useFeatureCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useFeatureTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinFeatureCategory($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'FeatureCategory', '\Thelia\Model\FeatureCategoryQuery');
|
||||
->joinFeatureTemplate($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'FeatureTemplate', '\Thelia\Model\FeatureTemplateQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -747,19 +747,19 @@ abstract class FeatureQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Category object
|
||||
* using the feature_category table as cross reference
|
||||
* Filter the query by a related Template object
|
||||
* using the feature_template table as cross reference
|
||||
*
|
||||
* @param Category $category the related object to use as filter
|
||||
* @param Template $template the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildFeatureQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCategory($category, $comparison = Criteria::EQUAL)
|
||||
public function filterByTemplate($template, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useFeatureCategoryQuery()
|
||||
->filterByCategory($category, $comparison)
|
||||
->useFeatureTemplateQuery()
|
||||
->filterByTemplate($template, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
|
||||
1495
core/lib/Thelia/Model/Base/FeatureTemplate.php
Normal file
1495
core/lib/Thelia/Model/Base/FeatureTemplate.php
Normal file
File diff suppressed because it is too large
Load Diff
759
core/lib/Thelia/Model/Base/FeatureTemplateQuery.php
Normal file
759
core/lib/Thelia/Model/Base/FeatureTemplateQuery.php
Normal file
@@ -0,0 +1,759 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelJoin;
|
||||
use Propel\Runtime\Collection\Collection;
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Thelia\Model\FeatureTemplate as ChildFeatureTemplate;
|
||||
use Thelia\Model\FeatureTemplateQuery as ChildFeatureTemplateQuery;
|
||||
use Thelia\Model\Map\FeatureTemplateTableMap;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'feature_template' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildFeatureTemplateQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildFeatureTemplateQuery orderByFeatureId($order = Criteria::ASC) Order by the feature_id column
|
||||
* @method ChildFeatureTemplateQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column
|
||||
* @method ChildFeatureTemplateQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildFeatureTemplateQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
* @method ChildFeatureTemplateQuery groupById() Group by the id column
|
||||
* @method ChildFeatureTemplateQuery groupByFeatureId() Group by the feature_id column
|
||||
* @method ChildFeatureTemplateQuery groupByTemplateId() Group by the template_id column
|
||||
* @method ChildFeatureTemplateQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildFeatureTemplateQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
* @method ChildFeatureTemplateQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildFeatureTemplateQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildFeatureTemplateQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildFeatureTemplateQuery leftJoinFeature($relationAlias = null) Adds a LEFT JOIN clause to the query using the Feature relation
|
||||
* @method ChildFeatureTemplateQuery rightJoinFeature($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Feature relation
|
||||
* @method ChildFeatureTemplateQuery innerJoinFeature($relationAlias = null) Adds a INNER JOIN clause to the query using the Feature relation
|
||||
*
|
||||
* @method ChildFeatureTemplateQuery leftJoinTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the Template relation
|
||||
* @method ChildFeatureTemplateQuery rightJoinTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Template relation
|
||||
* @method ChildFeatureTemplateQuery innerJoinTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the Template relation
|
||||
*
|
||||
* @method ChildFeatureTemplate findOne(ConnectionInterface $con = null) Return the first ChildFeatureTemplate matching the query
|
||||
* @method ChildFeatureTemplate findOneOrCreate(ConnectionInterface $con = null) Return the first ChildFeatureTemplate matching the query, or a new ChildFeatureTemplate object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildFeatureTemplate findOneById(int $id) Return the first ChildFeatureTemplate filtered by the id column
|
||||
* @method ChildFeatureTemplate findOneByFeatureId(int $feature_id) Return the first ChildFeatureTemplate filtered by the feature_id column
|
||||
* @method ChildFeatureTemplate findOneByTemplateId(int $template_id) Return the first ChildFeatureTemplate filtered by the template_id column
|
||||
* @method ChildFeatureTemplate findOneByCreatedAt(string $created_at) Return the first ChildFeatureTemplate filtered by the created_at column
|
||||
* @method ChildFeatureTemplate findOneByUpdatedAt(string $updated_at) Return the first ChildFeatureTemplate filtered by the updated_at column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildFeatureTemplate objects filtered by the id column
|
||||
* @method array findByFeatureId(int $feature_id) Return ChildFeatureTemplate objects filtered by the feature_id column
|
||||
* @method array findByTemplateId(int $template_id) Return ChildFeatureTemplate objects filtered by the template_id column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildFeatureTemplate objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildFeatureTemplate objects filtered by the updated_at column
|
||||
*
|
||||
*/
|
||||
abstract class FeatureTemplateQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \Thelia\Model\Base\FeatureTemplateQuery object.
|
||||
*
|
||||
* @param string $dbName The database name
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\FeatureTemplate', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildFeatureTemplateQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \Thelia\Model\FeatureTemplateQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \Thelia\Model\FeatureTemplateQuery();
|
||||
if (null !== $modelAlias) {
|
||||
$query->setModelAlias($modelAlias);
|
||||
}
|
||||
if ($criteria instanceof Criteria) {
|
||||
$query->mergeWith($criteria);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
* Propel uses the instance pool to skip the database if the object exists.
|
||||
* Go fast if the query is untouched.
|
||||
*
|
||||
* <code>
|
||||
* $obj = $c->findPk(12, $con);
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ChildFeatureTemplate|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = FeatureTemplateTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(FeatureTemplateTableMap::DATABASE_NAME);
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|
||||
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|
||||
|| $this->map || $this->having || $this->joins) {
|
||||
return $this->findPkComplex($key, $con);
|
||||
} else {
|
||||
return $this->findPkSimple($key, $con);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key using raw SQL to go fast.
|
||||
* Bypass doSelect() and the object formatter by using generated code.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildFeatureTemplate A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, FEATURE_ID, TEMPLATE_ID, CREATED_AT, UPDATED_AT FROM feature_template WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
} catch (Exception $e) {
|
||||
Propel::log($e->getMessage(), Propel::LOG_ERR);
|
||||
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
|
||||
}
|
||||
$obj = null;
|
||||
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
|
||||
$obj = new ChildFeatureTemplate();
|
||||
$obj->hydrate($row);
|
||||
FeatureTemplateTableMap::addInstanceToPool($obj, (string) $key);
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildFeatureTemplate|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
protected function findPkComplex($key, $con)
|
||||
{
|
||||
// As the query uses a PK condition, no limit(1) is necessary.
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKey($key)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find objects by primary key
|
||||
* <code>
|
||||
* $objs = $c->findPks(array(12, 56, 832), $con);
|
||||
* </code>
|
||||
* @param array $keys Primary keys to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
|
||||
*/
|
||||
public function findPks($keys, $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKeys($keys)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by primary key
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(FeatureTemplateTableMap::ID, $key, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a list of primary keys
|
||||
*
|
||||
* @param array $keys The list of primary key to use for the query
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(FeatureTemplateTableMap::ID, $keys, Criteria::IN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterById(1234); // WHERE id = 1234
|
||||
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
|
||||
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $id The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterById($id = null, $comparison = null)
|
||||
{
|
||||
if (is_array($id)) {
|
||||
$useMinMax = false;
|
||||
if (isset($id['min'])) {
|
||||
$this->addUsingAlias(FeatureTemplateTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(FeatureTemplateTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(FeatureTemplateTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the feature_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByFeatureId(1234); // WHERE feature_id = 1234
|
||||
* $query->filterByFeatureId(array(12, 34)); // WHERE feature_id IN (12, 34)
|
||||
* $query->filterByFeatureId(array('min' => 12)); // WHERE feature_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByFeature()
|
||||
*
|
||||
* @param mixed $featureId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByFeatureId($featureId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($featureId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($featureId['min'])) {
|
||||
$this->addUsingAlias(FeatureTemplateTableMap::FEATURE_ID, $featureId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($featureId['max'])) {
|
||||
$this->addUsingAlias(FeatureTemplateTableMap::FEATURE_ID, $featureId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(FeatureTemplateTableMap::FEATURE_ID, $featureId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the template_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByTemplateId(1234); // WHERE template_id = 1234
|
||||
* $query->filterByTemplateId(array(12, 34)); // WHERE template_id IN (12, 34)
|
||||
* $query->filterByTemplateId(array('min' => 12)); // WHERE template_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByTemplate()
|
||||
*
|
||||
* @param mixed $templateId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByTemplateId($templateId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($templateId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($templateId['min'])) {
|
||||
$this->addUsingAlias(FeatureTemplateTableMap::TEMPLATE_ID, $templateId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($templateId['max'])) {
|
||||
$this->addUsingAlias(FeatureTemplateTableMap::TEMPLATE_ID, $templateId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(FeatureTemplateTableMap::TEMPLATE_ID, $templateId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
|
||||
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
|
||||
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $createdAt The value to use as filter.
|
||||
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||
* Empty strings are treated as NULL.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCreatedAt($createdAt = null, $comparison = null)
|
||||
{
|
||||
if (is_array($createdAt)) {
|
||||
$useMinMax = false;
|
||||
if (isset($createdAt['min'])) {
|
||||
$this->addUsingAlias(FeatureTemplateTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($createdAt['max'])) {
|
||||
$this->addUsingAlias(FeatureTemplateTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(FeatureTemplateTableMap::CREATED_AT, $createdAt, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the updated_at column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
|
||||
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
|
||||
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $updatedAt The value to use as filter.
|
||||
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||
* Empty strings are treated as NULL.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
|
||||
{
|
||||
if (is_array($updatedAt)) {
|
||||
$useMinMax = false;
|
||||
if (isset($updatedAt['min'])) {
|
||||
$this->addUsingAlias(FeatureTemplateTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($updatedAt['max'])) {
|
||||
$this->addUsingAlias(FeatureTemplateTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(FeatureTemplateTableMap::UPDATED_AT, $updatedAt, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Feature object
|
||||
*
|
||||
* @param \Thelia\Model\Feature|ObjectCollection $feature The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByFeature($feature, $comparison = null)
|
||||
{
|
||||
if ($feature instanceof \Thelia\Model\Feature) {
|
||||
return $this
|
||||
->addUsingAlias(FeatureTemplateTableMap::FEATURE_ID, $feature->getId(), $comparison);
|
||||
} elseif ($feature instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(FeatureTemplateTableMap::FEATURE_ID, $feature->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByFeature() only accepts arguments of type \Thelia\Model\Feature or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Feature relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinFeature($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Feature');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Feature');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Feature relation Feature object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\FeatureQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useFeatureQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinFeature($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Feature', '\Thelia\Model\FeatureQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Template object
|
||||
*
|
||||
* @param \Thelia\Model\Template|ObjectCollection $template The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByTemplate($template, $comparison = null)
|
||||
{
|
||||
if ($template instanceof \Thelia\Model\Template) {
|
||||
return $this
|
||||
->addUsingAlias(FeatureTemplateTableMap::TEMPLATE_ID, $template->getId(), $comparison);
|
||||
} elseif ($template instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(FeatureTemplateTableMap::TEMPLATE_ID, $template->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByTemplate() only accepts arguments of type \Thelia\Model\Template or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Template relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Template');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Template');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Template relation Template object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\TemplateQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinTemplate($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Template', '\Thelia\Model\TemplateQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildFeatureTemplate $featureTemplate Object to remove from the list of results
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($featureTemplate = null)
|
||||
{
|
||||
if ($featureTemplate) {
|
||||
$this->addUsingAlias(FeatureTemplateTableMap::ID, $featureTemplate->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the feature_template table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(FeatureTemplateTableMap::DATABASE_NAME);
|
||||
}
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
$affectedRows += parent::doDeleteAll($con);
|
||||
// Because this db requires some delete cascade/set null emulation, we have to
|
||||
// clear the cached instance *after* the emulation has happened (since
|
||||
// instances get re-added by the select statement contained therein).
|
||||
FeatureTemplateTableMap::clearInstancePool();
|
||||
FeatureTemplateTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildFeatureTemplate or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildFeatureTemplate object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public function delete(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(FeatureTemplateTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(FeatureTemplateTableMap::DATABASE_NAME);
|
||||
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
|
||||
|
||||
FeatureTemplateTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
FeatureTemplateTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
// timestampable behavior
|
||||
|
||||
/**
|
||||
* Filter by the latest updated
|
||||
*
|
||||
* @param int $nbDays Maximum age of the latest update in days
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function recentlyUpdated($nbDays = 7)
|
||||
{
|
||||
return $this->addUsingAlias(FeatureTemplateTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter by the latest created
|
||||
*
|
||||
* @param int $nbDays Maximum age of in days
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function recentlyCreated($nbDays = 7)
|
||||
{
|
||||
return $this->addUsingAlias(FeatureTemplateTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by update date desc
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function lastUpdatedFirst()
|
||||
{
|
||||
return $this->addDescendingOrderByColumn(FeatureTemplateTableMap::UPDATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by update date asc
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function firstUpdatedFirst()
|
||||
{
|
||||
return $this->addAscendingOrderByColumn(FeatureTemplateTableMap::UPDATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by create date desc
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function lastCreatedFirst()
|
||||
{
|
||||
return $this->addDescendingOrderByColumn(FeatureTemplateTableMap::CREATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by create date asc
|
||||
*
|
||||
* @return ChildFeatureTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function firstCreatedFirst()
|
||||
{
|
||||
return $this->addAscendingOrderByColumn(FeatureTemplateTableMap::CREATED_AT);
|
||||
}
|
||||
|
||||
} // FeatureTemplateQuery
|
||||
@@ -43,6 +43,8 @@ use Thelia\Model\ProductVersion as ChildProductVersion;
|
||||
use Thelia\Model\ProductVersionQuery as ChildProductVersionQuery;
|
||||
use Thelia\Model\TaxRule as ChildTaxRule;
|
||||
use Thelia\Model\TaxRuleQuery as ChildTaxRuleQuery;
|
||||
use Thelia\Model\Template as ChildTemplate;
|
||||
use Thelia\Model\TemplateQuery as ChildTemplateQuery;
|
||||
use Thelia\Model\Map\ProductTableMap;
|
||||
use Thelia\Model\Map\ProductVersionTableMap;
|
||||
|
||||
@@ -111,6 +113,12 @@ abstract class Product implements ActiveRecordInterface
|
||||
*/
|
||||
protected $position;
|
||||
|
||||
/**
|
||||
* The value for the template_id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $template_id;
|
||||
|
||||
/**
|
||||
* The value for the created_at field.
|
||||
* @var string
|
||||
@@ -147,6 +155,11 @@ abstract class Product implements ActiveRecordInterface
|
||||
*/
|
||||
protected $aTaxRule;
|
||||
|
||||
/**
|
||||
* @var Template
|
||||
*/
|
||||
protected $aTemplate;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildProductCategory[] Collection to store aggregation of ChildProductCategory objects.
|
||||
*/
|
||||
@@ -665,6 +678,17 @@ abstract class Product implements ActiveRecordInterface
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [template_id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTemplateId()
|
||||
{
|
||||
|
||||
return $this->template_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
@@ -856,6 +880,31 @@ abstract class Product implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setPosition()
|
||||
|
||||
/**
|
||||
* Set the value of [template_id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return \Thelia\Model\Product The current object (for fluent API support)
|
||||
*/
|
||||
public function setTemplateId($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->template_id !== $v) {
|
||||
$this->template_id = $v;
|
||||
$this->modifiedColumns[] = ProductTableMap::TEMPLATE_ID;
|
||||
}
|
||||
|
||||
if ($this->aTemplate !== null && $this->aTemplate->getId() !== $v) {
|
||||
$this->aTemplate = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setTemplateId()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
@@ -1021,28 +1070,31 @@ abstract class Product implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->position = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductTableMap::translateFieldName('TemplateId', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->template_id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->version = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : ProductTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->version_created_by = (null !== $col) ? (string) $col : null;
|
||||
$this->resetModified();
|
||||
|
||||
@@ -1052,7 +1104,7 @@ abstract class Product implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 10; // 10 = ProductTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 11; // 11 = ProductTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\Product object", 0, $e);
|
||||
@@ -1077,6 +1129,9 @@ abstract class Product implements ActiveRecordInterface
|
||||
if ($this->aTaxRule !== null && $this->tax_rule_id !== $this->aTaxRule->getId()) {
|
||||
$this->aTaxRule = null;
|
||||
}
|
||||
if ($this->aTemplate !== null && $this->template_id !== $this->aTemplate->getId()) {
|
||||
$this->aTemplate = null;
|
||||
}
|
||||
} // ensureConsistency
|
||||
|
||||
/**
|
||||
@@ -1117,6 +1172,7 @@ abstract class Product implements ActiveRecordInterface
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->aTaxRule = null;
|
||||
$this->aTemplate = null;
|
||||
$this->collProductCategories = null;
|
||||
|
||||
$this->collFeatureProducts = null;
|
||||
@@ -1288,6 +1344,13 @@ abstract class Product implements ActiveRecordInterface
|
||||
$this->setTaxRule($this->aTaxRule);
|
||||
}
|
||||
|
||||
if ($this->aTemplate !== null) {
|
||||
if ($this->aTemplate->isModified() || $this->aTemplate->isNew()) {
|
||||
$affectedRows += $this->aTemplate->save($con);
|
||||
}
|
||||
$this->setTemplate($this->aTemplate);
|
||||
}
|
||||
|
||||
if ($this->isNew() || $this->isModified()) {
|
||||
// persist changes
|
||||
if ($this->isNew()) {
|
||||
@@ -1608,6 +1671,9 @@ abstract class Product implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(ProductTableMap::POSITION)) {
|
||||
$modifiedColumns[':p' . $index++] = 'POSITION';
|
||||
}
|
||||
if ($this->isColumnModified(ProductTableMap::TEMPLATE_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'TEMPLATE_ID';
|
||||
}
|
||||
if ($this->isColumnModified(ProductTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||
}
|
||||
@@ -1649,6 +1715,9 @@ abstract class Product implements ActiveRecordInterface
|
||||
case 'POSITION':
|
||||
$stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'TEMPLATE_ID':
|
||||
$stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'CREATED_AT':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1742,18 +1811,21 @@ abstract class Product implements ActiveRecordInterface
|
||||
return $this->getPosition();
|
||||
break;
|
||||
case 5:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getTemplateId();
|
||||
break;
|
||||
case 6:
|
||||
return $this->getUpdatedAt();
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 7:
|
||||
return $this->getVersion();
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
case 8:
|
||||
return $this->getVersionCreatedAt();
|
||||
return $this->getVersion();
|
||||
break;
|
||||
case 9:
|
||||
return $this->getVersionCreatedAt();
|
||||
break;
|
||||
case 10:
|
||||
return $this->getVersionCreatedBy();
|
||||
break;
|
||||
default:
|
||||
@@ -1790,11 +1862,12 @@ abstract class Product implements ActiveRecordInterface
|
||||
$keys[2] => $this->getRef(),
|
||||
$keys[3] => $this->getVisible(),
|
||||
$keys[4] => $this->getPosition(),
|
||||
$keys[5] => $this->getCreatedAt(),
|
||||
$keys[6] => $this->getUpdatedAt(),
|
||||
$keys[7] => $this->getVersion(),
|
||||
$keys[8] => $this->getVersionCreatedAt(),
|
||||
$keys[9] => $this->getVersionCreatedBy(),
|
||||
$keys[5] => $this->getTemplateId(),
|
||||
$keys[6] => $this->getCreatedAt(),
|
||||
$keys[7] => $this->getUpdatedAt(),
|
||||
$keys[8] => $this->getVersion(),
|
||||
$keys[9] => $this->getVersionCreatedAt(),
|
||||
$keys[10] => $this->getVersionCreatedBy(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -1806,6 +1879,9 @@ abstract class Product implements ActiveRecordInterface
|
||||
if (null !== $this->aTaxRule) {
|
||||
$result['TaxRule'] = $this->aTaxRule->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
if (null !== $this->aTemplate) {
|
||||
$result['Template'] = $this->aTemplate->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
if (null !== $this->collProductCategories) {
|
||||
$result['ProductCategories'] = $this->collProductCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
@@ -1889,18 +1965,21 @@ abstract class Product implements ActiveRecordInterface
|
||||
$this->setPosition($value);
|
||||
break;
|
||||
case 5:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setTemplateId($value);
|
||||
break;
|
||||
case 6:
|
||||
$this->setUpdatedAt($value);
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 7:
|
||||
$this->setVersion($value);
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
case 8:
|
||||
$this->setVersionCreatedAt($value);
|
||||
$this->setVersion($value);
|
||||
break;
|
||||
case 9:
|
||||
$this->setVersionCreatedAt($value);
|
||||
break;
|
||||
case 10:
|
||||
$this->setVersionCreatedBy($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1932,11 +2011,12 @@ abstract class Product implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[2], $arr)) $this->setRef($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setVisible($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setVersion($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedAt($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedBy($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setTemplateId($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setVersion($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedAt($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedBy($arr[$keys[10]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1953,6 +2033,7 @@ abstract class Product implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(ProductTableMap::REF)) $criteria->add(ProductTableMap::REF, $this->ref);
|
||||
if ($this->isColumnModified(ProductTableMap::VISIBLE)) $criteria->add(ProductTableMap::VISIBLE, $this->visible);
|
||||
if ($this->isColumnModified(ProductTableMap::POSITION)) $criteria->add(ProductTableMap::POSITION, $this->position);
|
||||
if ($this->isColumnModified(ProductTableMap::TEMPLATE_ID)) $criteria->add(ProductTableMap::TEMPLATE_ID, $this->template_id);
|
||||
if ($this->isColumnModified(ProductTableMap::CREATED_AT)) $criteria->add(ProductTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(ProductTableMap::UPDATED_AT)) $criteria->add(ProductTableMap::UPDATED_AT, $this->updated_at);
|
||||
if ($this->isColumnModified(ProductTableMap::VERSION)) $criteria->add(ProductTableMap::VERSION, $this->version);
|
||||
@@ -2025,6 +2106,7 @@ abstract class Product implements ActiveRecordInterface
|
||||
$copyObj->setRef($this->getRef());
|
||||
$copyObj->setVisible($this->getVisible());
|
||||
$copyObj->setPosition($this->getPosition());
|
||||
$copyObj->setTemplateId($this->getTemplateId());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
$copyObj->setVersion($this->getVersion());
|
||||
@@ -2183,6 +2265,57 @@ abstract class Product implements ActiveRecordInterface
|
||||
return $this->aTaxRule;
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares an association between this object and a ChildTemplate object.
|
||||
*
|
||||
* @param ChildTemplate $v
|
||||
* @return \Thelia\Model\Product The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setTemplate(ChildTemplate $v = null)
|
||||
{
|
||||
if ($v === null) {
|
||||
$this->setTemplateId(NULL);
|
||||
} else {
|
||||
$this->setTemplateId($v->getId());
|
||||
}
|
||||
|
||||
$this->aTemplate = $v;
|
||||
|
||||
// Add binding for other direction of this n:n relationship.
|
||||
// If this object has already been added to the ChildTemplate object, it will not be re-added.
|
||||
if ($v !== null) {
|
||||
$v->addProduct($this);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the associated ChildTemplate object
|
||||
*
|
||||
* @param ConnectionInterface $con Optional Connection object.
|
||||
* @return ChildTemplate The associated ChildTemplate object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getTemplate(ConnectionInterface $con = null)
|
||||
{
|
||||
if ($this->aTemplate === null && ($this->template_id !== null)) {
|
||||
$this->aTemplate = ChildTemplateQuery::create()->findPk($this->template_id, $con);
|
||||
/* The following can be used additionally to
|
||||
guarantee the related object contains a reference
|
||||
to this object. This level of coupling may, however, be
|
||||
undesirable since it could result in an only partially populated collection
|
||||
in the referenced object.
|
||||
$this->aTemplate->addProducts($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this->aTemplate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a collection based on the name of a relation.
|
||||
@@ -5349,6 +5482,7 @@ abstract class Product implements ActiveRecordInterface
|
||||
$this->ref = null;
|
||||
$this->visible = null;
|
||||
$this->position = null;
|
||||
$this->template_id = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->version = null;
|
||||
@@ -5507,6 +5641,7 @@ abstract class Product implements ActiveRecordInterface
|
||||
}
|
||||
$this->collProductsRelatedByProductId = null;
|
||||
$this->aTaxRule = null;
|
||||
$this->aTemplate = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5781,6 +5916,7 @@ abstract class Product implements ActiveRecordInterface
|
||||
$version->setRef($this->getRef());
|
||||
$version->setVisible($this->getVisible());
|
||||
$version->setPosition($this->getPosition());
|
||||
$version->setTemplateId($this->getTemplateId());
|
||||
$version->setCreatedAt($this->getCreatedAt());
|
||||
$version->setUpdatedAt($this->getUpdatedAt());
|
||||
$version->setVersion($this->getVersion());
|
||||
@@ -5828,6 +5964,7 @@ abstract class Product implements ActiveRecordInterface
|
||||
$this->setRef($version->getRef());
|
||||
$this->setVisible($version->getVisible());
|
||||
$this->setPosition($version->getPosition());
|
||||
$this->setTemplateId($version->getTemplateId());
|
||||
$this->setCreatedAt($version->getCreatedAt());
|
||||
$this->setUpdatedAt($version->getUpdatedAt());
|
||||
$this->setVersion($version->getVersion());
|
||||
|
||||
@@ -27,6 +27,7 @@ use Thelia\Model\Map\ProductTableMap;
|
||||
* @method ChildProductQuery orderByRef($order = Criteria::ASC) Order by the ref column
|
||||
* @method ChildProductQuery orderByVisible($order = Criteria::ASC) Order by the visible column
|
||||
* @method ChildProductQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
||||
* @method ChildProductQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column
|
||||
* @method ChildProductQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildProductQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
* @method ChildProductQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
||||
@@ -38,6 +39,7 @@ use Thelia\Model\Map\ProductTableMap;
|
||||
* @method ChildProductQuery groupByRef() Group by the ref column
|
||||
* @method ChildProductQuery groupByVisible() Group by the visible column
|
||||
* @method ChildProductQuery groupByPosition() Group by the position column
|
||||
* @method ChildProductQuery groupByTemplateId() Group by the template_id column
|
||||
* @method ChildProductQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildProductQuery groupByUpdatedAt() Group by the updated_at column
|
||||
* @method ChildProductQuery groupByVersion() Group by the version column
|
||||
@@ -52,6 +54,10 @@ use Thelia\Model\Map\ProductTableMap;
|
||||
* @method ChildProductQuery rightJoinTaxRule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TaxRule relation
|
||||
* @method ChildProductQuery innerJoinTaxRule($relationAlias = null) Adds a INNER JOIN clause to the query using the TaxRule relation
|
||||
*
|
||||
* @method ChildProductQuery leftJoinTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the Template relation
|
||||
* @method ChildProductQuery rightJoinTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Template relation
|
||||
* @method ChildProductQuery innerJoinTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the Template relation
|
||||
*
|
||||
* @method ChildProductQuery leftJoinProductCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductCategory relation
|
||||
* @method ChildProductQuery rightJoinProductCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductCategory relation
|
||||
* @method ChildProductQuery innerJoinProductCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductCategory relation
|
||||
@@ -104,6 +110,7 @@ use Thelia\Model\Map\ProductTableMap;
|
||||
* @method ChildProduct findOneByRef(string $ref) Return the first ChildProduct filtered by the ref column
|
||||
* @method ChildProduct findOneByVisible(int $visible) Return the first ChildProduct filtered by the visible column
|
||||
* @method ChildProduct findOneByPosition(int $position) Return the first ChildProduct filtered by the position column
|
||||
* @method ChildProduct findOneByTemplateId(int $template_id) Return the first ChildProduct filtered by the template_id column
|
||||
* @method ChildProduct findOneByCreatedAt(string $created_at) Return the first ChildProduct filtered by the created_at column
|
||||
* @method ChildProduct findOneByUpdatedAt(string $updated_at) Return the first ChildProduct filtered by the updated_at column
|
||||
* @method ChildProduct findOneByVersion(int $version) Return the first ChildProduct filtered by the version column
|
||||
@@ -115,6 +122,7 @@ use Thelia\Model\Map\ProductTableMap;
|
||||
* @method array findByRef(string $ref) Return ChildProduct objects filtered by the ref column
|
||||
* @method array findByVisible(int $visible) Return ChildProduct objects filtered by the visible column
|
||||
* @method array findByPosition(int $position) Return ChildProduct objects filtered by the position column
|
||||
* @method array findByTemplateId(int $template_id) Return ChildProduct objects filtered by the template_id column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildProduct objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildProduct objects filtered by the updated_at column
|
||||
* @method array findByVersion(int $version) Return ChildProduct objects filtered by the version column
|
||||
@@ -215,7 +223,7 @@ abstract class ProductQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, TAX_RULE_ID, REF, VISIBLE, POSITION, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM product WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, TAX_RULE_ID, REF, VISIBLE, POSITION, TEMPLATE_ID, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM product WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -499,6 +507,49 @@ abstract class ProductQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(ProductTableMap::POSITION, $position, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the template_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByTemplateId(1234); // WHERE template_id = 1234
|
||||
* $query->filterByTemplateId(array(12, 34)); // WHERE template_id IN (12, 34)
|
||||
* $query->filterByTemplateId(array('min' => 12)); // WHERE template_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByTemplate()
|
||||
*
|
||||
* @param mixed $templateId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildProductQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByTemplateId($templateId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($templateId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($templateId['min'])) {
|
||||
$this->addUsingAlias(ProductTableMap::TEMPLATE_ID, $templateId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($templateId['max'])) {
|
||||
$this->addUsingAlias(ProductTableMap::TEMPLATE_ID, $templateId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ProductTableMap::TEMPLATE_ID, $templateId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
@@ -773,6 +824,81 @@ abstract class ProductQuery extends ModelCriteria
|
||||
->useQuery($relationAlias ? $relationAlias : 'TaxRule', '\Thelia\Model\TaxRuleQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Template object
|
||||
*
|
||||
* @param \Thelia\Model\Template|ObjectCollection $template The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildProductQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByTemplate($template, $comparison = null)
|
||||
{
|
||||
if ($template instanceof \Thelia\Model\Template) {
|
||||
return $this
|
||||
->addUsingAlias(ProductTableMap::TEMPLATE_ID, $template->getId(), $comparison);
|
||||
} elseif ($template instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(ProductTableMap::TEMPLATE_ID, $template->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByTemplate() only accepts arguments of type \Thelia\Model\Template or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Template relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildProductQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Template');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Template');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Template relation Template object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\TemplateQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinTemplate($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Template', '\Thelia\Model\TemplateQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\ProductCategory object
|
||||
*
|
||||
|
||||
@@ -86,6 +86,12 @@ abstract class ProductVersion implements ActiveRecordInterface
|
||||
*/
|
||||
protected $position;
|
||||
|
||||
/**
|
||||
* The value for the template_id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $template_id;
|
||||
|
||||
/**
|
||||
* The value for the created_at field.
|
||||
* @var string
|
||||
@@ -453,6 +459,17 @@ abstract class ProductVersion implements ActiveRecordInterface
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [template_id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTemplateId()
|
||||
{
|
||||
|
||||
return $this->template_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
@@ -644,6 +661,27 @@ abstract class ProductVersion implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setPosition()
|
||||
|
||||
/**
|
||||
* Set the value of [template_id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return \Thelia\Model\ProductVersion The current object (for fluent API support)
|
||||
*/
|
||||
public function setTemplateId($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->template_id !== $v) {
|
||||
$this->template_id = $v;
|
||||
$this->modifiedColumns[] = ProductVersionTableMap::TEMPLATE_ID;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setTemplateId()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
@@ -809,28 +847,31 @@ abstract class ProductVersion implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductVersionTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->position = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductVersionTableMap::translateFieldName('TemplateId', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->template_id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->version = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->version_created_by = (null !== $col) ? (string) $col : null;
|
||||
$this->resetModified();
|
||||
|
||||
@@ -840,7 +881,7 @@ abstract class ProductVersion implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 10; // 10 = ProductVersionTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 11; // 11 = ProductVersionTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\ProductVersion object", 0, $e);
|
||||
@@ -1076,6 +1117,9 @@ abstract class ProductVersion implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(ProductVersionTableMap::POSITION)) {
|
||||
$modifiedColumns[':p' . $index++] = 'POSITION';
|
||||
}
|
||||
if ($this->isColumnModified(ProductVersionTableMap::TEMPLATE_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'TEMPLATE_ID';
|
||||
}
|
||||
if ($this->isColumnModified(ProductVersionTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||
}
|
||||
@@ -1117,6 +1161,9 @@ abstract class ProductVersion implements ActiveRecordInterface
|
||||
case 'POSITION':
|
||||
$stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'TEMPLATE_ID':
|
||||
$stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'CREATED_AT':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1203,18 +1250,21 @@ abstract class ProductVersion implements ActiveRecordInterface
|
||||
return $this->getPosition();
|
||||
break;
|
||||
case 5:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getTemplateId();
|
||||
break;
|
||||
case 6:
|
||||
return $this->getUpdatedAt();
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 7:
|
||||
return $this->getVersion();
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
case 8:
|
||||
return $this->getVersionCreatedAt();
|
||||
return $this->getVersion();
|
||||
break;
|
||||
case 9:
|
||||
return $this->getVersionCreatedAt();
|
||||
break;
|
||||
case 10:
|
||||
return $this->getVersionCreatedBy();
|
||||
break;
|
||||
default:
|
||||
@@ -1251,11 +1301,12 @@ abstract class ProductVersion implements ActiveRecordInterface
|
||||
$keys[2] => $this->getRef(),
|
||||
$keys[3] => $this->getVisible(),
|
||||
$keys[4] => $this->getPosition(),
|
||||
$keys[5] => $this->getCreatedAt(),
|
||||
$keys[6] => $this->getUpdatedAt(),
|
||||
$keys[7] => $this->getVersion(),
|
||||
$keys[8] => $this->getVersionCreatedAt(),
|
||||
$keys[9] => $this->getVersionCreatedBy(),
|
||||
$keys[5] => $this->getTemplateId(),
|
||||
$keys[6] => $this->getCreatedAt(),
|
||||
$keys[7] => $this->getUpdatedAt(),
|
||||
$keys[8] => $this->getVersion(),
|
||||
$keys[9] => $this->getVersionCreatedAt(),
|
||||
$keys[10] => $this->getVersionCreatedBy(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -1317,18 +1368,21 @@ abstract class ProductVersion implements ActiveRecordInterface
|
||||
$this->setPosition($value);
|
||||
break;
|
||||
case 5:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setTemplateId($value);
|
||||
break;
|
||||
case 6:
|
||||
$this->setUpdatedAt($value);
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 7:
|
||||
$this->setVersion($value);
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
case 8:
|
||||
$this->setVersionCreatedAt($value);
|
||||
$this->setVersion($value);
|
||||
break;
|
||||
case 9:
|
||||
$this->setVersionCreatedAt($value);
|
||||
break;
|
||||
case 10:
|
||||
$this->setVersionCreatedBy($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1360,11 +1414,12 @@ abstract class ProductVersion implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[2], $arr)) $this->setRef($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setVisible($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setVersion($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedAt($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedBy($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setTemplateId($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setVersion($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedAt($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedBy($arr[$keys[10]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1381,6 +1436,7 @@ abstract class ProductVersion implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(ProductVersionTableMap::REF)) $criteria->add(ProductVersionTableMap::REF, $this->ref);
|
||||
if ($this->isColumnModified(ProductVersionTableMap::VISIBLE)) $criteria->add(ProductVersionTableMap::VISIBLE, $this->visible);
|
||||
if ($this->isColumnModified(ProductVersionTableMap::POSITION)) $criteria->add(ProductVersionTableMap::POSITION, $this->position);
|
||||
if ($this->isColumnModified(ProductVersionTableMap::TEMPLATE_ID)) $criteria->add(ProductVersionTableMap::TEMPLATE_ID, $this->template_id);
|
||||
if ($this->isColumnModified(ProductVersionTableMap::CREATED_AT)) $criteria->add(ProductVersionTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(ProductVersionTableMap::UPDATED_AT)) $criteria->add(ProductVersionTableMap::UPDATED_AT, $this->updated_at);
|
||||
if ($this->isColumnModified(ProductVersionTableMap::VERSION)) $criteria->add(ProductVersionTableMap::VERSION, $this->version);
|
||||
@@ -1461,6 +1517,7 @@ abstract class ProductVersion implements ActiveRecordInterface
|
||||
$copyObj->setRef($this->getRef());
|
||||
$copyObj->setVisible($this->getVisible());
|
||||
$copyObj->setPosition($this->getPosition());
|
||||
$copyObj->setTemplateId($this->getTemplateId());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
$copyObj->setVersion($this->getVersion());
|
||||
@@ -1554,6 +1611,7 @@ abstract class ProductVersion implements ActiveRecordInterface
|
||||
$this->ref = null;
|
||||
$this->visible = null;
|
||||
$this->position = null;
|
||||
$this->template_id = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->version = null;
|
||||
|
||||
@@ -26,6 +26,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
|
||||
* @method ChildProductVersionQuery orderByRef($order = Criteria::ASC) Order by the ref column
|
||||
* @method ChildProductVersionQuery orderByVisible($order = Criteria::ASC) Order by the visible column
|
||||
* @method ChildProductVersionQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
||||
* @method ChildProductVersionQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column
|
||||
* @method ChildProductVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildProductVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
* @method ChildProductVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
||||
@@ -37,6 +38,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
|
||||
* @method ChildProductVersionQuery groupByRef() Group by the ref column
|
||||
* @method ChildProductVersionQuery groupByVisible() Group by the visible column
|
||||
* @method ChildProductVersionQuery groupByPosition() Group by the position column
|
||||
* @method ChildProductVersionQuery groupByTemplateId() Group by the template_id column
|
||||
* @method ChildProductVersionQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildProductVersionQuery groupByUpdatedAt() Group by the updated_at column
|
||||
* @method ChildProductVersionQuery groupByVersion() Group by the version column
|
||||
@@ -59,6 +61,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
|
||||
* @method ChildProductVersion findOneByRef(string $ref) Return the first ChildProductVersion filtered by the ref column
|
||||
* @method ChildProductVersion findOneByVisible(int $visible) Return the first ChildProductVersion filtered by the visible column
|
||||
* @method ChildProductVersion findOneByPosition(int $position) Return the first ChildProductVersion filtered by the position column
|
||||
* @method ChildProductVersion findOneByTemplateId(int $template_id) Return the first ChildProductVersion filtered by the template_id column
|
||||
* @method ChildProductVersion findOneByCreatedAt(string $created_at) Return the first ChildProductVersion filtered by the created_at column
|
||||
* @method ChildProductVersion findOneByUpdatedAt(string $updated_at) Return the first ChildProductVersion filtered by the updated_at column
|
||||
* @method ChildProductVersion findOneByVersion(int $version) Return the first ChildProductVersion filtered by the version column
|
||||
@@ -70,6 +73,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
|
||||
* @method array findByRef(string $ref) Return ChildProductVersion objects filtered by the ref column
|
||||
* @method array findByVisible(int $visible) Return ChildProductVersion objects filtered by the visible column
|
||||
* @method array findByPosition(int $position) Return ChildProductVersion objects filtered by the position column
|
||||
* @method array findByTemplateId(int $template_id) Return ChildProductVersion objects filtered by the template_id column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildProductVersion objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildProductVersion objects filtered by the updated_at column
|
||||
* @method array findByVersion(int $version) Return ChildProductVersion objects filtered by the version column
|
||||
@@ -163,7 +167,7 @@ abstract class ProductVersionQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, TAX_RULE_ID, REF, VISIBLE, POSITION, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM product_version WHERE ID = :p0 AND VERSION = :p1';
|
||||
$sql = 'SELECT ID, TAX_RULE_ID, REF, VISIBLE, POSITION, TEMPLATE_ID, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM product_version WHERE ID = :p0 AND VERSION = :p1';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
|
||||
@@ -459,6 +463,47 @@ abstract class ProductVersionQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(ProductVersionTableMap::POSITION, $position, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the template_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByTemplateId(1234); // WHERE template_id = 1234
|
||||
* $query->filterByTemplateId(array(12, 34)); // WHERE template_id IN (12, 34)
|
||||
* $query->filterByTemplateId(array('min' => 12)); // WHERE template_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $templateId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildProductVersionQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByTemplateId($templateId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($templateId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($templateId['min'])) {
|
||||
$this->addUsingAlias(ProductVersionTableMap::TEMPLATE_ID, $templateId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($templateId['max'])) {
|
||||
$this->addUsingAlias(ProductVersionTableMap::TEMPLATE_ID, $templateId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ProductVersionTableMap::TEMPLATE_ID, $templateId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
|
||||
@@ -1434,6 +1434,31 @@ abstract class TaxRule implements ActiveRecordInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this TaxRule is new, it will return
|
||||
* an empty collection; or if this TaxRule has previously
|
||||
* been saved, it will retrieve related Products from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
* actually need in TaxRule.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return Collection|ChildProduct[] List of ChildProduct objects
|
||||
*/
|
||||
public function getProductsJoinTemplate($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = ChildProductQuery::create(null, $criteria);
|
||||
$query->joinWith('Template', $joinBehavior);
|
||||
|
||||
return $this->getProducts($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collTaxRuleCountries collection
|
||||
*
|
||||
|
||||
3019
core/lib/Thelia/Model/Base/Template.php
Normal file
3019
core/lib/Thelia/Model/Base/Template.php
Normal file
File diff suppressed because it is too large
Load Diff
1265
core/lib/Thelia/Model/Base/TemplateI18n.php
Normal file
1265
core/lib/Thelia/Model/Base/TemplateI18n.php
Normal file
File diff suppressed because it is too large
Load Diff
508
core/lib/Thelia/Model/Base/TemplateI18nQuery.php
Normal file
508
core/lib/Thelia/Model/Base/TemplateI18nQuery.php
Normal file
@@ -0,0 +1,508 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelJoin;
|
||||
use Propel\Runtime\Collection\Collection;
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Thelia\Model\TemplateI18n as ChildTemplateI18n;
|
||||
use Thelia\Model\TemplateI18nQuery as ChildTemplateI18nQuery;
|
||||
use Thelia\Model\Map\TemplateI18nTableMap;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'template_i18n' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildTemplateI18nQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildTemplateI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
|
||||
* @method ChildTemplateI18nQuery orderByName($order = Criteria::ASC) Order by the name column
|
||||
*
|
||||
* @method ChildTemplateI18nQuery groupById() Group by the id column
|
||||
* @method ChildTemplateI18nQuery groupByLocale() Group by the locale column
|
||||
* @method ChildTemplateI18nQuery groupByName() Group by the name column
|
||||
*
|
||||
* @method ChildTemplateI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildTemplateI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildTemplateI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildTemplateI18nQuery leftJoinTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the Template relation
|
||||
* @method ChildTemplateI18nQuery rightJoinTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Template relation
|
||||
* @method ChildTemplateI18nQuery innerJoinTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the Template relation
|
||||
*
|
||||
* @method ChildTemplateI18n findOne(ConnectionInterface $con = null) Return the first ChildTemplateI18n matching the query
|
||||
* @method ChildTemplateI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildTemplateI18n matching the query, or a new ChildTemplateI18n object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildTemplateI18n findOneById(int $id) Return the first ChildTemplateI18n filtered by the id column
|
||||
* @method ChildTemplateI18n findOneByLocale(string $locale) Return the first ChildTemplateI18n filtered by the locale column
|
||||
* @method ChildTemplateI18n findOneByName(string $name) Return the first ChildTemplateI18n filtered by the name column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildTemplateI18n objects filtered by the id column
|
||||
* @method array findByLocale(string $locale) Return ChildTemplateI18n objects filtered by the locale column
|
||||
* @method array findByName(string $name) Return ChildTemplateI18n objects filtered by the name column
|
||||
*
|
||||
*/
|
||||
abstract class TemplateI18nQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \Thelia\Model\Base\TemplateI18nQuery object.
|
||||
*
|
||||
* @param string $dbName The database name
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\TemplateI18n', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildTemplateI18nQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildTemplateI18nQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \Thelia\Model\TemplateI18nQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \Thelia\Model\TemplateI18nQuery();
|
||||
if (null !== $modelAlias) {
|
||||
$query->setModelAlias($modelAlias);
|
||||
}
|
||||
if ($criteria instanceof Criteria) {
|
||||
$query->mergeWith($criteria);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
* Propel uses the instance pool to skip the database if the object exists.
|
||||
* Go fast if the query is untouched.
|
||||
*
|
||||
* <code>
|
||||
* $obj = $c->findPk(array(12, 34), $con);
|
||||
* </code>
|
||||
*
|
||||
* @param array[$id, $locale] $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ChildTemplateI18n|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = TemplateI18nTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(TemplateI18nTableMap::DATABASE_NAME);
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|
||||
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|
||||
|| $this->map || $this->having || $this->joins) {
|
||||
return $this->findPkComplex($key, $con);
|
||||
} else {
|
||||
return $this->findPkSimple($key, $con);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key using raw SQL to go fast.
|
||||
* Bypass doSelect() and the object formatter by using generated code.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildTemplateI18n A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, LOCALE, NAME FROM template_i18n WHERE ID = :p0 AND LOCALE = :p1';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
|
||||
$stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
|
||||
$stmt->execute();
|
||||
} catch (Exception $e) {
|
||||
Propel::log($e->getMessage(), Propel::LOG_ERR);
|
||||
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
|
||||
}
|
||||
$obj = null;
|
||||
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
|
||||
$obj = new ChildTemplateI18n();
|
||||
$obj->hydrate($row);
|
||||
TemplateI18nTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildTemplateI18n|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
protected function findPkComplex($key, $con)
|
||||
{
|
||||
// As the query uses a PK condition, no limit(1) is necessary.
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKey($key)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find objects by primary key
|
||||
* <code>
|
||||
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
|
||||
* </code>
|
||||
* @param array $keys Primary keys to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
|
||||
*/
|
||||
public function findPks($keys, $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKeys($keys)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by primary key
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
*
|
||||
* @return ChildTemplateI18nQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
$this->addUsingAlias(TemplateI18nTableMap::ID, $key[0], Criteria::EQUAL);
|
||||
$this->addUsingAlias(TemplateI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a list of primary keys
|
||||
*
|
||||
* @param array $keys The list of primary key to use for the query
|
||||
*
|
||||
* @return ChildTemplateI18nQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
if (empty($keys)) {
|
||||
return $this->add(null, '1<>1', Criteria::CUSTOM);
|
||||
}
|
||||
foreach ($keys as $key) {
|
||||
$cton0 = $this->getNewCriterion(TemplateI18nTableMap::ID, $key[0], Criteria::EQUAL);
|
||||
$cton1 = $this->getNewCriterion(TemplateI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
|
||||
$cton0->addAnd($cton1);
|
||||
$this->addOr($cton0);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterById(1234); // WHERE id = 1234
|
||||
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
|
||||
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByTemplate()
|
||||
*
|
||||
* @param mixed $id The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildTemplateI18nQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterById($id = null, $comparison = null)
|
||||
{
|
||||
if (is_array($id)) {
|
||||
$useMinMax = false;
|
||||
if (isset($id['min'])) {
|
||||
$this->addUsingAlias(TemplateI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(TemplateI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(TemplateI18nTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the locale column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
|
||||
* $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $locale The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildTemplateI18nQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByLocale($locale = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($locale)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $locale)) {
|
||||
$locale = str_replace('*', '%', $locale);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(TemplateI18nTableMap::LOCALE, $locale, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the name column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByName('fooValue'); // WHERE name = 'fooValue'
|
||||
* $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $name The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildTemplateI18nQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByName($name = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($name)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $name)) {
|
||||
$name = str_replace('*', '%', $name);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(TemplateI18nTableMap::NAME, $name, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Template object
|
||||
*
|
||||
* @param \Thelia\Model\Template|ObjectCollection $template The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildTemplateI18nQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByTemplate($template, $comparison = null)
|
||||
{
|
||||
if ($template instanceof \Thelia\Model\Template) {
|
||||
return $this
|
||||
->addUsingAlias(TemplateI18nTableMap::ID, $template->getId(), $comparison);
|
||||
} elseif ($template instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(TemplateI18nTableMap::ID, $template->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByTemplate() only accepts arguments of type \Thelia\Model\Template or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Template relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildTemplateI18nQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinTemplate($relationAlias = null, $joinType = 'LEFT JOIN')
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Template');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Template');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Template relation Template object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\TemplateQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useTemplateQuery($relationAlias = null, $joinType = 'LEFT JOIN')
|
||||
{
|
||||
return $this
|
||||
->joinTemplate($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Template', '\Thelia\Model\TemplateQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildTemplateI18n $templateI18n Object to remove from the list of results
|
||||
*
|
||||
* @return ChildTemplateI18nQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($templateI18n = null)
|
||||
{
|
||||
if ($templateI18n) {
|
||||
$this->addCond('pruneCond0', $this->getAliasedColName(TemplateI18nTableMap::ID), $templateI18n->getId(), Criteria::NOT_EQUAL);
|
||||
$this->addCond('pruneCond1', $this->getAliasedColName(TemplateI18nTableMap::LOCALE), $templateI18n->getLocale(), Criteria::NOT_EQUAL);
|
||||
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the template_i18n table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(TemplateI18nTableMap::DATABASE_NAME);
|
||||
}
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
$affectedRows += parent::doDeleteAll($con);
|
||||
// Because this db requires some delete cascade/set null emulation, we have to
|
||||
// clear the cached instance *after* the emulation has happened (since
|
||||
// instances get re-added by the select statement contained therein).
|
||||
TemplateI18nTableMap::clearInstancePool();
|
||||
TemplateI18nTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildTemplateI18n or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildTemplateI18n object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public function delete(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(TemplateI18nTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(TemplateI18nTableMap::DATABASE_NAME);
|
||||
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
|
||||
|
||||
TemplateI18nTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
TemplateI18nTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // TemplateI18nQuery
|
||||
907
core/lib/Thelia/Model/Base/TemplateQuery.php
Normal file
907
core/lib/Thelia/Model/Base/TemplateQuery.php
Normal file
@@ -0,0 +1,907 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelJoin;
|
||||
use Propel\Runtime\Collection\Collection;
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Thelia\Model\Template as ChildTemplate;
|
||||
use Thelia\Model\TemplateI18nQuery as ChildTemplateI18nQuery;
|
||||
use Thelia\Model\TemplateQuery as ChildTemplateQuery;
|
||||
use Thelia\Model\Map\TemplateTableMap;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'template' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildTemplateQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildTemplateQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildTemplateQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
* @method ChildTemplateQuery groupById() Group by the id column
|
||||
* @method ChildTemplateQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildTemplateQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
* @method ChildTemplateQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildTemplateQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildTemplateQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildTemplateQuery leftJoinProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the Product relation
|
||||
* @method ChildTemplateQuery rightJoinProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Product relation
|
||||
* @method ChildTemplateQuery innerJoinProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the Product relation
|
||||
*
|
||||
* @method ChildTemplateQuery leftJoinFeatureTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureTemplate relation
|
||||
* @method ChildTemplateQuery rightJoinFeatureTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureTemplate relation
|
||||
* @method ChildTemplateQuery innerJoinFeatureTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureTemplate relation
|
||||
*
|
||||
* @method ChildTemplateQuery leftJoinAttributeTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeTemplate relation
|
||||
* @method ChildTemplateQuery rightJoinAttributeTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeTemplate relation
|
||||
* @method ChildTemplateQuery innerJoinAttributeTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeTemplate relation
|
||||
*
|
||||
* @method ChildTemplateQuery leftJoinTemplateI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the TemplateI18n relation
|
||||
* @method ChildTemplateQuery rightJoinTemplateI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TemplateI18n relation
|
||||
* @method ChildTemplateQuery innerJoinTemplateI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the TemplateI18n relation
|
||||
*
|
||||
* @method ChildTemplate findOne(ConnectionInterface $con = null) Return the first ChildTemplate matching the query
|
||||
* @method ChildTemplate findOneOrCreate(ConnectionInterface $con = null) Return the first ChildTemplate matching the query, or a new ChildTemplate object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildTemplate findOneById(int $id) Return the first ChildTemplate filtered by the id column
|
||||
* @method ChildTemplate findOneByCreatedAt(string $created_at) Return the first ChildTemplate filtered by the created_at column
|
||||
* @method ChildTemplate findOneByUpdatedAt(string $updated_at) Return the first ChildTemplate filtered by the updated_at column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildTemplate objects filtered by the id column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildTemplate objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildTemplate objects filtered by the updated_at column
|
||||
*
|
||||
*/
|
||||
abstract class TemplateQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \Thelia\Model\Base\TemplateQuery object.
|
||||
*
|
||||
* @param string $dbName The database name
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\Template', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildTemplateQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildTemplateQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \Thelia\Model\TemplateQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \Thelia\Model\TemplateQuery();
|
||||
if (null !== $modelAlias) {
|
||||
$query->setModelAlias($modelAlias);
|
||||
}
|
||||
if ($criteria instanceof Criteria) {
|
||||
$query->mergeWith($criteria);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
* Propel uses the instance pool to skip the database if the object exists.
|
||||
* Go fast if the query is untouched.
|
||||
*
|
||||
* <code>
|
||||
* $obj = $c->findPk(12, $con);
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ChildTemplate|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = TemplateTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(TemplateTableMap::DATABASE_NAME);
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|
||||
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|
||||
|| $this->map || $this->having || $this->joins) {
|
||||
return $this->findPkComplex($key, $con);
|
||||
} else {
|
||||
return $this->findPkSimple($key, $con);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key using raw SQL to go fast.
|
||||
* Bypass doSelect() and the object formatter by using generated code.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildTemplate A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, CREATED_AT, UPDATED_AT FROM template WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
} catch (Exception $e) {
|
||||
Propel::log($e->getMessage(), Propel::LOG_ERR);
|
||||
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
|
||||
}
|
||||
$obj = null;
|
||||
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
|
||||
$obj = new ChildTemplate();
|
||||
$obj->hydrate($row);
|
||||
TemplateTableMap::addInstanceToPool($obj, (string) $key);
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildTemplate|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
protected function findPkComplex($key, $con)
|
||||
{
|
||||
// As the query uses a PK condition, no limit(1) is necessary.
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKey($key)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find objects by primary key
|
||||
* <code>
|
||||
* $objs = $c->findPks(array(12, 56, 832), $con);
|
||||
* </code>
|
||||
* @param array $keys Primary keys to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
|
||||
*/
|
||||
public function findPks($keys, $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKeys($keys)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by primary key
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(TemplateTableMap::ID, $key, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a list of primary keys
|
||||
*
|
||||
* @param array $keys The list of primary key to use for the query
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(TemplateTableMap::ID, $keys, Criteria::IN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterById(1234); // WHERE id = 1234
|
||||
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
|
||||
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $id The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterById($id = null, $comparison = null)
|
||||
{
|
||||
if (is_array($id)) {
|
||||
$useMinMax = false;
|
||||
if (isset($id['min'])) {
|
||||
$this->addUsingAlias(TemplateTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(TemplateTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(TemplateTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
|
||||
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
|
||||
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $createdAt The value to use as filter.
|
||||
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||
* Empty strings are treated as NULL.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCreatedAt($createdAt = null, $comparison = null)
|
||||
{
|
||||
if (is_array($createdAt)) {
|
||||
$useMinMax = false;
|
||||
if (isset($createdAt['min'])) {
|
||||
$this->addUsingAlias(TemplateTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($createdAt['max'])) {
|
||||
$this->addUsingAlias(TemplateTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(TemplateTableMap::CREATED_AT, $createdAt, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the updated_at column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
|
||||
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
|
||||
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $updatedAt The value to use as filter.
|
||||
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||
* Empty strings are treated as NULL.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
|
||||
{
|
||||
if (is_array($updatedAt)) {
|
||||
$useMinMax = false;
|
||||
if (isset($updatedAt['min'])) {
|
||||
$this->addUsingAlias(TemplateTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($updatedAt['max'])) {
|
||||
$this->addUsingAlias(TemplateTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(TemplateTableMap::UPDATED_AT, $updatedAt, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Product object
|
||||
*
|
||||
* @param \Thelia\Model\Product|ObjectCollection $product the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByProduct($product, $comparison = null)
|
||||
{
|
||||
if ($product instanceof \Thelia\Model\Product) {
|
||||
return $this
|
||||
->addUsingAlias(TemplateTableMap::ID, $product->getTemplateId(), $comparison);
|
||||
} elseif ($product instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useProductQuery()
|
||||
->filterByPrimaryKeys($product->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByProduct() only accepts arguments of type \Thelia\Model\Product or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Product relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Product');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Product');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Product relation Product object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinProduct($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\FeatureTemplate object
|
||||
*
|
||||
* @param \Thelia\Model\FeatureTemplate|ObjectCollection $featureTemplate the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByFeatureTemplate($featureTemplate, $comparison = null)
|
||||
{
|
||||
if ($featureTemplate instanceof \Thelia\Model\FeatureTemplate) {
|
||||
return $this
|
||||
->addUsingAlias(TemplateTableMap::ID, $featureTemplate->getTemplateId(), $comparison);
|
||||
} elseif ($featureTemplate instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useFeatureTemplateQuery()
|
||||
->filterByPrimaryKeys($featureTemplate->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByFeatureTemplate() only accepts arguments of type \Thelia\Model\FeatureTemplate or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the FeatureTemplate relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinFeatureTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('FeatureTemplate');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'FeatureTemplate');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the FeatureTemplate relation FeatureTemplate object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\FeatureTemplateQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useFeatureTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinFeatureTemplate($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'FeatureTemplate', '\Thelia\Model\FeatureTemplateQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\AttributeTemplate object
|
||||
*
|
||||
* @param \Thelia\Model\AttributeTemplate|ObjectCollection $attributeTemplate the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAttributeTemplate($attributeTemplate, $comparison = null)
|
||||
{
|
||||
if ($attributeTemplate instanceof \Thelia\Model\AttributeTemplate) {
|
||||
return $this
|
||||
->addUsingAlias(TemplateTableMap::ID, $attributeTemplate->getTemplateId(), $comparison);
|
||||
} elseif ($attributeTemplate instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useAttributeTemplateQuery()
|
||||
->filterByPrimaryKeys($attributeTemplate->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByAttributeTemplate() only accepts arguments of type \Thelia\Model\AttributeTemplate or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the AttributeTemplate relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinAttributeTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('AttributeTemplate');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'AttributeTemplate');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the AttributeTemplate relation AttributeTemplate object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\AttributeTemplateQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAttributeTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinAttributeTemplate($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'AttributeTemplate', '\Thelia\Model\AttributeTemplateQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\TemplateI18n object
|
||||
*
|
||||
* @param \Thelia\Model\TemplateI18n|ObjectCollection $templateI18n the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByTemplateI18n($templateI18n, $comparison = null)
|
||||
{
|
||||
if ($templateI18n instanceof \Thelia\Model\TemplateI18n) {
|
||||
return $this
|
||||
->addUsingAlias(TemplateTableMap::ID, $templateI18n->getId(), $comparison);
|
||||
} elseif ($templateI18n instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useTemplateI18nQuery()
|
||||
->filterByPrimaryKeys($templateI18n->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByTemplateI18n() only accepts arguments of type \Thelia\Model\TemplateI18n or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the TemplateI18n relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinTemplateI18n($relationAlias = null, $joinType = 'LEFT JOIN')
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('TemplateI18n');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'TemplateI18n');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the TemplateI18n relation TemplateI18n object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\TemplateI18nQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useTemplateI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
|
||||
{
|
||||
return $this
|
||||
->joinTemplateI18n($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'TemplateI18n', '\Thelia\Model\TemplateI18nQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Feature object
|
||||
* using the feature_template table as cross reference
|
||||
*
|
||||
* @param Feature $feature the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByFeature($feature, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useFeatureTemplateQuery()
|
||||
->filterByFeature($feature, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Attribute object
|
||||
* using the attribute_template table as cross reference
|
||||
*
|
||||
* @param Attribute $attribute the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAttribute($attribute, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useAttributeTemplateQuery()
|
||||
->filterByAttribute($attribute, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildTemplate $template Object to remove from the list of results
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($template = null)
|
||||
{
|
||||
if ($template) {
|
||||
$this->addUsingAlias(TemplateTableMap::ID, $template->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the template table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(TemplateTableMap::DATABASE_NAME);
|
||||
}
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
$affectedRows += parent::doDeleteAll($con);
|
||||
// Because this db requires some delete cascade/set null emulation, we have to
|
||||
// clear the cached instance *after* the emulation has happened (since
|
||||
// instances get re-added by the select statement contained therein).
|
||||
TemplateTableMap::clearInstancePool();
|
||||
TemplateTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildTemplate or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildTemplate object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public function delete(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(TemplateTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(TemplateTableMap::DATABASE_NAME);
|
||||
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
|
||||
|
||||
TemplateTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
TemplateTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
// i18n behavior
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the i18n relation
|
||||
*
|
||||
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$relationName = $relationAlias ? $relationAlias : 'TemplateI18n';
|
||||
|
||||
return $this
|
||||
->joinTemplateI18n($relationAlias, $joinType)
|
||||
->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query and hydrates the related I18n object.
|
||||
* Shortcut for $c->joinI18n($locale)->with()
|
||||
*
|
||||
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$this
|
||||
->joinI18n($locale, null, $joinType)
|
||||
->with('TemplateI18n');
|
||||
$this->with['TemplateI18n']->setIsWithOneToMany(false);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the I18n relation query object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
|
||||
*
|
||||
* @return ChildTemplateI18nQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinI18n($locale, $relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'TemplateI18n', '\Thelia\Model\TemplateI18nQuery');
|
||||
}
|
||||
|
||||
// timestampable behavior
|
||||
|
||||
/**
|
||||
* Filter by the latest updated
|
||||
*
|
||||
* @param int $nbDays Maximum age of the latest update in days
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function recentlyUpdated($nbDays = 7)
|
||||
{
|
||||
return $this->addUsingAlias(TemplateTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter by the latest created
|
||||
*
|
||||
* @param int $nbDays Maximum age of in days
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function recentlyCreated($nbDays = 7)
|
||||
{
|
||||
return $this->addUsingAlias(TemplateTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by update date desc
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function lastUpdatedFirst()
|
||||
{
|
||||
return $this->addDescendingOrderByColumn(TemplateTableMap::UPDATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by update date asc
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function firstUpdatedFirst()
|
||||
{
|
||||
return $this->addAscendingOrderByColumn(TemplateTableMap::UPDATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by create date desc
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function lastCreatedFirst()
|
||||
{
|
||||
return $this->addDescendingOrderByColumn(TemplateTableMap::CREATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by create date asc
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function firstCreatedFirst()
|
||||
{
|
||||
return $this->addAscendingOrderByColumn(TemplateTableMap::CREATED_AT);
|
||||
}
|
||||
|
||||
} // TemplateQuery
|
||||
@@ -65,6 +65,7 @@ class Config extends BaseConfig {
|
||||
*/
|
||||
public function postUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->resetQueryCache();
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_UPDATECONFIG, new ConfigEvent($this));
|
||||
}
|
||||
|
||||
@@ -83,6 +84,12 @@ class Config extends BaseConfig {
|
||||
*/
|
||||
public function postDelete(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->resetQueryCache();
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_DELETECONFIG, new ConfigEvent($this));
|
||||
}
|
||||
|
||||
public function resetQueryCache()
|
||||
{
|
||||
ConfigQuery::resetCache($this->getName());
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,32 @@ use Thelia\Model\Base\ConfigQuery as BaseConfigQuery;
|
||||
*
|
||||
*/
|
||||
class ConfigQuery extends BaseConfigQuery {
|
||||
|
||||
protected static $cache = array();
|
||||
|
||||
public static function read($search, $default = null)
|
||||
{
|
||||
if (array_key_exists($search, self::$cache)) {
|
||||
return self::$cache[$search];
|
||||
}
|
||||
|
||||
$value = self::create()->findOneByName($search);
|
||||
|
||||
return $value ? $value->getValue() : $default;
|
||||
self::$cache[$search] = $value ? $value->getValue() : $default;
|
||||
|
||||
return self::$cache[$search];
|
||||
}
|
||||
|
||||
public static function resetCache($key = null)
|
||||
{
|
||||
if($key) {
|
||||
if(array_key_exists($key, self::$cache)) {
|
||||
unset(self::$cache[$key]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
self::$cache = array();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function getDefaultLangWhenNoTranslationAvailable()
|
||||
|
||||
@@ -76,7 +76,6 @@ class Coupon extends BaseCoupon
|
||||
->setType($effect)
|
||||
->setAmount($amount)
|
||||
->setIsRemovingPostage($isRemovingPostage)
|
||||
->setType($amount)
|
||||
->setIsEnabled($isEnabled)
|
||||
->setExpirationDate($expirationDate)
|
||||
->setIsAvailableOnSpecialOffers($isAvailableOnSpecialOffers)
|
||||
|
||||
@@ -205,11 +205,42 @@ class Customer extends BaseCustomer implements UserInterface
|
||||
return array(new Role('CUSTOMER'));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getToken() {
|
||||
return $this->getRememberMeToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setToken($token) {
|
||||
$this->setRememberMeToken($token)->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSerial() {
|
||||
return $this->getRememberMeSerial();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setSerial($serial) {
|
||||
$this->setRememberMeSerial($serial)->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
// Set the serial number (for auto-login)
|
||||
$this->setRememberMeSerial(uniqid());
|
||||
|
||||
$this->setRef($this->generateRef());
|
||||
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_CREATECUSTOMER, new CustomerEvent($this));
|
||||
|
||||
10
core/lib/Thelia/Model/FeatureTemplate.php
Normal file
10
core/lib/Thelia/Model/FeatureTemplate.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\FeatureTemplate as BaseFeatureTemplate;
|
||||
|
||||
class FeatureTemplate extends BaseFeatureTemplate
|
||||
{
|
||||
|
||||
}
|
||||
21
core/lib/Thelia/Model/FeatureTemplateQuery.php
Normal file
21
core/lib/Thelia/Model/FeatureTemplateQuery.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\FeatureTemplateQuery as BaseFeatureTemplateQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'feature_template' 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 FeatureTemplateQuery extends BaseFeatureTemplateQuery
|
||||
{
|
||||
|
||||
} // FeatureTemplateQuery
|
||||
@@ -57,7 +57,7 @@ class AdminTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 9;
|
||||
const NUM_COLUMNS = 11;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class AdminTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 9;
|
||||
const NUM_HYDRATE_COLUMNS = 11;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -104,6 +104,16 @@ class AdminTableMap extends TableMap
|
||||
*/
|
||||
const SALT = 'admin.SALT';
|
||||
|
||||
/**
|
||||
* the column name for the REMEMBER_ME_TOKEN field
|
||||
*/
|
||||
const REMEMBER_ME_TOKEN = 'admin.REMEMBER_ME_TOKEN';
|
||||
|
||||
/**
|
||||
* the column name for the REMEMBER_ME_SERIAL field
|
||||
*/
|
||||
const REMEMBER_ME_SERIAL = 'admin.REMEMBER_ME_SERIAL';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
@@ -126,12 +136,12 @@ class AdminTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Firstname', 'Lastname', 'Login', 'Password', 'Algo', 'Salt', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(AdminTableMap::ID, AdminTableMap::FIRSTNAME, AdminTableMap::LASTNAME, AdminTableMap::LOGIN, AdminTableMap::PASSWORD, AdminTableMap::ALGO, AdminTableMap::SALT, AdminTableMap::CREATED_AT, AdminTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'FIRSTNAME', 'LASTNAME', 'LOGIN', 'PASSWORD', 'ALGO', 'SALT', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
|
||||
self::TYPE_PHPNAME => array('Id', 'Firstname', 'Lastname', 'Login', 'Password', 'Algo', 'Salt', 'RememberMeToken', 'RememberMeSerial', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'rememberMeToken', 'rememberMeSerial', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(AdminTableMap::ID, AdminTableMap::FIRSTNAME, AdminTableMap::LASTNAME, AdminTableMap::LOGIN, AdminTableMap::PASSWORD, AdminTableMap::ALGO, AdminTableMap::SALT, AdminTableMap::REMEMBER_ME_TOKEN, AdminTableMap::REMEMBER_ME_SERIAL, AdminTableMap::CREATED_AT, AdminTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'FIRSTNAME', 'LASTNAME', 'LOGIN', 'PASSWORD', 'ALGO', 'SALT', 'REMEMBER_ME_TOKEN', 'REMEMBER_ME_SERIAL', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'remember_me_token', 'remember_me_serial', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -141,12 +151,12 @@ class AdminTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Firstname' => 1, 'Lastname' => 2, 'Login' => 3, 'Password' => 4, 'Algo' => 5, 'Salt' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'createdAt' => 7, 'updatedAt' => 8, ),
|
||||
self::TYPE_COLNAME => array(AdminTableMap::ID => 0, AdminTableMap::FIRSTNAME => 1, AdminTableMap::LASTNAME => 2, AdminTableMap::LOGIN => 3, AdminTableMap::PASSWORD => 4, AdminTableMap::ALGO => 5, AdminTableMap::SALT => 6, AdminTableMap::CREATED_AT => 7, AdminTableMap::UPDATED_AT => 8, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'FIRSTNAME' => 1, 'LASTNAME' => 2, 'LOGIN' => 3, 'PASSWORD' => 4, 'ALGO' => 5, 'SALT' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'created_at' => 7, 'updated_at' => 8, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Firstname' => 1, 'Lastname' => 2, 'Login' => 3, 'Password' => 4, 'Algo' => 5, 'Salt' => 6, 'RememberMeToken' => 7, 'RememberMeSerial' => 8, 'CreatedAt' => 9, 'UpdatedAt' => 10, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'rememberMeToken' => 7, 'rememberMeSerial' => 8, 'createdAt' => 9, 'updatedAt' => 10, ),
|
||||
self::TYPE_COLNAME => array(AdminTableMap::ID => 0, AdminTableMap::FIRSTNAME => 1, AdminTableMap::LASTNAME => 2, AdminTableMap::LOGIN => 3, AdminTableMap::PASSWORD => 4, AdminTableMap::ALGO => 5, AdminTableMap::SALT => 6, AdminTableMap::REMEMBER_ME_TOKEN => 7, AdminTableMap::REMEMBER_ME_SERIAL => 8, AdminTableMap::CREATED_AT => 9, AdminTableMap::UPDATED_AT => 10, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'FIRSTNAME' => 1, 'LASTNAME' => 2, 'LOGIN' => 3, 'PASSWORD' => 4, 'ALGO' => 5, 'SALT' => 6, 'REMEMBER_ME_TOKEN' => 7, 'REMEMBER_ME_SERIAL' => 8, 'CREATED_AT' => 9, 'UPDATED_AT' => 10, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'remember_me_token' => 7, 'remember_me_serial' => 8, 'created_at' => 9, 'updated_at' => 10, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -172,6 +182,8 @@ class AdminTableMap extends TableMap
|
||||
$this->addColumn('PASSWORD', 'Password', 'VARCHAR', true, 128, null);
|
||||
$this->addColumn('ALGO', 'Algo', 'VARCHAR', false, 128, null);
|
||||
$this->addColumn('SALT', 'Salt', 'VARCHAR', false, 128, null);
|
||||
$this->addColumn('REMEMBER_ME_TOKEN', 'RememberMeToken', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('REMEMBER_ME_SERIAL', 'RememberMeSerial', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
@@ -352,6 +364,8 @@ class AdminTableMap extends TableMap
|
||||
$criteria->addSelectColumn(AdminTableMap::PASSWORD);
|
||||
$criteria->addSelectColumn(AdminTableMap::ALGO);
|
||||
$criteria->addSelectColumn(AdminTableMap::SALT);
|
||||
$criteria->addSelectColumn(AdminTableMap::REMEMBER_ME_TOKEN);
|
||||
$criteria->addSelectColumn(AdminTableMap::REMEMBER_ME_SERIAL);
|
||||
$criteria->addSelectColumn(AdminTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(AdminTableMap::UPDATED_AT);
|
||||
} else {
|
||||
@@ -362,6 +376,8 @@ class AdminTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.PASSWORD');
|
||||
$criteria->addSelectColumn($alias . '.ALGO');
|
||||
$criteria->addSelectColumn($alias . '.SALT');
|
||||
$criteria->addSelectColumn($alias . '.REMEMBER_ME_TOKEN');
|
||||
$criteria->addSelectColumn($alias . '.REMEMBER_ME_SERIAL');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
|
||||
@@ -162,9 +162,9 @@ class AttributeTableMap extends TableMap
|
||||
{
|
||||
$this->addRelation('AttributeAv', '\\Thelia\\Model\\AttributeAv', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT', 'AttributeAvs');
|
||||
$this->addRelation('AttributeCombination', '\\Thelia\\Model\\AttributeCombination', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT', 'AttributeCombinations');
|
||||
$this->addRelation('AttributeCategory', '\\Thelia\\Model\\AttributeCategory', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT', 'AttributeCategories');
|
||||
$this->addRelation('AttributeTemplate', '\\Thelia\\Model\\AttributeTemplate', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT', 'AttributeTemplates');
|
||||
$this->addRelation('AttributeI18n', '\\Thelia\\Model\\AttributeI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'AttributeI18ns');
|
||||
$this->addRelation('Category', '\\Thelia\\Model\\Category', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Categories');
|
||||
$this->addRelation('Template', '\\Thelia\\Model\\Template', RelationMap::MANY_TO_MANY, array(), null, null, 'Templates');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
@@ -189,7 +189,7 @@ class AttributeTableMap extends TableMap
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
AttributeAvTableMap::clearInstancePool();
|
||||
AttributeCombinationTableMap::clearInstancePool();
|
||||
AttributeCategoryTableMap::clearInstancePool();
|
||||
AttributeTemplateTableMap::clearInstancePool();
|
||||
AttributeI18nTableMap::clearInstancePool();
|
||||
}
|
||||
|
||||
|
||||
449
core/lib/Thelia/Model/Map/AttributeTemplateTableMap.php
Normal file
449
core/lib/Thelia/Model/Map/AttributeTemplateTableMap.php
Normal file
@@ -0,0 +1,449 @@
|
||||
<?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\AttributeTemplate;
|
||||
use Thelia\Model\AttributeTemplateQuery;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'attribute_template' 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 AttributeTemplateTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'Thelia.Model.Map.AttributeTemplateTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'attribute_template';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\Thelia\\Model\\AttributeTemplate';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'Thelia.Model.AttributeTemplate';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 5;
|
||||
|
||||
/**
|
||||
* 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 = 5;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'attribute_template.ID';
|
||||
|
||||
/**
|
||||
* the column name for the ATTRIBUTE_ID field
|
||||
*/
|
||||
const ATTRIBUTE_ID = 'attribute_template.ATTRIBUTE_ID';
|
||||
|
||||
/**
|
||||
* the column name for the TEMPLATE_ID field
|
||||
*/
|
||||
const TEMPLATE_ID = 'attribute_template.TEMPLATE_ID';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
const CREATED_AT = 'attribute_template.CREATED_AT';
|
||||
|
||||
/**
|
||||
* the column name for the UPDATED_AT field
|
||||
*/
|
||||
const UPDATED_AT = 'attribute_template.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', 'AttributeId', 'TemplateId', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'attributeId', 'templateId', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(AttributeTemplateTableMap::ID, AttributeTemplateTableMap::ATTRIBUTE_ID, AttributeTemplateTableMap::TEMPLATE_ID, AttributeTemplateTableMap::CREATED_AT, AttributeTemplateTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'ATTRIBUTE_ID', 'TEMPLATE_ID', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'attribute_id', 'template_id', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'AttributeId' => 1, 'TemplateId' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'attributeId' => 1, 'templateId' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
|
||||
self::TYPE_COLNAME => array(AttributeTemplateTableMap::ID => 0, AttributeTemplateTableMap::ATTRIBUTE_ID => 1, AttributeTemplateTableMap::TEMPLATE_ID => 2, AttributeTemplateTableMap::CREATED_AT => 3, AttributeTemplateTableMap::UPDATED_AT => 4, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ATTRIBUTE_ID' => 1, 'TEMPLATE_ID' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'attribute_id' => 1, 'template_id' => 2, 'created_at' => 3, 'updated_at' => 4, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialize the table attributes and columns
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('attribute_template');
|
||||
$this->setPhpName('AttributeTemplate');
|
||||
$this->setClassName('\\Thelia\\Model\\AttributeTemplate');
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
$this->setIsCrossRef(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('ATTRIBUTE_ID', 'AttributeId', 'INTEGER', 'attribute', 'ID', true, null, null);
|
||||
$this->addForeignKey('TEMPLATE_ID', 'TemplateId', 'INTEGER', 'template', 'ID', true, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Attribute', '\\Thelia\\Model\\Attribute', RelationMap::MANY_TO_ONE, array('attribute_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Template', '\\Thelia\\Model\\Template', RelationMap::MANY_TO_ONE, array('template_id' => 'id', ), null, null);
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the list of behaviors registered for this table
|
||||
*
|
||||
* @return array Associative array (name => parameters) of behaviors
|
||||
*/
|
||||
public function getBehaviors()
|
||||
{
|
||||
return array(
|
||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
|
||||
);
|
||||
} // getBehaviors()
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
*
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*/
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// If the PK cannot be derived from the row, return NULL.
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the primary key from the DB resultset row
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*
|
||||
* @return mixed The primary key of the row
|
||||
*/
|
||||
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
|
||||
return (int) $row[
|
||||
$indexType == TableMap::TYPE_NUM
|
||||
? 0 + $offset
|
||||
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* The class that the tableMap will make instances of.
|
||||
*
|
||||
* If $withPrefix is true, the returned path
|
||||
* uses a dot-path notation which is translated into a path
|
||||
* relative to a location on the PHP include_path.
|
||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||
*
|
||||
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||
* @return string path.to.ClassName
|
||||
*/
|
||||
public static function getOMClass($withPrefix = true)
|
||||
{
|
||||
return $withPrefix ? AttributeTemplateTableMap::CLASS_DEFAULT : AttributeTemplateTableMap::OM_CLASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates an object of the default type or an object that inherit from the default.
|
||||
*
|
||||
* @param array $row row returned by DataFetcher->fetch().
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
|
||||
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
|
||||
*
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @return array (AttributeTemplate object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = AttributeTemplateTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = AttributeTemplateTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, $offset, true); // rehydrate
|
||||
$col = $offset + AttributeTemplateTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = AttributeTemplateTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
AttributeTemplateTableMap::addInstanceToPool($obj, $key);
|
||||
}
|
||||
|
||||
return array($obj, $col);
|
||||
}
|
||||
|
||||
/**
|
||||
* The returned array will contain objects of the default type or
|
||||
* objects that inherit from the default.
|
||||
*
|
||||
* @param DataFetcherInterface $dataFetcher
|
||||
* @return array
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function populateObjects(DataFetcherInterface $dataFetcher)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = static::getOMClass(false);
|
||||
// populate the object(s)
|
||||
while ($row = $dataFetcher->fetch()) {
|
||||
$key = AttributeTemplateTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = AttributeTemplateTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, 0, true); // rehydrate
|
||||
$results[] = $obj;
|
||||
} else {
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($row);
|
||||
$results[] = $obj;
|
||||
AttributeTemplateTableMap::addInstanceToPool($obj, $key);
|
||||
} // if key exists
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
/**
|
||||
* Add all the columns needed to create a new object.
|
||||
*
|
||||
* Note: any columns that were marked with lazyLoad="true" in the
|
||||
* XML schema will not be added to the select list and only loaded
|
||||
* on demand.
|
||||
*
|
||||
* @param Criteria $criteria object containing the columns to add.
|
||||
* @param string $alias optional table alias
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function addSelectColumns(Criteria $criteria, $alias = null)
|
||||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(AttributeTemplateTableMap::ID);
|
||||
$criteria->addSelectColumn(AttributeTemplateTableMap::ATTRIBUTE_ID);
|
||||
$criteria->addSelectColumn(AttributeTemplateTableMap::TEMPLATE_ID);
|
||||
$criteria->addSelectColumn(AttributeTemplateTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(AttributeTemplateTableMap::UPDATED_AT);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.ATTRIBUTE_ID');
|
||||
$criteria->addSelectColumn($alias . '.TEMPLATE_ID');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TableMap related to this object.
|
||||
* This method is not needed for general use but a specific application could have a need.
|
||||
* @return TableMap
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getTableMap()
|
||||
{
|
||||
return Propel::getServiceContainer()->getDatabaseMap(AttributeTemplateTableMap::DATABASE_NAME)->getTable(AttributeTemplateTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(AttributeTemplateTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(AttributeTemplateTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new AttributeTemplateTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a AttributeTemplate or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or AttributeTemplate object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doDelete($values, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(AttributeTemplateTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \Thelia\Model\AttributeTemplate) { // it's a model object
|
||||
// create criteria based on pk values
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else { // it's a primary key, or an array of pks
|
||||
$criteria = new Criteria(AttributeTemplateTableMap::DATABASE_NAME);
|
||||
$criteria->add(AttributeTemplateTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = AttributeTemplateQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { AttributeTemplateTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { AttributeTemplateTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the attribute_template table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public static function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
return AttributeTemplateQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a AttributeTemplate or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or AttributeTemplate object containing data that is used to create the INSERT statement.
|
||||
* @param ConnectionInterface $con the ConnectionInterface connection to use
|
||||
* @return mixed The new primary key.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doInsert($criteria, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(AttributeTemplateTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from AttributeTemplate object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(AttributeTemplateTableMap::ID) && $criteria->keyContainsValue(AttributeTemplateTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.AttributeTemplateTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = AttributeTemplateQuery::create()->mergeWith($criteria);
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table (I guess, conceivably)
|
||||
$con->beginTransaction();
|
||||
$pk = $query->doInsert($con);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
} // AttributeTemplateTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
AttributeTemplateTableMap::buildTableMap();
|
||||
@@ -57,7 +57,7 @@ class CartItemTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 11;
|
||||
const NUM_COLUMNS = 12;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class CartItemTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 11;
|
||||
const NUM_HYDRATE_COLUMNS = 12;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -114,6 +114,11 @@ class CartItemTableMap extends TableMap
|
||||
*/
|
||||
const DISCOUNT = 'cart_item.DISCOUNT';
|
||||
|
||||
/**
|
||||
* the column name for the PROMO field
|
||||
*/
|
||||
const PROMO = 'cart_item.PROMO';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
@@ -136,12 +141,12 @@ class CartItemTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'CartId', 'ProductId', 'Quantity', 'ProductSaleElementsId', 'Price', 'PromoPrice', 'PriceEndOfLife', 'Discount', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'cartId', 'productId', 'quantity', 'productSaleElementsId', 'price', 'promoPrice', 'priceEndOfLife', 'discount', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(CartItemTableMap::ID, CartItemTableMap::CART_ID, CartItemTableMap::PRODUCT_ID, CartItemTableMap::QUANTITY, CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID, CartItemTableMap::PRICE, CartItemTableMap::PROMO_PRICE, CartItemTableMap::PRICE_END_OF_LIFE, CartItemTableMap::DISCOUNT, CartItemTableMap::CREATED_AT, CartItemTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'CART_ID', 'PRODUCT_ID', 'QUANTITY', 'PRODUCT_SALE_ELEMENTS_ID', 'PRICE', 'PROMO_PRICE', 'PRICE_END_OF_LIFE', 'DISCOUNT', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'cart_id', 'product_id', 'quantity', 'product_sale_elements_id', 'price', 'promo_price', 'price_end_of_life', 'discount', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
self::TYPE_PHPNAME => array('Id', 'CartId', 'ProductId', 'Quantity', 'ProductSaleElementsId', 'Price', 'PromoPrice', 'PriceEndOfLife', 'Discount', 'Promo', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'cartId', 'productId', 'quantity', 'productSaleElementsId', 'price', 'promoPrice', 'priceEndOfLife', 'discount', 'promo', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(CartItemTableMap::ID, CartItemTableMap::CART_ID, CartItemTableMap::PRODUCT_ID, CartItemTableMap::QUANTITY, CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID, CartItemTableMap::PRICE, CartItemTableMap::PROMO_PRICE, CartItemTableMap::PRICE_END_OF_LIFE, CartItemTableMap::DISCOUNT, CartItemTableMap::PROMO, CartItemTableMap::CREATED_AT, CartItemTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'CART_ID', 'PRODUCT_ID', 'QUANTITY', 'PRODUCT_SALE_ELEMENTS_ID', 'PRICE', 'PROMO_PRICE', 'PRICE_END_OF_LIFE', 'DISCOUNT', 'PROMO', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'cart_id', 'product_id', 'quantity', 'product_sale_elements_id', 'price', 'promo_price', 'price_end_of_life', 'discount', 'promo', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -151,12 +156,12 @@ class CartItemTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'CartId' => 1, 'ProductId' => 2, 'Quantity' => 3, 'ProductSaleElementsId' => 4, 'Price' => 5, 'PromoPrice' => 6, 'PriceEndOfLife' => 7, 'Discount' => 8, 'CreatedAt' => 9, 'UpdatedAt' => 10, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'cartId' => 1, 'productId' => 2, 'quantity' => 3, 'productSaleElementsId' => 4, 'price' => 5, 'promoPrice' => 6, 'priceEndOfLife' => 7, 'discount' => 8, 'createdAt' => 9, 'updatedAt' => 10, ),
|
||||
self::TYPE_COLNAME => array(CartItemTableMap::ID => 0, CartItemTableMap::CART_ID => 1, CartItemTableMap::PRODUCT_ID => 2, CartItemTableMap::QUANTITY => 3, CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID => 4, CartItemTableMap::PRICE => 5, CartItemTableMap::PROMO_PRICE => 6, CartItemTableMap::PRICE_END_OF_LIFE => 7, CartItemTableMap::DISCOUNT => 8, CartItemTableMap::CREATED_AT => 9, CartItemTableMap::UPDATED_AT => 10, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CART_ID' => 1, 'PRODUCT_ID' => 2, 'QUANTITY' => 3, 'PRODUCT_SALE_ELEMENTS_ID' => 4, 'PRICE' => 5, 'PROMO_PRICE' => 6, 'PRICE_END_OF_LIFE' => 7, 'DISCOUNT' => 8, 'CREATED_AT' => 9, 'UPDATED_AT' => 10, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'cart_id' => 1, 'product_id' => 2, 'quantity' => 3, 'product_sale_elements_id' => 4, 'price' => 5, 'promo_price' => 6, 'price_end_of_life' => 7, 'discount' => 8, 'created_at' => 9, 'updated_at' => 10, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'CartId' => 1, 'ProductId' => 2, 'Quantity' => 3, 'ProductSaleElementsId' => 4, 'Price' => 5, 'PromoPrice' => 6, 'PriceEndOfLife' => 7, 'Discount' => 8, 'Promo' => 9, 'CreatedAt' => 10, 'UpdatedAt' => 11, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'cartId' => 1, 'productId' => 2, 'quantity' => 3, 'productSaleElementsId' => 4, 'price' => 5, 'promoPrice' => 6, 'priceEndOfLife' => 7, 'discount' => 8, 'promo' => 9, 'createdAt' => 10, 'updatedAt' => 11, ),
|
||||
self::TYPE_COLNAME => array(CartItemTableMap::ID => 0, CartItemTableMap::CART_ID => 1, CartItemTableMap::PRODUCT_ID => 2, CartItemTableMap::QUANTITY => 3, CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID => 4, CartItemTableMap::PRICE => 5, CartItemTableMap::PROMO_PRICE => 6, CartItemTableMap::PRICE_END_OF_LIFE => 7, CartItemTableMap::DISCOUNT => 8, CartItemTableMap::PROMO => 9, CartItemTableMap::CREATED_AT => 10, CartItemTableMap::UPDATED_AT => 11, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CART_ID' => 1, 'PRODUCT_ID' => 2, 'QUANTITY' => 3, 'PRODUCT_SALE_ELEMENTS_ID' => 4, 'PRICE' => 5, 'PROMO_PRICE' => 6, 'PRICE_END_OF_LIFE' => 7, 'DISCOUNT' => 8, 'PROMO' => 9, 'CREATED_AT' => 10, 'UPDATED_AT' => 11, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'cart_id' => 1, 'product_id' => 2, 'quantity' => 3, 'product_sale_elements_id' => 4, 'price' => 5, 'promo_price' => 6, 'price_end_of_life' => 7, 'discount' => 8, 'promo' => 9, 'created_at' => 10, 'updated_at' => 11, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -184,6 +189,7 @@ class CartItemTableMap extends TableMap
|
||||
$this->addColumn('PROMO_PRICE', 'PromoPrice', 'FLOAT', false, null, null);
|
||||
$this->addColumn('PRICE_END_OF_LIFE', 'PriceEndOfLife', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('DISCOUNT', 'Discount', 'FLOAT', false, null, 0);
|
||||
$this->addColumn('PROMO', 'Promo', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
@@ -358,6 +364,7 @@ class CartItemTableMap extends TableMap
|
||||
$criteria->addSelectColumn(CartItemTableMap::PROMO_PRICE);
|
||||
$criteria->addSelectColumn(CartItemTableMap::PRICE_END_OF_LIFE);
|
||||
$criteria->addSelectColumn(CartItemTableMap::DISCOUNT);
|
||||
$criteria->addSelectColumn(CartItemTableMap::PROMO);
|
||||
$criteria->addSelectColumn(CartItemTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(CartItemTableMap::UPDATED_AT);
|
||||
} else {
|
||||
@@ -370,6 +377,7 @@ class CartItemTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.PROMO_PRICE');
|
||||
$criteria->addSelectColumn($alias . '.PRICE_END_OF_LIFE');
|
||||
$criteria->addSelectColumn($alias . '.DISCOUNT');
|
||||
$criteria->addSelectColumn($alias . '.PROMO');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
|
||||
@@ -191,16 +191,12 @@ class CategoryTableMap extends TableMap
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('ProductCategory', '\\Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'ProductCategories');
|
||||
$this->addRelation('FeatureCategory', '\\Thelia\\Model\\FeatureCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'FeatureCategories');
|
||||
$this->addRelation('AttributeCategory', '\\Thelia\\Model\\AttributeCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'AttributeCategories');
|
||||
$this->addRelation('CategoryImage', '\\Thelia\\Model\\CategoryImage', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryImages');
|
||||
$this->addRelation('CategoryDocument', '\\Thelia\\Model\\CategoryDocument', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryDocuments');
|
||||
$this->addRelation('CategoryAssociatedContent', '\\Thelia\\Model\\CategoryAssociatedContent', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryAssociatedContents');
|
||||
$this->addRelation('CategoryI18n', '\\Thelia\\Model\\CategoryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CategoryI18ns');
|
||||
$this->addRelation('CategoryVersion', '\\Thelia\\Model\\CategoryVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CategoryVersions');
|
||||
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Products');
|
||||
$this->addRelation('Feature', '\\Thelia\\Model\\Feature', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Features');
|
||||
$this->addRelation('Attribute', '\\Thelia\\Model\\Attribute', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Attributes');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
@@ -225,8 +221,6 @@ class CategoryTableMap extends TableMap
|
||||
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
ProductCategoryTableMap::clearInstancePool();
|
||||
FeatureCategoryTableMap::clearInstancePool();
|
||||
AttributeCategoryTableMap::clearInstancePool();
|
||||
CategoryImageTableMap::clearInstancePool();
|
||||
CategoryDocumentTableMap::clearInstancePool();
|
||||
CategoryAssociatedContentTableMap::clearInstancePool();
|
||||
|
||||
@@ -57,7 +57,7 @@ class CustomerTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 14;
|
||||
const NUM_COLUMNS = 16;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class CustomerTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 14;
|
||||
const NUM_HYDRATE_COLUMNS = 16;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -129,6 +129,16 @@ class CustomerTableMap extends TableMap
|
||||
*/
|
||||
const DISCOUNT = 'customer.DISCOUNT';
|
||||
|
||||
/**
|
||||
* the column name for the REMEMBER_ME_TOKEN field
|
||||
*/
|
||||
const REMEMBER_ME_TOKEN = 'customer.REMEMBER_ME_TOKEN';
|
||||
|
||||
/**
|
||||
* the column name for the REMEMBER_ME_SERIAL field
|
||||
*/
|
||||
const REMEMBER_ME_SERIAL = 'customer.REMEMBER_ME_SERIAL';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
@@ -151,12 +161,12 @@ class CustomerTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Ref', 'TitleId', 'Firstname', 'Lastname', 'Email', 'Password', 'Algo', 'Reseller', 'Lang', 'Sponsor', 'Discount', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'ref', 'titleId', 'firstname', 'lastname', 'email', 'password', 'algo', 'reseller', 'lang', 'sponsor', 'discount', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(CustomerTableMap::ID, CustomerTableMap::REF, CustomerTableMap::TITLE_ID, CustomerTableMap::FIRSTNAME, CustomerTableMap::LASTNAME, CustomerTableMap::EMAIL, CustomerTableMap::PASSWORD, CustomerTableMap::ALGO, CustomerTableMap::RESELLER, CustomerTableMap::LANG, CustomerTableMap::SPONSOR, CustomerTableMap::DISCOUNT, CustomerTableMap::CREATED_AT, CustomerTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'REF', 'TITLE_ID', 'FIRSTNAME', 'LASTNAME', 'EMAIL', 'PASSWORD', 'ALGO', 'RESELLER', 'LANG', 'SPONSOR', 'DISCOUNT', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'ref', 'title_id', 'firstname', 'lastname', 'email', 'password', 'algo', 'reseller', 'lang', 'sponsor', 'discount', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
|
||||
self::TYPE_PHPNAME => array('Id', 'Ref', 'TitleId', 'Firstname', 'Lastname', 'Email', 'Password', 'Algo', 'Reseller', 'Lang', 'Sponsor', 'Discount', 'RememberMeToken', 'RememberMeSerial', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'ref', 'titleId', 'firstname', 'lastname', 'email', 'password', 'algo', 'reseller', 'lang', 'sponsor', 'discount', 'rememberMeToken', 'rememberMeSerial', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(CustomerTableMap::ID, CustomerTableMap::REF, CustomerTableMap::TITLE_ID, CustomerTableMap::FIRSTNAME, CustomerTableMap::LASTNAME, CustomerTableMap::EMAIL, CustomerTableMap::PASSWORD, CustomerTableMap::ALGO, CustomerTableMap::RESELLER, CustomerTableMap::LANG, CustomerTableMap::SPONSOR, CustomerTableMap::DISCOUNT, CustomerTableMap::REMEMBER_ME_TOKEN, CustomerTableMap::REMEMBER_ME_SERIAL, CustomerTableMap::CREATED_AT, CustomerTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'REF', 'TITLE_ID', 'FIRSTNAME', 'LASTNAME', 'EMAIL', 'PASSWORD', 'ALGO', 'RESELLER', 'LANG', 'SPONSOR', 'DISCOUNT', 'REMEMBER_ME_TOKEN', 'REMEMBER_ME_SERIAL', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'ref', 'title_id', 'firstname', 'lastname', 'email', 'password', 'algo', 'reseller', 'lang', 'sponsor', 'discount', 'remember_me_token', 'remember_me_serial', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -166,12 +176,12 @@ class CustomerTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Ref' => 1, 'TitleId' => 2, 'Firstname' => 3, 'Lastname' => 4, 'Email' => 5, 'Password' => 6, 'Algo' => 7, 'Reseller' => 8, 'Lang' => 9, 'Sponsor' => 10, 'Discount' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'ref' => 1, 'titleId' => 2, 'firstname' => 3, 'lastname' => 4, 'email' => 5, 'password' => 6, 'algo' => 7, 'reseller' => 8, 'lang' => 9, 'sponsor' => 10, 'discount' => 11, 'createdAt' => 12, 'updatedAt' => 13, ),
|
||||
self::TYPE_COLNAME => array(CustomerTableMap::ID => 0, CustomerTableMap::REF => 1, CustomerTableMap::TITLE_ID => 2, CustomerTableMap::FIRSTNAME => 3, CustomerTableMap::LASTNAME => 4, CustomerTableMap::EMAIL => 5, CustomerTableMap::PASSWORD => 6, CustomerTableMap::ALGO => 7, CustomerTableMap::RESELLER => 8, CustomerTableMap::LANG => 9, CustomerTableMap::SPONSOR => 10, CustomerTableMap::DISCOUNT => 11, CustomerTableMap::CREATED_AT => 12, CustomerTableMap::UPDATED_AT => 13, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'REF' => 1, 'TITLE_ID' => 2, 'FIRSTNAME' => 3, 'LASTNAME' => 4, 'EMAIL' => 5, 'PASSWORD' => 6, 'ALGO' => 7, 'RESELLER' => 8, 'LANG' => 9, 'SPONSOR' => 10, 'DISCOUNT' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'ref' => 1, 'title_id' => 2, 'firstname' => 3, 'lastname' => 4, 'email' => 5, 'password' => 6, 'algo' => 7, 'reseller' => 8, 'lang' => 9, 'sponsor' => 10, 'discount' => 11, 'created_at' => 12, 'updated_at' => 13, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Ref' => 1, 'TitleId' => 2, 'Firstname' => 3, 'Lastname' => 4, 'Email' => 5, 'Password' => 6, 'Algo' => 7, 'Reseller' => 8, 'Lang' => 9, 'Sponsor' => 10, 'Discount' => 11, 'RememberMeToken' => 12, 'RememberMeSerial' => 13, 'CreatedAt' => 14, 'UpdatedAt' => 15, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'ref' => 1, 'titleId' => 2, 'firstname' => 3, 'lastname' => 4, 'email' => 5, 'password' => 6, 'algo' => 7, 'reseller' => 8, 'lang' => 9, 'sponsor' => 10, 'discount' => 11, 'rememberMeToken' => 12, 'rememberMeSerial' => 13, 'createdAt' => 14, 'updatedAt' => 15, ),
|
||||
self::TYPE_COLNAME => array(CustomerTableMap::ID => 0, CustomerTableMap::REF => 1, CustomerTableMap::TITLE_ID => 2, CustomerTableMap::FIRSTNAME => 3, CustomerTableMap::LASTNAME => 4, CustomerTableMap::EMAIL => 5, CustomerTableMap::PASSWORD => 6, CustomerTableMap::ALGO => 7, CustomerTableMap::RESELLER => 8, CustomerTableMap::LANG => 9, CustomerTableMap::SPONSOR => 10, CustomerTableMap::DISCOUNT => 11, CustomerTableMap::REMEMBER_ME_TOKEN => 12, CustomerTableMap::REMEMBER_ME_SERIAL => 13, CustomerTableMap::CREATED_AT => 14, CustomerTableMap::UPDATED_AT => 15, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'REF' => 1, 'TITLE_ID' => 2, 'FIRSTNAME' => 3, 'LASTNAME' => 4, 'EMAIL' => 5, 'PASSWORD' => 6, 'ALGO' => 7, 'RESELLER' => 8, 'LANG' => 9, 'SPONSOR' => 10, 'DISCOUNT' => 11, 'REMEMBER_ME_TOKEN' => 12, 'REMEMBER_ME_SERIAL' => 13, 'CREATED_AT' => 14, 'UPDATED_AT' => 15, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'ref' => 1, 'title_id' => 2, 'firstname' => 3, 'lastname' => 4, 'email' => 5, 'password' => 6, 'algo' => 7, 'reseller' => 8, 'lang' => 9, 'sponsor' => 10, 'discount' => 11, 'remember_me_token' => 12, 'remember_me_serial' => 13, 'created_at' => 14, 'updated_at' => 15, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -202,6 +212,8 @@ class CustomerTableMap extends TableMap
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', false, 10, null);
|
||||
$this->addColumn('SPONSOR', 'Sponsor', 'VARCHAR', false, 50, null);
|
||||
$this->addColumn('DISCOUNT', 'Discount', 'FLOAT', false, null, null);
|
||||
$this->addColumn('REMEMBER_ME_TOKEN', 'RememberMeToken', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('REMEMBER_ME_SERIAL', 'RememberMeSerial', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
@@ -390,6 +402,8 @@ class CustomerTableMap extends TableMap
|
||||
$criteria->addSelectColumn(CustomerTableMap::LANG);
|
||||
$criteria->addSelectColumn(CustomerTableMap::SPONSOR);
|
||||
$criteria->addSelectColumn(CustomerTableMap::DISCOUNT);
|
||||
$criteria->addSelectColumn(CustomerTableMap::REMEMBER_ME_TOKEN);
|
||||
$criteria->addSelectColumn(CustomerTableMap::REMEMBER_ME_SERIAL);
|
||||
$criteria->addSelectColumn(CustomerTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(CustomerTableMap::UPDATED_AT);
|
||||
} else {
|
||||
@@ -405,6 +419,8 @@ class CustomerTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.LANG');
|
||||
$criteria->addSelectColumn($alias . '.SPONSOR');
|
||||
$criteria->addSelectColumn($alias . '.DISCOUNT');
|
||||
$criteria->addSelectColumn($alias . '.REMEMBER_ME_TOKEN');
|
||||
$criteria->addSelectColumn($alias . '.REMEMBER_ME_SERIAL');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user