Merge branch 'master' of https://github.com/thelia/thelia into upload_management

# By Manuel Raynaud (60) and others
# Via Manuel Raynaud (16) and others
* 'master' of https://github.com/thelia/thelia: (113 commits)
  implement process for changing folder position
  allow possibility to change folder visibility
  allow to create folder
  add dispatcher before/after for folder crud management
  icreate folder delete event
  process folder update action
  create folder events
  display info in folders edition template
  push model
  re-add home link in menu
  comment dev menu in layout
  translate some missing string
  fixes order integration
  order process
  change some informations in layou
  fix query in Thelia\Model\Folder::countAllContents
  allow to order products on category page
  Add default language & editing language default field
  Vertical align middle tables
  Fixed translations
  ...

Conflicts:
	core/lib/Thelia/Tools/I18n.php
	templates/admin/default/category-edit.html
This commit is contained in:
gmorel
2013-09-21 14:44:57 +02:00
655 changed files with 38814 additions and 5319 deletions

View File

@@ -35,10 +35,10 @@ Installation
------------ ------------
``` bash ``` bash
$ git clone --recursive https://github.com/thelia/thelia.git $ git clone https://github.com/thelia/thelia.git
$ cd thelia $ cd thelia
$ curl -sS https://getcomposer.org/installer | php $ curl -sS https://getcomposer.org/installer | php
$ php composer.phar install --optimize-autoloader $ php composer.phar install --prefer-dist --optimize-autoloader
``` ```
Finish the installation using cli tools : Finish the installation using cli tools :

View File

@@ -160,6 +160,7 @@ class Category extends BaseAction implements EventSubscriberInterface
$content = new CategoryAssociatedContent(); $content = new CategoryAssociatedContent();
$content $content
->setDispatcher($this->getDispatcher())
->setCategory($event->getCategory()) ->setCategory($event->getCategory())
->setContentId($event->getContentId()) ->setContentId($event->getContentId())
->save() ->save()
@@ -174,7 +175,11 @@ class Category extends BaseAction implements EventSubscriberInterface
->filterByCategory($event->getCategory())->findOne() ->filterByCategory($event->getCategory())->findOne()
; ;
if ($content !== null) $content->delete(); if ($content !== null) {
$content
->setDispatcher($this->getDispatcher())
->delete();
}
} }

View File

@@ -0,0 +1,155 @@
<?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\Core\Event\FolderCreateEvent;
use Thelia\Core\Event\FolderDeleteEvent;
use Thelia\Core\Event\FolderToggleVisibilityEvent;
use Thelia\Core\Event\FolderUpdateEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Model\FolderQuery;
use Thelia\Model\Folder as FolderModel;
/**
* Class Folder
* @package Thelia\Action
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class Folder extends BaseAction implements EventSubscriberInterface {
public function update(FolderUpdateEvent $event)
{
if (null !== $folder = FolderQuery::create()->findPk($event->getFolderId())) {
$folder->setDispatcher($this->getDispatcher());
$folder
->setParent($event->getParent())
->setVisible($event->getVisible())
->setLocale($event->getLocale())
->setTitle($event->getTitle())
->setDescription($event->getDescription())
->setChapo($event->getChapo())
->setPostscriptum($event->getPostscriptum())
->save();
;
$event->setFolder($folder);
}
}
public function delete(FolderDeleteEvent $event)
{
if (null !== $folder = FolderQuery::create()->findPk($event->getFolderId())) {
$folder->setDispatcher($this->getDispatcher())
->delete();
$event->setFolder($folder);
}
}
/**
* @param FolderCreateEvent $event
*/
public function create(FolderCreateEvent $event)
{
$folder = new FolderModel();
$folder->setDispatcher($this->getDispatcher());
$folder
->setParent($event->getParent())
->setVisible($event->getVisible())
->setLocale($event->getLocale())
->setTitle($event->getTitle())
->save();
$event->setFolder($folder);
}
public function toggleVisibility(FolderToggleVisibilityEvent $event)
{
$folder = $event->getFolder();
$folder
->setDispatcher($this->getDispatcher())
->setVisible(!$folder->getVisible())
->save();
}
public function updatePosition(UpdatePositionEvent $event)
{
if(null !== $folder = FolderQuery::create()->findPk($event->getObjectId())) {
$folder->setDispatcher($this->getDispatcher());
switch($event->getMode())
{
case UpdatePositionEvent::POSITION_ABSOLUTE:
$folder->changeAbsolutePosition($event->getPosition());
break;
case UpdatePositionEvent::POSITION_DOWN:
$folder->movePositionDown();
break;
case UpdatePositionEvent::POSITION_UP:
$folder->movePositionUp();
break;
}
}
}
/**
* Returns an array of event names this subscriber wants to listen to.
*
* The array keys are event names and the value can be:
*
* * The method name to call (priority defaults to 0)
* * An array composed of the method name to call and the priority
* * An array of arrays composed of the method names to call and respective
* priorities, or 0 if unset
*
* For instance:
*
* * array('eventName' => 'methodName')
* * array('eventName' => array('methodName', $priority))
* * array('eventName' => array(array('methodName1', $priority), array('methodName2'))
*
* @return array The event names to listen to
*
* @api
*/
public static function getSubscribedEvents()
{
return array(
TheliaEvents::FOLDER_CREATE => array("create", 128),
TheliaEvents::FOLDER_UPDATE => array("update", 128),
TheliaEvents::FOLDER_DELETE => array("delete", 128),
TheliaEvents::FOLDER_TOGGLE_VISIBILITY => array("toggleVisibility", 128),
TheliaEvents::FOLDER_UPDATE_POSITION => array("updatePosition", 128),
);
}
}

View File

@@ -23,16 +23,23 @@
namespace Thelia\Action; namespace Thelia\Action;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\CartEvent;
use Thelia\Core\Event\OrderEvent; use Thelia\Core\Event\OrderEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\ProductPrice; use Thelia\Exception\OrderException;
use Thelia\Model\ProductPriceQuery; use Thelia\Exception\TheliaProcessException;
use Thelia\Model\CartItem; use Thelia\Model\AddressQuery;
use Thelia\Model\CartItemQuery; use Thelia\Model\OrderProductAttributeCombination;
use Thelia\Model\ModuleQuery;
use Thelia\Model\OrderProduct;
use Thelia\Model\OrderStatus;
use Thelia\Model\Map\OrderTableMap;
use Thelia\Model\OrderAddress;
use Thelia\Model\OrderStatusQuery;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
use Thelia\Tools\I18n;
/** /**
* *
@@ -61,13 +68,236 @@ class Order extends BaseAction implements EventSubscriberInterface
{ {
$order = $event->getOrder(); $order = $event->getOrder();
$deliveryAddress = $event->getDeliveryAddress();
$order->setDeliveryModuleId($event->getDeliveryModule()); $order->setDeliveryModuleId($event->getDeliveryModule());
$order->setPostage($event->getPostage());
$event->setOrder($order); $event->setOrder($order);
} }
/**
* @param \Thelia\Core\Event\OrderEvent $event
*/
public function setInvoiceAddress(OrderEvent $event)
{
$order = $event->getOrder();
$order->chosenInvoiceAddress = $event->getInvoiceAddress();
$event->setOrder($order);
}
/**
* @param \Thelia\Core\Event\OrderEvent $event
*/
public function setPaymentModule(OrderEvent $event)
{
$order = $event->getOrder();
$order->setPaymentModuleId($event->getPaymentModule());
$event->setOrder($order);
}
/**
* @param \Thelia\Core\Event\OrderEvent $event
*/
public function create(OrderEvent $event)
{
$con = \Propel\Runtime\Propel::getConnection(
OrderTableMap::DATABASE_NAME
);
$con->beginTransaction();
$sessionOrder = $event->getOrder();
/* use a copy to avoid errored reccord in session */
$placedOrder = $sessionOrder->copy();
$placedOrder->setDispatcher($this->getDispatcher());
$customer = $this->getSecurityContext()->getCustomerUser();
$currency = $this->getSession()->getCurrency();
$lang = $this->getSession()->getLang();
$deliveryAddress = AddressQuery::create()->findPk($sessionOrder->chosenDeliveryAddress);
$taxCountry = $deliveryAddress->getCountry();
$invoiceAddress = AddressQuery::create()->findPk($sessionOrder->chosenInvoiceAddress);
$cart = $this->getSession()->getCart();
$cartItems = $cart->getCartItems();
$paymentModule = ModuleQuery::create()->findPk($placedOrder->getPaymentModuleId());
/* fulfill order */
$placedOrder->setCustomerId($customer->getId());
$placedOrder->setCurrencyId($currency->getId());
$placedOrder->setCurrencyRate($currency->getRate());
$placedOrder->setLangId($lang->getId());
/* hard save the delivery and invoice addresses */
$deliveryOrderAddress = new OrderAddress();
$deliveryOrderAddress
->setCustomerTitleId($deliveryAddress->getTitleId())
->setCompany($deliveryAddress->getCompany())
->setFirstname($deliveryAddress->getFirstname())
->setLastname($deliveryAddress->getLastname())
->setAddress1($deliveryAddress->getAddress1())
->setAddress2($deliveryAddress->getAddress2())
->setAddress3($deliveryAddress->getAddress3())
->setZipcode($deliveryAddress->getZipcode())
->setCity($deliveryAddress->getCity())
->setCountryId($deliveryAddress->getCountryId())
->save($con)
;
$invoiceOrderAddress = new OrderAddress();
$invoiceOrderAddress
->setCustomerTitleId($invoiceAddress->getTitleId())
->setCompany($invoiceAddress->getCompany())
->setFirstname($invoiceAddress->getFirstname())
->setLastname($invoiceAddress->getLastname())
->setAddress1($invoiceAddress->getAddress1())
->setAddress2($invoiceAddress->getAddress2())
->setAddress3($invoiceAddress->getAddress3())
->setZipcode($invoiceAddress->getZipcode())
->setCity($invoiceAddress->getCity())
->setCountryId($invoiceAddress->getCountryId())
->save($con)
;
$placedOrder->setDeliveryOrderAddressId($deliveryOrderAddress->getId());
$placedOrder->setInvoiceOrderAddressId($invoiceOrderAddress->getId());
$placedOrder->setStatusId(
OrderStatusQuery::create()->findOneByCode(OrderStatus::CODE_NOT_PAID)->getId()
);
$placedOrder->save($con);
/* fulfill order_products and decrease stock */
foreach($cartItems as $cartItem) {
$product = $cartItem->getProduct();
/* get translation */
$productI18n = I18n::forceI18nRetrieving($this->getSession()->getLang()->getLocale(), 'Product', $product->getId());
$pse = $cartItem->getProductSaleElements();
/* check still in stock */
if($cartItem->getQuantity() > $pse->getQuantity()) {
throw new TheliaProcessException("Not enough stock", TheliaProcessException::CART_ITEM_NOT_ENOUGH_STOCK, $cartItem);
}
/* decrease stock */
$pse->setQuantity(
$pse->getQuantity() - $cartItem->getQuantity()
);
$pse->save($con);
/* get tax */
$taxRuleI18n = I18n::forceI18nRetrieving($this->getSession()->getLang()->getLocale(), 'TaxRule', $product->getTaxRuleId());
$taxDetail = $product->getTaxRule()->getTaxDetail(
$taxCountry,
$cartItem->getPromo() == 1 ? $cartItem->getPromoPrice() : $cartItem->getPrice(),
$this->getSession()->getLang()->getLocale()
);
$orderProduct = new OrderProduct();
$orderProduct
->setOrderId($placedOrder->getId())
->setProductRef($product->getRef())
->setProductSaleElementsRef($pse->getRef())
->setTitle($productI18n->getTitle())
->setChapo($productI18n->getChapo())
->setDescription($productI18n->getDescription())
->setPostscriptum($productI18n->getPostscriptum())
->setQuantity($cartItem->getQuantity())
->setPrice($cartItem->getPrice())
->setPromoPrice($cartItem->getPromoPrice())
->setWasNew($pse->getNewness())
->setWasInPromo($cartItem->getPromo())
->setWeight($pse->getWeight())
->setTaxRuleTitle($taxRuleI18n->getTitle())
->setTaxRuleDescription($taxRuleI18n->getDescription())
;
$orderProduct->setDispatcher($this->getDispatcher());
$orderProduct->save($con);
/* fulfill order_product_tax */
foreach($taxDetail as $tax) {
$tax->setOrderProductId($orderProduct->getId());
$tax->save($con);
}
/* fulfill order_attribute_combination and decrease stock */
foreach($pse->getAttributeCombinations() as $attributeCombination) {
$attribute = I18n::forceI18nRetrieving($this->getSession()->getLang()->getLocale(), 'Attribute', $attributeCombination->getAttributeId());
$attributeAv = I18n::forceI18nRetrieving($this->getSession()->getLang()->getLocale(), 'AttributeAv', $attributeCombination->getAttributeAvId());
$orderAttributeCombination = new OrderProductAttributeCombination();
$orderAttributeCombination
->setOrderProductId($orderProduct->getId())
->setAttributeTitle($attribute->getTitle())
->setAttributeChapo($attribute->getChapo())
->setAttributeDescription($attribute->getDescription())
->setAttributePostscriptumn($attribute->getPostscriptum())
->setAttributeAvTitle($attributeAv->getTitle())
->setAttributeAvChapo($attributeAv->getChapo())
->setAttributeAvDescription($attributeAv->getDescription())
->setAttributeAvPostscriptum($attributeAv->getPostscriptum())
;
$orderAttributeCombination->save($con);
}
}
/* discount @todo */
$con->commit();
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_BEFORE_PAYMENT, new OrderEvent($placedOrder));
/* clear session */
/* but memorize placed order */
$sessionOrder = new \Thelia\Model\Order();
$event->setOrder($sessionOrder);
$event->setPlacedOrder($placedOrder);
$this->getSession()->setOrder($sessionOrder);
/* empty cart @todo */
/* call pay method */
$paymentModuleReflection = new \ReflectionClass($paymentModule->getFullNamespace());
$paymentModuleInstance = $paymentModuleReflection->newInstance();
$paymentModuleInstance->setRequest($this->getRequest());
$paymentModuleInstance->setDispatcher($this->getDispatcher());
$paymentModuleInstance->pay($placedOrder);
}
/**
* @param \Thelia\Core\Event\OrderEvent $event
*/
public function sendOrderEmail(OrderEvent $event)
{
/* @todo */
}
/**
* @param \Thelia\Core\Event\OrderEvent $event
*/
public function setReference(OrderEvent $event)
{
$event->getOrder()->setRef($this->generateRef());
}
public function generateRef()
{
/* order addresses are unique */
return uniqid('ORD', true);
}
/** /**
* Returns an array of event names this subscriber wants to listen to. * Returns an array of event names this subscriber wants to listen to.
* *
@@ -93,6 +323,41 @@ class Order extends BaseAction implements EventSubscriberInterface
return array( return array(
TheliaEvents::ORDER_SET_DELIVERY_ADDRESS => array("setDeliveryAddress", 128), TheliaEvents::ORDER_SET_DELIVERY_ADDRESS => array("setDeliveryAddress", 128),
TheliaEvents::ORDER_SET_DELIVERY_MODULE => array("setDeliveryModule", 128), TheliaEvents::ORDER_SET_DELIVERY_MODULE => array("setDeliveryModule", 128),
TheliaEvents::ORDER_SET_INVOICE_ADDRESS => array("setInvoiceAddress", 128),
TheliaEvents::ORDER_SET_PAYMENT_MODULE => array("setPaymentModule", 128),
TheliaEvents::ORDER_PAY => array("create", 128),
TheliaEvents::ORDER_BEFORE_CREATE => array("setReference", 128),
TheliaEvents::ORDER_BEFORE_PAYMENT => array("sendOrderEmail", 128),
); );
} }
/**
* Return the security context
*
* @return SecurityContext
*/
protected function getSecurityContext()
{
return $this->container->get('thelia.securityContext');
}
/**
* @return \Symfony\Component\HttpFoundation\Request
*/
protected function getRequest()
{
return $this->container->get('request');
}
/**
* Returns the session from the current request
*
* @return \Thelia\Core\HttpFoundation\Session\Session
*/
protected function getSession()
{
$request = $this->getRequest();
return $request->getSession();
}
} }

View File

@@ -40,6 +40,14 @@ use Thelia\Core\Event\ProductAddContentEvent;
use Thelia\Core\Event\ProductDeleteContentEvent; use Thelia\Core\Event\ProductDeleteContentEvent;
use Thelia\Model\ProductAssociatedContent; use Thelia\Model\ProductAssociatedContent;
use Thelia\Model\ProductAssociatedContentQuery; use Thelia\Model\ProductAssociatedContentQuery;
use Thelia\Model\ProductCategory;
use Thelia\Model\TaxRule;
use Thelia\Model\TaxRuleQuery;
use Thelia\Model\TaxQuery;
use Thelia\Model\AccessoryQuery;
use Thelia\Model\Accessory;
use Thelia\Core\Event\ProductAddAccessoryEvent;
use Thelia\Core\Event\ProductDeleteAccessoryEvent;
class Product extends BaseAction implements EventSubscriberInterface class Product extends BaseAction implements EventSubscriberInterface
{ {
@@ -55,12 +63,15 @@ class Product extends BaseAction implements EventSubscriberInterface
$product $product
->setDispatcher($this->getDispatcher()) ->setDispatcher($this->getDispatcher())
->setLocale($event->getLocale()) ->setRef($event->getRef())
->setTitle($event->getTitle()) ->setTitle($event->getTitle())
->setParent($event->getParent()) ->setLocale($event->getLocale())
->setVisible($event->getVisible()) ->setVisible($event->getVisible())
->save() // Set the default tax rule to this product
->setTaxRule(TaxRuleQuery::create()->findOneByIsDefault(true))
->create($event->getDefaultCategory())
; ;
$event->setProduct($product); $event->setProduct($product);
@@ -160,6 +171,7 @@ class Product extends BaseAction implements EventSubscriberInterface
$content = new ProductAssociatedContent(); $content = new ProductAssociatedContent();
$content $content
->setDispatcher($this->getDispatcher())
->setProduct($event->getProduct()) ->setProduct($event->getProduct())
->setContentId($event->getContentId()) ->setContentId($event->getContentId())
->save() ->save()
@@ -174,9 +186,66 @@ class Product extends BaseAction implements EventSubscriberInterface
->filterByProduct($event->getProduct())->findOne() ->filterByProduct($event->getProduct())->findOne()
; ;
if ($content !== null) $content->delete(); if ($content !== null)
$content
->setDispatcher($this->getDispatcher())
->delete()
;
} }
public function addAccessory(ProductAddAccessoryEvent $event) {
if (AccessoryQuery::create()
->filterByAccessory($event->getAccessoryId())
->filterByProductId($event->getProduct()->getId())->count() <= 0) {
$accessory = new Accessory();
$accessory
->setDispatcher($this->getDispatcher())
->setProductId($event->getProduct()->getId())
->setAccessory($event->getAccessoryId())
->save()
;
}
}
public function removeAccessory(ProductDeleteAccessoryEvent $event) {
$accessory = AccessoryQuery::create()
->filterByAccessory($event->getAccessoryId())
->filterByProductId($event->getProduct()->getId())->findOne()
;
if ($accessory !== null)
$accessory
->setDispatcher($this->getDispatcher())
->delete()
;
}
/**
* Changes position, selecting absolute ou relative change.
*
* @param ProductChangePositionEvent $event
*/
public function updateAccessoryPosition(UpdatePositionEvent $event)
{
if (null !== $accessory = AccessoryQuery::create()->findPk($event->getObjectId())) {
$accessory->setDispatcher($this->getDispatcher());
$mode = $event->getMode();
if ($mode == UpdatePositionEvent::POSITION_ABSOLUTE)
return $accessory->changeAbsolutePosition($event->getPosition());
else if ($mode == UpdatePositionEvent::POSITION_UP)
return $accessory->movePositionUp();
else if ($mode == UpdatePositionEvent::POSITION_DOWN)
return $accessory->movePositionDown();
}
}
/** /**
* {@inheritDoc} * {@inheritDoc}
@@ -193,7 +262,10 @@ class Product extends BaseAction implements EventSubscriberInterface
TheliaEvents::PRODUCT_ADD_CONTENT => array("addContent", 128), TheliaEvents::PRODUCT_ADD_CONTENT => array("addContent", 128),
TheliaEvents::PRODUCT_REMOVE_CONTENT => array("removeContent", 128), TheliaEvents::PRODUCT_REMOVE_CONTENT => array("removeContent", 128),
TheliaEvents::PRODUCT_UPDATE_ACCESSORY_POSITION => array("updateAccessoryPosition", 128),
TheliaEvents::PRODUCT_ADD_ACCESSORY => array("addAccessory", 128),
TheliaEvents::PRODUCT_REMOVE_ACCESSORY => array("removeAccessory", 128),
); );
} }
} }

View File

@@ -139,4 +139,6 @@ trait CartTrait
return $id; return $id;
} }
abstract public function getDispatcher();
} }

View File

@@ -62,18 +62,26 @@ class CacheClear extends ContainerAwareCommand
$this->clearCache($cacheDir, $output); $this->clearCache($cacheDir, $output);
if (!$input->getOption("without-assets")) { if (!$input->getOption("without-assets")) {
$this->clearCache(THELIA_WEB_DIR . "/assets", $output); $this->clearCache(THELIA_WEB_DIR . "assets", $output);
} }
} }
protected function clearCache($dir, OutputInterface $output) protected function clearCache($dir, OutputInterface $output)
{ {
if (!is_writable($dir)) { $output->writeln(sprintf("Clearing cache in <info>%s</info> directory", $dir));
throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $dir));
try {
$directoryBrowser = new \DirectoryIterator($dir);
} catch(\UnexpectedValueException $e) {
// throws same exception code for does not exist and permission denied ...
if(!file_exists($dir)) {
$output->writeln(sprintf("<info>%s cache dir already clear</info>", $dir));
return;
} }
$output->writeln(sprintf("Clearing cache in <info>%s</info> directory", $dir)); throw $e;
}
$fs = new Filesystem(); $fs = new Filesystem();
try { try {
@@ -81,7 +89,7 @@ class CacheClear extends ContainerAwareCommand
$output->writeln(sprintf("<info>%s cache dir cleared successfully</info>", $dir)); $output->writeln(sprintf("<info>%s cache dir cleared successfully</info>", $dir));
} catch (IOException $e) { } catch (IOException $e) {
$output->writeln(sprintf("error during clearing cache : %s", $e->getMessage())); $output->writeln(sprintf("Error during clearing cache : %s", $e->getMessage()));
} }
} }
} }

View File

@@ -0,0 +1,90 @@
<?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\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Exception\IOException;
use Thelia\Command\ContainerAwareCommand;
use Thelia\Model\ModuleQuery;
/**
* activates a module
*
* Class ModuleActivateCommand
* @package Thelia\Command
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*
*/
class ModuleActivateCommand extends BaseModuleGenerate
{
protected function configure()
{
$this
->setName("module:activate")
->setDescription("Activates a module")
->addArgument(
"module" ,
InputArgument::REQUIRED,
"module to activate"
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$moduleCode = $this->formatModuleName($input->getArgument("module"));
$module = ModuleQuery::create()->findOneByCode($moduleCode);
if(null === $module) {
throw new \RuntimeException(sprintf("module %s not found", $moduleCode));
}
try {
new \TheliaDebugBar\TheliaDebugBar();
$moduleReflection = new \ReflectionClass($module->getFullNamespace());
$moduleInstance = $moduleReflection->newInstance();
$moduleInstance->activate();
} catch(\Exception $e) {
throw new \RuntimeException(sprintf("Activation fail with Exception : [%d] %s", $e->getCode(), $e->getMessage()));
}
//impossible to change output class in CommandTester...
if (method_exists($output, "renderBlock")) {
$output->renderBlock(array(
'',
sprintf("Activation succeed for module %s", $moduleCode),
''
), "bg=green;fg=black");
}
}
}

View File

@@ -54,6 +54,13 @@ class ReloadDatabaseCommand extends BaseModuleGenerate
$connection = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME); $connection = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
$connection = $connection->getWrappedConnection(); $connection = $connection->getWrappedConnection();
$tables = $connection->query("SHOW TABLES");
$connection->query("SET FOREIGN_KEY_CHECKS = 0");
foreach($tables as $table) {
$connection->query(sprintf("DROP TABLE `%s`", $table[0]));
}
$connection->query("SET FOREIGN_KEY_CHECKS = 1");
$database = new Database($connection); $database = new Database($connection);
$output->writeln(array( $output->writeln(array(
'', '',

View File

@@ -97,6 +97,11 @@
<tag name="kernel.event_subscriber"/> <tag name="kernel.event_subscriber"/>
</service> </service>
<service id="thelia.action.folder" class="Thelia\Action\Folder">
<argument type="service" id="service_container"/>
<tag name="kernel.event_subscriber"/>
</service>
</services> </services>
</config> </config>

View File

@@ -18,18 +18,21 @@
<loop class="Thelia\Core\Template\Loop\Currency" name="currency"/> <loop class="Thelia\Core\Template\Loop\Currency" name="currency"/>
<loop class="Thelia\Core\Template\Loop\Customer" name="customer"/> <loop class="Thelia\Core\Template\Loop\Customer" name="customer"/>
<loop class="Thelia\Core\Template\Loop\Feature" name="feature"/> <loop class="Thelia\Core\Template\Loop\Feature" name="feature"/>
<loop class="Thelia\Core\Template\Loop\FeatureAvailability" name="feature_availability"/> <loop class="Thelia\Core\Template\Loop\FeatureAvailability" name="feature-availability"/>
<loop class="Thelia\Core\Template\Loop\FeatureValue" name="feature_value"/> <loop class="Thelia\Core\Template\Loop\FeatureValue" name="feature_value"/>
<loop class="Thelia\Core\Template\Loop\Folder" name="folder"/> <loop class="Thelia\Core\Template\Loop\Folder" name="folder"/>
<loop class="Thelia\Core\Template\Loop\Module" name="module"/>
<loop class="Thelia\Core\Template\Loop\Order" name="order"/> <loop class="Thelia\Core\Template\Loop\Order" name="order"/>
<loop class="Thelia\Core\Template\Loop\OrderStatus" name="order-status"/> <loop class="Thelia\Core\Template\Loop\OrderStatus" name="order-status"/>
<loop class="Thelia\Core\Template\Loop\CategoryPath" name="category-path"/> <loop class="Thelia\Core\Template\Loop\CategoryPath" name="category-path"/>
<loop class="Thelia\Core\Template\Loop\Payment" name="payment"/>
<loop class="Thelia\Core\Template\Loop\Product" name="product"/> <loop class="Thelia\Core\Template\Loop\Product" name="product"/>
<loop class="Thelia\Core\Template\Loop\ProductSaleElements" name="product_sale_elements"/> <loop class="Thelia\Core\Template\Loop\ProductSaleElements" name="product_sale_elements"/>
<loop class="Thelia\Core\Template\Loop\Feed" name="feed"/> <loop class="Thelia\Core\Template\Loop\Feed" name="feed"/>
<loop class="Thelia\Core\Template\Loop\Title" name="title"/> <loop class="Thelia\Core\Template\Loop\Title" name="title"/>
<loop class="Thelia\Core\Template\Loop\Lang" name="lang"/> <loop class="Thelia\Core\Template\Loop\Lang" name="lang"/>
<loop class="Thelia\Core\Template\Loop\CategoryTree" name="category-tree"/> <loop class="Thelia\Core\Template\Loop\CategoryTree" name="category-tree"/>
<loop class="Thelia\Core\Template\Loop\FolderTree" name="folder-tree"/>
<loop class="Thelia\Core\Template\Loop\Cart" name="cart"/> <loop class="Thelia\Core\Template\Loop\Cart" name="cart"/>
<loop class="Thelia\Core\Template\Loop\Image" name="image"/> <loop class="Thelia\Core\Template\Loop\Image" name="image"/>
<loop class="Thelia\Core\Template\Loop\Config" name="config"/> <loop class="Thelia\Core\Template\Loop\Config" name="config"/>
@@ -37,6 +40,7 @@
<loop class="Thelia\Core\Template\Loop\Message" name="message"/> <loop class="Thelia\Core\Template\Loop\Message" name="message"/>
<loop class="Thelia\Core\Template\Loop\Delivery" name="delivery"/> <loop class="Thelia\Core\Template\Loop\Delivery" name="delivery"/>
<loop class="Thelia\Core\Template\Loop\Template" name="template"/> <!-- This is product templates ;-) --> <loop class="Thelia\Core\Template\Loop\Template" name="template"/> <!-- This is product templates ;-) -->
<loop class="Thelia\Core\Template\Loop\TaxRule" name="tax-rule"/>
</loops> </loops>
<forms> <forms>
@@ -62,9 +66,16 @@
<form name="thelia.admin.product.creation" class="Thelia\Form\ProductCreationForm"/> <form name="thelia.admin.product.creation" class="Thelia\Form\ProductCreationForm"/>
<form name="thelia.admin.product.deletion" class="Thelia\Form\ProductModificationForm"/> <form name="thelia.admin.product.deletion" class="Thelia\Form\ProductModificationForm"/>
<form name="thelia.admin.folder.creation" class="Thelia\Form\FolderCreationForm"/>
<form name="thelia.admin.folder.modification" class="Thelia\Form\FolderModificationForm"/>
<form name="thelia.admin.content.creation" class="Thelia\Form\ContentCreationForm"/>
<form name="thelia.admin.content.modification" class="Thelia\Form\ContentModificationForm"/>
<form name="thelia.cart.add" class="Thelia\Form\CartAdd"/> <form name="thelia.cart.add" class="Thelia\Form\CartAdd"/>
<form name="thelia.order.delivery" class="Thelia\Form\OrderDelivery"/> <form name="thelia.order.delivery" class="Thelia\Form\OrderDelivery"/>
<form name="thelia.order.payment" class="Thelia\Form\OrderPayment"/>
<form name="thelia.admin.config.creation" class="Thelia\Form\ConfigCreationForm"/> <form name="thelia.admin.config.creation" class="Thelia\Form\ConfigCreationForm"/>
<form name="thelia.admin.config.modification" class="Thelia\Form\ConfigModificationForm"/> <form name="thelia.admin.config.modification" class="Thelia\Form\ConfigModificationForm"/>
@@ -93,6 +104,8 @@
<form name="thelia.admin.country.creation" class="Thelia\Form\CountryCreationForm"/> <form name="thelia.admin.country.creation" class="Thelia\Form\CountryCreationForm"/>
<form name="thelia.admin.country.modification" class="Thelia\Form\CountryModificationForm"/> <form name="thelia.admin.country.modification" class="Thelia\Form\CountryModificationForm"/>
<form name="thelia.admin.profile.modification" class="Thelia\Form\ProfileModificationForm"/>
</forms> </forms>
@@ -103,6 +116,7 @@
<command class="Thelia\Command\ModuleGenerateCommand"/> <command class="Thelia\Command\ModuleGenerateCommand"/>
<command class="Thelia\Command\ModuleGenerateModelCommand"/> <command class="Thelia\Command\ModuleGenerateModelCommand"/>
<command class="Thelia\Command\ModuleGenerateSqlCommand"/> <command class="Thelia\Command\ModuleGenerateSqlCommand"/>
<command class="Thelia\Command\ModuleActivateCommand"/>
<command class="Thelia\Command\CreateAdminUser"/> <command class="Thelia\Command\CreateAdminUser"/>
<command class="Thelia\Command\ReloadDatabaseCommand"/> <command class="Thelia\Command\ReloadDatabaseCommand"/>
</commands> </commands>
@@ -218,6 +232,7 @@
<argument type="service" id="request" /> <argument type="service" id="request" />
<argument type="service" id="thelia.securityContext" /> <argument type="service" id="thelia.securityContext" />
<argument type="service" id="thelia.parser.context"/> <argument type="service" id="thelia.parser.context"/>
<argument type="service" id="event_dispatcher"/>
</service> </service>
<service id="smarty.plugin.adminUtilities" class="Thelia\Core\Template\Smarty\Plugins\AdminUtilities" scope="request"> <service id="smarty.plugin.adminUtilities" class="Thelia\Core\Template\Smarty\Plugins\AdminUtilities" scope="request">

View File

@@ -24,6 +24,12 @@
<default key="_controller">Thelia\Controller\Admin\SessionController::checkLoginAction</default> <default key="_controller">Thelia\Controller\Admin\SessionController::checkLoginAction</default>
</route> </route>
<!-- Route to edit admin profile -->
<route id="admin.profile.update.view" path="/admin/profile/update" methods="get">
<default key="_controller">Thelia\Controller\Admin\AdminController::updateAction</default>
</route>
<!-- Route to the catalog controller --> <!-- Route to the catalog controller -->
@@ -161,6 +167,8 @@
<default key="_controller">Thelia\Controller\Admin\ProductController::updatePositionAction</default> <default key="_controller">Thelia\Controller\Admin\ProductController::updatePositionAction</default>
</route> </route>
<!-- Related content -->
<route id="admin.products.related-content.add" path="/admin/products/related-content/add"> <route id="admin.products.related-content.add" path="/admin/products/related-content/add">
<default key="_controller">Thelia\Controller\Admin\ProductController::addRelatedContentAction</default> <default key="_controller">Thelia\Controller\Admin\ProductController::addRelatedContentAction</default>
</route> </route>
@@ -174,6 +182,60 @@
<requirement key="_format">xml|json</requirement> <requirement key="_format">xml|json</requirement>
</route> </route>
<!-- Product accessories -->
<route id="admin.products.accessories.add" path="/admin/products/accessory/add">
<default key="_controller">Thelia\Controller\Admin\ProductController::addAccessoryAction</default>
</route>
<route id="admin.products.accessories.delete" path="/admin/products/accessory/delete">
<default key="_controller">Thelia\Controller\Admin\ProductController::deleteAccessoryAction</default>
</route>
<route id="admin.product.accessories-content" path="/admin/product/{productId}/available-accessories/{categoryId}.{_format}" methods="GET">
<default key="_controller">Thelia\Controller\Admin\ProductController::getAvailableAccessoriesAction</default>
<requirement key="_format">xml|json</requirement>
</route>
<route id="admin.products.update-accessory-position" path="/admin/products/update-accessory-position">
<default key="_controller">Thelia\Controller\Admin\ProductController::updateAccessoryPositionAction</default>
</route>
<!--Features and attributes -->
<route id="admin.products.update-attributes-and-features" path="/admin/product/{productId}/update-attributes-and-features">
<default key="_controller">Thelia\Controller\Admin\ProductController::updateAttributesAndFeaturesAction</default>
</route>
<!-- Folder routes management -->
<route id="admin.folders.default" path="/admin/folders">
<default key="_controller">Thelia\Controller\Admin\FolderController::defaultAction</default>
</route>
<route id="admin.folders.create" path="/admin/folders/create">
<default key="_controller">Thelia\Controller\Admin\FolderController::createAction</default>
</route>
<route id="admin.folders.update" path="/admin/folders/update" methods="get">
<default key="_controller">Thelia\Controller\Admin\FolderController::updateAction</default>
</route>
<route id="admin.folders.toggle-online" path="/admin/folders/toggle-online">
<default key="_controller">Thelia\Controller\Admin\FolderController::setToggleVisibilityAction</default>
</route>
<route id="admin.folders.save" path="/admin/folders/save">
<default key="_controller">Thelia\Controller\Admin\FolderController::processUpdateAction</default>
</route>
<route id="admin.folders.delete" path="/admin/folders/delete">
<default key="_controller">Thelia\Controller\Admin\FolderController::deleteAction</default>
</route>
<route id="admin.folders.update-position" path="/admin/folders/update-position">
<default key="_controller">Thelia\Controller\Admin\FolderController::updatePositionAction</default>
</route>
<!-- Route to the Coupon controller (process Coupon browsing) --> <!-- Route to the Coupon controller (process Coupon browsing) -->
@@ -407,6 +469,33 @@
<!-- end countries routes management --> <!-- end countries routes management -->
<!-- Shipping zones routes management -->
<route id="admin.configuration.shipping-zones.default" path="/admin/configuration/shipping_zones">
<default key="_controller">Thelia\Controller\Admin\ShippingZoneController::indexAction</default>
</route>
<route id="admin.configuration.shipping-zones.update.view" path="/admin/configuration/shipping_zones/update/{shipping_zones_id}" methods="get">
<default key="_controller">Thelia\Controller\Admin\ShippingZoneController::updateAction</default>
<requirement key="shipping_zones_id">\d+</requirement>
</route>
<!-- end shipping routes management -->
<!-- Shipping zones routes management -->
<route id="admin.configuration.shipping-configuration.default" path="/admin/configuration/shipping_configuration">
<default key="_controller">Thelia\Controller\Admin\ShippingConfigurationController::indexAction</default>
</route>
<route id="admin.configuration.shipping-configuration.update.view" path="/admin/configuration/shipping_configuration/update/{shipping_configuration_id}" methods="get">
<default key="_controller">Thelia\Controller\Admin\ShippingConfigurationController::updateAction</default>
<requirement key="shipping_configuration_id">\d+</requirement>
</route>
<!-- end shipping routes management -->
<!-- feature and features value management --> <!-- feature and features value management -->
<route id="admin.configuration.features.default" path="/admin/configuration/features"> <route id="admin.configuration.features.default" path="/admin/configuration/features">
@@ -464,6 +553,15 @@
<!-- end feature and feature routes management --> <!-- end feature and feature routes management -->
<!-- Modules rule management -->
<route id="admin.module" path="/admin/modules">
<default key="_controller">Thelia\Controller\Admin\ModuleController::indexAction</default>
</route>
<!-- end Modules rule management -->
<!-- The default route, to display a template --> <!-- The default route, to display a template -->
<route id="admin.processTemplate" path="/admin/{template}"> <route id="admin.processTemplate" path="/admin/{template}">

View File

@@ -112,27 +112,36 @@
<default key="_view">cart</default> <default key="_view">cart</default>
</route> </route>
<route id="order.delivery" path="/order/delivery" methods="post"> <!-- end cart routes -->
<!-- order management process -->
<route id="order.delivery.process" path="/order/delivery" methods="post">
<default key="_controller">Thelia\Controller\Front\OrderController::deliver</default> <default key="_controller">Thelia\Controller\Front\OrderController::deliver</default>
<default key="_view">order_delivery</default> <default key="_view">order_delivery</default>
</route> </route>
<route id="order.delivery.process" path="/order/delivery"> <route id="order.delivery" path="/order/delivery">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default> <default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">order_delivery</default> <default key="_view">order_delivery</default>
</route> </route>
<route id="order.invoice.process" path="/order/invoice" methods="post">
<default key="_controller">Thelia\Controller\Front\OrderController::invoice</default>
<default key="_view">order_invoice</default>
</route>
<route id="order.invoice" path="/order/invoice"> <route id="order.invoice" path="/order/invoice">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default> <default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">order_invoice</default> <default key="_view">order_invoice</default>
</route> </route>
<!-- end cart routes --> <route id="order.payment.process" path="/order/pay">
<default key="_controller">Thelia\Controller\Front\OrderController::pay</default>
</route>
<!-- order management process --> <route id="order.placed" path="/order/placed/{order_id}">
<route id="order.delivery.add" path="/delivery/choose/{delivery_id}"> <default key="_controller">Thelia\Controller\Front\OrderController::orderPlaced</default>
<default key="_controller">Thelia\Controller\Front\DeliveryController::select</default> <default key="_view">order_placed</default>
<requirement key="delivery_id">\d+</requirement>
</route> </route>
<!-- end order management process --> <!-- end order management process -->

View File

@@ -492,9 +492,6 @@ abstract class AbstractCrudController extends BaseAdminController
$changeEvent = $this->createToggleVisibilityEvent($this->getRequest()); $changeEvent = $this->createToggleVisibilityEvent($this->getRequest());
// Create and dispatch the change event
$changeEvent->setIsDefault(true);
try { try {
$this->dispatch($this->visibilityToggleEventIdentifier, $changeEvent); $this->dispatch($this->visibilityToggleEventIdentifier, $changeEvent);
} catch (\Exception $ex) { } catch (\Exception $ex) {
@@ -502,7 +499,7 @@ abstract class AbstractCrudController extends BaseAdminController
return $this->errorPage($ex); return $this->errorPage($ex);
} }
$this->redirectToListTemplate(); return $this->nullResponse();
} }
/** /**

View File

@@ -33,4 +33,9 @@ class AdminController extends BaseAdminController
{ {
return $this->render("home"); return $this->render("home");
} }
public function updateAction()
{
return $this->render("profile-edit");
}
} }

View File

@@ -135,7 +135,7 @@ class CategoryController extends AbstractCrudController
'description' => $object->getDescription(), 'description' => $object->getDescription(),
'postscriptum' => $object->getPostscriptum(), 'postscriptum' => $object->getPostscriptum(),
'visible' => $object->getVisible(), 'visible' => $object->getVisible(),
'url' => $object->getRewritenUrl($this->getCurrentEditionLocale()), 'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
'parent' => $object->getParent() 'parent' => $object->getParent()
); );

View File

@@ -0,0 +1,328 @@
<?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\FolderCreateEvent;
use Thelia\Core\Event\FolderDeleteEvent;
use Thelia\Core\Event\FolderToggleVisibilityEvent;
use Thelia\Core\Event\FolderUpdateEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Form\FolderCreationForm;
use Thelia\Form\FolderModificationForm;
use Thelia\Model\FolderQuery;
/**
* Class FolderController
* @package Thelia\Controller\Admin
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class FolderController extends AbstractCrudController
{
public function __construct()
{
parent::__construct(
'folder',
'manual',
'folder_order',
'admin.folder.default',
'admin.folder.create',
'admin.folder.update',
'admin.folder.delete',
TheliaEvents::FOLDER_CREATE,
TheliaEvents::FOLDER_UPDATE,
TheliaEvents::FOLDER_DELETE,
TheliaEvents::FOLDER_TOGGLE_VISIBILITY,
TheliaEvents::FOLDER_UPDATE_POSITION
);
}
/**
* Return the creation form for this object
*/
protected function getCreationForm()
{
return new FolderCreationForm($this->getRequest());
}
/**
* Return the update form for this object
*/
protected function getUpdateForm()
{
return new FolderModificationForm($this->getRequest());
}
/**
* Hydrate the update form for this object, before passing it to the update template
*
* @param \Thelia\Model\Folder $object
*/
protected function hydrateObjectForm($object) {
// Prepare the data that will hydrate the form
$data = array(
'id' => $object->getId(),
'locale' => $object->getLocale(),
'title' => $object->getTitle(),
'chapo' => $object->getChapo(),
'description' => $object->getDescription(),
'postscriptum' => $object->getPostscriptum(),
'visible' => $object->getVisible(),
'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
'parent' => $object->getParent()
);
// Setup the object form
return new FolderModificationForm($this->getRequest(), "form", $data);
}
/**
* Creates the creation event with the provided form data
*
* @param unknown $formData
*/
protected function getCreationEvent($formData)
{
$creationEvent = new FolderCreateEvent();
$creationEvent
->setLocale($formData['locale'])
->setTitle($formData['title'])
->setVisible($formData['visible'])
->setParent($formData['parent']);
return $creationEvent;
}
/**
* Creates the update event with the provided form data
*
* @param unknown $formData
*/
protected function getUpdateEvent($formData)
{
$updateEvent = new FolderUpdateEvent($formData['id']);
$updateEvent
->setLocale($formData['locale'])
->setTitle($formData['title'])
->setChapo($formData['chapo'])
->setDescription($formData['description'])
->setPostscriptum($formData['postscriptum'])
->setVisible($formData['visible'])
->setUrl($formData['url'])
->setParent($formData['parent'])
;
return $updateEvent;
}
/**
* Creates the delete event with the provided form data
*/
protected function getDeleteEvent()
{
return new FolderDeleteEvent($this->getRequest()->get('folder_id'), 0);
}
/**
* @return FolderToggleVisibilityEvent|void
*/
protected function createToggleVisibilityEvent()
{
return new FolderToggleVisibilityEvent($this->getExistingObject());
}
/**
* @param $positionChangeMode
* @param $positionValue
* @return UpdatePositionEvent|void
*/
protected function createUpdatePositionEvent($positionChangeMode, $positionValue) {
return new UpdatePositionEvent(
$this->getRequest()->get('folder_id', null),
$positionChangeMode,
$positionValue
);
}
/**
* Return true if the event contains the object, e.g. the action has updated the object in the event.
*
* @param unknown $event
*/
protected function eventContainsObject($event)
{
return $event->hasFolder();
}
/**
* Get the created object from an event.
*
* @param $event \Thelia\Core\Event\FolderEvent $event
*
* @return null|\Thelia\Model\Folder
*/
protected function getObjectFromEvent($event)
{
return $event->hasFolder() ? $event->getFolder() : null;
}
/**
* Load an existing object from the database
*/
protected function getExistingObject() {
return FolderQuery::create()
->joinWithI18n($this->getCurrentEditionLocale())
->findOneById($this->getRequest()->get('folder_id', 0));
}
/**
* Returns the object label form the object event (name, title, etc.)
*
* @param unknown $object
*/
protected function getObjectLabel($object) {
return $object->getTitle();
}
/**
* Returns the object ID from the object
*
* @param unknown $object
*/
protected function getObjectId($object)
{
return $object->getId();
}
/**
* Render the main list template
*
* @param unknown $currentOrder, if any, null otherwise.
*/
protected function renderListTemplate($currentOrder) {
// Get product order
$product_order = $this->getListOrderFromSession('content', 'content_order', 'manual');
return $this->render('folders',
array(
'folder_order' => $currentOrder,
'content_order' => $product_order,
'folder_id' => $this->getRequest()->get('folder_id', 0)
));
}
/**
* Render the edition template
*/
protected function renderEditionTemplate() {
return $this->render('folder-edit', $this->getEditionArguments());
}
protected function getEditionArguments()
{
return array(
'folder_id' => $this->getRequest()->get('folder_id', 0),
'current_tab' => $this->getRequest()->get('current_tab', 'general')
);
}
/**
* @param \Thelia\Core\Event\FolderUpdateEvent $updateEvent
* @return Response|void
*/
protected function performAdditionalUpdateAction($updateEvent)
{
if ($this->getRequest()->get('save_mode') != 'stay') {
// Redirect to parent category list
$this->redirectToRoute(
'admin.folders.default',
array('folder_id' => $updateEvent->getFolder()->getParent())
);
}
}
/**
* Put in this method post object delete processing if required.
*
* @param \Thelia\Core\Event\FolderDeleteEvent $deleteEvent the delete event
* @return Response a response, or null to continue normal processing
*/
protected function performAdditionalDeleteAction($deleteEvent)
{
// Redirect to parent category list
$this->redirectToRoute(
'admin.folders.default',
array('folder_id' => $deleteEvent->getFolder()->getParent())
);
}
/**
* @param $event \Thelia\Core\Event\UpdatePositionEvent
* @return null|Response
*/
protected function performAdditionalUpdatePositionAction($event)
{
$folder = FolderQuery::create()->findPk($event->getObjectId());
if ($folder != null) {
// Redirect to parent category list
$this->redirectToRoute(
'admin.folders.default',
array('folder_id' => $folder->getParent())
);
}
return null;
}
/**
* Redirect to the edition template
*/
protected function redirectToEditionTemplate()
{
$this->redirectToRoute("admin.folders.update", $this->getEditionArguments());
}
/**
* Redirect to the list template
*/
protected function redirectToListTemplate()
{
$this->redirectToRoute(
'admin.folders.default',
array('folder_id' => $this->getRequest()->get('folder_id', 0))
);
}
}

View File

@@ -0,0 +1,46 @@
<?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;
/**
* Class ModuleController
* @package Thelia\Controller\Admin
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class ModuleController extends BaseAdminController
{
public function indexAction()
{
if (null !== $response = $this->checkAuth("admin.module.view")) return $response;
return $this->render("modules", array("display_module" => 20));
}
public function updateAction($module_id)
{
return $this->render("module-edit", array(
"module_id" => $module_id
));
}
}

View File

@@ -39,6 +39,10 @@ use Thelia\Model\FolderQuery;
use Thelia\Model\ContentQuery; use Thelia\Model\ContentQuery;
use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Model\ProductAssociatedContentQuery; use Thelia\Model\ProductAssociatedContentQuery;
use Thelia\Model\AccessoryQuery;
use Thelia\Model\CategoryQuery;
use Thelia\Core\Event\ProductAddAccessoryEvent;
use Thelia\Core\Event\ProductDeleteAccessoryEvent;
/** /**
* Manages products * Manages products
@@ -83,9 +87,10 @@ class ProductController extends AbstractCrudController
$createEvent = new ProductCreateEvent(); $createEvent = new ProductCreateEvent();
$createEvent $createEvent
->setRef($formData['ref'])
->setTitle($formData['title']) ->setTitle($formData['title'])
->setLocale($formData["locale"]) ->setLocale($formData['locale'])
->setParent($formData['parent']) ->setDefaultCategory($formData['default_category'])
->setVisible($formData['visible']) ->setVisible($formData['visible'])
; ;
@@ -141,8 +146,8 @@ class ProductController extends AbstractCrudController
'description' => $object->getDescription(), 'description' => $object->getDescription(),
'postscriptum' => $object->getPostscriptum(), 'postscriptum' => $object->getPostscriptum(),
'visible' => $object->getVisible(), 'visible' => $object->getVisible(),
'url' => $object->getRewritenUrl($this->getCurrentEditionLocale()), 'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
'parent' => $object->getParent() 'default_category' => $object->getDefaultCategoryId()
); );
// Setup the object form // Setup the object form
@@ -174,12 +179,27 @@ class ProductController extends AbstractCrudController
protected function getEditionArguments() protected function getEditionArguments()
{ {
return array( return array(
'category_id' => $this->getCategoryId(),
'product_id' => $this->getRequest()->get('product_id', 0), 'product_id' => $this->getRequest()->get('product_id', 0),
'folder_id' => $this->getRequest()->get('folder_id', 0), 'folder_id' => $this->getRequest()->get('folder_id', 0),
'accessory_category_id'=> $this->getRequest()->get('accessory_category_id', 0),
'current_tab' => $this->getRequest()->get('current_tab', 'general') 'current_tab' => $this->getRequest()->get('current_tab', 'general')
); );
} }
protected function getCategoryId() {
// Trouver le category_id, soit depuis la reques, souit depuis le produit courant
$category_id = $this->getRequest()->get('category_id', null);
if ($category_id == null) {
$product = $this->getExistingObject();
if ($product !== null) $category_id = $product->getDefaultCategoryId();
}
return $category_id != null ? $category_id : 0;
}
protected function renderListTemplate($currentOrder) protected function renderListTemplate($currentOrder)
{ {
$this->getListOrderFromSession('product', 'product_order', 'manual'); $this->getListOrderFromSession('product', 'product_order', 'manual');
@@ -187,18 +207,15 @@ class ProductController extends AbstractCrudController
return $this->render('categories', return $this->render('categories',
array( array(
'product_order' => $currentOrder, 'product_order' => $currentOrder,
'product_id' => $this->getRequest()->get('product_id', 0) 'category_id' => $this->getCategoryId()
)); ));
} }
protected function redirectToListTemplate() protected function redirectToListTemplate()
{ {
// Redirect to the product default category list
$product = $this->getExistingObject();
$this->redirectToRoute( $this->redirectToRoute(
'admin.products.default', 'admin.products.default',
array('category_id' => $product != null ? $product->getDefaultCategory() : 0) array('category_id' => $this->getCategoryId())
); );
} }
@@ -238,7 +255,7 @@ class ProductController extends AbstractCrudController
// Redirect to parent product list // Redirect to parent product list
$this->redirectToRoute( $this->redirectToRoute(
'admin.products.default', 'admin.products.default',
array('category_id' => $deleteEvent->getProduct()->getDefaultCategory()) array('category_id' => $this->getCategoryId())
); );
} }
@@ -249,25 +266,21 @@ class ProductController extends AbstractCrudController
// Redirect to parent product list // Redirect to parent product list
$this->redirectToRoute( $this->redirectToRoute(
'admin.categories.default', 'admin.categories.default',
array('category_id' => $product->getDefaultCategory()) array('category_id' => $this->getCategoryId())
); );
} }
} }
protected function performAdditionalUpdatePositionAction($event) protected function performAdditionalUpdatePositionAction($positionEvent)
{ {
$product = ProductQuery::create()->findPk($event->getObjectId());
if ($product != null) {
// Redirect to parent product list // Redirect to parent product list
$this->redirectToRoute( $this->redirectToRoute(
'admin.categories.default', 'admin.categories.default',
array('category_id' => $product->getDefaultCategory()) array('category_id' => $this->getCategoryId())
); );
} }
return null; // -- Related content management -------------------------------------------
}
public function getAvailableRelatedContentAction($productId, $folderId) public function getAvailableRelatedContentAction($productId, $folderId)
{ {
@@ -347,4 +360,118 @@ class ProductController extends AbstractCrudController
$this->redirectToEditionTemplate(); $this->redirectToEditionTemplate();
} }
// -- Accessories management ----------------------------------------------
public function getAvailableAccessoriesAction($productId, $categoryId)
{
$result = array();
$categories = CategoryQuery::create()->filterById($categoryId)->find();
if ($categories !== null) {
$list = ProductQuery::create()
->joinWithI18n($this->getCurrentEditionLocale())
->filterByCategory($categories, Criteria::IN)
->filterById(AccessoryQuery::create()->select('accessory')->findByProductId($productId), Criteria::NOT_IN)
->find();
;
if ($list !== null) {
foreach($list as $item) {
$result[] = array('id' => $item->getId(), 'title' => $item->getTitle());
}
}
}
return $this->jsonResponse(json_encode($result));
}
public function addAccessoryAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
$accessory_id = intval($this->getRequest()->get('accessory_id'));
if ($accessory_id > 0) {
$event = new ProductAddAccessoryEvent(
$this->getExistingObject(),
$accessory_id
);
try {
$this->dispatch(TheliaEvents::PRODUCT_ADD_ACCESSORY, $event);
}
catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
}
$this->redirectToEditionTemplate();
}
public function deleteAccessoryAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
$accessory_id = intval($this->getRequest()->get('accessory_id'));
if ($accessory_id > 0) {
$event = new ProductDeleteAccessoryEvent(
$this->getExistingObject(),
$accessory_id
);
try {
$this->dispatch(TheliaEvents::PRODUCT_REMOVE_ACCESSORY, $event);
}
catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
}
$this->redirectToEditionTemplate();
}
/**
* Update accessory position (only for objects whichsupport that)
*/
public function updateAccessoryPositionAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth('admin.products.update')) return $response;
try {
$mode = $this->getRequest()->get('mode', null);
if ($mode == 'up')
$mode = UpdatePositionEvent::POSITION_UP;
else if ($mode == 'down')
$mode = UpdatePositionEvent::POSITION_DOWN;
else
$mode = UpdatePositionEvent::POSITION_ABSOLUTE;
$position = $this->getRequest()->get('position', null);
$event = new UpdatePositionEvent($mode, $position);
$this->dispatch(TheliaEvents::PRODUCT_UPDATE_ACCESSORY_POSITION, $event);
}
catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
$this->redirectToEditionTemplate();
}
} }

View File

@@ -0,0 +1,46 @@
<?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;
/**
* Class ShippingConfigurationController
* @package Thelia\Controller\Admin
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class ShippingConfigurationController extends BaseAdminController
{
public function indexAction()
{
if (null !== $response = $this->checkAuth("admin.shipping-configuration.view")) return $response;
return $this->render("shipping-configuration", array("display_shipping_configuration" => 20));
}
public function updateAction($shipping_configuration_id)
{
return $this->render("shipping-configuration-edit", array(
"shipping_configuration_id" => $shipping_configuration_id
));
}
}

View File

@@ -0,0 +1,46 @@
<?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;
/**
* Class ShippingZoneController
* @package Thelia\Controller\Admin
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class ShippingZoneController extends BaseAdminController
{
public function indexAction()
{
if (null !== $response = $this->checkAuth("admin.shipping-zones.view")) return $response;
return $this->render("shipping-zones", array("display_shipping_zone" => 20));
}
public function updateAction($shipping_zones_id)
{
return $this->render("shipping-zones-edit", array(
"shipping_zones_id" => $shipping_zones_id
));
}
}

View File

@@ -24,6 +24,8 @@ namespace Thelia\Controller\Front;
use Symfony\Component\Routing\Router; use Symfony\Component\Routing\Router;
use Thelia\Controller\BaseController; use Thelia\Controller\BaseController;
use Thelia\Model\AddressQuery;
use Thelia\Model\ModuleQuery;
use Thelia\Tools\URL; use Thelia\Tools\URL;
class BaseFrontController extends BaseController class BaseFrontController extends BaseController
@@ -65,4 +67,20 @@ class BaseFrontController extends BaseController
$this->redirectToRoute("cart.view"); $this->redirectToRoute("cart.view");
} }
} }
protected function checkValidDelivery()
{
$order = $this->getSession()->getOrder();
if(null === $order || null === $order->chosenDeliveryAddress || null === $order->getDeliveryModuleId() || null === AddressQuery::create()->findPk($order->chosenDeliveryAddress) || null === ModuleQuery::create()->findPk($order->getDeliveryModuleId())) {
$this->redirectToRoute("order.delivery");
}
}
protected function checkValidInvoice()
{
$order = $this->getSession()->getOrder();
if(null === $order || null === $order->chosenInvoiceAddress || null === $order->getPaymentModuleId() || null === AddressQuery::create()->findPk($order->chosenInvoiceAddress) || null === ModuleQuery::create()->findPk($order->getPaymentModuleId())) {
$this->redirectToRoute("order.invoice");
}
}
} }

View File

@@ -23,15 +23,21 @@
namespace Thelia\Controller\Front; namespace Thelia\Controller\Front;
use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Exception\PropelException;
use Thelia\Exception\TheliaProcessException;
use Thelia\Form\Exception\FormValidationException; use Thelia\Form\Exception\FormValidationException;
use Thelia\Core\Event\OrderEvent; use Thelia\Core\Event\OrderEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Thelia\Form\OrderDelivery; use Thelia\Form\OrderDelivery;
use Thelia\Form\OrderPayment;
use Thelia\Log\Tlog; use Thelia\Log\Tlog;
use Thelia\Model\AddressQuery; use Thelia\Model\AddressQuery;
use Thelia\Model\AreaDeliveryModuleQuery; use Thelia\Model\AreaDeliveryModuleQuery;
use Thelia\Model\Base\OrderQuery;
use Thelia\Model\CountryQuery;
use Thelia\Model\ModuleQuery;
use Thelia\Model\Order; use Thelia\Model\Order;
use Thelia\Tools\URL;
/** /**
* Class OrderController * Class OrderController
@@ -41,7 +47,6 @@ use Thelia\Model\Order;
class OrderController extends BaseFrontController class OrderController extends BaseFrontController
{ {
/** /**
* set billing address
* set delivery address * set delivery address
* set delivery module * set delivery module
*/ */
@@ -59,25 +64,32 @@ class OrderController extends BaseFrontController
$deliveryAddressId = $form->get("delivery-address")->getData(); $deliveryAddressId = $form->get("delivery-address")->getData();
$deliveryModuleId = $form->get("delivery-module")->getData(); $deliveryModuleId = $form->get("delivery-module")->getData();
$deliveryAddress = AddressQuery::create()->findPk($deliveryAddressId);
$deliveryModule = ModuleQuery::create()->findPk($deliveryModuleId);
/* check that the delivery address belong to the current customer */ /* check that the delivery address belongs to the current customer */
$deliveryAddress = AddressQuery::create()->findPk($deliveryAddressId); $deliveryAddress = AddressQuery::create()->findPk($deliveryAddressId);
if($deliveryAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) { if($deliveryAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) {
throw new \Exception("Address does not belong to the current customer"); throw new \Exception("Delivery address does not belong to the current customer");
} }
/* check that the delivery module fetch the delivery address area */ /* check that the delivery module fetches the delivery address area */
if(AreaDeliveryModuleQuery::create() if(AreaDeliveryModuleQuery::create()
->filterByAreaId($deliveryAddress->getCountry()->getAreaId()) ->filterByAreaId($deliveryAddress->getCountry()->getAreaId())
->filterByDeliveryModuleId() ->filterByDeliveryModuleId($deliveryModuleId)
->count() == 0) { ->count() == 0) {
throw new \Exception("PUKE"); throw new \Exception("Delivery module cannot be use with selected delivery address");
} }
/* get postage amount */
$moduleReflection = new \ReflectionClass($deliveryModule->getFullNamespace());
$moduleInstance = $moduleReflection->newInstance();
$postage = $moduleInstance->getPostage($deliveryAddress->getCountry());
$orderEvent = $this->getOrderEvent(); $orderEvent = $this->getOrderEvent();
$orderEvent->setDeliveryAddress($deliveryAddressId); $orderEvent->setDeliveryAddress($deliveryAddressId);
$orderEvent->setDeliveryModule($deliveryModuleId); $orderEvent->setDeliveryModule($deliveryModuleId);
$orderEvent->setPostage($postage);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_ADDRESS, $orderEvent); $this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_ADDRESS, $orderEvent);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_MODULE, $orderEvent); $this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_MODULE, $orderEvent);
@@ -105,6 +117,111 @@ class OrderController extends BaseFrontController
} }
/**
* set invoice address
* set payment module
*/
public function invoice()
{
$this->checkAuth();
$this->checkCartNotEmpty();
$this->checkValidDelivery();
$message = false;
$orderPayment = new OrderPayment($this->getRequest());
try {
$form = $this->validateForm($orderPayment, "post");
$invoiceAddressId = $form->get("invoice-address")->getData();
$paymentModuleId = $form->get("payment-module")->getData();
/* check that the invoice address belongs to the current customer */
$invoiceAddress = AddressQuery::create()->findPk($invoiceAddressId);
if($invoiceAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) {
throw new \Exception("Invoice address does not belong to the current customer");
}
$orderEvent = $this->getOrderEvent();
$orderEvent->setInvoiceAddress($invoiceAddressId);
$orderEvent->setPaymentModule($paymentModuleId);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_INVOICE_ADDRESS, $orderEvent);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_PAYMENT_MODULE, $orderEvent);
$this->redirectToRoute("order.payment.process");
} catch (FormValidationException $e) {
$message = sprintf("Please check your input: %s", $e->getMessage());
} catch (PropelException $e) {
$this->getParserContext()->setGeneralError($e->getMessage());
} catch (\Exception $e) {
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
}
if ($message !== false) {
Tlog::getInstance()->error(sprintf("Error during order payment process : %s. Exception was %s", $message, $e->getMessage()));
$orderPayment->setErrorMessage($message);
$this->getParserContext()
->addForm($orderPayment)
->setGeneralError($message)
;
}
}
public function pay()
{
/* check customer */
$this->checkAuth();
/* check cart count */
$this->checkCartNotEmpty();
/* check delivery address and module */
$this->checkValidDelivery();
/* check invoice address and payment module */
$this->checkValidInvoice();
$orderEvent = $this->getOrderEvent();
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_PAY, $orderEvent);
$placedOrder = $orderEvent->getPlacedOrder();
if(null !== $placedOrder && null !== $placedOrder->getId()) {
/* order has been placed */
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute('order.placed', array('order_id' => $orderEvent->getPlacedOrder()->getId()))));
} else {
/* order has not been placed */
$this->redirectToRoute("cart.view");
}
}
public function orderPlaced($order_id)
{
/* check if the placed order matched the customer */
$placedOrder = OrderQuery::create()->findPk(
$this->getRequest()->attributes->get('order_id')
);
if(null === $placedOrder) {
throw new TheliaProcessException("No placed order", TheliaProcessException::NO_PLACED_ORDER, $placedOrder);
}
$customer = $this->getSecurityContext()->getCustomerUser();
if(null === $customer || $placedOrder->getCustomerId() !== $customer->getId()) {
throw new TheliaProcessException("Received placed order id does not belong to the current customer", TheliaProcessException::PLACED_ORDER_ID_BAD_CURRENT_CUSTOMER, $placedOrder);
}
$this->getParserContext()->set("placed_order_id", $placedOrder->getId());
}
protected function getOrderEvent() protected function getOrderEvent()
{ {
$order = $this->getOrder($this->getRequest()); $order = $this->getOrder($this->getRequest());

View 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;
use Thelia\Model\Accessory;
use Thelia\Core\Event\ActionEvent;
class AccessoryEvent extends ActionEvent
{
public $accessory = null;
public function __construct(Accessory $accessory = null)
{
$this->accessory = $accessory;
}
public function hasAccessory()
{
return ! is_null($this->accessory);
}
public function getAccessory()
{
return $this->accessory;
}
public function setAccessory(Accessory $accessory)
{
$this->accessory = $accessory;
return $this;
}
}

View 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;
use Thelia\Model\CategoryAssociatedContent;
use Thelia\Core\Event\ActionEvent;
class CategoryAssociatedContentEvent extends ActionEvent
{
public $content = null;
public function __construct(CategoryAssociatedContent $content = null)
{
$this->content = $content;
}
public function hasCategoryAssociatedContent()
{
return ! is_null($this->content);
}
public function getCategoryAssociatedContent()
{
return $this->content;
}
public function setCategoryAssociatedContent(CategoryAssociatedContent $content)
{
$this->content = $content;
return $this;
}
}

View File

@@ -0,0 +1,120 @@
<?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 FolderCreateEvent
* @package Thelia\Core\Event
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class FolderCreateEvent extends FolderEvent {
protected $title;
protected $parent;
protected $locale;
protected $visible;
/**
* @param mixed $locale
*
* @return $this
*/
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
/**
* @return mixed
*/
public function getLocale()
{
return $this->locale;
}
/**
* @param mixed $parent
*
*
* @return $this
*/
public function setParent($parent)
{
$this->parent = $parent;
return $this;
}
/**
* @return mixed
*/
public function getParent()
{
return $this->parent;
}
/**
* @param mixed $title
*
* @return $this
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* @return mixed
*/
public function getTitle()
{
return $this->title;
}
/**
* @param mixed $visible
*
* @return $this
*/
public function setVisible($visible)
{
$this->visible = $visible;
return $this;
}
/**
* @return mixed
*/
public function getVisible()
{
return $this->visible;
}
}

View File

@@ -21,35 +21,44 @@
/* */ /* */
/*************************************************************************************/ /*************************************************************************************/
namespace Thelia\Controller\Front; namespace Thelia\Core\Event;
use Thelia\Model\ModuleQuery;
use Thelia\Tools\URL;
/** /**
* Class DeliveryController * Class FolderDeleteEvent
* @package Thelia\Controller\Front * @package Thelia\Core\Event
* @author Manuel Raynaud <mraynaud@openstudio.fr> * @author Manuel Raynaud <mraynaud@openstudio.fr>
*/ */
class DeliveryController extends BaseFrontController class FolderDeleteEvent extends FolderEvent{
/**
* @var int folder id
*/
protected $folder_id;
/**
* @param int $folder_id
*/
function __construct($folder_id)
{ {
public function select($delivery_id) $this->folder_id = $folder_id;
}
/**
* @param int $folder_id
*/
public function setFolderId($folder_id)
{ {
if ($this->getSecurityContext()->hasCustomerUser() === false) { $this->folder_id = $folder_id;
$this->redirect(URL::getInstance()->getIndexPage());
} }
$request = $this->getRequest(); /**
* @return int
*/
public function getFolderId()
{
return $this->folder_id;
}
$deliveryModule = ModuleQuery::create()
->filterById($delivery_id)
->filterByActivate(1)
->findOne()
;
if ($deliveryModule) {
$request->getSession()->setDelivery($delivery_id);
} else {
$this->pageNotFound();
}
}
} }

View File

@@ -0,0 +1,73 @@
<?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\Folder;
/**
* Class FolderEvent
* @package Thelia\Core\Event
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class FolderEvent extends ActionEvent {
/**
* @var \Thelia\Model\Folder
*/
protected $folder;
function __construct(Folder $folder = null)
{
$this->folder = $folder;
}
/**
* @param \Thelia\Model\Folder $folder
*/
public function setFolder(Folder $folder)
{
$this->folder = $folder;
return $this;
}
/**
* @return \Thelia\Model\Folder
*/
public function getFolder()
{
return $this->folder;
}
/**
* test if a folder object exists
*
* @return bool
*/
public function hasFolder()
{
return null !== $this->folder;
}
}

View File

@@ -0,0 +1,34 @@
<?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 FolderToggleVisibilityEvent
* @package Thelia\Core\Event
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class FolderToggleVisibilityEvent extends FolderEvent {
}

View File

@@ -0,0 +1,136 @@
<?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 FolderUpdateEvent
* @package Thelia\Core\Event
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class FolderUpdateEvent extends FolderCreateEvent {
protected $folder_id;
protected $chapo;
protected $description;
protected $postscriptum;
protected $url;
function __construct($folder_id)
{
$this->folder_id = $folder_id;
}
/**
* @param mixed $chapo
*/
public function setChapo($chapo)
{
$this->chapo = $chapo;
return $this;
}
/**
* @return mixed
*/
public function getChapo()
{
return $this->chapo;
}
/**
* @param mixed $description
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* @return mixed
*/
public function getDescription()
{
return $this->description;
}
/**
* @param mixed $folder_id
*/
public function setFolderId($folder_id)
{
$this->folder_id = $folder_id;
return $this;
}
/**
* @return mixed
*/
public function getFolderId()
{
return $this->folder_id;
}
/**
* @param mixed $postscriptum
*/
public function setPostscriptum($postscriptum)
{
$this->postscriptum = $postscriptum;
return $this;
}
/**
* @return mixed
*/
public function getPostscriptum()
{
return $this->postscriptum;
}
/**
* @param mixed $url
*/
public function setUrl($url)
{
$this->url = $url;
return $this;
}
/**
* @return mixed
*/
public function getUrl()
{
return $this->url;
}
}

View File

@@ -0,0 +1,60 @@
<?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 GenerateRewrittenUrlEvent
* @package Thelia\Core\Event
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class GenerateRewrittenUrlEvent extends ActionEvent {
protected $object;
protected $locale;
protected $url;
public function __construct($object, $locale)
{
$this->object;
$this->locale;
}
public function setUrl($url)
{
$this->url = $url;
}
public function isRewritten()
{
return null !== $this->url;
}
public function getUrl()
{
return $this->url;
}
}

View File

@@ -23,17 +23,18 @@
namespace Thelia\Core\Event; namespace Thelia\Core\Event;
use Thelia\Model\Address;
use Thelia\Model\AddressQuery;
use Thelia\Model\Module;
use Thelia\Model\Order; use Thelia\Model\Order;
class OrderEvent extends ActionEvent class OrderEvent extends ActionEvent
{ {
protected $order = null; protected $order = null;
protected $billingAddress = null; protected $placedOrder = null;
protected $invoiceAddress = null;
protected $deliveryAddress = null; protected $deliveryAddress = null;
protected $deliveryModule = null; protected $deliveryModule = null;
protected $paymentModule = null;
protected $postage = null;
protected $ref = null;
/** /**
* @param Order $order * @param Order $order
@@ -51,12 +52,20 @@ class OrderEvent extends ActionEvent
$this->order = $order; $this->order = $order;
} }
/**
* @param Order $order
*/
public function setPlacedOrder(Order $order)
{
$this->placedOrder = $order;
}
/** /**
* @param $address * @param $address
*/ */
public function setBillingAddress($address) public function setInvoiceAddress($address)
{ {
$this->deliveryAddress = $address; $this->invoiceAddress = $address;
} }
/** /**
@@ -75,6 +84,30 @@ class OrderEvent extends ActionEvent
$this->deliveryModule = $module; $this->deliveryModule = $module;
} }
/**
* @param $module
*/
public function setPaymentModule($module)
{
$this->paymentModule = $module;
}
/**
* @param $postage
*/
public function setPostage($postage)
{
$this->postage = $postage;
}
/**
* @param $ref
*/
public function setRef($ref)
{
$this->ref = $ref;
}
/** /**
* @return null|Order * @return null|Order
*/ */
@@ -84,15 +117,23 @@ class OrderEvent extends ActionEvent
} }
/** /**
* @return array|mixed|Address * @return null|Order
*/ */
public function getBillingAddress() public function getPlacedOrder()
{ {
return $this->billingAddress; return $this->placedOrder;
} }
/** /**
* @return array|mixed|Address * @return null|int
*/
public function getInvoiceAddress()
{
return $this->invoiceAddress;
}
/**
* @return null|int
*/ */
public function getDeliveryAddress() public function getDeliveryAddress()
{ {
@@ -100,10 +141,34 @@ class OrderEvent extends ActionEvent
} }
/** /**
* @return array|mixed|Address * @return null|int
*/ */
public function getDeliveryModule() public function getDeliveryModule()
{ {
return $this->deliveryModule; return $this->deliveryModule;
} }
/**
* @return null|int
*/
public function getPaymentModule()
{
return $this->paymentModule;
}
/**
* @return null|int
*/
public function getPostage()
{
return $this->postage;
}
/**
* @return null|int
*/
public function getRef()
{
return $this->ref;
}
} }

View File

@@ -0,0 +1,48 @@
<?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\Product;
class ProductAddAccessoryEvent extends ProductEvent
{
protected $accessory_id;
public function __construct(Product $product, $accessory_id)
{
parent::__construct($product);
$this->accessory_id = $accessory_id;
}
public function getAccessoryId()
{
return $this->accessory_id;
}
public function setAccessoryId($accessory_id)
{
$this->accessory_id = $accessory_id;
}
}

View 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;
use Thelia\Model\ProductAssociatedContent;
use Thelia\Core\Event\ActionEvent;
class ProductAssociatedContentEvent extends ActionEvent
{
public $content = null;
public function __construct(ProductAssociatedContent $content = null)
{
$this->content = $content;
}
public function hasProductAssociatedContent()
{
return ! is_null($this->content);
}
public function getProductAssociatedContent()
{
return $this->content;
}
public function setProductAssociatedContent(ProductAssociatedContent $content)
{
$this->content = $content;
return $this;
}
}

View File

@@ -25,11 +25,23 @@ namespace Thelia\Core\Event;
class ProductCreateEvent extends ProductEvent class ProductCreateEvent extends ProductEvent
{ {
protected $ref;
protected $title; protected $title;
protected $parent;
protected $locale; protected $locale;
protected $default_category;
protected $visible; protected $visible;
public function getRef()
{
return $this->ref;
}
public function setRef($ref)
{
$this->ref = $ref;
return $this;
}
public function getTitle() public function getTitle()
{ {
return $this->title; return $this->title;
@@ -38,19 +50,6 @@ class ProductCreateEvent extends ProductEvent
public function setTitle($title) public function setTitle($title)
{ {
$this->title = $title; $this->title = $title;
return $this;
}
public function getParent()
{
return $this->parent;
}
public function setParent($parent)
{
$this->parent = $parent;
return $this; return $this;
} }
@@ -62,7 +61,17 @@ class ProductCreateEvent extends ProductEvent
public function setLocale($locale) public function setLocale($locale)
{ {
$this->locale = $locale; $this->locale = $locale;
return $this;
}
public function getDefaultCategory()
{
return $this->default_category;
}
public function setDefaultCategory($default_category)
{
$this->default_category = $default_category;
return $this; return $this;
} }
@@ -74,7 +83,6 @@ class ProductCreateEvent extends ProductEvent
public function setVisible($visible) public function setVisible($visible)
{ {
$this->visible = $visible; $this->visible = $visible;
return $this; return $this;
} }
} }

View File

@@ -0,0 +1,48 @@
<?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\Product;
class ProductDeleteAccessoryEvent extends ProductEvent
{
protected $accessory_id;
public function __construct(Product $product, $accessory_id)
{
parent::__construct($product);
$this->accessory_id = $accessory_id;
}
public function getAccessoryId()
{
return $this->accessory_id;
}
public function setAccessoryId($accessory_id)
{
$this->accessory_id = $accessory_id;
}
}

View File

@@ -165,6 +165,37 @@ final class TheliaEvents
const BEFORE_UPDATECATEGORY = "action.before_updateCategory"; const BEFORE_UPDATECATEGORY = "action.before_updateCategory";
const AFTER_UPDATECATEGORY = "action.after_updateCategory"; const AFTER_UPDATECATEGORY = "action.after_updateCategory";
// -- folder management -----------------------------------------------
const FOLDER_CREATE = "action.createFolder";
const FOLDER_UPDATE = "action.updateFolder";
const FOLDER_DELETE = "action.deleteFolder";
const FOLDER_TOGGLE_VISIBILITY = "action.toggleFolderVisibility";
const FOLDER_UPDATE_POSITION = "action.updateFolderPosition";
// const FOLDER_ADD_CONTENT = "action.categoryAddContent";
// const FOLDER_REMOVE_CONTENT = "action.categoryRemoveContent";
const BEFORE_CREATEFOLDER = "action.before_createFolder";
const AFTER_CREATEFOLDER = "action.after_createFolder";
const BEFORE_DELETEFOLDER = "action.before_deleteFolder";
const AFTER_DELETEFOLDER = "action.after_deleteFolder";
const BEFORE_UPDATEFOLDER = "action.before_updateFolder";
const AFTER_UPDATEFOLDER = "action.after_updateFolder";
// -- Categories Associated Content ----------------------------------------
const BEFORE_CREATECATEGORY_ASSOCIATED_CONTENT = "action.before_createCategoryAssociatedContent";
const AFTER_CREATECATEGORY_ASSOCIATED_CONTENT = "action.after_createCategoryAssociatedContent";
const BEFORE_DELETECATEGORY_ASSOCIATED_CONTENT = "action.before_deleteCategoryAssociatedContenty";
const AFTER_DELETECATEGORY_ASSOCIATED_CONTENT = "action.after_deleteproduct_accessory";
const BEFORE_UPDATECATEGORY_ASSOCIATED_CONTENT = "action.before_updateCategoryAssociatedContent";
const AFTER_UPDATECATEGORY_ASSOCIATED_CONTENT = "action.after_updateCategoryAssociatedContent";
// -- Product management ----------------------------------------------- // -- Product management -----------------------------------------------
const PRODUCT_CREATE = "action.createProduct"; const PRODUCT_CREATE = "action.createProduct";
@@ -176,6 +207,10 @@ final class TheliaEvents
const PRODUCT_ADD_CONTENT = "action.productAddContent"; const PRODUCT_ADD_CONTENT = "action.productAddContent";
const PRODUCT_REMOVE_CONTENT = "action.productRemoveContent"; const PRODUCT_REMOVE_CONTENT = "action.productRemoveContent";
const PRODUCT_ADD_ACCESSORY = "action.productAddAccessory";
const PRODUCT_REMOVE_ACCESSORY = "action.productRemoveAccessory";
const PRODUCT_UPDATE_ACCESSORY_POSITION = "action.updateProductPosition";
const BEFORE_CREATEPRODUCT = "action.before_createproduct"; const BEFORE_CREATEPRODUCT = "action.before_createproduct";
const AFTER_CREATEPRODUCT = "action.after_createproduct"; const AFTER_CREATEPRODUCT = "action.after_createproduct";
@@ -185,6 +220,28 @@ final class TheliaEvents
const BEFORE_UPDATEPRODUCT = "action.before_updateProduct"; const BEFORE_UPDATEPRODUCT = "action.before_updateProduct";
const AFTER_UPDATEPRODUCT = "action.after_updateProduct"; const AFTER_UPDATEPRODUCT = "action.after_updateProduct";
// -- Product Accessories --------------------------------------------------
const BEFORE_CREATEACCESSORY = "action.before_createAccessory";
const AFTER_CREATEACCESSORY = "action.after_createAccessory";
const BEFORE_DELETEACCESSORY = "action.before_deleteAccessory";
const AFTER_DELETEACCESSORY = "action.after_deleteAccessory";
const BEFORE_UPDATEACCESSORY = "action.before_updateAccessory";
const AFTER_UPDATEACCESSORY = "action.after_updateAccessory";
// -- Product Associated Content --------------------------------------------------
const BEFORE_CREATEPRODUCT_ASSOCIATED_CONTENT = "action.before_createProductAssociatedContent";
const AFTER_CREATEPRODUCT_ASSOCIATED_CONTENT = "action.after_createProductAssociatedContent";
const BEFORE_DELETEPRODUCT_ASSOCIATED_CONTENT = "action.before_deleteProductAssociatedContenty";
const AFTER_DELETEPRODUCT_ASSOCIATED_CONTENT = "action.after_deleteproduct_accessory";
const BEFORE_UPDATEPRODUCT_ASSOCIATED_CONTENT = "action.before_updateProductAssociatedContent";
const AFTER_UPDATEPRODUCT_ASSOCIATED_CONTENT = "action.after_updateProductAssociatedContent";
/** /**
* sent when a new existing cat id duplicated. This append when current customer is different from current cart * sent when a new existing cat id duplicated. This append when current customer is different from current cart
*/ */
@@ -215,9 +272,17 @@ final class TheliaEvents
/** /**
* Order linked event * Order linked event
*/ */
const ORDER_SET_BILLING_ADDRESS = "action.order.setBillingAddress";
const ORDER_SET_DELIVERY_ADDRESS = "action.order.setDeliveryAddress"; const ORDER_SET_DELIVERY_ADDRESS = "action.order.setDeliveryAddress";
const ORDER_SET_DELIVERY_MODULE = "action.order.setDeliveryModule"; const ORDER_SET_DELIVERY_MODULE = "action.order.setDeliveryModule";
const ORDER_SET_INVOICE_ADDRESS = "action.order.setInvoiceAddress";
const ORDER_SET_PAYMENT_MODULE = "action.order.setPaymentModule";
const ORDER_PAY = "action.order.pay";
const ORDER_BEFORE_CREATE = "action.order.beforeCreate";
const ORDER_AFTER_CREATE = "action.order.afterCreate";
const ORDER_BEFORE_PAYMENT = "action.order.beforePayment";
const ORDER_PRODUCT_BEFORE_CREATE = "action.orderProduct.beforeCreate";
const ORDER_PRODUCT_AFTER_CREATE = "action.orderProduct.afterCreate";
/** /**
* Sent on image processing * Sent on image processing
@@ -451,4 +516,9 @@ final class TheliaEvents
*/ */
const MAILTRANSPORTER_CONFIG = 'action.mailertransporter.config'; const MAILTRANSPORTER_CONFIG = 'action.mailertransporter.config';
/**
* sent when Thelia try to generate a rewriten url
*/
const GENERATE_REWRITTENURL = 'action.generate_rewritenurl';
} }

View File

@@ -28,8 +28,10 @@ use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Router;
use Thelia\Core\Template\Exception\ResourceNotFoundException; use Thelia\Core\Template\Exception\ResourceNotFoundException;
use Thelia\Core\Template\ParserInterface; use Thelia\Core\Template\ParserInterface;
use Thelia\Exception\OrderException;
use Thelia\Tools\Redirect; use Thelia\Tools\Redirect;
use Thelia\Tools\URL; use Thelia\Tools\URL;
use Thelia\Core\Security\Exception\AuthenticationException; use Thelia\Core\Security\Exception\AuthenticationException;
@@ -77,16 +79,39 @@ class ViewListener implements EventSubscriberInterface
$content = $parser->getContent(); $content = $parser->getContent();
if ($content instanceof Response) { if ($content instanceof Response) {
$event->setResponse($content); $response = $content;$event->setResponse($content);
} else { } else {
$event->setResponse(new Response($content, $parser->getStatus() ?: 200)); $response = new Response($content, $parser->getStatus() ?: 200);
} }
$response->setCache(array(
'last_modified' => new \DateTime(),
'max_age' => 600,
's_maxage' => 600,
'private' => false,
'public' => true,
));
$event->setResponse($response);
} catch (ResourceNotFoundException $e) { } catch (ResourceNotFoundException $e) {
$event->setResponse(new Response($e->getMessage(), 404)); $event->setResponse(new Response($e->getMessage(), 404));
} catch (AuthenticationException $ex) { } catch (AuthenticationException $ex) {
// Redirect to the login template // Redirect to the login template
Redirect::exec($this->container->get('thelia.url.manager')->viewUrl($ex->getLoginTemplate())); Redirect::exec($this->container->get('thelia.url.manager')->viewUrl($ex->getLoginTemplate()));
} catch (OrderException $e) {
switch($e->getCode()) {
case OrderException::CART_EMPTY:
// Redirect to the cart template
Redirect::exec($this->container->get('router.chainRequest')->generate($e->cartRoute, $e->arguments, Router::ABSOLUTE_URL));
break;
case OrderException::UNDEFINED_DELIVERY:
// Redirect to the delivery choice template
Redirect::exec($this->container->get('router.chainRequest')->generate($e->orderDeliveryRoute, $e->arguments, Router::ABSOLUTE_URL));
break;
}
throw $e;
} }
} }

View File

@@ -218,6 +218,9 @@ class Session extends BaseSession
return $this; return $this;
} }
/**
* @return Order
*/
public function getOrder() public function getOrder()
{ {
return $this->get("thelia.order"); return $this->get("thelia.order");

View File

@@ -128,7 +128,7 @@ class RewritingRouter implements RouterInterface, RequestMatcherInterface
*/ */
public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
{ {
// TODO: Implement generate() method. throw new RouteNotFoundException();
} }
/** /**

View File

@@ -65,6 +65,8 @@ abstract class BaseI18nLoop extends BaseLoop
{ {
/* manage translations */ /* manage translations */
$fr = $this->getForce_return();
return ModelCriteriaTools::getI18n( return ModelCriteriaTools::getI18n(
$this->getBackend_context(), $this->getBackend_context(),
$this->getLang(), $this->getLang(),

View File

@@ -93,8 +93,10 @@ class Accessory extends Product
$accessories = $this->search($search); $accessories = $this->search($search);
$accessoryIdList = array(0); $accessoryIdList = array(0);
$accessoryPosition = array();
foreach ($accessories as $accessory) { foreach ($accessories as $accessory) {
array_push($accessoryIdList, $accessory->getAccessory()); array_push($accessoryIdList, $accessory->getAccessory());
$accessoryPosition[$accessory->getAccessory()] = $accessory->getPosition();
} }
$receivedIdList = $this->getId(); $receivedIdList = $this->getId();
@@ -106,7 +108,15 @@ class Accessory extends Product
$this->args->get('id')->setValue( implode(',', array_intersect($receivedIdList, $accessoryIdList)) ); $this->args->get('id')->setValue( implode(',', array_intersect($receivedIdList, $accessoryIdList)) );
} }
return parent::exec($pagination); $loopResult = parent::exec($pagination);
foreach($loopResult as $loopResultRow) {
$loopResultRow
->set("POSITION" , $accessoryPosition[$loopResultRow->get('ID')])
;
}
return $loopResult;
} }
} }

View File

@@ -54,7 +54,13 @@ class Address extends BaseLoop
protected function getArgDefinitions() protected function getArgDefinitions()
{ {
return new ArgumentCollection( return new ArgumentCollection(
Argument::createIntListTypeArgument('id'), new Argument(
'id',
new TypeCollection(
new Type\IntListType(),
new Type\EnumType(array('*', 'any'))
)
),
new Argument( new Argument(
'customer', 'customer',
new TypeCollection( new TypeCollection(
@@ -63,8 +69,14 @@ class Address extends BaseLoop
), ),
'current' 'current'
), ),
Argument::createBooleanTypeArgument('default'), Argument::createBooleanOrBothTypeArgument('default'),
Argument::createIntListTypeArgument('exclude') new Argument(
'exclude',
new TypeCollection(
new Type\IntListType(),
new Type\EnumType(array('none'))
)
)
); );
} }
@@ -79,7 +91,7 @@ class Address extends BaseLoop
$id = $this->getId(); $id = $this->getId();
if (null !== $id) { if (null !== $id && !in_array($id, array('*', 'any'))) {
$search->filterById($id, Criteria::IN); $search->filterById($id, Criteria::IN);
} }
@@ -106,7 +118,7 @@ class Address extends BaseLoop
$exclude = $this->getExclude(); $exclude = $this->getExclude();
if (!is_null($exclude)) { if (null !== $exclude && 'none' !== $exclude) {
$search->filterById($exclude, Criteria::NOT_IN); $search->filterById($exclude, Criteria::NOT_IN);
} }

View File

@@ -58,7 +58,19 @@ class Argument
public function setValue($value) public function setValue($value)
{ {
$this->value = $value === null ? null : (string) $value; $x = $value === null;
if($value === null) {
$this->value = null;
} else {
if(false === $value) {
/* (string) $value = "" */
$this->value = 0;
} else {
$this->value = (string) $value;
}
}
//$this->value = $value === null ? null : (string) $value;
} }
public static function createAnyTypeArgument($name, $default=null, $mandatory=false, $empty=true) public static function createAnyTypeArgument($name, $default=null, $mandatory=false, $empty=true)

View File

@@ -97,9 +97,9 @@ class AssociatedContent extends Content
$exclude_product = $this->getExcludeProduct(); $exclude_product = $this->getExcludeProduct();
// If we have to filter by template, find all attributes assigned to this template, and filter by found IDs // If we have to filter by product, find all products assigned to this product, and filter by found IDs
if (null !== $exclude_product) { if (null !== $exclude_product) {
// Exclure tous les attribut qui sont attachés aux templates indiqués // Exclude all contents related to the given product
$search->filterById( $search->filterById(
ProductAssociatedContentQuery::create()->filterByProductId($exclude_product)->select('product_id')->find(), ProductAssociatedContentQuery::create()->filterByProductId($exclude_product)->select('product_id')->find(),
Criteria::NOT_IN Criteria::NOT_IN
@@ -108,7 +108,7 @@ class AssociatedContent extends Content
$exclude_category = $this->getExcludeCategory(); $exclude_category = $this->getExcludeCategory();
// If we have to filter by template, find all attributes assigned to this template, and filter by found IDs // If we have to filter by category, find all contents assigned to this category, and filter by found IDs
if (null !== $exclude_category) { if (null !== $exclude_category) {
// Exclure tous les attribut qui sont attachés aux templates indiqués // Exclure tous les attribut qui sont attachés aux templates indiqués
$search->filterById( $search->filterById(

View File

@@ -29,7 +29,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\ModuleQuery; use Thelia\Model\ModuleQuery;
/** /**
* Class Delivery
* @package Thelia\Core\Template\Loop * @package Thelia\Core\Template\Loop
* @author Manuel Raynaud <mraynaud@openstudio.fr> * @author Manuel Raynaud <mraynaud@openstudio.fr>
*/ */
@@ -93,6 +92,8 @@ class BaseSpecificModule extends BaseI18nLoop
{ {
$search = ModuleQuery::create(); $search = ModuleQuery::create();
$search->filterByActivate(1);
if (null !== $id = $this->getId()) { if (null !== $id = $this->getId()) {
$search->filterById($id); $search->filterById($id);
} }

View File

@@ -81,6 +81,8 @@ class Cart extends BaseLoop
return $result; return $result;
} }
$taxCountry = CountryQuery::create()->findPk(64); // @TODO : make it magic;
foreach ($cartItems as $cartItem) { foreach ($cartItems as $cartItem) {
$product = $cartItem->getProduct(); $product = $cartItem->getProduct();
$productSaleElement = $cartItem->getProductSaleElements(); $productSaleElement = $cartItem->getProductSaleElements();
@@ -97,12 +99,8 @@ class Cart extends BaseLoop
->set("STOCK", $productSaleElement->getQuantity()) ->set("STOCK", $productSaleElement->getQuantity())
->set("PRICE", $cartItem->getPrice()) ->set("PRICE", $cartItem->getPrice())
->set("PROMO_PRICE", $cartItem->getPromoPrice()) ->set("PROMO_PRICE", $cartItem->getPromoPrice())
->set("TAXED_PRICE", $cartItem->getTaxedPrice( ->set("TAXED_PRICE", $cartItem->getTaxedPrice($taxCountry))
CountryQuery::create()->findOneById(64) // @TODO : make it magic ->set("PROMO_TAXED_PRICE", $cartItem->getTaxedPromoPrice($taxCountry))
))
->set("PROMO_TAXED_PRICE", $cartItem->getTaxedPromoPrice(
CountryQuery::create()->findOneById(64) // @TODO : make it magic
))
->set("IS_PROMO", $cartItem->getPromo() === 1 ? 1 : 0); ->set("IS_PROMO", $cartItem->getPromo() === 1 ? 1 : 0);
$result->addRow($loopResultRow); $result->addRow($loopResultRow);
} }
@@ -110,4 +108,13 @@ class Cart extends BaseLoop
return $result; return $result;
} }
/**
* Return the event dispatcher,
*
* @return \Symfony\Component\EventDispatcher\EventDispatcher
*/
public function getDispatcher()
{
return $this->dispatcher;
}
} }

View File

@@ -206,7 +206,8 @@ class Category extends BaseI18nLoop
->set("POSTSCRIPTUM", $category->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("POSTSCRIPTUM", $category->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("PARENT", $category->getParent()) ->set("PARENT", $category->getParent())
->set("URL", $category->getUrl($locale)) ->set("URL", $category->getUrl($locale))
->set("PRODUCT_COUNT", $category->countChild()) ->set("PRODUCT_COUNT", $category->countAllProducts())
->set("CHILD_COUNT", $category->countChild())
->set("VISIBLE", $category->getVisible() ? "1" : "0") ->set("VISIBLE", $category->getVisible() ? "1" : "0")
->set("POSITION", $category->getPosition()) ->set("POSITION", $category->getPosition())

View File

@@ -59,7 +59,7 @@ class CategoryTree extends BaseI18nLoop
} }
// changement de rubrique // changement de rubrique
protected function buildCategoryTree($parent, $visible, $level, $max_level, $exclude, LoopResult &$loopResult) protected function buildCategoryTree($parent, $visible, $level, $previousLevel, $max_level, $exclude, LoopResult &$loopResult)
{ {
if ($level > $max_level) return; if ($level > $max_level) return;
@@ -87,11 +87,12 @@ class CategoryTree extends BaseI18nLoop
->set("ID", $result->getId())->set("TITLE", $result->getVirtualColumn('i18n_TITLE')) ->set("ID", $result->getId())->set("TITLE", $result->getVirtualColumn('i18n_TITLE'))
->set("PARENT", $result->getParent())->set("URL", $result->getUrl($locale)) ->set("PARENT", $result->getParent())->set("URL", $result->getUrl($locale))
->set("VISIBLE", $result->getVisible() ? "1" : "0")->set("LEVEL", $level) ->set("VISIBLE", $result->getVisible() ? "1" : "0")->set("LEVEL", $level)
->set('CHILD_COUNT', $result->countChild())->set('PREV_LEVEL', $previousLevel)
; ;
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);
$this->buildCategoryTree($result->getId(), $visible, 1 + $level, $max_level, $exclude, $loopResult); $this->buildCategoryTree($result->getId(), $visible, 1 + $level, $level, $max_level, $exclude, $loopResult);
} }
} }
@@ -109,7 +110,7 @@ class CategoryTree extends BaseI18nLoop
$loopResult = new LoopResult(); $loopResult = new LoopResult();
$this->buildCategoryTree($id, $visible, 0, $depth, $exclude, $loopResult); $this->buildCategoryTree($id, $visible, 0, 0, $depth, $exclude, $loopResult);
return $loopResult; return $loopResult;
} }

View File

@@ -87,7 +87,7 @@ class Country extends BaseI18nLoop
if (true === $withArea) { if (true === $withArea) {
$search->filterByAreaId(null, Criteria::ISNOTNULL); $search->filterByAreaId(null, Criteria::ISNOTNULL);
} elseif (false == $withArea) { } elseif (false === $withArea) {
$search->filterByAreaId(null, Criteria::ISNULL); $search->filterByAreaId(null, Criteria::ISNULL);
} }

View File

@@ -89,7 +89,7 @@ class Delivery extends BaseSpecificModule
->set('CHAPO', $deliveryModule->getVirtualColumn('i18n_CHAPO')) ->set('CHAPO', $deliveryModule->getVirtualColumn('i18n_CHAPO'))
->set('DESCRIPTION', $deliveryModule->getVirtualColumn('i18n_DESCRIPTION')) ->set('DESCRIPTION', $deliveryModule->getVirtualColumn('i18n_DESCRIPTION'))
->set('POSTSCRIPTUM', $deliveryModule->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set('POSTSCRIPTUM', $deliveryModule->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set('PRICE', $moduleInstance->calculate($country)) ->set('POSTAGE', $moduleInstance->getPostage($country))
; ;
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);

View File

@@ -31,10 +31,12 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\Base\CategoryQuery; use Thelia\Model\CategoryQuery;
use Thelia\Model\Base\ProductCategoryQuery; use Thelia\Model\FeatureI18nQuery;
use Thelia\Model\Base\FeatureQuery; use Thelia\Model\ProductCategoryQuery;
use Thelia\Model\FeatureQuery;
use Thelia\Model\Map\ProductCategoryTableMap; use Thelia\Model\Map\ProductCategoryTableMap;
use Thelia\Model\ProductQuery;
use Thelia\Type\TypeCollection; use Thelia\Type\TypeCollection;
use Thelia\Type; use Thelia\Type;
use Thelia\Type\BooleanOrBothType; use Thelia\Type\BooleanOrBothType;
@@ -71,7 +73,8 @@ class Feature extends BaseI18nLoop
new Type\EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual_reverse')) new Type\EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual_reverse'))
), ),
'manual' 'manual'
) ),
Argument::createAnyTypeArgument('title')
); );
} }
@@ -134,6 +137,23 @@ class Feature extends BaseI18nLoop
); );
} }
$title = $this->getTitle();
if (null !== $title) {
//find all feture that match exactly this title and find with all locales.
$features = FeatureI18nQuery::create()
->filterByTitle($title, Criteria::LIKE)
->select('id')
->find();
if($features) {
$search->filterById(
$features,
Criteria::IN
);
}
}
$orders = $this->getOrder(); $orders = $this->getOrder();
foreach ($orders as $order) { foreach ($orders as $order) {

View File

@@ -162,7 +162,8 @@ class Folder extends BaseI18nLoop
->set("POSTSCRIPTUM", $folder->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("POSTSCRIPTUM", $folder->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("PARENT", $folder->getParent()) ->set("PARENT", $folder->getParent())
->set("URL", $folder->getUrl($locale)) ->set("URL", $folder->getUrl($locale))
->set("CONTENT_COUNT", $folder->countChild()) ->set("CHILD_COUNT", $folder->countChild())
->set("CONTENT_COUNT", $folder->countAllContents())
->set("VISIBLE", $folder->getVisible() ? "1" : "0") ->set("VISIBLE", $folder->getVisible() ? "1" : "0")
->set("POSITION", $folder->getPosition()) ->set("POSITION", $folder->getPosition())
; ;

View File

@@ -0,0 +1,118 @@
<?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\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\FolderQuery;
use Thelia\Type;
use Thelia\Type\BooleanOrBothType;
use Thelia\Core\Template\Element\BaseI18nLoop;
/**
*
* Folder tree loop, to get a folder tree from a given folder to a given depth.
*
* - folder is the folder id
* - depth is the maximum depth to go, default unlimited
* - visible if true or missing, only visible categories will be displayed. If false, all categories (visible or not) are returned.
*
* @package Thelia\Core\Template\Loop
* @author Franck Allimant <franck@cqfdev.fr>
*/
class FolderTree extends BaseI18nLoop
{
/**
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntTypeArgument('folder', null, true),
Argument::createIntTypeArgument('depth', PHP_INT_MAX),
Argument::createBooleanOrBothTypeArgument('visible', true, false),
Argument::createIntListTypeArgument('exclude', array())
);
}
// changement de rubrique
protected function buildFolderTree($parent, $visible, $level, $max_level, $exclude, LoopResult &$loopResult)
{
if ($level > $max_level) return;
$search = FolderQuery::create();
$locale = $this->configureI18nProcessing($search, array(
'TITLE'
));
$search->filterByParent($parent);
if ($visible != BooleanOrBothType::ANY) $search->filterByVisible($visible);
if ($exclude != null) $search->filterById($exclude, Criteria::NOT_IN);
$search->orderByPosition(Criteria::ASC);
$results = $search->find();
foreach ($results as $result) {
$loopResultRow = new LoopResultRow();
$loopResultRow
->set("ID", $result->getId())->set("TITLE", $result->getVirtualColumn('i18n_TITLE'))
->set("PARENT", $result->getParent())->set("URL", $result->getUrl($locale))
->set("VISIBLE", $result->getVisible() ? "1" : "0")->set("LEVEL", $level)
;
$loopResult->addRow($loopResultRow);
$this->buildFolderTree($result->getId(), $visible, 1 + $level, $max_level, $exclude, $loopResult);
}
}
/**
* @param $pagination (ignored)
*
* @return \Thelia\Core\Template\Element\LoopResult
*/
public function exec(&$pagination)
{
$id = $this->getFolder();
$depth = $this->getDepth();
$visible = $this->getVisible();
$exclude = $this->getExclude();
$loopResult = new LoopResult();
$this->buildFolderTree($id, $visible, 0, $depth, $exclude, $loopResult);
return $loopResult;
}
}

View File

@@ -48,7 +48,7 @@ class Image extends BaseI18nLoop
/** /**
* @var array Possible image sources * @var array Possible image sources
*/ */
protected $possible_sources = array('category', 'product', 'folder', 'content'); protected $possible_sources = array('category', 'product', 'folder', 'content', 'module');
/** /**
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection * @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
@@ -93,7 +93,8 @@ class Image extends BaseI18nLoop
new EnumType($this->possible_sources) new EnumType($this->possible_sources)
) )
), ),
Argument::createIntTypeArgument('source_id') Argument::createIntTypeArgument('source_id'),
Argument::createBooleanTypeArgument('force_return', true)
); );
// Add possible image sources // Add possible image sources
@@ -175,7 +176,7 @@ class Image extends BaseI18nLoop
$source_id = $this->getSourceId(); $source_id = $this->getSourceId();
$id = $this->getId(); $id = $this->getId();
//echo "source = ".$this->getSource()."source_id=$source_id, id=$id<br />"; //echo "source = ".$this->getSourceId()."source_id=$source_id, id=$id<br />";
if (is_null($source_id) && is_null($id)) { if (is_null($source_id) && is_null($id)) {
throw new \InvalidArgumentException("If 'source' argument is specified, 'id' or 'source_id' argument should be specified"); throw new \InvalidArgumentException("If 'source' argument is specified, 'id' or 'source_id' argument should be specified");
@@ -214,6 +215,7 @@ class Image extends BaseI18nLoop
*/ */
public function exec(&$pagination) public function exec(&$pagination)
{ {
// Select the proper query to use, and get the object type // Select the proper query to use, and get the object type
$object_type = $object_id = null; $object_type = $object_id = null;
@@ -269,6 +271,7 @@ class Image extends BaseI18nLoop
$loopResult = new LoopResult($results); $loopResult = new LoopResult($results);
foreach ($results as $result) { foreach ($results as $result) {
// Create image processing event // Create image processing event
$event = new ImageEvent($this->request); $event = new ImageEvent($this->request);
@@ -315,7 +318,8 @@ class Image extends BaseI18nLoop
; ;
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);
} catch (\Exception $ex) { }
catch (\Exception $ex) {
// Ignore the result and log an error // Ignore the result and log an error
Tlog::getInstance()->addError("Failed to process image in image loop: ", $this->args); Tlog::getInstance()->addError("Failed to process image in image loop: ", $this->args);
} }

View File

@@ -0,0 +1,137 @@
<?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\ModuleQuery;
use Thelia\Module\BaseModule;
use Thelia\Type;
/**
*
* Module loop
*
*
* Class Module
* @package Thelia\Core\Template\Loop
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*/
class Module extends BaseI18nLoop
{
public $timestampable = true;
/**
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntListTypeArgument('id'),
new Argument(
'module_type',
new Type\TypeCollection(
new Type\EnumListType(array(
BaseModule::CLASSIC_MODULE_TYPE,
BaseModule::DELIVERY_MODULE_TYPE,
BaseModule::PAYMENT_MODULE_TYPE,
))
)
),
Argument::createIntListTypeArgument('exclude'),
Argument::createBooleanOrBothTypeArgument('active', Type\BooleanOrBothType::ANY)
);
}
/**
* @param $pagination
*
* @return \Thelia\Core\Template\Element\LoopResult
*/
public function exec(&$pagination)
{
$search = ModuleQuery::create();
/* manage translations */
$locale = $this->configureI18nProcessing($search);
$id = $this->getId();
if (null !== $id) {
$search->filterById($id, Criteria::IN);
}
$moduleType = $this->getModule_type();
if (null !== $moduleType) {
$search->filterByType($moduleType, Criteria::IN);
}
$exclude = $this->getExclude();
if (!is_null($exclude)) {
$search->filterById($exclude, Criteria::NOT_IN);
}
$active = $this->getActive();
if($active !== Type\BooleanOrBothType::ANY) {
$search->filterByActivate($active ? 1 : 0, Criteria::EQUAL);
}
$search->orderByPosition();
/* perform search */
$modules = $this->search($search, $pagination);
$loopResult = new LoopResult($modules);
foreach ($modules as $module) {
$loopResultRow = new LoopResultRow($loopResult, $module, $this->versionable, $this->timestampable, $this->countable);
$loopResultRow->set("ID", $module->getId())
->set("IS_TRANSLATED",$module->getVirtualColumn('IS_TRANSLATED'))
->set("LOCALE",$locale)
->set("TITLE",$module->getVirtualColumn('i18n_TITLE'))
->set("CHAPO", $module->getVirtualColumn('i18n_CHAPO'))
->set("DESCRIPTION", $module->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM", $module->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("CODE", $module->getCode())
->set("TYPE", $module->getType())
->set("ACTIVE", $module->getActivate())
->set("CLASS", $module->getFullNamespace())
->set("POSITION", $module->getPosition());
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

View File

@@ -23,12 +23,16 @@
namespace Thelia\Core\Template\Loop; namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\BaseLoop; use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult; 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\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\OrderQuery;
use Thelia\Type\TypeCollection;
use Thelia\Type;
/** /**
* *
* @package Thelia\Core\Template\Loop * @package Thelia\Core\Template\Loop
@@ -37,19 +41,94 @@ use Thelia\Core\Template\Loop\Argument\Argument;
*/ */
class Order extends BaseLoop class Order extends BaseLoop
{ {
public $countable = true;
public $timestampable = true;
public $versionable = false;
public function getArgDefinitions() public function getArgDefinitions()
{ {
return new ArgumentCollection(); return new ArgumentCollection(
Argument::createIntListTypeArgument('id'),
new Argument(
'customer',
new TypeCollection(
new Type\IntType(),
new Type\EnumType(array('current'))
),
'current'
),
Argument::createIntListTypeArgument('status')
);
} }
/** /**
* @param $pagination
* *
* * @return LoopResult
* @return \Thelia\Core\Template\Element\LoopResult
*/ */
public function exec(&$pagination) public function exec(&$pagination)
{ {
// TODO : a coder ! $search = OrderQuery::create();
$id = $this->getId();
if (null !== $id) {
$search->filterById($id, Criteria::IN);
}
$customer = $this->getCustomer();
if ($customer === 'current') {
$currentCustomer = $this->securityContext->getCustomerUser();
if ($currentCustomer === null) {
return new LoopResult(); return new LoopResult();
} else {
$search->filterByCustomerId($currentCustomer->getId(), Criteria::EQUAL);
}
} else {
$search->filterByCustomerId($customer, Criteria::EQUAL);
}
$status = $this->getStatus();
if (null !== $status) {
$search->filterByStatusId($status, Criteria::IN);
}
$orders = $this->search($search, $pagination);
$loopResult = new LoopResult($orders);
foreach ($orders as $order) {
$tax = 0;
$amount = $order->getTotalAmount($tax);
$loopResultRow = new LoopResultRow($loopResult, $order, $this->versionable, $this->timestampable, $this->countable);
$loopResultRow
->set("ID", $order->getId())
->set("REF", $order->getRef())
->set("CUSTOMER", $order->getCustomerId())
->set("DELIVERY_ADDRESS", $order->getDeliveryOrderAddressId())
->set("INVOICE_ADDRESS", $order->getInvoiceOrderAddressId())
->set("INVOICE_DATE", $order->getInvoiceDate())
->set("CURRENCY", $order->getCurrencyId())
->set("CURRENCY_RATE", $order->getCurrencyRate())
->set("TRANSACTION_REF", $order->getTransactionRef())
->set("DELIVERY_REF", $order->getDeliveryRef())
->set("INVOICE_REF", $order->getInvoiceRef())
->set("POSTAGE", $order->getPostage())
->set("PAYMENT_MODULE", $order->getPaymentModuleId())
->set("DELIVERY_MODULE", $order->getDeliveryModuleId())
->set("STATUS", $order->getStatusId())
->set("LANG", $order->getLangId())
->set("POSTAGE", $order->getPostage())
->set("TOTAL_TAX", $tax)
->set("TOTAL_AMOUNT", $amount - $tax)
->set("TOTAL_TAXED_AMOUNT", $amount)
;
$loopResult->addRow($loopResultRow);
}
return $loopResult;
} }
} }

View File

@@ -0,0 +1,84 @@
<?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\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Module\BaseModule;
/**
* Class Payment
* @package Thelia\Core\Template\Loop
* @author Etienne Roudeix <eroudeix@gmail.com>
*/
class Payment extends BaseSpecificModule
{
public function getArgDefinitions()
{
$collection = parent::getArgDefinitions();
return $collection;
}
public function exec(&$pagination)
{
$search = parent::exec($pagination);
/* manage translations */
$locale = $this->configureI18nProcessing($search);
$search->filterByType(BaseModule::PAYMENT_MODULE_TYPE, Criteria::EQUAL);
/* perform search */
$paymentModules = $this->search($search, $pagination);
$loopResult = new LoopResult($paymentModules);
foreach ($paymentModules as $paymentModule) {
$loopResultRow = new LoopResultRow($loopResult, $paymentModule, $this->versionable, $this->timestampable, $this->countable);
$moduleReflection = new \ReflectionClass($paymentModule->getFullNamespace());
if ($moduleReflection->isSubclassOf("Thelia\Module\PaymentModuleInterface") === false) {
throw new \RuntimeException(sprintf("payment module %s is not a Thelia\Module\PaymentModuleInterface", $paymentModule->getCode()));
}
$moduleInstance = $moduleReflection->newInstance();
$moduleInstance->setRequest($this->request);
$moduleInstance->setDispatcher($this->dispatcher);
$loopResultRow
->set('ID', $paymentModule->getId())
->set('TITLE', $paymentModule->getVirtualColumn('i18n_TITLE'))
->set('CHAPO', $paymentModule->getVirtualColumn('i18n_CHAPO'))
->set('DESCRIPTION', $paymentModule->getVirtualColumn('i18n_DESCRIPTION'))
->set('POSTSCRIPTUM', $paymentModule->getVirtualColumn('i18n_POSTSCRIPTUM'))
;
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

View File

@@ -32,6 +32,7 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Exception\TaxEngineException;
use Thelia\Model\CategoryQuery; use Thelia\Model\CategoryQuery;
use Thelia\Model\CountryQuery; use Thelia\Model\CountryQuery;
use Thelia\Model\CurrencyQuery; use Thelia\Model\CurrencyQuery;
@@ -597,16 +598,43 @@ class Product extends BaseI18nLoop
$loopResult = new LoopResult($products); $loopResult = new LoopResult($products);
$taxCountry = CountryQuery::create()->findPk(64); // @TODO : make it magic
foreach ($products as $product) { foreach ($products as $product) {
$loopResultRow = new LoopResultRow($loopResult, $product, $this->versionable, $this->timestampable, $this->countable); $loopResultRow = new LoopResultRow($loopResult, $product, $this->versionable, $this->timestampable, $this->countable);
$price = $product->getRealLowestPrice(); $price = $product->getRealLowestPrice();
try {
$taxedPrice = $product->getTaxedPrice( $taxedPrice = $product->getTaxedPrice(
CountryQuery::create()->findOneById(64) // @TODO : make it magic $taxCountry
); );
} catch(TaxEngineException $e) {
$taxedPrice = null;
}
// Find previous and next product, in the default category.
$default_category_id = $product->getDefaultCategoryId();
$loopResultRow->set("ID", $product->getId()) $previous = ProductQuery::create()
->joinProductCategory()
->where('ProductCategory.category_id = ?', $default_category_id)
->filterByPosition($product->getPosition(), Criteria::LESS_THAN)
->orderByPosition(Criteria::DESC)
->findOne()
;
$next = ProductQuery::create()
->joinProductCategory()
->where('ProductCategory.category_id = ?', $default_category_id)
->filterByPosition($product->getPosition(), Criteria::GREATER_THAN)
->orderByPosition(Criteria::ASC)
->findOne()
;
$loopResultRow
->set("ID" , $product->getId())
->set("REF" , $product->getRef()) ->set("REF" , $product->getRef())
->set("IS_TRANSLATED" , $product->getVirtualColumn('IS_TRANSLATED')) ->set("IS_TRANSLATED" , $product->getVirtualColumn('IS_TRANSLATED'))
->set("LOCALE" , $locale) ->set("LOCALE" , $locale)
@@ -621,6 +649,13 @@ class Product extends BaseI18nLoop
->set("IS_PROMO" , $product->getVirtualColumn('main_product_is_promo')) ->set("IS_PROMO" , $product->getVirtualColumn('main_product_is_promo'))
->set("IS_NEW" , $product->getVirtualColumn('main_product_is_new')) ->set("IS_NEW" , $product->getVirtualColumn('main_product_is_new'))
->set("POSITION" , $product->getPosition()) ->set("POSITION" , $product->getPosition())
->set("VISIBLE" , $product->getVisible() ? "1" : "0")
->set("HAS_PREVIOUS" , $previous != null ? 1 : 0)
->set("HAS_NEXT" , $next != null ? 1 : 0)
->set("PREVIOUS" , $previous != null ? $previous->getId() : -1)
->set("NEXT" , $next != null ? $next->getId() : -1)
->set("DEFAULT_CATEGORY" , $default_category_id)
; ;
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);

View File

@@ -31,6 +31,7 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Exception\TaxEngineException;
use Thelia\Model\Base\ProductSaleElementsQuery; use Thelia\Model\Base\ProductSaleElementsQuery;
use Thelia\Model\CountryQuery; use Thelia\Model\CountryQuery;
use Thelia\Model\CurrencyQuery; use Thelia\Model\CurrencyQuery;
@@ -147,17 +148,27 @@ class ProductSaleElements extends BaseLoop
$loopResult = new LoopResult($PSEValues); $loopResult = new LoopResult($PSEValues);
$taxCountry = CountryQuery::create()->findPk(64); // @TODO : make it magic
foreach ($PSEValues as $PSEValue) { foreach ($PSEValues as $PSEValue) {
$loopResultRow = new LoopResultRow($loopResult, $PSEValue, $this->versionable, $this->timestampable, $this->countable); $loopResultRow = new LoopResultRow($loopResult, $PSEValue, $this->versionable, $this->timestampable, $this->countable);
$price = $PSEValue->getPrice(); $price = $PSEValue->getPrice();
try {
$taxedPrice = $PSEValue->getTaxedPrice( $taxedPrice = $PSEValue->getTaxedPrice(
CountryQuery::create()->findOneById(64) // @TODO : make it magic $taxCountry
); );
} catch(TaxEngineException $e) {
$taxedPrice = null;
}
$promoPrice = $PSEValue->getPromoPrice(); $promoPrice = $PSEValue->getPromoPrice();
try {
$taxedPromoPrice = $PSEValue->getTaxedPromoPrice( $taxedPromoPrice = $PSEValue->getTaxedPromoPrice(
CountryQuery::create()->findOneById(64) // @TODO : make it magic $taxCountry
); );
} catch(TaxEngineException $e) {
$taxedPromoPrice = null;
}
$loopResultRow->set("ID", $PSEValue->getId()) $loopResultRow->set("ID", $PSEValue->getId())
->set("QUANTITY", $PSEValue->getQuantity()) ->set("QUANTITY", $PSEValue->getQuantity())

View File

@@ -0,0 +1,135 @@
<?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\Type\TypeCollection;
use Thelia\Type;
use Thelia\Model\TaxRuleQuery;
/**
*
* TaxRule loop
*
*
* Class TaxRule
* @package Thelia\Core\Template\Loop
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*/
class TaxRule extends BaseI18nLoop
{
public $timestampable = true;
/**
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntListTypeArgument('id'),
Argument::createIntListTypeArgument('exclude'),
new Argument(
'order',
new TypeCollection(
new Type\EnumListType(array('id', 'id_reverse', 'alpha', 'alpha_reverse'))
),
'alpha'
)
);
}
/**
* @param $pagination
*
* @return \Thelia\Core\Template\Element\LoopResult
*/
public function exec(&$pagination)
{
$search = TaxRuleQuery::create();
/* manage translations */
$locale = $this->configureI18nProcessing($search, array('TITLE', 'DESCRIPTION'));
$id = $this->getId();
if (null !== $id) {
$search->filterById($id, Criteria::IN);
}
$exclude = $this->getExclude();
if (null !== $exclude) {
$search->filterById($exclude, Criteria::NOT_IN);
}
$orders = $this->getOrder();
foreach ($orders as $order) {
switch ($order) {
case "id":
$search->orderById(Criteria::ASC);
break;
case "id_reverse":
$search->orderById(Criteria::DESC);
break;
case "alpha":
$search->addAscendingOrderByColumn('i18n_TITLE');
break;
case "alpha_reverse":
$search->addDescendingOrderByColumn('i18n_TITLE');
break;
}
}
/* perform search */
$tax_rules = $this->search($search, $pagination);
$loopResult = new LoopResult($tax_rules);
foreach ($tax_rules as $tax_rule) {
$loopResultRow = new LoopResultRow($loopResult, $tax_rule, $this->versionable, $this->timestampable, $this->countable);
$loopResultRow
->set("ID" , $tax_rule->getId())
->set("IS_TRANSLATED" , $tax_rule->getVirtualColumn('IS_TRANSLATED'))
->set("LOCALE" , $locale)
->set("TITLE" , $tax_rule->getVirtualColumn('i18n_TITLE'))
->set("DESCRIPTION" , $tax_rule->getVirtualColumn('i18n_DESCRIPTION'))
->set("IS_DEFAULT" , $tax_rule->getIsDefault() ? '1' : '0')
;
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

View File

@@ -24,6 +24,7 @@
namespace Thelia\Core\Template\Smarty\Plugins; namespace Thelia\Core\Template\Smarty\Plugins;
use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelCriteria;
use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Core\Security\SecurityContext; use Thelia\Core\Security\SecurityContext;
@@ -53,12 +54,14 @@ class DataAccessFunctions extends AbstractSmartyPlugin
private $securityContext; private $securityContext;
protected $parserContext; protected $parserContext;
protected $request; protected $request;
protected $dispatcher;
public function __construct(Request $request, SecurityContext $securityContext, ParserContext $parserContext) public function __construct(Request $request, SecurityContext $securityContext, ParserContext $parserContext, ContainerAwareEventDispatcher $dispatcher)
{ {
$this->securityContext = $securityContext; $this->securityContext = $securityContext;
$this->parserContext = $parserContext; $this->parserContext = $parserContext;
$this->request = $request; $this->request = $request;
$this->dispatcher = $dispatcher;
} }
/** /**
@@ -188,7 +191,22 @@ class DataAccessFunctions extends AbstractSmartyPlugin
public function orderDataAccess($params, &$smarty) public function orderDataAccess($params, &$smarty)
{ {
return $this->dataAccess("Order", $params, $this->request->getSession()->getOrder()); $order = $this->request->getSession()->getOrder();
$attribute = $this->getNormalizedParam($params, array('attribute', 'attrib', 'attr'));
switch($attribute) {
case 'postage':
return $order->getPostage();
case 'delivery_address':
return $order->chosenDeliveryAddress;
case 'invoice_address':
return $order->chosenInvoiceAddress;
case 'delivery_module':
return $order->getDeliveryModuleId();
case 'payment_module':
return $order->getPaymentModuleId();
}
throw new \InvalidArgumentException(sprintf("%s has no '%s' attribute", 'Order', $attribute));
} }
/** /**
@@ -196,6 +214,8 @@ class DataAccessFunctions extends AbstractSmartyPlugin
* *
* @param $params * @param $params
* @param $smarty * @param $smarty
*
* @return string
*/ */
public function langDataAccess($params, $smarty) public function langDataAccess($params, $smarty)
{ {
@@ -294,6 +314,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
*/ */
public function getPluginDescriptors() public function getPluginDescriptors()
{ {
return array( return array(
new SmartyPluginDescriptor('function', 'admin', $this, 'adminDataAccess'), new SmartyPluginDescriptor('function', 'admin', $this, 'adminDataAccess'),
new SmartyPluginDescriptor('function', 'customer', $this, 'customerDataAccess'), new SmartyPluginDescriptor('function', 'customer', $this, 'customerDataAccess'),
@@ -308,4 +329,14 @@ class DataAccessFunctions extends AbstractSmartyPlugin
new SmartyPluginDescriptor('function', 'order', $this, 'orderDataAccess'), new SmartyPluginDescriptor('function', 'order', $this, 'orderDataAccess'),
); );
} }
/**
* Return the event dispatcher,
*
* @return \Symfony\Component\EventDispatcher\EventDispatcher
*/
public function getDispatcher()
{
return $this->dispatcher;
}
} }

View File

@@ -29,6 +29,8 @@ use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Core\Security\SecurityContext; use Thelia\Core\Security\SecurityContext;
use Thelia\Core\Security\Exception\AuthenticationException; use Thelia\Core\Security\Exception\AuthenticationException;
use Thelia\Exception\OrderException; use Thelia\Exception\OrderException;
use Thelia\Model\AddressQuery;
use Thelia\Model\ModuleQuery;
class Security extends AbstractSmartyPlugin class Security extends AbstractSmartyPlugin
{ {
@@ -78,7 +80,22 @@ class Security extends AbstractSmartyPlugin
{ {
$cart = $this->request->getSession()->getCart(); $cart = $this->request->getSession()->getCart();
if($cart===null || $cart->countCartItems() == 0) { if($cart===null || $cart->countCartItems() == 0) {
throw new OrderException('Cart must not be empty', OrderException::CART_EMPTY); throw new OrderException('Cart must not be empty', OrderException::CART_EMPTY, array('empty' => 1));
}
return "";
}
public function checkValidDeliveryFunction($params, &$smarty)
{
$order = $this->request->getSession()->getOrder();
/* Does address and module still exists ? We assume address owner can't change neither module type */
if($order !== null) {
$checkAddress = AddressQuery::create()->findPk($order->chosenDeliveryAddress);
$checkModule = ModuleQuery::create()->findPk($order->getDeliveryModuleId());
}
if(null === $order || null == $checkAddress || null === $checkModule) {
throw new OrderException('Delivery must be defined', OrderException::UNDEFINED_DELIVERY, array('missing' => 1));
} }
return ""; return "";
@@ -94,6 +111,7 @@ class Security extends AbstractSmartyPlugin
return array( return array(
new SmartyPluginDescriptor('function', 'check_auth', $this, 'checkAuthFunction'), new SmartyPluginDescriptor('function', 'check_auth', $this, 'checkAuthFunction'),
new SmartyPluginDescriptor('function', 'check_cart_not_empty', $this, 'checkCartNotEmptyFunction'), new SmartyPluginDescriptor('function', 'check_cart_not_empty', $this, 'checkCartNotEmptyFunction'),
new SmartyPluginDescriptor('function', 'check_valid_delivery', $this, 'checkValidDeliveryFunction'),
); );
} }
} }

View File

@@ -132,6 +132,8 @@ class TheliaLoop extends AbstractSmartyPlugin
$loopResults = $loop->exec(self::$pagination[$name]); $loopResults = $loop->exec(self::$pagination[$name]);
$loopResults->rewind();
$this->loopstack[$name] = $loopResults; $this->loopstack[$name] = $loopResults;
// Pas de résultat ? la boucle est terminée, ne pas évaluer le contenu. // Pas de résultat ? la boucle est terminée, ne pas évaluer le contenu.

View File

@@ -27,6 +27,7 @@ use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Tools\URL; use Thelia\Tools\URL;
use Thelia\Core\HttpFoundation\Request; use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Translation\Translator;
class UrlGenerator extends AbstractSmartyPlugin class UrlGenerator extends AbstractSmartyPlugin
{ {
@@ -47,11 +48,27 @@ class UrlGenerator extends AbstractSmartyPlugin
public function generateUrlFunction($params, &$smarty) public function generateUrlFunction($params, &$smarty)
{ {
// the path to process // the path to process
$path = $this->getParam($params, 'path'); $path = $this->getParam($params, 'path', null);
$file = $this->getParam($params, 'file', null);
if ($file !== null) {
$path = $file;
$mode = URL::PATH_TO_FILE;
}
else if ($path !== null) {
$mode = URL::WITH_INDEX_PAGE;
}
else {
throw \InvalidArgumentException(Translator::getInstance()->trans("Please specify either 'path' or 'file' parameter in {url} function."));
}
$target = $this->getParam($params, 'target', null); $target = $this->getParam($params, 'target', null);
$url = URL::getInstance()->absoluteUrl($path, $this->getArgsFromParam($params, array('path', 'target'))); $url = URL::getInstance()->absoluteUrl(
$path,
$this->getArgsFromParam($params, array('path', 'file', 'target')),
$mode
);
if ($target != null) $url .= '#'.$target; if ($target != null) $url .= '#'.$target;
@@ -169,7 +186,8 @@ class UrlGenerator extends AbstractSmartyPlugin
protected function getCurrentUrl() protected function getCurrentUrl()
{ {
return URL::getInstance()->retrieveCurrent($this->request)->toString(); //return URL::getInstance()->retrieveCurrent($this->request)->toString();
return $this->request->getUri();
} }
protected function getReturnToUrl() protected function getReturnToUrl()

View File

@@ -266,4 +266,14 @@ class CouponBaseAdapter implements CouponAdapterInterface
{ {
return $this->container->get('thelia.constraint.validator'); return $this->container->get('thelia.constraint.validator');
} }
/**
* Return the event dispatcher,
*
* @return \Symfony\Component\EventDispatcher\EventDispatcher
*/
public function getDispatcher()
{
return $this->container->get('event_dispatcher');
}
} }

View File

@@ -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\Exception;
class ModuleException extends \RuntimeException
{
const UNKNOWN_EXCEPTION = 0;
const CODE_NOT_FOUND = 404;
public function __construct($message, $code = null, $previous = null)
{
if ($code === null) {
$code = self::UNKNOWN_EXCEPTION;
}
parent::__construct($message, $code, $previous);
}
}

View File

@@ -25,12 +25,25 @@ namespace Thelia\Exception;
class OrderException extends \RuntimeException class OrderException extends \RuntimeException
{ {
/**
* @var string The cart template name
*/
public $cartRoute = "cart.view";
public $orderDeliveryRoute = "order.delivery";
public $arguments = array();
const UNKNOWN_EXCEPTION = 0; const UNKNOWN_EXCEPTION = 0;
const CART_EMPTY = 100; const CART_EMPTY = 100;
public function __construct($message, $code = null, $previous = null) const UNDEFINED_DELIVERY = 200;
public function __construct($message, $code = null, $arguments = array(), $previous = null)
{ {
if(is_array($arguments)) {
$this->arguments = $arguments;
}
if ($code === null) { if ($code === null) {
$code = self::UNKNOWN_EXCEPTION; $code = self::UNKNOWN_EXCEPTION;
} }

View File

@@ -39,6 +39,7 @@ class TaxEngineException extends \RuntimeException
const UNDEFINED_TAX_RULES_COLLECTION = 503; const UNDEFINED_TAX_RULES_COLLECTION = 503;
const UNDEFINED_REQUIREMENTS = 504; const UNDEFINED_REQUIREMENTS = 504;
const UNDEFINED_REQUIREMENT_VALUE = 505; const UNDEFINED_REQUIREMENT_VALUE = 505;
const UNDEFINED_TAX_RULE = 506;
const BAD_AMOUNT_FORMAT = 601; const BAD_AMOUNT_FORMAT = 601;

View 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\Exception;
/**
* these exception are non fatal exception, due to thelia process exception
* or customer random navigation
*
* they redirect the customer who trig them to a specific error page // @todo
*
* Class TheliaProcessException
* @package Thelia\Exception
*/
class TheliaProcessException extends \RuntimeException
{
public $data = null;
const UNKNOWN_EXCEPTION = 0;
const CART_ITEM_NOT_ENOUGH_STOCK = 100;
const NO_PLACED_ORDER = 101;
const PLACED_ORDER_ID_BAD_CURRENT_CUSTOMER = 102;
public function __construct($message, $code = null, $data = null, $previous = null)
{
$this->data = $data;
if ($code === null) {
$code = self::UNKNOWN_EXCEPTION;
}
parent::__construct($message, $code, $previous);
}
}

View File

@@ -0,0 +1,63 @@
<?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\NotBlank;
use Thelia\Core\Translation\Translator;
class ContentCreationForm extends BaseForm
{
protected function buildForm($change_mode = false)
{
$this->formBuilder
->add("title", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => "Content title *",
"label_attr" => array(
"for" => "title"
)
))
->add("default_folder", "integer", array(
"constraints" => array(
new NotBlank()
)
))
->add("locale", "text", array(
"constraints" => array(
new NotBlank()
)
))
->add("visible", "integer", array(
"label" => Translator::getInstance()->trans("This content is online."),
"label_attr" => array("for" => "visible_create")
))
;
}
public function getName()
{
return "thelia_content_creation";
}
}

View File

@@ -0,0 +1,66 @@
<?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\NotBlank;
use Thelia\Core\Translation\Translator;
class FolderCreationForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add("title", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Folder title *"),
"label_attr" => array(
"for" => "title"
)
))
->add("parent", "text", array(
"label" => Translator::getInstance()->trans("Parent folder *"),
"constraints" => array(
new NotBlank()
),
"label_attr" => array("for" => "parent_create")
))
->add("locale", "text", array(
"constraints" => array(
new NotBlank()
),
"label_attr" => array("for" => "locale_create")
))
->add("visible", "integer", array(
"label" => Translator::getInstance()->trans("This folder is online."),
"label_attr" => array("for" => "visible_create")
))
;
}
public function getName()
{
return "thelia_folder_creation";
}
}

View 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\Form;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Thelia\Core\Translation\Translator;
use Symfony\Component\Validator\Constraints\NotBlank;
class FolderModificationForm extends FolderCreationForm
{
use StandardDescriptionFieldsTrait;
protected function buildForm()
{
parent::buildForm(true);
$this->formBuilder
->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0)))))
->add("url", "text", array(
"label" => Translator::getInstance()->trans("Rewriten URL *"),
"constraints" => array(new NotBlank()),
"label_attr" => array("for" => "rewriten_url")
))
;
// Add standard description fields, excluding title and locale, which a re defined in parent class
$this->addStandardDescFields(array('title', 'locale'));
}
public function getName()
{
return "thelia_folder_modification";
}
}

View File

@@ -80,11 +80,18 @@ class OrderDelivery extends BaseForm
->filterByType(BaseModule::DELIVERY_MODULE_TYPE) ->filterByType(BaseModule::DELIVERY_MODULE_TYPE)
->filterByActivate(1) ->filterByActivate(1)
->filterById($value) ->filterById($value)
->find(); ->findOne();
if(null === $module) { if(null === $module) {
$context->addViolation("Delivery module ID not found"); $context->addViolation("Delivery module ID not found");
} }
$moduleReflection = new \ReflectionClass($module->getFullNamespace());
if ($moduleReflection->isSubclassOf("Thelia\Module\DeliveryModuleInterface") === false) {
$context->addViolation(
sprintf("delivery module %s is not a Thelia\Module\DeliveryModuleInterface", $module->getCode())
);
}
} }
public function getName() public function getName()

View File

@@ -0,0 +1,101 @@
<?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 Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Model\AddressQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Translation\Translator;
use Thelia\Model\ModuleQuery;
use Thelia\Module\BaseModule;
/**
* Class OrderPayment
* @package Thelia\Form
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*/
class OrderPayment extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add("invoice-address", "integer", array(
"required" => true,
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Callback(array(
"methods" => array(
array($this, "verifyInvoiceAddress")
)
))
)
))
->add("payment-module", "integer", array(
"required" => true,
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Callback(array(
"methods" => array(
array($this, "verifyPaymentModule")
)
))
)
));
}
public function verifyInvoiceAddress($value, ExecutionContextInterface $context)
{
$address = AddressQuery::create()
->findPk($value);
if(null === $address) {
$context->addViolation("Address ID not found");
}
}
public function verifyPaymentModule($value, ExecutionContextInterface $context)
{
$module = ModuleQuery::create()
->filterByType(BaseModule::PAYMENT_MODULE_TYPE)
->filterByActivate(1)
->filterById($value)
->findOne();
if(null === $module) {
$context->addViolation("Payment module ID not found");
}
$moduleReflection = new \ReflectionClass($module->getFullNamespace());
if ($moduleReflection->isSubclassOf("Thelia\Module\PaymentModuleInterface") === false) {
$context->addViolation(
sprintf("delivery module %s is not a Thelia\Module\PaymentModuleInterface", $module->getCode())
);
}
}
public function getName()
{
return "thelia_order_payment";
}
}

View File

@@ -23,47 +23,64 @@
namespace Thelia\Form; namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
use Thelia\Model\ProductQuery;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\ExecutionContextInterface;
class ProductCreationForm extends BaseForm class ProductCreationForm extends BaseForm
{ {
protected function buildForm() protected function buildForm($change_mode = false)
{ {
$ref_constraints = array(new NotBlank());
if (! $change_mode) {
$ref_constraints[] = new Callback(array(
"methods" => array(array($this, "checkDuplicateRef"))
));
}
$this->formBuilder $this->formBuilder
->add("ref", "text", array( ->add("ref", "text", array(
"constraints" => array( "constraints" => $ref_constraints,
new NotBlank()
),
"label" => "Product reference *", "label" => "Product reference *",
"label_attr" => array( "label_attr" => array("for" => "ref")
"for" => "ref"
)
)) ))
->add("title", "text", array( ->add("title", "text", array(
"constraints" => array( "constraints" => array(
new NotBlank() new NotBlank()
), ),
"label" => "Product title *", "label" => "Product title *",
"label_attr" => array( "label_attr" => array("for" => "title")
"for" => "title"
)
)) ))
->add("default_category", "integer", array( ->add("default_category", "integer", array(
"constraints" => array( "constraints" => array(new NotBlank()),
new NotBlank() "label" => Translator::getInstance()->trans("Default product category."),
) "label_attr" => array("for" => "default_category_field")
)) ))
->add("locale", "text", array( ->add("locale", "text", array(
"constraints" => array( "constraints" => array(new NotBlank())
new NotBlank()
)
)) ))
->add("visible", "integer", array( ->add("visible", "integer", array(
"label" => Translator::getInstance()->trans("This product is online."), "label" => Translator::getInstance()->trans("This product is online."),
"label_attr" => array("for" => "visible_create") "label_attr" => array("for" => "visible_field")
)) ))
; ;
} }
public function checkDuplicateRef($value, ExecutionContextInterface $context)
{
$count = ProductQuery::create()->filterByRef($value)->count();
if ($count > 0) {
$context->addViolation(
Translator::getInstance()->trans(
"A product with reference %ref already exists. Please choose another reference.",
array('%ref' => $value)
));
}
}
public function getName() public function getName()
{ {
return "thelia_product_creation"; return "thelia_product_creation";

View File

@@ -0,0 +1,119 @@
<?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\Core\Translation\Translator;
use Thelia\Model\ConfigQuery;
/**
* Class ProfileModification
* @package Thelia\Form
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class ProfileModificationForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add("firstname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("First Name"),
"label_attr" => array(
"for" => "firstname"
)
))
->add("lastname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Last Name"),
"label_attr" => array(
"for" => "lastname"
)
))
->add("default_language", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Default language"),
"label_attr" => array(
"for" => "default_language"
)
))
->add("editing_language_default", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Editing language default"),
"label_attr" => array(
"for" => "editing_language_default"
)
))
->add("old_password", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4)))
),
"label" => Translator::getInstance()->trans("Old password"),
"label_attr" => array(
"for" => "old_password"
)
))
->add("password", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4)))
),
"label" => Translator::getInstance()->trans("Password"),
"label_attr" => array(
"for" => "password"
)
))
->add("password_confirm", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4))),
new Constraints\Callback(array("methods" => array(
array($this, "verifyPasswordField")
)))
),
"label" => "Password confirmation",
"label_attr" => array(
"for" => "password_confirmation"
)
))
;
}
public function getName()
{
return "thelia_profile_modification";
}
}

View File

@@ -44,12 +44,14 @@ class CheckPermission extends BaseInstall
const DIR_CONF = 'local/config'; const DIR_CONF = 'local/config';
const DIR_LOG = 'log'; const DIR_LOG = 'log';
const DIR_CACHE = 'cache'; const DIR_CACHE = 'cache';
const DIR_WEB = 'web';
/** @var array Directory needed to be writable */ /** @var array Directory needed to be writable */
protected $directoriesToBeWritable = array( protected $directoriesToBeWritable = array(
self::DIR_CONF, self::DIR_CONF,
self::DIR_LOG, self::DIR_LOG,
self::DIR_CACHE, self::DIR_CACHE,
self::DIR_WEB,
); );
/** @var array Minimum server configuration necessary */ /** @var array Minimum server configuration necessary */

View File

@@ -3,7 +3,77 @@
namespace Thelia\Model; namespace Thelia\Model;
use Thelia\Model\Base\Accessory as BaseAccessory; use Thelia\Model\Base\Accessory as BaseAccessory;
use Thelia\Core\Event\TheliaEvents;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Core\Event\AccessoryEvent;
class Accessory extends BaseAccessory { class Accessory extends BaseAccessory {
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait;
/**
* Calculate next position relative to our product
*/
protected function addCriteriaToPositionQuery($query) {
$query->filterByProductId($this->getProductId());
}
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->setPosition($this->getNextPosition());
$this->dispatchEvent(TheliaEvents::BEFORE_CREATEACCESSORY, new AccessoryEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_CREATEACCESSORY, new AccessoryEvent($this));
}
/**
* {@inheritDoc}
*/
public function preUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATEACCESSORY, new AccessoryEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_UPDATEACCESSORY, new AccessoryEvent($this));
}
/**
* {@inheritDoc}
*/
public function preDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_DELETEACCESSORY, new AccessoryEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_DELETEACCESSORY, new AccessoryEvent($this));
}
} }

View File

@@ -1,9 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\AttributeCategory as BaseAttributeCategory;
class AttributeCategory extends BaseAttributeCategory {
}

View File

@@ -24,6 +24,8 @@ use Thelia\Model\GroupModuleQuery as ChildGroupModuleQuery;
use Thelia\Model\Module as ChildModule; use Thelia\Model\Module as ChildModule;
use Thelia\Model\ModuleI18n as ChildModuleI18n; use Thelia\Model\ModuleI18n as ChildModuleI18n;
use Thelia\Model\ModuleI18nQuery as ChildModuleI18nQuery; use Thelia\Model\ModuleI18nQuery as ChildModuleI18nQuery;
use Thelia\Model\ModuleImage as ChildModuleImage;
use Thelia\Model\ModuleImageQuery as ChildModuleImageQuery;
use Thelia\Model\ModuleQuery as ChildModuleQuery; use Thelia\Model\ModuleQuery as ChildModuleQuery;
use Thelia\Model\Order as ChildOrder; use Thelia\Model\Order as ChildOrder;
use Thelia\Model\OrderQuery as ChildOrderQuery; use Thelia\Model\OrderQuery as ChildOrderQuery;
@@ -135,6 +137,12 @@ abstract class Module implements ActiveRecordInterface
protected $collGroupModules; protected $collGroupModules;
protected $collGroupModulesPartial; protected $collGroupModulesPartial;
/**
* @var ObjectCollection|ChildModuleImage[] Collection to store aggregation of ChildModuleImage objects.
*/
protected $collModuleImages;
protected $collModuleImagesPartial;
/** /**
* @var ObjectCollection|ChildModuleI18n[] Collection to store aggregation of ChildModuleI18n objects. * @var ObjectCollection|ChildModuleI18n[] Collection to store aggregation of ChildModuleI18n objects.
*/ */
@@ -187,6 +195,12 @@ abstract class Module implements ActiveRecordInterface
*/ */
protected $groupModulesScheduledForDeletion = null; protected $groupModulesScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $moduleImagesScheduledForDeletion = null;
/** /**
* An array of objects scheduled for deletion. * An array of objects scheduled for deletion.
* @var ObjectCollection * @var ObjectCollection
@@ -864,6 +878,8 @@ abstract class Module implements ActiveRecordInterface
$this->collGroupModules = null; $this->collGroupModules = null;
$this->collModuleImages = null;
$this->collModuleI18ns = null; $this->collModuleI18ns = null;
} // if (deep) } // if (deep)
@@ -1067,6 +1083,23 @@ abstract class Module implements ActiveRecordInterface
} }
} }
if ($this->moduleImagesScheduledForDeletion !== null) {
if (!$this->moduleImagesScheduledForDeletion->isEmpty()) {
\Thelia\Model\ModuleImageQuery::create()
->filterByPrimaryKeys($this->moduleImagesScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->moduleImagesScheduledForDeletion = null;
}
}
if ($this->collModuleImages !== null) {
foreach ($this->collModuleImages as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->moduleI18nsScheduledForDeletion !== null) { if ($this->moduleI18nsScheduledForDeletion !== null) {
if (!$this->moduleI18nsScheduledForDeletion->isEmpty()) { if (!$this->moduleI18nsScheduledForDeletion->isEmpty()) {
\Thelia\Model\ModuleI18nQuery::create() \Thelia\Model\ModuleI18nQuery::create()
@@ -1312,6 +1345,9 @@ abstract class Module implements ActiveRecordInterface
if (null !== $this->collGroupModules) { if (null !== $this->collGroupModules) {
$result['GroupModules'] = $this->collGroupModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); $result['GroupModules'] = $this->collGroupModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
} }
if (null !== $this->collModuleImages) {
$result['ModuleImages'] = $this->collModuleImages->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collModuleI18ns) { if (null !== $this->collModuleI18ns) {
$result['ModuleI18ns'] = $this->collModuleI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); $result['ModuleI18ns'] = $this->collModuleI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
} }
@@ -1524,6 +1560,12 @@ abstract class Module implements ActiveRecordInterface
} }
} }
foreach ($this->getModuleImages() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addModuleImage($relObj->copy($deepCopy));
}
}
foreach ($this->getModuleI18ns() as $relObj) { foreach ($this->getModuleI18ns() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addModuleI18n($relObj->copy($deepCopy)); $copyObj->addModuleI18n($relObj->copy($deepCopy));
@@ -1583,6 +1625,9 @@ abstract class Module implements ActiveRecordInterface
if ('GroupModule' == $relationName) { if ('GroupModule' == $relationName) {
return $this->initGroupModules(); return $this->initGroupModules();
} }
if ('ModuleImage' == $relationName) {
return $this->initModuleImages();
}
if ('ModuleI18n' == $relationName) { if ('ModuleI18n' == $relationName) {
return $this->initModuleI18ns(); return $this->initModuleI18ns();
} }
@@ -2810,6 +2855,224 @@ abstract class Module implements ActiveRecordInterface
return $this->getGroupModules($query, $con); return $this->getGroupModules($query, $con);
} }
/**
* Clears out the collModuleImages 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 addModuleImages()
*/
public function clearModuleImages()
{
$this->collModuleImages = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Reset is the collModuleImages collection loaded partially.
*/
public function resetPartialModuleImages($v = true)
{
$this->collModuleImagesPartial = $v;
}
/**
* Initializes the collModuleImages collection.
*
* By default this just sets the collModuleImages collection to an empty array (like clearcollModuleImages());
* however, you may wish to override this method in your stub class to provide setting appropriate
* to your application -- for example, setting the initial array to the values stored in database.
*
* @param boolean $overrideExisting If set to true, the method call initializes
* the collection even if it is not empty
*
* @return void
*/
public function initModuleImages($overrideExisting = true)
{
if (null !== $this->collModuleImages && !$overrideExisting) {
return;
}
$this->collModuleImages = new ObjectCollection();
$this->collModuleImages->setModel('\Thelia\Model\ModuleImage');
}
/**
* Gets an array of ChildModuleImage objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this ChildModule is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @return Collection|ChildModuleImage[] List of ChildModuleImage objects
* @throws PropelException
*/
public function getModuleImages($criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collModuleImagesPartial && !$this->isNew();
if (null === $this->collModuleImages || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collModuleImages) {
// return empty collection
$this->initModuleImages();
} else {
$collModuleImages = ChildModuleImageQuery::create(null, $criteria)
->filterByModule($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collModuleImagesPartial && count($collModuleImages)) {
$this->initModuleImages(false);
foreach ($collModuleImages as $obj) {
if (false == $this->collModuleImages->contains($obj)) {
$this->collModuleImages->append($obj);
}
}
$this->collModuleImagesPartial = true;
}
$collModuleImages->getInternalIterator()->rewind();
return $collModuleImages;
}
if ($partial && $this->collModuleImages) {
foreach ($this->collModuleImages as $obj) {
if ($obj->isNew()) {
$collModuleImages[] = $obj;
}
}
}
$this->collModuleImages = $collModuleImages;
$this->collModuleImagesPartial = false;
}
}
return $this->collModuleImages;
}
/**
* Sets a collection of ModuleImage 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 $moduleImages A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildModule The current object (for fluent API support)
*/
public function setModuleImages(Collection $moduleImages, ConnectionInterface $con = null)
{
$moduleImagesToDelete = $this->getModuleImages(new Criteria(), $con)->diff($moduleImages);
$this->moduleImagesScheduledForDeletion = $moduleImagesToDelete;
foreach ($moduleImagesToDelete as $moduleImageRemoved) {
$moduleImageRemoved->setModule(null);
}
$this->collModuleImages = null;
foreach ($moduleImages as $moduleImage) {
$this->addModuleImage($moduleImage);
}
$this->collModuleImages = $moduleImages;
$this->collModuleImagesPartial = false;
return $this;
}
/**
* Returns the number of related ModuleImage objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param ConnectionInterface $con
* @return int Count of related ModuleImage objects.
* @throws PropelException
*/
public function countModuleImages(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collModuleImagesPartial && !$this->isNew();
if (null === $this->collModuleImages || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collModuleImages) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getModuleImages());
}
$query = ChildModuleImageQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByModule($this)
->count($con);
}
return count($this->collModuleImages);
}
/**
* Method called to associate a ChildModuleImage object to this object
* through the ChildModuleImage foreign key attribute.
*
* @param ChildModuleImage $l ChildModuleImage
* @return \Thelia\Model\Module The current object (for fluent API support)
*/
public function addModuleImage(ChildModuleImage $l)
{
if ($this->collModuleImages === null) {
$this->initModuleImages();
$this->collModuleImagesPartial = true;
}
if (!in_array($l, $this->collModuleImages->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddModuleImage($l);
}
return $this;
}
/**
* @param ModuleImage $moduleImage The moduleImage object to add.
*/
protected function doAddModuleImage($moduleImage)
{
$this->collModuleImages[]= $moduleImage;
$moduleImage->setModule($this);
}
/**
* @param ModuleImage $moduleImage The moduleImage object to remove.
* @return ChildModule The current object (for fluent API support)
*/
public function removeModuleImage($moduleImage)
{
if ($this->getModuleImages()->contains($moduleImage)) {
$this->collModuleImages->remove($this->collModuleImages->search($moduleImage));
if (null === $this->moduleImagesScheduledForDeletion) {
$this->moduleImagesScheduledForDeletion = clone $this->collModuleImages;
$this->moduleImagesScheduledForDeletion->clear();
}
$this->moduleImagesScheduledForDeletion[]= clone $moduleImage;
$moduleImage->setModule(null);
}
return $this;
}
/** /**
* Clears out the collModuleI18ns collection * Clears out the collModuleI18ns collection
* *
@@ -3087,6 +3350,11 @@ abstract class Module implements ActiveRecordInterface
$o->clearAllReferences($deep); $o->clearAllReferences($deep);
} }
} }
if ($this->collModuleImages) {
foreach ($this->collModuleImages as $o) {
$o->clearAllReferences($deep);
}
}
if ($this->collModuleI18ns) { if ($this->collModuleI18ns) {
foreach ($this->collModuleI18ns as $o) { foreach ($this->collModuleI18ns as $o) {
$o->clearAllReferences($deep); $o->clearAllReferences($deep);
@@ -3114,6 +3382,10 @@ abstract class Module implements ActiveRecordInterface
$this->collGroupModules->clearIterator(); $this->collGroupModules->clearIterator();
} }
$this->collGroupModules = null; $this->collGroupModules = null;
if ($this->collModuleImages instanceof Collection) {
$this->collModuleImages->clearIterator();
}
$this->collModuleImages = null;
if ($this->collModuleI18ns instanceof Collection) { if ($this->collModuleI18ns instanceof Collection) {
$this->collModuleI18ns->clearIterator(); $this->collModuleI18ns->clearIterator();
} }

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,607 @@
<?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\ModuleImageI18n as ChildModuleImageI18n;
use Thelia\Model\ModuleImageI18nQuery as ChildModuleImageI18nQuery;
use Thelia\Model\Map\ModuleImageI18nTableMap;
/**
* Base class that represents a query for the 'module_image_i18n' table.
*
*
*
* @method ChildModuleImageI18nQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildModuleImageI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildModuleImageI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildModuleImageI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildModuleImageI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ChildModuleImageI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
*
* @method ChildModuleImageI18nQuery groupById() Group by the id column
* @method ChildModuleImageI18nQuery groupByLocale() Group by the locale column
* @method ChildModuleImageI18nQuery groupByTitle() Group by the title column
* @method ChildModuleImageI18nQuery groupByDescription() Group by the description column
* @method ChildModuleImageI18nQuery groupByChapo() Group by the chapo column
* @method ChildModuleImageI18nQuery groupByPostscriptum() Group by the postscriptum column
*
* @method ChildModuleImageI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildModuleImageI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildModuleImageI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildModuleImageI18nQuery leftJoinModuleImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the ModuleImage relation
* @method ChildModuleImageI18nQuery rightJoinModuleImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleImage relation
* @method ChildModuleImageI18nQuery innerJoinModuleImage($relationAlias = null) Adds a INNER JOIN clause to the query using the ModuleImage relation
*
* @method ChildModuleImageI18n findOne(ConnectionInterface $con = null) Return the first ChildModuleImageI18n matching the query
* @method ChildModuleImageI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildModuleImageI18n matching the query, or a new ChildModuleImageI18n object populated from the query conditions when no match is found
*
* @method ChildModuleImageI18n findOneById(int $id) Return the first ChildModuleImageI18n filtered by the id column
* @method ChildModuleImageI18n findOneByLocale(string $locale) Return the first ChildModuleImageI18n filtered by the locale column
* @method ChildModuleImageI18n findOneByTitle(string $title) Return the first ChildModuleImageI18n filtered by the title column
* @method ChildModuleImageI18n findOneByDescription(string $description) Return the first ChildModuleImageI18n filtered by the description column
* @method ChildModuleImageI18n findOneByChapo(string $chapo) Return the first ChildModuleImageI18n filtered by the chapo column
* @method ChildModuleImageI18n findOneByPostscriptum(string $postscriptum) Return the first ChildModuleImageI18n filtered by the postscriptum column
*
* @method array findById(int $id) Return ChildModuleImageI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildModuleImageI18n objects filtered by the locale column
* @method array findByTitle(string $title) Return ChildModuleImageI18n objects filtered by the title column
* @method array findByDescription(string $description) Return ChildModuleImageI18n objects filtered by the description column
* @method array findByChapo(string $chapo) Return ChildModuleImageI18n objects filtered by the chapo column
* @method array findByPostscriptum(string $postscriptum) Return ChildModuleImageI18n objects filtered by the postscriptum column
*
*/
abstract class ModuleImageI18nQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\ModuleImageI18nQuery 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\\ModuleImageI18n', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildModuleImageI18nQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildModuleImageI18nQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\ModuleImageI18nQuery) {
return $criteria;
}
$query = new \Thelia\Model\ModuleImageI18nQuery();
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 ChildModuleImageI18n|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = ModuleImageI18nTableMap::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(ModuleImageI18nTableMap::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 ChildModuleImageI18n A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM module_image_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 ChildModuleImageI18n();
$obj->hydrate($row);
ModuleImageI18nTableMap::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 ChildModuleImageI18n|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 ChildModuleImageI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(ModuleImageI18nTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(ModuleImageI18nTableMap::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 ChildModuleImageI18nQuery 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(ModuleImageI18nTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(ModuleImageI18nTableMap::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 filterByModuleImage()
*
* @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 ChildModuleImageI18nQuery 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(ModuleImageI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(ModuleImageI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ModuleImageI18nTableMap::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 ChildModuleImageI18nQuery 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(ModuleImageI18nTableMap::LOCALE, $locale, $comparison);
}
/**
* Filter the query on the title column
*
* Example usage:
* <code>
* $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
* $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
* </code>
*
* @param string $title 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 ChildModuleImageI18nQuery The current query, for fluid interface
*/
public function filterByTitle($title = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($title)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $title)) {
$title = str_replace('*', '%', $title);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ModuleImageI18nTableMap::TITLE, $title, $comparison);
}
/**
* Filter the query on the description column
*
* Example usage:
* <code>
* $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
* $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
* </code>
*
* @param string $description 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 ChildModuleImageI18nQuery The current query, for fluid interface
*/
public function filterByDescription($description = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($description)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $description)) {
$description = str_replace('*', '%', $description);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ModuleImageI18nTableMap::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the chapo column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* </code>
*
* @param string $chapo 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 ChildModuleImageI18nQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ModuleImageI18nTableMap::CHAPO, $chapo, $comparison);
}
/**
* Filter the query on the postscriptum column
*
* Example usage:
* <code>
* $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
* $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
* </code>
*
* @param string $postscriptum 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 ChildModuleImageI18nQuery The current query, for fluid interface
*/
public function filterByPostscriptum($postscriptum = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($postscriptum)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $postscriptum)) {
$postscriptum = str_replace('*', '%', $postscriptum);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ModuleImageI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\ModuleImage object
*
* @param \Thelia\Model\ModuleImage|ObjectCollection $moduleImage The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildModuleImageI18nQuery The current query, for fluid interface
*/
public function filterByModuleImage($moduleImage, $comparison = null)
{
if ($moduleImage instanceof \Thelia\Model\ModuleImage) {
return $this
->addUsingAlias(ModuleImageI18nTableMap::ID, $moduleImage->getId(), $comparison);
} elseif ($moduleImage instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ModuleImageI18nTableMap::ID, $moduleImage->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByModuleImage() only accepts arguments of type \Thelia\Model\ModuleImage or Collection');
}
}
/**
* Adds a JOIN clause to the query using the ModuleImage relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildModuleImageI18nQuery The current query, for fluid interface
*/
public function joinModuleImage($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ModuleImage');
// 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, 'ModuleImage');
}
return $this;
}
/**
* Use the ModuleImage relation ModuleImage 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\ModuleImageQuery A secondary query class using the current class as primary query
*/
public function useModuleImageQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinModuleImage($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ModuleImage', '\Thelia\Model\ModuleImageQuery');
}
/**
* Exclude object from result
*
* @param ChildModuleImageI18n $moduleImageI18n Object to remove from the list of results
*
* @return ChildModuleImageI18nQuery The current query, for fluid interface
*/
public function prune($moduleImageI18n = null)
{
if ($moduleImageI18n) {
$this->addCond('pruneCond0', $this->getAliasedColName(ModuleImageI18nTableMap::ID), $moduleImageI18n->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(ModuleImageI18nTableMap::LOCALE), $moduleImageI18n->getLocale(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the module_image_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(ModuleImageI18nTableMap::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).
ModuleImageI18nTableMap::clearInstancePool();
ModuleImageI18nTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildModuleImageI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildModuleImageI18n 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(ModuleImageI18nTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(ModuleImageI18nTableMap::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();
ModuleImageI18nTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
ModuleImageI18nTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // ModuleImageI18nQuery

View File

@@ -12,84 +12,89 @@ use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Exception\PropelException;
use Thelia\Model\AttributeCategory as ChildAttributeCategory; use Thelia\Model\ModuleImage as ChildModuleImage;
use Thelia\Model\AttributeCategoryQuery as ChildAttributeCategoryQuery; use Thelia\Model\ModuleImageI18nQuery as ChildModuleImageI18nQuery;
use Thelia\Model\Map\AttributeCategoryTableMap; use Thelia\Model\ModuleImageQuery as ChildModuleImageQuery;
use Thelia\Model\Map\ModuleImageTableMap;
/** /**
* Base class that represents a query for the 'attribute_category' table. * Base class that represents a query for the 'module_image' table.
* *
* *
* *
* @method ChildAttributeCategoryQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildModuleImageQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildAttributeCategoryQuery orderByCategoryId($order = Criteria::ASC) Order by the category_id column * @method ChildModuleImageQuery orderByModuleId($order = Criteria::ASC) Order by the module_id column
* @method ChildAttributeCategoryQuery orderByAttributeId($order = Criteria::ASC) Order by the attribute_id column * @method ChildModuleImageQuery orderByFile($order = Criteria::ASC) Order by the file column
* @method ChildAttributeCategoryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildModuleImageQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildAttributeCategoryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildModuleImageQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildModuleImageQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* *
* @method ChildAttributeCategoryQuery groupById() Group by the id column * @method ChildModuleImageQuery groupById() Group by the id column
* @method ChildAttributeCategoryQuery groupByCategoryId() Group by the category_id column * @method ChildModuleImageQuery groupByModuleId() Group by the module_id column
* @method ChildAttributeCategoryQuery groupByAttributeId() Group by the attribute_id column * @method ChildModuleImageQuery groupByFile() Group by the file column
* @method ChildAttributeCategoryQuery groupByCreatedAt() Group by the created_at column * @method ChildModuleImageQuery groupByPosition() Group by the position column
* @method ChildAttributeCategoryQuery groupByUpdatedAt() Group by the updated_at column * @method ChildModuleImageQuery groupByCreatedAt() Group by the created_at column
* @method ChildModuleImageQuery groupByUpdatedAt() Group by the updated_at column
* *
* @method ChildAttributeCategoryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildModuleImageQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildAttributeCategoryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildModuleImageQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildAttributeCategoryQuery innerJoin($relation) Adds a INNER JOIN clause to the query * @method ChildModuleImageQuery innerJoin($relation) Adds a INNER JOIN clause to the query
* *
* @method ChildAttributeCategoryQuery leftJoinCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the Category relation * @method ChildModuleImageQuery leftJoinModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the Module relation
* @method ChildAttributeCategoryQuery rightJoinCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Category relation * @method ChildModuleImageQuery rightJoinModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Module relation
* @method ChildAttributeCategoryQuery innerJoinCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the Category relation * @method ChildModuleImageQuery innerJoinModule($relationAlias = null) Adds a INNER JOIN clause to the query using the Module relation
* *
* @method ChildAttributeCategoryQuery leftJoinAttribute($relationAlias = null) Adds a LEFT JOIN clause to the query using the Attribute relation * @method ChildModuleImageQuery leftJoinModuleImageI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ModuleImageI18n relation
* @method ChildAttributeCategoryQuery rightJoinAttribute($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Attribute relation * @method ChildModuleImageQuery rightJoinModuleImageI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleImageI18n relation
* @method ChildAttributeCategoryQuery innerJoinAttribute($relationAlias = null) Adds a INNER JOIN clause to the query using the Attribute relation * @method ChildModuleImageQuery innerJoinModuleImageI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ModuleImageI18n relation
* *
* @method ChildAttributeCategory findOne(ConnectionInterface $con = null) Return the first ChildAttributeCategory matching the query * @method ChildModuleImage findOne(ConnectionInterface $con = null) Return the first ChildModuleImage matching the query
* @method ChildAttributeCategory findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAttributeCategory matching the query, or a new ChildAttributeCategory object populated from the query conditions when no match is found * @method ChildModuleImage findOneOrCreate(ConnectionInterface $con = null) Return the first ChildModuleImage matching the query, or a new ChildModuleImage object populated from the query conditions when no match is found
* *
* @method ChildAttributeCategory findOneById(int $id) Return the first ChildAttributeCategory filtered by the id column * @method ChildModuleImage findOneById(int $id) Return the first ChildModuleImage filtered by the id column
* @method ChildAttributeCategory findOneByCategoryId(int $category_id) Return the first ChildAttributeCategory filtered by the category_id column * @method ChildModuleImage findOneByModuleId(int $module_id) Return the first ChildModuleImage filtered by the module_id column
* @method ChildAttributeCategory findOneByAttributeId(int $attribute_id) Return the first ChildAttributeCategory filtered by the attribute_id column * @method ChildModuleImage findOneByFile(string $file) Return the first ChildModuleImage filtered by the file column
* @method ChildAttributeCategory findOneByCreatedAt(string $created_at) Return the first ChildAttributeCategory filtered by the created_at column * @method ChildModuleImage findOneByPosition(int $position) Return the first ChildModuleImage filtered by the position column
* @method ChildAttributeCategory findOneByUpdatedAt(string $updated_at) Return the first ChildAttributeCategory filtered by the updated_at column * @method ChildModuleImage findOneByCreatedAt(string $created_at) Return the first ChildModuleImage filtered by the created_at column
* @method ChildModuleImage findOneByUpdatedAt(string $updated_at) Return the first ChildModuleImage filtered by the updated_at column
* *
* @method array findById(int $id) Return ChildAttributeCategory objects filtered by the id column * @method array findById(int $id) Return ChildModuleImage objects filtered by the id column
* @method array findByCategoryId(int $category_id) Return ChildAttributeCategory objects filtered by the category_id column * @method array findByModuleId(int $module_id) Return ChildModuleImage objects filtered by the module_id column
* @method array findByAttributeId(int $attribute_id) Return ChildAttributeCategory objects filtered by the attribute_id column * @method array findByFile(string $file) Return ChildModuleImage objects filtered by the file column
* @method array findByCreatedAt(string $created_at) Return ChildAttributeCategory objects filtered by the created_at column * @method array findByPosition(int $position) Return ChildModuleImage objects filtered by the position column
* @method array findByUpdatedAt(string $updated_at) Return ChildAttributeCategory objects filtered by the updated_at column * @method array findByCreatedAt(string $created_at) Return ChildModuleImage objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildModuleImage objects filtered by the updated_at column
* *
*/ */
abstract class AttributeCategoryQuery extends ModelCriteria abstract class ModuleImageQuery extends ModelCriteria
{ {
/** /**
* Initializes internal state of \Thelia\Model\Base\AttributeCategoryQuery object. * Initializes internal state of \Thelia\Model\Base\ModuleImageQuery object.
* *
* @param string $dbName The database name * @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book' * @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' * @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/ */
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\AttributeCategory', $modelAlias = null) public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\ModuleImage', $modelAlias = null)
{ {
parent::__construct($dbName, $modelName, $modelAlias); parent::__construct($dbName, $modelName, $modelAlias);
} }
/** /**
* Returns a new ChildAttributeCategoryQuery object. * Returns a new ChildModuleImageQuery object.
* *
* @param string $modelAlias The alias of a model in the query * @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from * @param Criteria $criteria Optional Criteria to build the query from
* *
* @return ChildAttributeCategoryQuery * @return ChildModuleImageQuery
*/ */
public static function create($modelAlias = null, $criteria = null) public static function create($modelAlias = null, $criteria = null)
{ {
if ($criteria instanceof \Thelia\Model\AttributeCategoryQuery) { if ($criteria instanceof \Thelia\Model\ModuleImageQuery) {
return $criteria; return $criteria;
} }
$query = new \Thelia\Model\AttributeCategoryQuery(); $query = new \Thelia\Model\ModuleImageQuery();
if (null !== $modelAlias) { if (null !== $modelAlias) {
$query->setModelAlias($modelAlias); $query->setModelAlias($modelAlias);
} }
@@ -112,19 +117,19 @@ abstract class AttributeCategoryQuery extends ModelCriteria
* @param mixed $key Primary key to use for the query * @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object * @param ConnectionInterface $con an optional connection object
* *
* @return ChildAttributeCategory|array|mixed the result, formatted by the current formatter * @return ChildModuleImage|array|mixed the result, formatted by the current formatter
*/ */
public function findPk($key, $con = null) public function findPk($key, $con = null)
{ {
if ($key === null) { if ($key === null) {
return null; return null;
} }
if ((null !== ($obj = AttributeCategoryTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { if ((null !== ($obj = ModuleImageTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool // the object is already in the instance pool
return $obj; return $obj;
} }
if ($con === null) { if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(AttributeCategoryTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getReadConnection(ModuleImageTableMap::DATABASE_NAME);
} }
$this->basePreSelect($con); $this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select if ($this->formatter || $this->modelAlias || $this->with || $this->select
@@ -143,11 +148,11 @@ abstract class AttributeCategoryQuery extends ModelCriteria
* @param mixed $key Primary key to use for the query * @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object * @param ConnectionInterface $con A connection object
* *
* @return ChildAttributeCategory A model object, or null if the key is not found * @return ChildModuleImage A model object, or null if the key is not found
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, CATEGORY_ID, ATTRIBUTE_ID, CREATED_AT, UPDATED_AT FROM attribute_category WHERE ID = :p0'; $sql = 'SELECT ID, MODULE_ID, FILE, POSITION, CREATED_AT, UPDATED_AT FROM module_image WHERE ID = :p0';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -158,9 +163,9 @@ abstract class AttributeCategoryQuery extends ModelCriteria
} }
$obj = null; $obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildAttributeCategory(); $obj = new ChildModuleImage();
$obj->hydrate($row); $obj->hydrate($row);
AttributeCategoryTableMap::addInstanceToPool($obj, (string) $key); ModuleImageTableMap::addInstanceToPool($obj, (string) $key);
} }
$stmt->closeCursor(); $stmt->closeCursor();
@@ -173,7 +178,7 @@ abstract class AttributeCategoryQuery extends ModelCriteria
* @param mixed $key Primary key to use for the query * @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object * @param ConnectionInterface $con A connection object
* *
* @return ChildAttributeCategory|array|mixed the result, formatted by the current formatter * @return ChildModuleImage|array|mixed the result, formatted by the current formatter
*/ */
protected function findPkComplex($key, $con) protected function findPkComplex($key, $con)
{ {
@@ -215,12 +220,12 @@ abstract class AttributeCategoryQuery extends ModelCriteria
* *
* @param mixed $key Primary key to use for the query * @param mixed $key Primary key to use for the query
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function filterByPrimaryKey($key) public function filterByPrimaryKey($key)
{ {
return $this->addUsingAlias(AttributeCategoryTableMap::ID, $key, Criteria::EQUAL); return $this->addUsingAlias(ModuleImageTableMap::ID, $key, Criteria::EQUAL);
} }
/** /**
@@ -228,12 +233,12 @@ abstract class AttributeCategoryQuery extends ModelCriteria
* *
* @param array $keys The list of primary key to use for the query * @param array $keys The list of primary key to use for the query
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function filterByPrimaryKeys($keys) public function filterByPrimaryKeys($keys)
{ {
return $this->addUsingAlias(AttributeCategoryTableMap::ID, $keys, Criteria::IN); return $this->addUsingAlias(ModuleImageTableMap::ID, $keys, Criteria::IN);
} }
/** /**
@@ -252,18 +257,18 @@ abstract class AttributeCategoryQuery extends ModelCriteria
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function filterById($id = null, $comparison = null) public function filterById($id = null, $comparison = null)
{ {
if (is_array($id)) { if (is_array($id)) {
$useMinMax = false; $useMinMax = false;
if (isset($id['min'])) { if (isset($id['min'])) {
$this->addUsingAlias(AttributeCategoryTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(ModuleImageTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($id['max'])) { if (isset($id['max'])) {
$this->addUsingAlias(AttributeCategoryTableMap::ID, $id['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(ModuleImageTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -274,39 +279,39 @@ abstract class AttributeCategoryQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(AttributeCategoryTableMap::ID, $id, $comparison); return $this->addUsingAlias(ModuleImageTableMap::ID, $id, $comparison);
} }
/** /**
* Filter the query on the category_id column * Filter the query on the module_id column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByCategoryId(1234); // WHERE category_id = 1234 * $query->filterByModuleId(1234); // WHERE module_id = 1234
* $query->filterByCategoryId(array(12, 34)); // WHERE category_id IN (12, 34) * $query->filterByModuleId(array(12, 34)); // WHERE module_id IN (12, 34)
* $query->filterByCategoryId(array('min' => 12)); // WHERE category_id > 12 * $query->filterByModuleId(array('min' => 12)); // WHERE module_id > 12
* </code> * </code>
* *
* @see filterByCategory() * @see filterByModule()
* *
* @param mixed $categoryId The value to use as filter. * @param mixed $moduleId The value to use as filter.
* Use scalar values for equality. * Use scalar values for equality.
* Use array values for in_array() equivalent. * Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function filterByCategoryId($categoryId = null, $comparison = null) public function filterByModuleId($moduleId = null, $comparison = null)
{ {
if (is_array($categoryId)) { if (is_array($moduleId)) {
$useMinMax = false; $useMinMax = false;
if (isset($categoryId['min'])) { if (isset($moduleId['min'])) {
$this->addUsingAlias(AttributeCategoryTableMap::CATEGORY_ID, $categoryId['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(ModuleImageTableMap::MODULE_ID, $moduleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($categoryId['max'])) { if (isset($moduleId['max'])) {
$this->addUsingAlias(AttributeCategoryTableMap::CATEGORY_ID, $categoryId['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(ModuleImageTableMap::MODULE_ID, $moduleId['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -317,39 +322,66 @@ abstract class AttributeCategoryQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(AttributeCategoryTableMap::CATEGORY_ID, $categoryId, $comparison); return $this->addUsingAlias(ModuleImageTableMap::MODULE_ID, $moduleId, $comparison);
} }
/** /**
* Filter the query on the attribute_id column * Filter the query on the file column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByAttributeId(1234); // WHERE attribute_id = 1234 * $query->filterByFile('fooValue'); // WHERE file = 'fooValue'
* $query->filterByAttributeId(array(12, 34)); // WHERE attribute_id IN (12, 34) * $query->filterByFile('%fooValue%'); // WHERE file LIKE '%fooValue%'
* $query->filterByAttributeId(array('min' => 12)); // WHERE attribute_id > 12
* </code> * </code>
* *
* @see filterByAttribute() * @param string $file 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
* *
* @param mixed $attributeId The value to use as filter. * @return ChildModuleImageQuery The current query, for fluid interface
*/
public function filterByFile($file = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($file)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $file)) {
$file = str_replace('*', '%', $file);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ModuleImageTableMap::FILE, $file, $comparison);
}
/**
* Filter the query on the position column
*
* Example usage:
* <code>
* $query->filterByPosition(1234); // WHERE position = 1234
* $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
* $query->filterByPosition(array('min' => 12)); // WHERE position > 12
* </code>
*
* @param mixed $position The value to use as filter.
* Use scalar values for equality. * Use scalar values for equality.
* Use array values for in_array() equivalent. * Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function filterByAttributeId($attributeId = null, $comparison = null) public function filterByPosition($position = null, $comparison = null)
{ {
if (is_array($attributeId)) { if (is_array($position)) {
$useMinMax = false; $useMinMax = false;
if (isset($attributeId['min'])) { if (isset($position['min'])) {
$this->addUsingAlias(AttributeCategoryTableMap::ATTRIBUTE_ID, $attributeId['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(ModuleImageTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($attributeId['max'])) { if (isset($position['max'])) {
$this->addUsingAlias(AttributeCategoryTableMap::ATTRIBUTE_ID, $attributeId['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(ModuleImageTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -360,7 +392,7 @@ abstract class AttributeCategoryQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(AttributeCategoryTableMap::ATTRIBUTE_ID, $attributeId, $comparison); return $this->addUsingAlias(ModuleImageTableMap::POSITION, $position, $comparison);
} }
/** /**
@@ -381,18 +413,18 @@ abstract class AttributeCategoryQuery extends ModelCriteria
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function filterByCreatedAt($createdAt = null, $comparison = null) public function filterByCreatedAt($createdAt = null, $comparison = null)
{ {
if (is_array($createdAt)) { if (is_array($createdAt)) {
$useMinMax = false; $useMinMax = false;
if (isset($createdAt['min'])) { if (isset($createdAt['min'])) {
$this->addUsingAlias(AttributeCategoryTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(ModuleImageTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($createdAt['max'])) { if (isset($createdAt['max'])) {
$this->addUsingAlias(AttributeCategoryTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(ModuleImageTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -403,7 +435,7 @@ abstract class AttributeCategoryQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(AttributeCategoryTableMap::CREATED_AT, $createdAt, $comparison); return $this->addUsingAlias(ModuleImageTableMap::CREATED_AT, $createdAt, $comparison);
} }
/** /**
@@ -424,18 +456,18 @@ abstract class AttributeCategoryQuery extends ModelCriteria
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function filterByUpdatedAt($updatedAt = null, $comparison = null) public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{ {
if (is_array($updatedAt)) { if (is_array($updatedAt)) {
$useMinMax = false; $useMinMax = false;
if (isset($updatedAt['min'])) { if (isset($updatedAt['min'])) {
$this->addUsingAlias(AttributeCategoryTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(ModuleImageTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($updatedAt['max'])) { if (isset($updatedAt['max'])) {
$this->addUsingAlias(AttributeCategoryTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(ModuleImageTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -446,46 +478,46 @@ abstract class AttributeCategoryQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(AttributeCategoryTableMap::UPDATED_AT, $updatedAt, $comparison); return $this->addUsingAlias(ModuleImageTableMap::UPDATED_AT, $updatedAt, $comparison);
} }
/** /**
* Filter the query by a related \Thelia\Model\Category object * Filter the query by a related \Thelia\Model\Module object
* *
* @param \Thelia\Model\Category|ObjectCollection $category The related object(s) to use as filter * @param \Thelia\Model\Module|ObjectCollection $module The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function filterByCategory($category, $comparison = null) public function filterByModule($module, $comparison = null)
{ {
if ($category instanceof \Thelia\Model\Category) { if ($module instanceof \Thelia\Model\Module) {
return $this return $this
->addUsingAlias(AttributeCategoryTableMap::CATEGORY_ID, $category->getId(), $comparison); ->addUsingAlias(ModuleImageTableMap::MODULE_ID, $module->getId(), $comparison);
} elseif ($category instanceof ObjectCollection) { } elseif ($module instanceof ObjectCollection) {
if (null === $comparison) { if (null === $comparison) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} }
return $this return $this
->addUsingAlias(AttributeCategoryTableMap::CATEGORY_ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison); ->addUsingAlias(ModuleImageTableMap::MODULE_ID, $module->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else { } else {
throw new PropelException('filterByCategory() only accepts arguments of type \Thelia\Model\Category or Collection'); throw new PropelException('filterByModule() only accepts arguments of type \Thelia\Model\Module or Collection');
} }
} }
/** /**
* Adds a JOIN clause to the query using the Category relation * Adds a JOIN clause to the query using the Module relation
* *
* @param string $relationAlias optional alias for the relation * @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function joinCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function joinModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Category'); $relationMap = $tableMap->getRelation('Module');
// create a ModelJoin object for this join // create a ModelJoin object for this join
$join = new ModelJoin(); $join = new ModelJoin();
@@ -500,14 +532,14 @@ abstract class AttributeCategoryQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias); $this->addJoinObject($join, $relationAlias);
} else { } else {
$this->addJoinObject($join, 'Category'); $this->addJoinObject($join, 'Module');
} }
return $this; return $this;
} }
/** /**
* Use the Category relation Category object * Use the Module relation Module object
* *
* @see useQuery() * @see useQuery()
* *
@@ -515,52 +547,50 @@ abstract class AttributeCategoryQuery extends ModelCriteria
* to be used as main alias in the secondary query * to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return \Thelia\Model\CategoryQuery A secondary query class using the current class as primary query * @return \Thelia\Model\ModuleQuery A secondary query class using the current class as primary query
*/ */
public function useCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function useModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinCategory($relationAlias, $joinType) ->joinModule($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Category', '\Thelia\Model\CategoryQuery'); ->useQuery($relationAlias ? $relationAlias : 'Module', '\Thelia\Model\ModuleQuery');
} }
/** /**
* Filter the query by a related \Thelia\Model\Attribute object * Filter the query by a related \Thelia\Model\ModuleImageI18n object
* *
* @param \Thelia\Model\Attribute|ObjectCollection $attribute The related object(s) to use as filter * @param \Thelia\Model\ModuleImageI18n|ObjectCollection $moduleImageI18n the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function filterByAttribute($attribute, $comparison = null) public function filterByModuleImageI18n($moduleImageI18n, $comparison = null)
{ {
if ($attribute instanceof \Thelia\Model\Attribute) { if ($moduleImageI18n instanceof \Thelia\Model\ModuleImageI18n) {
return $this return $this
->addUsingAlias(AttributeCategoryTableMap::ATTRIBUTE_ID, $attribute->getId(), $comparison); ->addUsingAlias(ModuleImageTableMap::ID, $moduleImageI18n->getId(), $comparison);
} elseif ($attribute instanceof ObjectCollection) { } elseif ($moduleImageI18n instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this return $this
->addUsingAlias(AttributeCategoryTableMap::ATTRIBUTE_ID, $attribute->toKeyValue('PrimaryKey', 'Id'), $comparison); ->useModuleImageI18nQuery()
->filterByPrimaryKeys($moduleImageI18n->getPrimaryKeys())
->endUse();
} else { } else {
throw new PropelException('filterByAttribute() only accepts arguments of type \Thelia\Model\Attribute or Collection'); throw new PropelException('filterByModuleImageI18n() only accepts arguments of type \Thelia\Model\ModuleImageI18n or Collection');
} }
} }
/** /**
* Adds a JOIN clause to the query using the Attribute relation * Adds a JOIN clause to the query using the ModuleImageI18n relation
* *
* @param string $relationAlias optional alias for the relation * @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function joinAttribute($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function joinModuleImageI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Attribute'); $relationMap = $tableMap->getRelation('ModuleImageI18n');
// create a ModelJoin object for this join // create a ModelJoin object for this join
$join = new ModelJoin(); $join = new ModelJoin();
@@ -575,14 +605,14 @@ abstract class AttributeCategoryQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias); $this->addJoinObject($join, $relationAlias);
} else { } else {
$this->addJoinObject($join, 'Attribute'); $this->addJoinObject($join, 'ModuleImageI18n');
} }
return $this; return $this;
} }
/** /**
* Use the Attribute relation Attribute object * Use the ModuleImageI18n relation ModuleImageI18n object
* *
* @see useQuery() * @see useQuery()
* *
@@ -590,33 +620,33 @@ abstract class AttributeCategoryQuery extends ModelCriteria
* to be used as main alias in the secondary query * to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @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 * @return \Thelia\Model\ModuleImageI18nQuery A secondary query class using the current class as primary query
*/ */
public function useAttributeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function useModuleImageI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{ {
return $this return $this
->joinAttribute($relationAlias, $joinType) ->joinModuleImageI18n($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Attribute', '\Thelia\Model\AttributeQuery'); ->useQuery($relationAlias ? $relationAlias : 'ModuleImageI18n', '\Thelia\Model\ModuleImageI18nQuery');
} }
/** /**
* Exclude object from result * Exclude object from result
* *
* @param ChildAttributeCategory $attributeCategory Object to remove from the list of results * @param ChildModuleImage $moduleImage Object to remove from the list of results
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function prune($attributeCategory = null) public function prune($moduleImage = null)
{ {
if ($attributeCategory) { if ($moduleImage) {
$this->addUsingAlias(AttributeCategoryTableMap::ID, $attributeCategory->getId(), Criteria::NOT_EQUAL); $this->addUsingAlias(ModuleImageTableMap::ID, $moduleImage->getId(), Criteria::NOT_EQUAL);
} }
return $this; return $this;
} }
/** /**
* Deletes all rows from the attribute_category table. * Deletes all rows from the module_image table.
* *
* @param ConnectionInterface $con the connection to use * @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). * @return int The number of affected rows (if supported by underlying database driver).
@@ -624,7 +654,7 @@ abstract class AttributeCategoryQuery extends ModelCriteria
public function doDeleteAll(ConnectionInterface $con = null) public function doDeleteAll(ConnectionInterface $con = null)
{ {
if (null === $con) { if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(AttributeCategoryTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getWriteConnection(ModuleImageTableMap::DATABASE_NAME);
} }
$affectedRows = 0; // initialize var to track total num of affected rows $affectedRows = 0; // initialize var to track total num of affected rows
try { try {
@@ -635,8 +665,8 @@ abstract class AttributeCategoryQuery extends ModelCriteria
// Because this db requires some delete cascade/set null emulation, we have to // Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since // clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein). // instances get re-added by the select statement contained therein).
AttributeCategoryTableMap::clearInstancePool(); ModuleImageTableMap::clearInstancePool();
AttributeCategoryTableMap::clearRelatedInstancePool(); ModuleImageTableMap::clearRelatedInstancePool();
$con->commit(); $con->commit();
} catch (PropelException $e) { } catch (PropelException $e) {
@@ -648,9 +678,9 @@ abstract class AttributeCategoryQuery extends ModelCriteria
} }
/** /**
* Performs a DELETE on the database, given a ChildAttributeCategory or Criteria object OR a primary key value. * Performs a DELETE on the database, given a ChildModuleImage or Criteria object OR a primary key value.
* *
* @param mixed $values Criteria or ChildAttributeCategory object or primary key or array of primary keys * @param mixed $values Criteria or ChildModuleImage object or primary key or array of primary keys
* which is used to create the DELETE statement * which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use * @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 * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
@@ -661,13 +691,13 @@ abstract class AttributeCategoryQuery extends ModelCriteria
public function delete(ConnectionInterface $con = null) public function delete(ConnectionInterface $con = null)
{ {
if (null === $con) { if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(AttributeCategoryTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getWriteConnection(ModuleImageTableMap::DATABASE_NAME);
} }
$criteria = $this; $criteria = $this;
// Set the correct dbName // Set the correct dbName
$criteria->setDbName(AttributeCategoryTableMap::DATABASE_NAME); $criteria->setDbName(ModuleImageTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows $affectedRows = 0; // initialize var to track total num of affected rows
@@ -677,10 +707,10 @@ abstract class AttributeCategoryQuery extends ModelCriteria
$con->beginTransaction(); $con->beginTransaction();
AttributeCategoryTableMap::removeInstanceFromPool($criteria); ModuleImageTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con); $affectedRows += ModelCriteria::delete($con);
AttributeCategoryTableMap::clearRelatedInstancePool(); ModuleImageTableMap::clearRelatedInstancePool();
$con->commit(); $con->commit();
return $affectedRows; return $affectedRows;
@@ -697,11 +727,11 @@ abstract class AttributeCategoryQuery extends ModelCriteria
* *
* @param int $nbDays Maximum age of the latest update in days * @param int $nbDays Maximum age of the latest update in days
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function recentlyUpdated($nbDays = 7) public function recentlyUpdated($nbDays = 7)
{ {
return $this->addUsingAlias(AttributeCategoryTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); return $this->addUsingAlias(ModuleImageTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
} }
/** /**
@@ -709,51 +739,108 @@ abstract class AttributeCategoryQuery extends ModelCriteria
* *
* @param int $nbDays Maximum age of in days * @param int $nbDays Maximum age of in days
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function recentlyCreated($nbDays = 7) public function recentlyCreated($nbDays = 7)
{ {
return $this->addUsingAlias(AttributeCategoryTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); return $this->addUsingAlias(ModuleImageTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
} }
/** /**
* Order by update date desc * Order by update date desc
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function lastUpdatedFirst() public function lastUpdatedFirst()
{ {
return $this->addDescendingOrderByColumn(AttributeCategoryTableMap::UPDATED_AT); return $this->addDescendingOrderByColumn(ModuleImageTableMap::UPDATED_AT);
} }
/** /**
* Order by update date asc * Order by update date asc
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function firstUpdatedFirst() public function firstUpdatedFirst()
{ {
return $this->addAscendingOrderByColumn(AttributeCategoryTableMap::UPDATED_AT); return $this->addAscendingOrderByColumn(ModuleImageTableMap::UPDATED_AT);
} }
/** /**
* Order by create date desc * Order by create date desc
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function lastCreatedFirst() public function lastCreatedFirst()
{ {
return $this->addDescendingOrderByColumn(AttributeCategoryTableMap::CREATED_AT); return $this->addDescendingOrderByColumn(ModuleImageTableMap::CREATED_AT);
} }
/** /**
* Order by create date asc * Order by create date asc
* *
* @return ChildAttributeCategoryQuery The current query, for fluid interface * @return ChildModuleImageQuery The current query, for fluid interface
*/ */
public function firstCreatedFirst() public function firstCreatedFirst()
{ {
return $this->addAscendingOrderByColumn(AttributeCategoryTableMap::CREATED_AT); return $this->addAscendingOrderByColumn(ModuleImageTableMap::CREATED_AT);
} }
} // AttributeCategoryQuery // 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 ChildModuleImageQuery The current query, for fluid interface
*/
public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$relationName = $relationAlias ? $relationAlias : 'ModuleImageI18n';
return $this
->joinModuleImageI18n($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 ChildModuleImageQuery The current query, for fluid interface
*/
public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
{
$this
->joinI18n($locale, null, $joinType)
->with('ModuleImageI18n');
$this->with['ModuleImageI18n']->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 ChildModuleImageI18nQuery 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 : 'ModuleImageI18n', '\Thelia\Model\ModuleImageI18nQuery');
}
} // ModuleImageQuery

View File

@@ -60,6 +60,10 @@ use Thelia\Model\Map\ModuleTableMap;
* @method ChildModuleQuery rightJoinGroupModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GroupModule relation * @method ChildModuleQuery rightJoinGroupModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GroupModule relation
* @method ChildModuleQuery innerJoinGroupModule($relationAlias = null) Adds a INNER JOIN clause to the query using the GroupModule relation * @method ChildModuleQuery innerJoinGroupModule($relationAlias = null) Adds a INNER JOIN clause to the query using the GroupModule relation
* *
* @method ChildModuleQuery leftJoinModuleImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the ModuleImage relation
* @method ChildModuleQuery rightJoinModuleImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleImage relation
* @method ChildModuleQuery innerJoinModuleImage($relationAlias = null) Adds a INNER JOIN clause to the query using the ModuleImage relation
*
* @method ChildModuleQuery leftJoinModuleI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ModuleI18n relation * @method ChildModuleQuery leftJoinModuleI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ModuleI18n relation
* @method ChildModuleQuery rightJoinModuleI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleI18n relation * @method ChildModuleQuery rightJoinModuleI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleI18n relation
* @method ChildModuleQuery innerJoinModuleI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ModuleI18n relation * @method ChildModuleQuery innerJoinModuleI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ModuleI18n relation
@@ -861,6 +865,79 @@ abstract class ModuleQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'GroupModule', '\Thelia\Model\GroupModuleQuery'); ->useQuery($relationAlias ? $relationAlias : 'GroupModule', '\Thelia\Model\GroupModuleQuery');
} }
/**
* Filter the query by a related \Thelia\Model\ModuleImage object
*
* @param \Thelia\Model\ModuleImage|ObjectCollection $moduleImage the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildModuleQuery The current query, for fluid interface
*/
public function filterByModuleImage($moduleImage, $comparison = null)
{
if ($moduleImage instanceof \Thelia\Model\ModuleImage) {
return $this
->addUsingAlias(ModuleTableMap::ID, $moduleImage->getModuleId(), $comparison);
} elseif ($moduleImage instanceof ObjectCollection) {
return $this
->useModuleImageQuery()
->filterByPrimaryKeys($moduleImage->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByModuleImage() only accepts arguments of type \Thelia\Model\ModuleImage or Collection');
}
}
/**
* Adds a JOIN clause to the query using the ModuleImage relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildModuleQuery The current query, for fluid interface
*/
public function joinModuleImage($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ModuleImage');
// 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, 'ModuleImage');
}
return $this;
}
/**
* Use the ModuleImage relation ModuleImage 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\ModuleImageQuery A secondary query class using the current class as primary query
*/
public function useModuleImageQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinModuleImage($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ModuleImage', '\Thelia\Model\ModuleImageQuery');
}
/** /**
* Filter the query by a related \Thelia\Model\ModuleI18n object * Filter the query by a related \Thelia\Model\ModuleI18n object
* *

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,897 @@
<?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\OrderProductAttributeCombination as ChildOrderProductAttributeCombination;
use Thelia\Model\OrderProductAttributeCombinationQuery as ChildOrderProductAttributeCombinationQuery;
use Thelia\Model\Map\OrderProductAttributeCombinationTableMap;
/**
* Base class that represents a query for the 'order_product_attribute_combination' table.
*
*
*
* @method ChildOrderProductAttributeCombinationQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildOrderProductAttributeCombinationQuery orderByOrderProductId($order = Criteria::ASC) Order by the order_product_id column
* @method ChildOrderProductAttributeCombinationQuery orderByAttributeTitle($order = Criteria::ASC) Order by the attribute_title column
* @method ChildOrderProductAttributeCombinationQuery orderByAttributeChapo($order = Criteria::ASC) Order by the attribute_chapo column
* @method ChildOrderProductAttributeCombinationQuery orderByAttributeDescription($order = Criteria::ASC) Order by the attribute_description column
* @method ChildOrderProductAttributeCombinationQuery orderByAttributePostscriptumn($order = Criteria::ASC) Order by the attribute_postscriptumn column
* @method ChildOrderProductAttributeCombinationQuery orderByAttributeAvTitle($order = Criteria::ASC) Order by the attribute_av_title column
* @method ChildOrderProductAttributeCombinationQuery orderByAttributeAvChapo($order = Criteria::ASC) Order by the attribute_av_chapo column
* @method ChildOrderProductAttributeCombinationQuery orderByAttributeAvDescription($order = Criteria::ASC) Order by the attribute_av_description column
* @method ChildOrderProductAttributeCombinationQuery orderByAttributeAvPostscriptum($order = Criteria::ASC) Order by the attribute_av_postscriptum column
* @method ChildOrderProductAttributeCombinationQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildOrderProductAttributeCombinationQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildOrderProductAttributeCombinationQuery groupById() Group by the id column
* @method ChildOrderProductAttributeCombinationQuery groupByOrderProductId() Group by the order_product_id column
* @method ChildOrderProductAttributeCombinationQuery groupByAttributeTitle() Group by the attribute_title column
* @method ChildOrderProductAttributeCombinationQuery groupByAttributeChapo() Group by the attribute_chapo column
* @method ChildOrderProductAttributeCombinationQuery groupByAttributeDescription() Group by the attribute_description column
* @method ChildOrderProductAttributeCombinationQuery groupByAttributePostscriptumn() Group by the attribute_postscriptumn column
* @method ChildOrderProductAttributeCombinationQuery groupByAttributeAvTitle() Group by the attribute_av_title column
* @method ChildOrderProductAttributeCombinationQuery groupByAttributeAvChapo() Group by the attribute_av_chapo column
* @method ChildOrderProductAttributeCombinationQuery groupByAttributeAvDescription() Group by the attribute_av_description column
* @method ChildOrderProductAttributeCombinationQuery groupByAttributeAvPostscriptum() Group by the attribute_av_postscriptum column
* @method ChildOrderProductAttributeCombinationQuery groupByCreatedAt() Group by the created_at column
* @method ChildOrderProductAttributeCombinationQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildOrderProductAttributeCombinationQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildOrderProductAttributeCombinationQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildOrderProductAttributeCombinationQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildOrderProductAttributeCombinationQuery leftJoinOrderProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderProduct relation
* @method ChildOrderProductAttributeCombinationQuery rightJoinOrderProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProduct relation
* @method ChildOrderProductAttributeCombinationQuery innerJoinOrderProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProduct relation
*
* @method ChildOrderProductAttributeCombination findOne(ConnectionInterface $con = null) Return the first ChildOrderProductAttributeCombination matching the query
* @method ChildOrderProductAttributeCombination findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderProductAttributeCombination matching the query, or a new ChildOrderProductAttributeCombination object populated from the query conditions when no match is found
*
* @method ChildOrderProductAttributeCombination findOneById(int $id) Return the first ChildOrderProductAttributeCombination filtered by the id column
* @method ChildOrderProductAttributeCombination findOneByOrderProductId(int $order_product_id) Return the first ChildOrderProductAttributeCombination filtered by the order_product_id column
* @method ChildOrderProductAttributeCombination findOneByAttributeTitle(string $attribute_title) Return the first ChildOrderProductAttributeCombination filtered by the attribute_title column
* @method ChildOrderProductAttributeCombination findOneByAttributeChapo(string $attribute_chapo) Return the first ChildOrderProductAttributeCombination filtered by the attribute_chapo column
* @method ChildOrderProductAttributeCombination findOneByAttributeDescription(string $attribute_description) Return the first ChildOrderProductAttributeCombination filtered by the attribute_description column
* @method ChildOrderProductAttributeCombination findOneByAttributePostscriptumn(string $attribute_postscriptumn) Return the first ChildOrderProductAttributeCombination filtered by the attribute_postscriptumn column
* @method ChildOrderProductAttributeCombination findOneByAttributeAvTitle(string $attribute_av_title) Return the first ChildOrderProductAttributeCombination filtered by the attribute_av_title column
* @method ChildOrderProductAttributeCombination findOneByAttributeAvChapo(string $attribute_av_chapo) Return the first ChildOrderProductAttributeCombination filtered by the attribute_av_chapo column
* @method ChildOrderProductAttributeCombination findOneByAttributeAvDescription(string $attribute_av_description) Return the first ChildOrderProductAttributeCombination filtered by the attribute_av_description column
* @method ChildOrderProductAttributeCombination findOneByAttributeAvPostscriptum(string $attribute_av_postscriptum) Return the first ChildOrderProductAttributeCombination filtered by the attribute_av_postscriptum column
* @method ChildOrderProductAttributeCombination findOneByCreatedAt(string $created_at) Return the first ChildOrderProductAttributeCombination filtered by the created_at column
* @method ChildOrderProductAttributeCombination findOneByUpdatedAt(string $updated_at) Return the first ChildOrderProductAttributeCombination filtered by the updated_at column
*
* @method array findById(int $id) Return ChildOrderProductAttributeCombination objects filtered by the id column
* @method array findByOrderProductId(int $order_product_id) Return ChildOrderProductAttributeCombination objects filtered by the order_product_id column
* @method array findByAttributeTitle(string $attribute_title) Return ChildOrderProductAttributeCombination objects filtered by the attribute_title column
* @method array findByAttributeChapo(string $attribute_chapo) Return ChildOrderProductAttributeCombination objects filtered by the attribute_chapo column
* @method array findByAttributeDescription(string $attribute_description) Return ChildOrderProductAttributeCombination objects filtered by the attribute_description column
* @method array findByAttributePostscriptumn(string $attribute_postscriptumn) Return ChildOrderProductAttributeCombination objects filtered by the attribute_postscriptumn column
* @method array findByAttributeAvTitle(string $attribute_av_title) Return ChildOrderProductAttributeCombination objects filtered by the attribute_av_title column
* @method array findByAttributeAvChapo(string $attribute_av_chapo) Return ChildOrderProductAttributeCombination objects filtered by the attribute_av_chapo column
* @method array findByAttributeAvDescription(string $attribute_av_description) Return ChildOrderProductAttributeCombination objects filtered by the attribute_av_description column
* @method array findByAttributeAvPostscriptum(string $attribute_av_postscriptum) Return ChildOrderProductAttributeCombination objects filtered by the attribute_av_postscriptum column
* @method array findByCreatedAt(string $created_at) Return ChildOrderProductAttributeCombination objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildOrderProductAttributeCombination objects filtered by the updated_at column
*
*/
abstract class OrderProductAttributeCombinationQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\OrderProductAttributeCombinationQuery 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\\OrderProductAttributeCombination', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildOrderProductAttributeCombinationQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildOrderProductAttributeCombinationQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\OrderProductAttributeCombinationQuery) {
return $criteria;
}
$query = new \Thelia\Model\OrderProductAttributeCombinationQuery();
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 ChildOrderProductAttributeCombination|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = OrderProductAttributeCombinationTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(OrderProductAttributeCombinationTableMap::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 ChildOrderProductAttributeCombination A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, ORDER_PRODUCT_ID, ATTRIBUTE_TITLE, ATTRIBUTE_CHAPO, ATTRIBUTE_DESCRIPTION, ATTRIBUTE_POSTSCRIPTUMN, ATTRIBUTE_AV_TITLE, ATTRIBUTE_AV_CHAPO, ATTRIBUTE_AV_DESCRIPTION, ATTRIBUTE_AV_POSTSCRIPTUM, CREATED_AT, UPDATED_AT FROM order_product_attribute_combination 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 ChildOrderProductAttributeCombination();
$obj->hydrate($row);
OrderProductAttributeCombinationTableMap::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 ChildOrderProductAttributeCombination|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 ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::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 ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::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 ChildOrderProductAttributeCombinationQuery 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(OrderProductAttributeCombinationTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(OrderProductAttributeCombinationTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the order_product_id column
*
* Example usage:
* <code>
* $query->filterByOrderProductId(1234); // WHERE order_product_id = 1234
* $query->filterByOrderProductId(array(12, 34)); // WHERE order_product_id IN (12, 34)
* $query->filterByOrderProductId(array('min' => 12)); // WHERE order_product_id > 12
* </code>
*
* @see filterByOrderProduct()
*
* @param mixed $orderProductId 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 ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByOrderProductId($orderProductId = null, $comparison = null)
{
if (is_array($orderProductId)) {
$useMinMax = false;
if (isset($orderProductId['min'])) {
$this->addUsingAlias(OrderProductAttributeCombinationTableMap::ORDER_PRODUCT_ID, $orderProductId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($orderProductId['max'])) {
$this->addUsingAlias(OrderProductAttributeCombinationTableMap::ORDER_PRODUCT_ID, $orderProductId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ORDER_PRODUCT_ID, $orderProductId, $comparison);
}
/**
* Filter the query on the attribute_title column
*
* Example usage:
* <code>
* $query->filterByAttributeTitle('fooValue'); // WHERE attribute_title = 'fooValue'
* $query->filterByAttributeTitle('%fooValue%'); // WHERE attribute_title LIKE '%fooValue%'
* </code>
*
* @param string $attributeTitle 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 ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributeTitle($attributeTitle = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($attributeTitle)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $attributeTitle)) {
$attributeTitle = str_replace('*', '%', $attributeTitle);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ATTRIBUTE_TITLE, $attributeTitle, $comparison);
}
/**
* Filter the query on the attribute_chapo column
*
* Example usage:
* <code>
* $query->filterByAttributeChapo('fooValue'); // WHERE attribute_chapo = 'fooValue'
* $query->filterByAttributeChapo('%fooValue%'); // WHERE attribute_chapo LIKE '%fooValue%'
* </code>
*
* @param string $attributeChapo 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 ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributeChapo($attributeChapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($attributeChapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $attributeChapo)) {
$attributeChapo = str_replace('*', '%', $attributeChapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ATTRIBUTE_CHAPO, $attributeChapo, $comparison);
}
/**
* Filter the query on the attribute_description column
*
* Example usage:
* <code>
* $query->filterByAttributeDescription('fooValue'); // WHERE attribute_description = 'fooValue'
* $query->filterByAttributeDescription('%fooValue%'); // WHERE attribute_description LIKE '%fooValue%'
* </code>
*
* @param string $attributeDescription 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 ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributeDescription($attributeDescription = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($attributeDescription)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $attributeDescription)) {
$attributeDescription = str_replace('*', '%', $attributeDescription);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ATTRIBUTE_DESCRIPTION, $attributeDescription, $comparison);
}
/**
* Filter the query on the attribute_postscriptumn column
*
* Example usage:
* <code>
* $query->filterByAttributePostscriptumn('fooValue'); // WHERE attribute_postscriptumn = 'fooValue'
* $query->filterByAttributePostscriptumn('%fooValue%'); // WHERE attribute_postscriptumn LIKE '%fooValue%'
* </code>
*
* @param string $attributePostscriptumn 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 ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributePostscriptumn($attributePostscriptumn = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($attributePostscriptumn)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $attributePostscriptumn)) {
$attributePostscriptumn = str_replace('*', '%', $attributePostscriptumn);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ATTRIBUTE_POSTSCRIPTUMN, $attributePostscriptumn, $comparison);
}
/**
* Filter the query on the attribute_av_title column
*
* Example usage:
* <code>
* $query->filterByAttributeAvTitle('fooValue'); // WHERE attribute_av_title = 'fooValue'
* $query->filterByAttributeAvTitle('%fooValue%'); // WHERE attribute_av_title LIKE '%fooValue%'
* </code>
*
* @param string $attributeAvTitle 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 ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributeAvTitle($attributeAvTitle = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($attributeAvTitle)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $attributeAvTitle)) {
$attributeAvTitle = str_replace('*', '%', $attributeAvTitle);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_TITLE, $attributeAvTitle, $comparison);
}
/**
* Filter the query on the attribute_av_chapo column
*
* Example usage:
* <code>
* $query->filterByAttributeAvChapo('fooValue'); // WHERE attribute_av_chapo = 'fooValue'
* $query->filterByAttributeAvChapo('%fooValue%'); // WHERE attribute_av_chapo LIKE '%fooValue%'
* </code>
*
* @param string $attributeAvChapo 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 ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributeAvChapo($attributeAvChapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($attributeAvChapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $attributeAvChapo)) {
$attributeAvChapo = str_replace('*', '%', $attributeAvChapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_CHAPO, $attributeAvChapo, $comparison);
}
/**
* Filter the query on the attribute_av_description column
*
* Example usage:
* <code>
* $query->filterByAttributeAvDescription('fooValue'); // WHERE attribute_av_description = 'fooValue'
* $query->filterByAttributeAvDescription('%fooValue%'); // WHERE attribute_av_description LIKE '%fooValue%'
* </code>
*
* @param string $attributeAvDescription 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 ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributeAvDescription($attributeAvDescription = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($attributeAvDescription)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $attributeAvDescription)) {
$attributeAvDescription = str_replace('*', '%', $attributeAvDescription);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_DESCRIPTION, $attributeAvDescription, $comparison);
}
/**
* Filter the query on the attribute_av_postscriptum column
*
* Example usage:
* <code>
* $query->filterByAttributeAvPostscriptum('fooValue'); // WHERE attribute_av_postscriptum = 'fooValue'
* $query->filterByAttributeAvPostscriptum('%fooValue%'); // WHERE attribute_av_postscriptum LIKE '%fooValue%'
* </code>
*
* @param string $attributeAvPostscriptum 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 ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributeAvPostscriptum($attributeAvPostscriptum = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($attributeAvPostscriptum)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $attributeAvPostscriptum)) {
$attributeAvPostscriptum = str_replace('*', '%', $attributeAvPostscriptum);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_POSTSCRIPTUM, $attributeAvPostscriptum, $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 ChildOrderProductAttributeCombinationQuery 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(OrderProductAttributeCombinationTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(OrderProductAttributeCombinationTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::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 ChildOrderProductAttributeCombinationQuery 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(OrderProductAttributeCombinationTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(OrderProductAttributeCombinationTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\OrderProduct object
*
* @param \Thelia\Model\OrderProduct|ObjectCollection $orderProduct The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function filterByOrderProduct($orderProduct, $comparison = null)
{
if ($orderProduct instanceof \Thelia\Model\OrderProduct) {
return $this
->addUsingAlias(OrderProductAttributeCombinationTableMap::ORDER_PRODUCT_ID, $orderProduct->getId(), $comparison);
} elseif ($orderProduct instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(OrderProductAttributeCombinationTableMap::ORDER_PRODUCT_ID, $orderProduct->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByOrderProduct() only accepts arguments of type \Thelia\Model\OrderProduct or Collection');
}
}
/**
* Adds a JOIN clause to the query using the OrderProduct relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function joinOrderProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('OrderProduct');
// 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, 'OrderProduct');
}
return $this;
}
/**
* Use the OrderProduct relation OrderProduct 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\OrderProductQuery A secondary query class using the current class as primary query
*/
public function useOrderProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinOrderProduct($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderProduct', '\Thelia\Model\OrderProductQuery');
}
/**
* Exclude object from result
*
* @param ChildOrderProductAttributeCombination $orderProductAttributeCombination Object to remove from the list of results
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function prune($orderProductAttributeCombination = null)
{
if ($orderProductAttributeCombination) {
$this->addUsingAlias(OrderProductAttributeCombinationTableMap::ID, $orderProductAttributeCombination->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the order_product_attribute_combination 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(OrderProductAttributeCombinationTableMap::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).
OrderProductAttributeCombinationTableMap::clearInstancePool();
OrderProductAttributeCombinationTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildOrderProductAttributeCombination or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildOrderProductAttributeCombination 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(OrderProductAttributeCombinationTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(OrderProductAttributeCombinationTableMap::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();
OrderProductAttributeCombinationTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
OrderProductAttributeCombinationTableMap::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 ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(OrderProductAttributeCombinationTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(OrderProductAttributeCombinationTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(OrderProductAttributeCombinationTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(OrderProductAttributeCombinationTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildOrderProductAttributeCombinationQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(OrderProductAttributeCombinationTableMap::CREATED_AT);
}
} // OrderProductAttributeCombinationQuery

View File

@@ -24,12 +24,19 @@ use Thelia\Model\Map\OrderProductTableMap;
* @method ChildOrderProductQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildOrderProductQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildOrderProductQuery orderByOrderId($order = Criteria::ASC) Order by the order_id column * @method ChildOrderProductQuery orderByOrderId($order = Criteria::ASC) Order by the order_id column
* @method ChildOrderProductQuery orderByProductRef($order = Criteria::ASC) Order by the product_ref column * @method ChildOrderProductQuery orderByProductRef($order = Criteria::ASC) Order by the product_ref column
* @method ChildOrderProductQuery orderByProductSaleElementsRef($order = Criteria::ASC) Order by the product_sale_elements_ref column
* @method ChildOrderProductQuery orderByTitle($order = Criteria::ASC) Order by the title column * @method ChildOrderProductQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildOrderProductQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildOrderProductQuery orderByChapo($order = Criteria::ASC) Order by the chapo column * @method ChildOrderProductQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ChildOrderProductQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildOrderProductQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
* @method ChildOrderProductQuery orderByQuantity($order = Criteria::ASC) Order by the quantity column * @method ChildOrderProductQuery orderByQuantity($order = Criteria::ASC) Order by the quantity column
* @method ChildOrderProductQuery orderByPrice($order = Criteria::ASC) Order by the price column * @method ChildOrderProductQuery orderByPrice($order = Criteria::ASC) Order by the price column
* @method ChildOrderProductQuery orderByTax($order = Criteria::ASC) Order by the tax column * @method ChildOrderProductQuery orderByPromoPrice($order = Criteria::ASC) Order by the promo_price column
* @method ChildOrderProductQuery orderByWasNew($order = Criteria::ASC) Order by the was_new column
* @method ChildOrderProductQuery orderByWasInPromo($order = Criteria::ASC) Order by the was_in_promo column
* @method ChildOrderProductQuery orderByWeight($order = Criteria::ASC) Order by the weight column
* @method ChildOrderProductQuery orderByTaxRuleTitle($order = Criteria::ASC) Order by the tax_rule_title column
* @method ChildOrderProductQuery orderByTaxRuleDescription($order = Criteria::ASC) Order by the tax_rule_description column
* @method ChildOrderProductQuery orderByParent($order = Criteria::ASC) Order by the parent column * @method ChildOrderProductQuery orderByParent($order = Criteria::ASC) Order by the parent column
* @method ChildOrderProductQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildOrderProductQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildOrderProductQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildOrderProductQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
@@ -37,12 +44,19 @@ use Thelia\Model\Map\OrderProductTableMap;
* @method ChildOrderProductQuery groupById() Group by the id column * @method ChildOrderProductQuery groupById() Group by the id column
* @method ChildOrderProductQuery groupByOrderId() Group by the order_id column * @method ChildOrderProductQuery groupByOrderId() Group by the order_id column
* @method ChildOrderProductQuery groupByProductRef() Group by the product_ref column * @method ChildOrderProductQuery groupByProductRef() Group by the product_ref column
* @method ChildOrderProductQuery groupByProductSaleElementsRef() Group by the product_sale_elements_ref column
* @method ChildOrderProductQuery groupByTitle() Group by the title column * @method ChildOrderProductQuery groupByTitle() Group by the title column
* @method ChildOrderProductQuery groupByDescription() Group by the description column
* @method ChildOrderProductQuery groupByChapo() Group by the chapo column * @method ChildOrderProductQuery groupByChapo() Group by the chapo column
* @method ChildOrderProductQuery groupByDescription() Group by the description column
* @method ChildOrderProductQuery groupByPostscriptum() Group by the postscriptum column
* @method ChildOrderProductQuery groupByQuantity() Group by the quantity column * @method ChildOrderProductQuery groupByQuantity() Group by the quantity column
* @method ChildOrderProductQuery groupByPrice() Group by the price column * @method ChildOrderProductQuery groupByPrice() Group by the price column
* @method ChildOrderProductQuery groupByTax() Group by the tax column * @method ChildOrderProductQuery groupByPromoPrice() Group by the promo_price column
* @method ChildOrderProductQuery groupByWasNew() Group by the was_new column
* @method ChildOrderProductQuery groupByWasInPromo() Group by the was_in_promo column
* @method ChildOrderProductQuery groupByWeight() Group by the weight column
* @method ChildOrderProductQuery groupByTaxRuleTitle() Group by the tax_rule_title column
* @method ChildOrderProductQuery groupByTaxRuleDescription() Group by the tax_rule_description column
* @method ChildOrderProductQuery groupByParent() Group by the parent column * @method ChildOrderProductQuery groupByParent() Group by the parent column
* @method ChildOrderProductQuery groupByCreatedAt() Group by the created_at column * @method ChildOrderProductQuery groupByCreatedAt() Group by the created_at column
* @method ChildOrderProductQuery groupByUpdatedAt() Group by the updated_at column * @method ChildOrderProductQuery groupByUpdatedAt() Group by the updated_at column
@@ -55,9 +69,13 @@ use Thelia\Model\Map\OrderProductTableMap;
* @method ChildOrderProductQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation * @method ChildOrderProductQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation
* @method ChildOrderProductQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation * @method ChildOrderProductQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation
* *
* @method ChildOrderProductQuery leftJoinOrderFeature($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderFeature relation * @method ChildOrderProductQuery leftJoinOrderProductAttributeCombination($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderProductAttributeCombination relation
* @method ChildOrderProductQuery rightJoinOrderFeature($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderFeature relation * @method ChildOrderProductQuery rightJoinOrderProductAttributeCombination($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProductAttributeCombination relation
* @method ChildOrderProductQuery innerJoinOrderFeature($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderFeature relation * @method ChildOrderProductQuery innerJoinOrderProductAttributeCombination($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProductAttributeCombination relation
*
* @method ChildOrderProductQuery leftJoinOrderProductTax($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderProductTax relation
* @method ChildOrderProductQuery rightJoinOrderProductTax($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProductTax relation
* @method ChildOrderProductQuery innerJoinOrderProductTax($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProductTax relation
* *
* @method ChildOrderProduct findOne(ConnectionInterface $con = null) Return the first ChildOrderProduct matching the query * @method ChildOrderProduct findOne(ConnectionInterface $con = null) Return the first ChildOrderProduct matching the query
* @method ChildOrderProduct findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderProduct matching the query, or a new ChildOrderProduct object populated from the query conditions when no match is found * @method ChildOrderProduct findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderProduct matching the query, or a new ChildOrderProduct object populated from the query conditions when no match is found
@@ -65,12 +83,19 @@ use Thelia\Model\Map\OrderProductTableMap;
* @method ChildOrderProduct findOneById(int $id) Return the first ChildOrderProduct filtered by the id column * @method ChildOrderProduct findOneById(int $id) Return the first ChildOrderProduct filtered by the id column
* @method ChildOrderProduct findOneByOrderId(int $order_id) Return the first ChildOrderProduct filtered by the order_id column * @method ChildOrderProduct findOneByOrderId(int $order_id) Return the first ChildOrderProduct filtered by the order_id column
* @method ChildOrderProduct findOneByProductRef(string $product_ref) Return the first ChildOrderProduct filtered by the product_ref column * @method ChildOrderProduct findOneByProductRef(string $product_ref) Return the first ChildOrderProduct filtered by the product_ref column
* @method ChildOrderProduct findOneByProductSaleElementsRef(string $product_sale_elements_ref) Return the first ChildOrderProduct filtered by the product_sale_elements_ref column
* @method ChildOrderProduct findOneByTitle(string $title) Return the first ChildOrderProduct filtered by the title column * @method ChildOrderProduct findOneByTitle(string $title) Return the first ChildOrderProduct filtered by the title column
* @method ChildOrderProduct findOneByDescription(string $description) Return the first ChildOrderProduct filtered by the description column
* @method ChildOrderProduct findOneByChapo(string $chapo) Return the first ChildOrderProduct filtered by the chapo column * @method ChildOrderProduct findOneByChapo(string $chapo) Return the first ChildOrderProduct filtered by the chapo column
* @method ChildOrderProduct findOneByDescription(string $description) Return the first ChildOrderProduct filtered by the description column
* @method ChildOrderProduct findOneByPostscriptum(string $postscriptum) Return the first ChildOrderProduct filtered by the postscriptum column
* @method ChildOrderProduct findOneByQuantity(double $quantity) Return the first ChildOrderProduct filtered by the quantity column * @method ChildOrderProduct findOneByQuantity(double $quantity) Return the first ChildOrderProduct filtered by the quantity column
* @method ChildOrderProduct findOneByPrice(double $price) Return the first ChildOrderProduct filtered by the price column * @method ChildOrderProduct findOneByPrice(double $price) Return the first ChildOrderProduct filtered by the price column
* @method ChildOrderProduct findOneByTax(double $tax) Return the first ChildOrderProduct filtered by the tax column * @method ChildOrderProduct findOneByPromoPrice(string $promo_price) Return the first ChildOrderProduct filtered by the promo_price column
* @method ChildOrderProduct findOneByWasNew(int $was_new) Return the first ChildOrderProduct filtered by the was_new column
* @method ChildOrderProduct findOneByWasInPromo(int $was_in_promo) Return the first ChildOrderProduct filtered by the was_in_promo column
* @method ChildOrderProduct findOneByWeight(string $weight) Return the first ChildOrderProduct filtered by the weight column
* @method ChildOrderProduct findOneByTaxRuleTitle(string $tax_rule_title) Return the first ChildOrderProduct filtered by the tax_rule_title column
* @method ChildOrderProduct findOneByTaxRuleDescription(string $tax_rule_description) Return the first ChildOrderProduct filtered by the tax_rule_description column
* @method ChildOrderProduct findOneByParent(int $parent) Return the first ChildOrderProduct filtered by the parent column * @method ChildOrderProduct findOneByParent(int $parent) Return the first ChildOrderProduct filtered by the parent column
* @method ChildOrderProduct findOneByCreatedAt(string $created_at) Return the first ChildOrderProduct filtered by the created_at column * @method ChildOrderProduct findOneByCreatedAt(string $created_at) Return the first ChildOrderProduct filtered by the created_at column
* @method ChildOrderProduct findOneByUpdatedAt(string $updated_at) Return the first ChildOrderProduct filtered by the updated_at column * @method ChildOrderProduct findOneByUpdatedAt(string $updated_at) Return the first ChildOrderProduct filtered by the updated_at column
@@ -78,12 +103,19 @@ use Thelia\Model\Map\OrderProductTableMap;
* @method array findById(int $id) Return ChildOrderProduct objects filtered by the id column * @method array findById(int $id) Return ChildOrderProduct objects filtered by the id column
* @method array findByOrderId(int $order_id) Return ChildOrderProduct objects filtered by the order_id column * @method array findByOrderId(int $order_id) Return ChildOrderProduct objects filtered by the order_id column
* @method array findByProductRef(string $product_ref) Return ChildOrderProduct objects filtered by the product_ref column * @method array findByProductRef(string $product_ref) Return ChildOrderProduct objects filtered by the product_ref column
* @method array findByProductSaleElementsRef(string $product_sale_elements_ref) Return ChildOrderProduct objects filtered by the product_sale_elements_ref column
* @method array findByTitle(string $title) Return ChildOrderProduct objects filtered by the title column * @method array findByTitle(string $title) Return ChildOrderProduct objects filtered by the title column
* @method array findByDescription(string $description) Return ChildOrderProduct objects filtered by the description column
* @method array findByChapo(string $chapo) Return ChildOrderProduct objects filtered by the chapo column * @method array findByChapo(string $chapo) Return ChildOrderProduct objects filtered by the chapo column
* @method array findByDescription(string $description) Return ChildOrderProduct objects filtered by the description column
* @method array findByPostscriptum(string $postscriptum) Return ChildOrderProduct objects filtered by the postscriptum column
* @method array findByQuantity(double $quantity) Return ChildOrderProduct objects filtered by the quantity column * @method array findByQuantity(double $quantity) Return ChildOrderProduct objects filtered by the quantity column
* @method array findByPrice(double $price) Return ChildOrderProduct objects filtered by the price column * @method array findByPrice(double $price) Return ChildOrderProduct objects filtered by the price column
* @method array findByTax(double $tax) Return ChildOrderProduct objects filtered by the tax column * @method array findByPromoPrice(string $promo_price) Return ChildOrderProduct objects filtered by the promo_price column
* @method array findByWasNew(int $was_new) Return ChildOrderProduct objects filtered by the was_new column
* @method array findByWasInPromo(int $was_in_promo) Return ChildOrderProduct objects filtered by the was_in_promo column
* @method array findByWeight(string $weight) Return ChildOrderProduct objects filtered by the weight column
* @method array findByTaxRuleTitle(string $tax_rule_title) Return ChildOrderProduct objects filtered by the tax_rule_title column
* @method array findByTaxRuleDescription(string $tax_rule_description) Return ChildOrderProduct objects filtered by the tax_rule_description column
* @method array findByParent(int $parent) Return ChildOrderProduct objects filtered by the parent column * @method array findByParent(int $parent) Return ChildOrderProduct objects filtered by the parent column
* @method array findByCreatedAt(string $created_at) Return ChildOrderProduct objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildOrderProduct objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildOrderProduct objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildOrderProduct objects filtered by the updated_at column
@@ -175,7 +207,7 @@ abstract class OrderProductQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, ORDER_ID, PRODUCT_REF, TITLE, DESCRIPTION, CHAPO, QUANTITY, PRICE, TAX, PARENT, CREATED_AT, UPDATED_AT FROM order_product WHERE ID = :p0'; $sql = 'SELECT ID, ORDER_ID, PRODUCT_REF, PRODUCT_SALE_ELEMENTS_REF, TITLE, CHAPO, DESCRIPTION, POSTSCRIPTUM, QUANTITY, PRICE, PROMO_PRICE, WAS_NEW, WAS_IN_PROMO, WEIGHT, TAX_RULE_TITLE, TAX_RULE_DESCRIPTION, PARENT, CREATED_AT, UPDATED_AT FROM order_product WHERE ID = :p0';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -377,6 +409,35 @@ abstract class OrderProductQuery extends ModelCriteria
return $this->addUsingAlias(OrderProductTableMap::PRODUCT_REF, $productRef, $comparison); return $this->addUsingAlias(OrderProductTableMap::PRODUCT_REF, $productRef, $comparison);
} }
/**
* Filter the query on the product_sale_elements_ref column
*
* Example usage:
* <code>
* $query->filterByProductSaleElementsRef('fooValue'); // WHERE product_sale_elements_ref = 'fooValue'
* $query->filterByProductSaleElementsRef('%fooValue%'); // WHERE product_sale_elements_ref LIKE '%fooValue%'
* </code>
*
* @param string $productSaleElementsRef 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 ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByProductSaleElementsRef($productSaleElementsRef = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($productSaleElementsRef)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $productSaleElementsRef)) {
$productSaleElementsRef = str_replace('*', '%', $productSaleElementsRef);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF, $productSaleElementsRef, $comparison);
}
/** /**
* Filter the query on the title column * Filter the query on the title column
* *
@@ -406,6 +467,35 @@ abstract class OrderProductQuery extends ModelCriteria
return $this->addUsingAlias(OrderProductTableMap::TITLE, $title, $comparison); return $this->addUsingAlias(OrderProductTableMap::TITLE, $title, $comparison);
} }
/**
* Filter the query on the chapo column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* </code>
*
* @param string $chapo 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 ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTableMap::CHAPO, $chapo, $comparison);
}
/** /**
* Filter the query on the description column * Filter the query on the description column
* *
@@ -436,32 +526,32 @@ abstract class OrderProductQuery extends ModelCriteria
} }
/** /**
* Filter the query on the chapo column * Filter the query on the postscriptum column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
* </code> * </code>
* *
* @param string $chapo The value to use as filter. * @param string $postscriptum The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE) * Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildOrderProductQuery The current query, for fluid interface * @return ChildOrderProductQuery The current query, for fluid interface
*/ */
public function filterByChapo($chapo = null, $comparison = null) public function filterByPostscriptum($postscriptum = null, $comparison = null)
{ {
if (null === $comparison) { if (null === $comparison) {
if (is_array($chapo)) { if (is_array($postscriptum)) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) { } elseif (preg_match('/[\%\*]/', $postscriptum)) {
$chapo = str_replace('*', '%', $chapo); $postscriptum = str_replace('*', '%', $postscriptum);
$comparison = Criteria::LIKE; $comparison = Criteria::LIKE;
} }
} }
return $this->addUsingAlias(OrderProductTableMap::CHAPO, $chapo, $comparison); return $this->addUsingAlias(OrderProductTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
} }
/** /**
@@ -547,16 +637,45 @@ abstract class OrderProductQuery extends ModelCriteria
} }
/** /**
* Filter the query on the tax column * Filter the query on the promo_price column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByTax(1234); // WHERE tax = 1234 * $query->filterByPromoPrice('fooValue'); // WHERE promo_price = 'fooValue'
* $query->filterByTax(array(12, 34)); // WHERE tax IN (12, 34) * $query->filterByPromoPrice('%fooValue%'); // WHERE promo_price LIKE '%fooValue%'
* $query->filterByTax(array('min' => 12)); // WHERE tax > 12
* </code> * </code>
* *
* @param mixed $tax The value to use as filter. * @param string $promoPrice 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 ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByPromoPrice($promoPrice = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($promoPrice)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $promoPrice)) {
$promoPrice = str_replace('*', '%', $promoPrice);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTableMap::PROMO_PRICE, $promoPrice, $comparison);
}
/**
* Filter the query on the was_new column
*
* Example usage:
* <code>
* $query->filterByWasNew(1234); // WHERE was_new = 1234
* $query->filterByWasNew(array(12, 34)); // WHERE was_new IN (12, 34)
* $query->filterByWasNew(array('min' => 12)); // WHERE was_new > 12
* </code>
*
* @param mixed $wasNew The value to use as filter.
* Use scalar values for equality. * Use scalar values for equality.
* Use array values for in_array() equivalent. * Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@@ -564,16 +683,16 @@ abstract class OrderProductQuery extends ModelCriteria
* *
* @return ChildOrderProductQuery The current query, for fluid interface * @return ChildOrderProductQuery The current query, for fluid interface
*/ */
public function filterByTax($tax = null, $comparison = null) public function filterByWasNew($wasNew = null, $comparison = null)
{ {
if (is_array($tax)) { if (is_array($wasNew)) {
$useMinMax = false; $useMinMax = false;
if (isset($tax['min'])) { if (isset($wasNew['min'])) {
$this->addUsingAlias(OrderProductTableMap::TAX, $tax['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(OrderProductTableMap::WAS_NEW, $wasNew['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($tax['max'])) { if (isset($wasNew['max'])) {
$this->addUsingAlias(OrderProductTableMap::TAX, $tax['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(OrderProductTableMap::WAS_NEW, $wasNew['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -584,7 +703,135 @@ abstract class OrderProductQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(OrderProductTableMap::TAX, $tax, $comparison); return $this->addUsingAlias(OrderProductTableMap::WAS_NEW, $wasNew, $comparison);
}
/**
* Filter the query on the was_in_promo column
*
* Example usage:
* <code>
* $query->filterByWasInPromo(1234); // WHERE was_in_promo = 1234
* $query->filterByWasInPromo(array(12, 34)); // WHERE was_in_promo IN (12, 34)
* $query->filterByWasInPromo(array('min' => 12)); // WHERE was_in_promo > 12
* </code>
*
* @param mixed $wasInPromo 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 ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByWasInPromo($wasInPromo = null, $comparison = null)
{
if (is_array($wasInPromo)) {
$useMinMax = false;
if (isset($wasInPromo['min'])) {
$this->addUsingAlias(OrderProductTableMap::WAS_IN_PROMO, $wasInPromo['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($wasInPromo['max'])) {
$this->addUsingAlias(OrderProductTableMap::WAS_IN_PROMO, $wasInPromo['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderProductTableMap::WAS_IN_PROMO, $wasInPromo, $comparison);
}
/**
* Filter the query on the weight column
*
* Example usage:
* <code>
* $query->filterByWeight('fooValue'); // WHERE weight = 'fooValue'
* $query->filterByWeight('%fooValue%'); // WHERE weight LIKE '%fooValue%'
* </code>
*
* @param string $weight 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 ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByWeight($weight = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($weight)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $weight)) {
$weight = str_replace('*', '%', $weight);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTableMap::WEIGHT, $weight, $comparison);
}
/**
* Filter the query on the tax_rule_title column
*
* Example usage:
* <code>
* $query->filterByTaxRuleTitle('fooValue'); // WHERE tax_rule_title = 'fooValue'
* $query->filterByTaxRuleTitle('%fooValue%'); // WHERE tax_rule_title LIKE '%fooValue%'
* </code>
*
* @param string $taxRuleTitle 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 ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByTaxRuleTitle($taxRuleTitle = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($taxRuleTitle)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $taxRuleTitle)) {
$taxRuleTitle = str_replace('*', '%', $taxRuleTitle);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTableMap::TAX_RULE_TITLE, $taxRuleTitle, $comparison);
}
/**
* Filter the query on the tax_rule_description column
*
* Example usage:
* <code>
* $query->filterByTaxRuleDescription('fooValue'); // WHERE tax_rule_description = 'fooValue'
* $query->filterByTaxRuleDescription('%fooValue%'); // WHERE tax_rule_description LIKE '%fooValue%'
* </code>
*
* @param string $taxRuleDescription 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 ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByTaxRuleDescription($taxRuleDescription = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($taxRuleDescription)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $taxRuleDescription)) {
$taxRuleDescription = str_replace('*', '%', $taxRuleDescription);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTableMap::TAX_RULE_DESCRIPTION, $taxRuleDescription, $comparison);
} }
/** /**
@@ -790,40 +1037,40 @@ abstract class OrderProductQuery extends ModelCriteria
} }
/** /**
* Filter the query by a related \Thelia\Model\OrderFeature object * Filter the query by a related \Thelia\Model\OrderProductAttributeCombination object
* *
* @param \Thelia\Model\OrderFeature|ObjectCollection $orderFeature the related object to use as filter * @param \Thelia\Model\OrderProductAttributeCombination|ObjectCollection $orderProductAttributeCombination the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildOrderProductQuery The current query, for fluid interface * @return ChildOrderProductQuery The current query, for fluid interface
*/ */
public function filterByOrderFeature($orderFeature, $comparison = null) public function filterByOrderProductAttributeCombination($orderProductAttributeCombination, $comparison = null)
{ {
if ($orderFeature instanceof \Thelia\Model\OrderFeature) { if ($orderProductAttributeCombination instanceof \Thelia\Model\OrderProductAttributeCombination) {
return $this return $this
->addUsingAlias(OrderProductTableMap::ID, $orderFeature->getOrderProductId(), $comparison); ->addUsingAlias(OrderProductTableMap::ID, $orderProductAttributeCombination->getOrderProductId(), $comparison);
} elseif ($orderFeature instanceof ObjectCollection) { } elseif ($orderProductAttributeCombination instanceof ObjectCollection) {
return $this return $this
->useOrderFeatureQuery() ->useOrderProductAttributeCombinationQuery()
->filterByPrimaryKeys($orderFeature->getPrimaryKeys()) ->filterByPrimaryKeys($orderProductAttributeCombination->getPrimaryKeys())
->endUse(); ->endUse();
} else { } else {
throw new PropelException('filterByOrderFeature() only accepts arguments of type \Thelia\Model\OrderFeature or Collection'); throw new PropelException('filterByOrderProductAttributeCombination() only accepts arguments of type \Thelia\Model\OrderProductAttributeCombination or Collection');
} }
} }
/** /**
* Adds a JOIN clause to the query using the OrderFeature relation * Adds a JOIN clause to the query using the OrderProductAttributeCombination relation
* *
* @param string $relationAlias optional alias for the relation * @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return ChildOrderProductQuery The current query, for fluid interface * @return ChildOrderProductQuery The current query, for fluid interface
*/ */
public function joinOrderFeature($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function joinOrderProductAttributeCombination($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('OrderFeature'); $relationMap = $tableMap->getRelation('OrderProductAttributeCombination');
// create a ModelJoin object for this join // create a ModelJoin object for this join
$join = new ModelJoin(); $join = new ModelJoin();
@@ -838,14 +1085,14 @@ abstract class OrderProductQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias); $this->addJoinObject($join, $relationAlias);
} else { } else {
$this->addJoinObject($join, 'OrderFeature'); $this->addJoinObject($join, 'OrderProductAttributeCombination');
} }
return $this; return $this;
} }
/** /**
* Use the OrderFeature relation OrderFeature object * Use the OrderProductAttributeCombination relation OrderProductAttributeCombination object
* *
* @see useQuery() * @see useQuery()
* *
@@ -853,13 +1100,86 @@ abstract class OrderProductQuery extends ModelCriteria
* to be used as main alias in the secondary query * to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return \Thelia\Model\OrderFeatureQuery A secondary query class using the current class as primary query * @return \Thelia\Model\OrderProductAttributeCombinationQuery A secondary query class using the current class as primary query
*/ */
public function useOrderFeatureQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function useOrderProductAttributeCombinationQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinOrderFeature($relationAlias, $joinType) ->joinOrderProductAttributeCombination($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderFeature', '\Thelia\Model\OrderFeatureQuery'); ->useQuery($relationAlias ? $relationAlias : 'OrderProductAttributeCombination', '\Thelia\Model\OrderProductAttributeCombinationQuery');
}
/**
* Filter the query by a related \Thelia\Model\OrderProductTax object
*
* @param \Thelia\Model\OrderProductTax|ObjectCollection $orderProductTax the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderProductQuery The current query, for fluid interface
*/
public function filterByOrderProductTax($orderProductTax, $comparison = null)
{
if ($orderProductTax instanceof \Thelia\Model\OrderProductTax) {
return $this
->addUsingAlias(OrderProductTableMap::ID, $orderProductTax->getOrderProductId(), $comparison);
} elseif ($orderProductTax instanceof ObjectCollection) {
return $this
->useOrderProductTaxQuery()
->filterByPrimaryKeys($orderProductTax->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByOrderProductTax() only accepts arguments of type \Thelia\Model\OrderProductTax or Collection');
}
}
/**
* Adds a JOIN clause to the query using the OrderProductTax relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildOrderProductQuery The current query, for fluid interface
*/
public function joinOrderProductTax($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('OrderProductTax');
// 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, 'OrderProductTax');
}
return $this;
}
/**
* Use the OrderProductTax relation OrderProductTax 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\OrderProductTaxQuery A secondary query class using the current class as primary query
*/
public function useOrderProductTaxQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinOrderProductTax($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderProductTax', '\Thelia\Model\OrderProductTaxQuery');
} }
/** /**

View File

@@ -16,20 +16,18 @@ use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\TableMap; use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime; use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\Category as ChildCategory; use Thelia\Model\OrderProduct as ChildOrderProduct;
use Thelia\Model\CategoryQuery as ChildCategoryQuery; use Thelia\Model\OrderProductQuery as ChildOrderProductQuery;
use Thelia\Model\Feature as ChildFeature; use Thelia\Model\OrderProductTax as ChildOrderProductTax;
use Thelia\Model\FeatureCategory as ChildFeatureCategory; use Thelia\Model\OrderProductTaxQuery as ChildOrderProductTaxQuery;
use Thelia\Model\FeatureCategoryQuery as ChildFeatureCategoryQuery; use Thelia\Model\Map\OrderProductTaxTableMap;
use Thelia\Model\FeatureQuery as ChildFeatureQuery;
use Thelia\Model\Map\FeatureCategoryTableMap;
abstract class FeatureCategory implements ActiveRecordInterface abstract class OrderProductTax implements ActiveRecordInterface
{ {
/** /**
* TableMap class name * TableMap class name
*/ */
const TABLE_MAP = '\\Thelia\\Model\\Map\\FeatureCategoryTableMap'; const TABLE_MAP = '\\Thelia\\Model\\Map\\OrderProductTaxTableMap';
/** /**
@@ -65,16 +63,28 @@ abstract class FeatureCategory implements ActiveRecordInterface
protected $id; protected $id;
/** /**
* The value for the feature_id field. * The value for the order_product_id field.
* @var int * @var int
*/ */
protected $feature_id; protected $order_product_id;
/** /**
* The value for the category_id field. * The value for the title field.
* @var int * @var string
*/ */
protected $category_id; protected $title;
/**
* The value for the description field.
* @var string
*/
protected $description;
/**
* The value for the amount field.
* @var double
*/
protected $amount;
/** /**
* The value for the created_at field. * The value for the created_at field.
@@ -89,14 +99,9 @@ abstract class FeatureCategory implements ActiveRecordInterface
protected $updated_at; protected $updated_at;
/** /**
* @var Category * @var OrderProduct
*/ */
protected $aCategory; protected $aOrderProduct;
/**
* @var Feature
*/
protected $aFeature;
/** /**
* Flag to prevent endless save loop, if this object is referenced * Flag to prevent endless save loop, if this object is referenced
@@ -107,7 +112,7 @@ abstract class FeatureCategory implements ActiveRecordInterface
protected $alreadyInSave = false; protected $alreadyInSave = false;
/** /**
* Initializes internal state of Thelia\Model\Base\FeatureCategory object. * Initializes internal state of Thelia\Model\Base\OrderProductTax object.
*/ */
public function __construct() public function __construct()
{ {
@@ -202,9 +207,9 @@ abstract class FeatureCategory implements ActiveRecordInterface
} }
/** /**
* Compares this with another <code>FeatureCategory</code> instance. If * Compares this with another <code>OrderProductTax</code> instance. If
* <code>obj</code> is an instance of <code>FeatureCategory</code>, delegates to * <code>obj</code> is an instance of <code>OrderProductTax</code>, delegates to
* <code>equals(FeatureCategory)</code>. Otherwise, returns <code>false</code>. * <code>equals(OrderProductTax)</code>. Otherwise, returns <code>false</code>.
* *
* @param obj The object to compare to. * @param obj The object to compare to.
* @return Whether equal to the object specified. * @return Whether equal to the object specified.
@@ -285,7 +290,7 @@ abstract class FeatureCategory implements ActiveRecordInterface
* @param string $name The virtual column name * @param string $name The virtual column name
* @param mixed $value The value to give to the virtual column * @param mixed $value The value to give to the virtual column
* *
* @return FeatureCategory The current object, for fluid interface * @return OrderProductTax The current object, for fluid interface
*/ */
public function setVirtualColumn($name, $value) public function setVirtualColumn($name, $value)
{ {
@@ -317,7 +322,7 @@ abstract class FeatureCategory implements ActiveRecordInterface
* or a format name ('XML', 'YAML', 'JSON', 'CSV') * or a format name ('XML', 'YAML', 'JSON', 'CSV')
* @param string $data The source data to import from * @param string $data The source data to import from
* *
* @return FeatureCategory The current object, for fluid interface * @return OrderProductTax The current object, for fluid interface
*/ */
public function importFrom($parser, $data) public function importFrom($parser, $data)
{ {
@@ -372,25 +377,47 @@ abstract class FeatureCategory implements ActiveRecordInterface
} }
/** /**
* Get the [feature_id] column value. * Get the [order_product_id] column value.
* *
* @return int * @return int
*/ */
public function getFeatureId() public function getOrderProductId()
{ {
return $this->feature_id; return $this->order_product_id;
} }
/** /**
* Get the [category_id] column value. * Get the [title] column value.
* *
* @return int * @return string
*/ */
public function getCategoryId() public function getTitle()
{ {
return $this->category_id; return $this->title;
}
/**
* Get the [description] column value.
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Get the [amount] column value.
*
* @return double
*/
public function getAmount()
{
return $this->amount;
} }
/** /**
@@ -437,7 +464,7 @@ abstract class FeatureCategory implements ActiveRecordInterface
* Set the value of [id] column. * Set the value of [id] column.
* *
* @param int $v new value * @param int $v new value
* @return \Thelia\Model\FeatureCategory The current object (for fluent API support) * @return \Thelia\Model\OrderProductTax The current object (for fluent API support)
*/ */
public function setId($v) public function setId($v)
{ {
@@ -447,7 +474,7 @@ abstract class FeatureCategory implements ActiveRecordInterface
if ($this->id !== $v) { if ($this->id !== $v) {
$this->id = $v; $this->id = $v;
$this->modifiedColumns[] = FeatureCategoryTableMap::ID; $this->modifiedColumns[] = OrderProductTaxTableMap::ID;
} }
@@ -455,61 +482,99 @@ abstract class FeatureCategory implements ActiveRecordInterface
} // setId() } // setId()
/** /**
* Set the value of [feature_id] column. * Set the value of [order_product_id] column.
* *
* @param int $v new value * @param int $v new value
* @return \Thelia\Model\FeatureCategory The current object (for fluent API support) * @return \Thelia\Model\OrderProductTax The current object (for fluent API support)
*/ */
public function setFeatureId($v) public function setOrderProductId($v)
{ {
if ($v !== null) { if ($v !== null) {
$v = (int) $v; $v = (int) $v;
} }
if ($this->feature_id !== $v) { if ($this->order_product_id !== $v) {
$this->feature_id = $v; $this->order_product_id = $v;
$this->modifiedColumns[] = FeatureCategoryTableMap::FEATURE_ID; $this->modifiedColumns[] = OrderProductTaxTableMap::ORDER_PRODUCT_ID;
} }
if ($this->aFeature !== null && $this->aFeature->getId() !== $v) { if ($this->aOrderProduct !== null && $this->aOrderProduct->getId() !== $v) {
$this->aFeature = null; $this->aOrderProduct = null;
} }
return $this; return $this;
} // setFeatureId() } // setOrderProductId()
/** /**
* Set the value of [category_id] column. * Set the value of [title] column.
* *
* @param int $v new value * @param string $v new value
* @return \Thelia\Model\FeatureCategory The current object (for fluent API support) * @return \Thelia\Model\OrderProductTax The current object (for fluent API support)
*/ */
public function setCategoryId($v) public function setTitle($v)
{ {
if ($v !== null) { if ($v !== null) {
$v = (int) $v; $v = (string) $v;
} }
if ($this->category_id !== $v) { if ($this->title !== $v) {
$this->category_id = $v; $this->title = $v;
$this->modifiedColumns[] = FeatureCategoryTableMap::CATEGORY_ID; $this->modifiedColumns[] = OrderProductTaxTableMap::TITLE;
}
if ($this->aCategory !== null && $this->aCategory->getId() !== $v) {
$this->aCategory = null;
} }
return $this; return $this;
} // setCategoryId() } // setTitle()
/**
* Set the value of [description] column.
*
* @param string $v new value
* @return \Thelia\Model\OrderProductTax The current object (for fluent API support)
*/
public function setDescription($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->description !== $v) {
$this->description = $v;
$this->modifiedColumns[] = OrderProductTaxTableMap::DESCRIPTION;
}
return $this;
} // setDescription()
/**
* Set the value of [amount] column.
*
* @param double $v new value
* @return \Thelia\Model\OrderProductTax The current object (for fluent API support)
*/
public function setAmount($v)
{
if ($v !== null) {
$v = (double) $v;
}
if ($this->amount !== $v) {
$this->amount = $v;
$this->modifiedColumns[] = OrderProductTaxTableMap::AMOUNT;
}
return $this;
} // setAmount()
/** /**
* Sets the value of [created_at] column to a normalized version of the date/time value specified. * Sets the value of [created_at] column to a normalized version of the date/time value specified.
* *
* @param mixed $v string, integer (timestamp), or \DateTime value. * @param mixed $v string, integer (timestamp), or \DateTime value.
* Empty strings are treated as NULL. * Empty strings are treated as NULL.
* @return \Thelia\Model\FeatureCategory The current object (for fluent API support) * @return \Thelia\Model\OrderProductTax The current object (for fluent API support)
*/ */
public function setCreatedAt($v) public function setCreatedAt($v)
{ {
@@ -517,7 +582,7 @@ abstract class FeatureCategory implements ActiveRecordInterface
if ($this->created_at !== null || $dt !== null) { if ($this->created_at !== null || $dt !== null) {
if ($dt !== $this->created_at) { if ($dt !== $this->created_at) {
$this->created_at = $dt; $this->created_at = $dt;
$this->modifiedColumns[] = FeatureCategoryTableMap::CREATED_AT; $this->modifiedColumns[] = OrderProductTaxTableMap::CREATED_AT;
} }
} // if either are not null } // if either are not null
@@ -530,7 +595,7 @@ abstract class FeatureCategory implements ActiveRecordInterface
* *
* @param mixed $v string, integer (timestamp), or \DateTime value. * @param mixed $v string, integer (timestamp), or \DateTime value.
* Empty strings are treated as NULL. * Empty strings are treated as NULL.
* @return \Thelia\Model\FeatureCategory The current object (for fluent API support) * @return \Thelia\Model\OrderProductTax The current object (for fluent API support)
*/ */
public function setUpdatedAt($v) public function setUpdatedAt($v)
{ {
@@ -538,7 +603,7 @@ abstract class FeatureCategory implements ActiveRecordInterface
if ($this->updated_at !== null || $dt !== null) { if ($this->updated_at !== null || $dt !== null) {
if ($dt !== $this->updated_at) { if ($dt !== $this->updated_at) {
$this->updated_at = $dt; $this->updated_at = $dt;
$this->modifiedColumns[] = FeatureCategoryTableMap::UPDATED_AT; $this->modifiedColumns[] = OrderProductTaxTableMap::UPDATED_AT;
} }
} // if either are not null } // if either are not null
@@ -583,22 +648,28 @@ abstract class FeatureCategory implements ActiveRecordInterface
try { try {
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : FeatureCategoryTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : OrderProductTaxTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
$this->id = (null !== $col) ? (int) $col : null; $this->id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : FeatureCategoryTableMap::translateFieldName('FeatureId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : OrderProductTaxTableMap::translateFieldName('OrderProductId', TableMap::TYPE_PHPNAME, $indexType)];
$this->feature_id = (null !== $col) ? (int) $col : null; $this->order_product_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : FeatureCategoryTableMap::translateFieldName('CategoryId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : OrderProductTaxTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)];
$this->category_id = (null !== $col) ? (int) $col : null; $this->title = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : FeatureCategoryTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : OrderProductTaxTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)];
$this->description = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : OrderProductTaxTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)];
$this->amount = (null !== $col) ? (double) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : OrderProductTaxTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : FeatureCategoryTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : OrderProductTaxTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
@@ -611,10 +682,10 @@ abstract class FeatureCategory implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 5; // 5 = FeatureCategoryTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 7; // 7 = OrderProductTaxTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\FeatureCategory object", 0, $e); throw new PropelException("Error populating \Thelia\Model\OrderProductTax object", 0, $e);
} }
} }
@@ -633,11 +704,8 @@ abstract class FeatureCategory implements ActiveRecordInterface
*/ */
public function ensureConsistency() public function ensureConsistency()
{ {
if ($this->aFeature !== null && $this->feature_id !== $this->aFeature->getId()) { if ($this->aOrderProduct !== null && $this->order_product_id !== $this->aOrderProduct->getId()) {
$this->aFeature = null; $this->aOrderProduct = null;
}
if ($this->aCategory !== null && $this->category_id !== $this->aCategory->getId()) {
$this->aCategory = null;
} }
} // ensureConsistency } // ensureConsistency
@@ -662,13 +730,13 @@ abstract class FeatureCategory implements ActiveRecordInterface
} }
if ($con === null) { if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(FeatureCategoryTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getReadConnection(OrderProductTaxTableMap::DATABASE_NAME);
} }
// We don't need to alter the object instance pool; we're just modifying this instance // We don't need to alter the object instance pool; we're just modifying this instance
// already in the pool. // already in the pool.
$dataFetcher = ChildFeatureCategoryQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); $dataFetcher = ChildOrderProductTaxQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
$row = $dataFetcher->fetch(); $row = $dataFetcher->fetch();
$dataFetcher->close(); $dataFetcher->close();
if (!$row) { if (!$row) {
@@ -678,8 +746,7 @@ abstract class FeatureCategory implements ActiveRecordInterface
if ($deep) { // also de-associate any related objects? if ($deep) { // also de-associate any related objects?
$this->aCategory = null; $this->aOrderProduct = null;
$this->aFeature = null;
} // if (deep) } // if (deep)
} }
@@ -689,8 +756,8 @@ abstract class FeatureCategory implements ActiveRecordInterface
* @param ConnectionInterface $con * @param ConnectionInterface $con
* @return void * @return void
* @throws PropelException * @throws PropelException
* @see FeatureCategory::setDeleted() * @see OrderProductTax::setDeleted()
* @see FeatureCategory::isDeleted() * @see OrderProductTax::isDeleted()
*/ */
public function delete(ConnectionInterface $con = null) public function delete(ConnectionInterface $con = null)
{ {
@@ -699,12 +766,12 @@ abstract class FeatureCategory implements ActiveRecordInterface
} }
if ($con === null) { if ($con === null) {
$con = Propel::getServiceContainer()->getWriteConnection(FeatureCategoryTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getWriteConnection(OrderProductTaxTableMap::DATABASE_NAME);
} }
$con->beginTransaction(); $con->beginTransaction();
try { try {
$deleteQuery = ChildFeatureCategoryQuery::create() $deleteQuery = ChildOrderProductTaxQuery::create()
->filterByPrimaryKey($this->getPrimaryKey()); ->filterByPrimaryKey($this->getPrimaryKey());
$ret = $this->preDelete($con); $ret = $this->preDelete($con);
if ($ret) { if ($ret) {
@@ -741,7 +808,7 @@ abstract class FeatureCategory implements ActiveRecordInterface
} }
if ($con === null) { if ($con === null) {
$con = Propel::getServiceContainer()->getWriteConnection(FeatureCategoryTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getWriteConnection(OrderProductTaxTableMap::DATABASE_NAME);
} }
$con->beginTransaction(); $con->beginTransaction();
@@ -751,16 +818,16 @@ abstract class FeatureCategory implements ActiveRecordInterface
if ($isInsert) { if ($isInsert) {
$ret = $ret && $this->preInsert($con); $ret = $ret && $this->preInsert($con);
// timestampable behavior // timestampable behavior
if (!$this->isColumnModified(FeatureCategoryTableMap::CREATED_AT)) { if (!$this->isColumnModified(OrderProductTaxTableMap::CREATED_AT)) {
$this->setCreatedAt(time()); $this->setCreatedAt(time());
} }
if (!$this->isColumnModified(FeatureCategoryTableMap::UPDATED_AT)) { if (!$this->isColumnModified(OrderProductTaxTableMap::UPDATED_AT)) {
$this->setUpdatedAt(time()); $this->setUpdatedAt(time());
} }
} else { } else {
$ret = $ret && $this->preUpdate($con); $ret = $ret && $this->preUpdate($con);
// timestampable behavior // timestampable behavior
if ($this->isModified() && !$this->isColumnModified(FeatureCategoryTableMap::UPDATED_AT)) { if ($this->isModified() && !$this->isColumnModified(OrderProductTaxTableMap::UPDATED_AT)) {
$this->setUpdatedAt(time()); $this->setUpdatedAt(time());
} }
} }
@@ -772,7 +839,7 @@ abstract class FeatureCategory implements ActiveRecordInterface
$this->postUpdate($con); $this->postUpdate($con);
} }
$this->postSave($con); $this->postSave($con);
FeatureCategoryTableMap::addInstanceToPool($this); OrderProductTaxTableMap::addInstanceToPool($this);
} else { } else {
$affectedRows = 0; $affectedRows = 0;
} }
@@ -807,18 +874,11 @@ abstract class FeatureCategory implements ActiveRecordInterface
// method. This object relates to these object(s) by a // method. This object relates to these object(s) by a
// foreign key reference. // foreign key reference.
if ($this->aCategory !== null) { if ($this->aOrderProduct !== null) {
if ($this->aCategory->isModified() || $this->aCategory->isNew()) { if ($this->aOrderProduct->isModified() || $this->aOrderProduct->isNew()) {
$affectedRows += $this->aCategory->save($con); $affectedRows += $this->aOrderProduct->save($con);
} }
$this->setCategory($this->aCategory); $this->setOrderProduct($this->aOrderProduct);
}
if ($this->aFeature !== null) {
if ($this->aFeature->isModified() || $this->aFeature->isNew()) {
$affectedRows += $this->aFeature->save($con);
}
$this->setFeature($this->aFeature);
} }
if ($this->isNew() || $this->isModified()) { if ($this->isNew() || $this->isModified()) {
@@ -852,30 +912,36 @@ abstract class FeatureCategory implements ActiveRecordInterface
$modifiedColumns = array(); $modifiedColumns = array();
$index = 0; $index = 0;
$this->modifiedColumns[] = FeatureCategoryTableMap::ID; $this->modifiedColumns[] = OrderProductTaxTableMap::ID;
if (null !== $this->id) { if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . FeatureCategoryTableMap::ID . ')'); throw new PropelException('Cannot insert a value for auto-increment primary key (' . OrderProductTaxTableMap::ID . ')');
} }
// check the columns in natural order for more readable SQL queries // check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(FeatureCategoryTableMap::ID)) { if ($this->isColumnModified(OrderProductTaxTableMap::ID)) {
$modifiedColumns[':p' . $index++] = 'ID'; $modifiedColumns[':p' . $index++] = 'ID';
} }
if ($this->isColumnModified(FeatureCategoryTableMap::FEATURE_ID)) { if ($this->isColumnModified(OrderProductTaxTableMap::ORDER_PRODUCT_ID)) {
$modifiedColumns[':p' . $index++] = 'FEATURE_ID'; $modifiedColumns[':p' . $index++] = 'ORDER_PRODUCT_ID';
} }
if ($this->isColumnModified(FeatureCategoryTableMap::CATEGORY_ID)) { if ($this->isColumnModified(OrderProductTaxTableMap::TITLE)) {
$modifiedColumns[':p' . $index++] = 'CATEGORY_ID'; $modifiedColumns[':p' . $index++] = 'TITLE';
} }
if ($this->isColumnModified(FeatureCategoryTableMap::CREATED_AT)) { if ($this->isColumnModified(OrderProductTaxTableMap::DESCRIPTION)) {
$modifiedColumns[':p' . $index++] = 'DESCRIPTION';
}
if ($this->isColumnModified(OrderProductTaxTableMap::AMOUNT)) {
$modifiedColumns[':p' . $index++] = 'AMOUNT';
}
if ($this->isColumnModified(OrderProductTaxTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT'; $modifiedColumns[':p' . $index++] = 'CREATED_AT';
} }
if ($this->isColumnModified(FeatureCategoryTableMap::UPDATED_AT)) { if ($this->isColumnModified(OrderProductTaxTableMap::UPDATED_AT)) {
$modifiedColumns[':p' . $index++] = 'UPDATED_AT'; $modifiedColumns[':p' . $index++] = 'UPDATED_AT';
} }
$sql = sprintf( $sql = sprintf(
'INSERT INTO feature_category (%s) VALUES (%s)', 'INSERT INTO order_product_tax (%s) VALUES (%s)',
implode(', ', $modifiedColumns), implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns)) implode(', ', array_keys($modifiedColumns))
); );
@@ -887,11 +953,17 @@ abstract class FeatureCategory implements ActiveRecordInterface
case 'ID': case 'ID':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break; break;
case 'FEATURE_ID': case 'ORDER_PRODUCT_ID':
$stmt->bindValue($identifier, $this->feature_id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->order_product_id, PDO::PARAM_INT);
break; break;
case 'CATEGORY_ID': case 'TITLE':
$stmt->bindValue($identifier, $this->category_id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
break;
case 'DESCRIPTION':
$stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
break;
case 'AMOUNT':
$stmt->bindValue($identifier, $this->amount, PDO::PARAM_STR);
break; break;
case 'CREATED_AT': case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
@@ -945,7 +1017,7 @@ abstract class FeatureCategory implements ActiveRecordInterface
*/ */
public function getByName($name, $type = TableMap::TYPE_PHPNAME) public function getByName($name, $type = TableMap::TYPE_PHPNAME)
{ {
$pos = FeatureCategoryTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $pos = OrderProductTaxTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
$field = $this->getByPosition($pos); $field = $this->getByPosition($pos);
return $field; return $field;
@@ -965,15 +1037,21 @@ abstract class FeatureCategory implements ActiveRecordInterface
return $this->getId(); return $this->getId();
break; break;
case 1: case 1:
return $this->getFeatureId(); return $this->getOrderProductId();
break; break;
case 2: case 2:
return $this->getCategoryId(); return $this->getTitle();
break; break;
case 3: case 3:
return $this->getCreatedAt(); return $this->getDescription();
break; break;
case 4: case 4:
return $this->getAmount();
break;
case 5:
return $this->getCreatedAt();
break;
case 6:
return $this->getUpdatedAt(); return $this->getUpdatedAt();
break; break;
default: default:
@@ -999,17 +1077,19 @@ abstract class FeatureCategory implements ActiveRecordInterface
*/ */
public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{ {
if (isset($alreadyDumpedObjects['FeatureCategory'][$this->getPrimaryKey()])) { if (isset($alreadyDumpedObjects['OrderProductTax'][$this->getPrimaryKey()])) {
return '*RECURSION*'; return '*RECURSION*';
} }
$alreadyDumpedObjects['FeatureCategory'][$this->getPrimaryKey()] = true; $alreadyDumpedObjects['OrderProductTax'][$this->getPrimaryKey()] = true;
$keys = FeatureCategoryTableMap::getFieldNames($keyType); $keys = OrderProductTaxTableMap::getFieldNames($keyType);
$result = array( $result = array(
$keys[0] => $this->getId(), $keys[0] => $this->getId(),
$keys[1] => $this->getFeatureId(), $keys[1] => $this->getOrderProductId(),
$keys[2] => $this->getCategoryId(), $keys[2] => $this->getTitle(),
$keys[3] => $this->getCreatedAt(), $keys[3] => $this->getDescription(),
$keys[4] => $this->getUpdatedAt(), $keys[4] => $this->getAmount(),
$keys[5] => $this->getCreatedAt(),
$keys[6] => $this->getUpdatedAt(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn) foreach($virtualColumns as $key => $virtualColumn)
@@ -1018,11 +1098,8 @@ abstract class FeatureCategory implements ActiveRecordInterface
} }
if ($includeForeignObjects) { if ($includeForeignObjects) {
if (null !== $this->aCategory) { if (null !== $this->aOrderProduct) {
$result['Category'] = $this->aCategory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); $result['OrderProduct'] = $this->aOrderProduct->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
if (null !== $this->aFeature) {
$result['Feature'] = $this->aFeature->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
} }
} }
@@ -1042,7 +1119,7 @@ abstract class FeatureCategory implements ActiveRecordInterface
*/ */
public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
{ {
$pos = FeatureCategoryTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $pos = OrderProductTaxTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
return $this->setByPosition($pos, $value); return $this->setByPosition($pos, $value);
} }
@@ -1062,15 +1139,21 @@ abstract class FeatureCategory implements ActiveRecordInterface
$this->setId($value); $this->setId($value);
break; break;
case 1: case 1:
$this->setFeatureId($value); $this->setOrderProductId($value);
break; break;
case 2: case 2:
$this->setCategoryId($value); $this->setTitle($value);
break; break;
case 3: case 3:
$this->setCreatedAt($value); $this->setDescription($value);
break; break;
case 4: case 4:
$this->setAmount($value);
break;
case 5:
$this->setCreatedAt($value);
break;
case 6:
$this->setUpdatedAt($value); $this->setUpdatedAt($value);
break; break;
} // switch() } // switch()
@@ -1095,13 +1178,15 @@ abstract class FeatureCategory implements ActiveRecordInterface
*/ */
public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
{ {
$keys = FeatureCategoryTableMap::getFieldNames($keyType); $keys = OrderProductTaxTableMap::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setFeatureId($arr[$keys[1]]); if (array_key_exists($keys[1], $arr)) $this->setOrderProductId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setCategoryId($arr[$keys[2]]); if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); if (array_key_exists($keys[4], $arr)) $this->setAmount($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]]);
} }
/** /**
@@ -1111,13 +1196,15 @@ abstract class FeatureCategory implements ActiveRecordInterface
*/ */
public function buildCriteria() public function buildCriteria()
{ {
$criteria = new Criteria(FeatureCategoryTableMap::DATABASE_NAME); $criteria = new Criteria(OrderProductTaxTableMap::DATABASE_NAME);
if ($this->isColumnModified(FeatureCategoryTableMap::ID)) $criteria->add(FeatureCategoryTableMap::ID, $this->id); if ($this->isColumnModified(OrderProductTaxTableMap::ID)) $criteria->add(OrderProductTaxTableMap::ID, $this->id);
if ($this->isColumnModified(FeatureCategoryTableMap::FEATURE_ID)) $criteria->add(FeatureCategoryTableMap::FEATURE_ID, $this->feature_id); if ($this->isColumnModified(OrderProductTaxTableMap::ORDER_PRODUCT_ID)) $criteria->add(OrderProductTaxTableMap::ORDER_PRODUCT_ID, $this->order_product_id);
if ($this->isColumnModified(FeatureCategoryTableMap::CATEGORY_ID)) $criteria->add(FeatureCategoryTableMap::CATEGORY_ID, $this->category_id); if ($this->isColumnModified(OrderProductTaxTableMap::TITLE)) $criteria->add(OrderProductTaxTableMap::TITLE, $this->title);
if ($this->isColumnModified(FeatureCategoryTableMap::CREATED_AT)) $criteria->add(FeatureCategoryTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(OrderProductTaxTableMap::DESCRIPTION)) $criteria->add(OrderProductTaxTableMap::DESCRIPTION, $this->description);
if ($this->isColumnModified(FeatureCategoryTableMap::UPDATED_AT)) $criteria->add(FeatureCategoryTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(OrderProductTaxTableMap::AMOUNT)) $criteria->add(OrderProductTaxTableMap::AMOUNT, $this->amount);
if ($this->isColumnModified(OrderProductTaxTableMap::CREATED_AT)) $criteria->add(OrderProductTaxTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(OrderProductTaxTableMap::UPDATED_AT)) $criteria->add(OrderProductTaxTableMap::UPDATED_AT, $this->updated_at);
return $criteria; return $criteria;
} }
@@ -1132,8 +1219,8 @@ abstract class FeatureCategory implements ActiveRecordInterface
*/ */
public function buildPkeyCriteria() public function buildPkeyCriteria()
{ {
$criteria = new Criteria(FeatureCategoryTableMap::DATABASE_NAME); $criteria = new Criteria(OrderProductTaxTableMap::DATABASE_NAME);
$criteria->add(FeatureCategoryTableMap::ID, $this->id); $criteria->add(OrderProductTaxTableMap::ID, $this->id);
return $criteria; return $criteria;
} }
@@ -1174,15 +1261,17 @@ abstract class FeatureCategory implements ActiveRecordInterface
* If desired, this method can also make copies of all associated (fkey referrers) * If desired, this method can also make copies of all associated (fkey referrers)
* objects. * objects.
* *
* @param object $copyObj An object of \Thelia\Model\FeatureCategory (or compatible) type. * @param object $copyObj An object of \Thelia\Model\OrderProductTax (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
* @throws PropelException * @throws PropelException
*/ */
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{ {
$copyObj->setFeatureId($this->getFeatureId()); $copyObj->setOrderProductId($this->getOrderProductId());
$copyObj->setCategoryId($this->getCategoryId()); $copyObj->setTitle($this->getTitle());
$copyObj->setDescription($this->getDescription());
$copyObj->setAmount($this->getAmount());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) { if ($makeNew) {
@@ -1200,7 +1289,7 @@ abstract class FeatureCategory implements ActiveRecordInterface
* objects. * objects.
* *
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @return \Thelia\Model\FeatureCategory Clone of current object. * @return \Thelia\Model\OrderProductTax Clone of current object.
* @throws PropelException * @throws PropelException
*/ */
public function copy($deepCopy = false) public function copy($deepCopy = false)
@@ -1214,26 +1303,26 @@ abstract class FeatureCategory implements ActiveRecordInterface
} }
/** /**
* Declares an association between this object and a ChildCategory object. * Declares an association between this object and a ChildOrderProduct object.
* *
* @param ChildCategory $v * @param ChildOrderProduct $v
* @return \Thelia\Model\FeatureCategory The current object (for fluent API support) * @return \Thelia\Model\OrderProductTax The current object (for fluent API support)
* @throws PropelException * @throws PropelException
*/ */
public function setCategory(ChildCategory $v = null) public function setOrderProduct(ChildOrderProduct $v = null)
{ {
if ($v === null) { if ($v === null) {
$this->setCategoryId(NULL); $this->setOrderProductId(NULL);
} else { } else {
$this->setCategoryId($v->getId()); $this->setOrderProductId($v->getId());
} }
$this->aCategory = $v; $this->aOrderProduct = $v;
// Add binding for other direction of this n:n relationship. // Add binding for other direction of this n:n relationship.
// If this object has already been added to the ChildCategory object, it will not be re-added. // If this object has already been added to the ChildOrderProduct object, it will not be re-added.
if ($v !== null) { if ($v !== null) {
$v->addFeatureCategory($this); $v->addOrderProductTax($this);
} }
@@ -1242,77 +1331,26 @@ abstract class FeatureCategory implements ActiveRecordInterface
/** /**
* Get the associated ChildCategory object * Get the associated ChildOrderProduct object
* *
* @param ConnectionInterface $con Optional Connection object. * @param ConnectionInterface $con Optional Connection object.
* @return ChildCategory The associated ChildCategory object. * @return ChildOrderProduct The associated ChildOrderProduct object.
* @throws PropelException * @throws PropelException
*/ */
public function getCategory(ConnectionInterface $con = null) public function getOrderProduct(ConnectionInterface $con = null)
{ {
if ($this->aCategory === null && ($this->category_id !== null)) { if ($this->aOrderProduct === null && ($this->order_product_id !== null)) {
$this->aCategory = ChildCategoryQuery::create()->findPk($this->category_id, $con); $this->aOrderProduct = ChildOrderProductQuery::create()->findPk($this->order_product_id, $con);
/* The following can be used additionally to /* The following can be used additionally to
guarantee the related object contains a reference guarantee the related object contains a reference
to this object. This level of coupling may, however, be to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection undesirable since it could result in an only partially populated collection
in the referenced object. in the referenced object.
$this->aCategory->addFeatureCategories($this); $this->aOrderProduct->addOrderProductTaxes($this);
*/ */
} }
return $this->aCategory; return $this->aOrderProduct;
}
/**
* Declares an association between this object and a ChildFeature object.
*
* @param ChildFeature $v
* @return \Thelia\Model\FeatureCategory The current object (for fluent API support)
* @throws PropelException
*/
public function setFeature(ChildFeature $v = null)
{
if ($v === null) {
$this->setFeatureId(NULL);
} else {
$this->setFeatureId($v->getId());
}
$this->aFeature = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the ChildFeature object, it will not be re-added.
if ($v !== null) {
$v->addFeatureCategory($this);
}
return $this;
}
/**
* Get the associated ChildFeature object
*
* @param ConnectionInterface $con Optional Connection object.
* @return ChildFeature The associated ChildFeature object.
* @throws PropelException
*/
public function getFeature(ConnectionInterface $con = null)
{
if ($this->aFeature === null && ($this->feature_id !== null)) {
$this->aFeature = ChildFeatureQuery::create()->findPk($this->feature_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->aFeature->addFeatureCategories($this);
*/
}
return $this->aFeature;
} }
/** /**
@@ -1321,8 +1359,10 @@ abstract class FeatureCategory implements ActiveRecordInterface
public function clear() public function clear()
{ {
$this->id = null; $this->id = null;
$this->feature_id = null; $this->order_product_id = null;
$this->category_id = null; $this->title = null;
$this->description = null;
$this->amount = null;
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
@@ -1346,8 +1386,7 @@ abstract class FeatureCategory implements ActiveRecordInterface
if ($deep) { if ($deep) {
} // if ($deep) } // if ($deep)
$this->aCategory = null; $this->aOrderProduct = null;
$this->aFeature = null;
} }
/** /**
@@ -1357,7 +1396,7 @@ abstract class FeatureCategory implements ActiveRecordInterface
*/ */
public function __toString() public function __toString()
{ {
return (string) $this->exportTo(FeatureCategoryTableMap::DEFAULT_STRING_FORMAT); return (string) $this->exportTo(OrderProductTaxTableMap::DEFAULT_STRING_FORMAT);
} }
// timestampable behavior // timestampable behavior
@@ -1365,11 +1404,11 @@ abstract class FeatureCategory implements ActiveRecordInterface
/** /**
* Mark the current object so that the update date doesn't get updated during next save * Mark the current object so that the update date doesn't get updated during next save
* *
* @return ChildFeatureCategory The current object (for fluent API support) * @return ChildOrderProductTax The current object (for fluent API support)
*/ */
public function keepUpdateDateUnchanged() public function keepUpdateDateUnchanged()
{ {
$this->modifiedColumns[] = FeatureCategoryTableMap::UPDATED_AT; $this->modifiedColumns[] = OrderProductTaxTableMap::UPDATED_AT;
return $this; return $this;
} }

View File

@@ -12,84 +12,88 @@ use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Exception\PropelException;
use Thelia\Model\FeatureCategory as ChildFeatureCategory; use Thelia\Model\OrderProductTax as ChildOrderProductTax;
use Thelia\Model\FeatureCategoryQuery as ChildFeatureCategoryQuery; use Thelia\Model\OrderProductTaxQuery as ChildOrderProductTaxQuery;
use Thelia\Model\Map\FeatureCategoryTableMap; use Thelia\Model\Map\OrderProductTaxTableMap;
/** /**
* Base class that represents a query for the 'feature_category' table. * Base class that represents a query for the 'order_product_tax' table.
* *
* *
* *
* @method ChildFeatureCategoryQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildOrderProductTaxQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildFeatureCategoryQuery orderByFeatureId($order = Criteria::ASC) Order by the feature_id column * @method ChildOrderProductTaxQuery orderByOrderProductId($order = Criteria::ASC) Order by the order_product_id column
* @method ChildFeatureCategoryQuery orderByCategoryId($order = Criteria::ASC) Order by the category_id column * @method ChildOrderProductTaxQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildFeatureCategoryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildOrderProductTaxQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildFeatureCategoryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildOrderProductTaxQuery orderByAmount($order = Criteria::ASC) Order by the amount column
* @method ChildOrderProductTaxQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildOrderProductTaxQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* *
* @method ChildFeatureCategoryQuery groupById() Group by the id column * @method ChildOrderProductTaxQuery groupById() Group by the id column
* @method ChildFeatureCategoryQuery groupByFeatureId() Group by the feature_id column * @method ChildOrderProductTaxQuery groupByOrderProductId() Group by the order_product_id column
* @method ChildFeatureCategoryQuery groupByCategoryId() Group by the category_id column * @method ChildOrderProductTaxQuery groupByTitle() Group by the title column
* @method ChildFeatureCategoryQuery groupByCreatedAt() Group by the created_at column * @method ChildOrderProductTaxQuery groupByDescription() Group by the description column
* @method ChildFeatureCategoryQuery groupByUpdatedAt() Group by the updated_at column * @method ChildOrderProductTaxQuery groupByAmount() Group by the amount column
* @method ChildOrderProductTaxQuery groupByCreatedAt() Group by the created_at column
* @method ChildOrderProductTaxQuery groupByUpdatedAt() Group by the updated_at column
* *
* @method ChildFeatureCategoryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildOrderProductTaxQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildFeatureCategoryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildOrderProductTaxQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildFeatureCategoryQuery innerJoin($relation) Adds a INNER JOIN clause to the query * @method ChildOrderProductTaxQuery innerJoin($relation) Adds a INNER JOIN clause to the query
* *
* @method ChildFeatureCategoryQuery leftJoinCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the Category relation * @method ChildOrderProductTaxQuery leftJoinOrderProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderProduct relation
* @method ChildFeatureCategoryQuery rightJoinCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Category relation * @method ChildOrderProductTaxQuery rightJoinOrderProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProduct relation
* @method ChildFeatureCategoryQuery innerJoinCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the Category relation * @method ChildOrderProductTaxQuery innerJoinOrderProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProduct relation
* *
* @method ChildFeatureCategoryQuery leftJoinFeature($relationAlias = null) Adds a LEFT JOIN clause to the query using the Feature relation * @method ChildOrderProductTax findOne(ConnectionInterface $con = null) Return the first ChildOrderProductTax matching the query
* @method ChildFeatureCategoryQuery rightJoinFeature($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Feature relation * @method ChildOrderProductTax findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderProductTax matching the query, or a new ChildOrderProductTax object populated from the query conditions when no match is found
* @method ChildFeatureCategoryQuery innerJoinFeature($relationAlias = null) Adds a INNER JOIN clause to the query using the Feature relation
* *
* @method ChildFeatureCategory findOne(ConnectionInterface $con = null) Return the first ChildFeatureCategory matching the query * @method ChildOrderProductTax findOneById(int $id) Return the first ChildOrderProductTax filtered by the id column
* @method ChildFeatureCategory findOneOrCreate(ConnectionInterface $con = null) Return the first ChildFeatureCategory matching the query, or a new ChildFeatureCategory object populated from the query conditions when no match is found * @method ChildOrderProductTax findOneByOrderProductId(int $order_product_id) Return the first ChildOrderProductTax filtered by the order_product_id column
* @method ChildOrderProductTax findOneByTitle(string $title) Return the first ChildOrderProductTax filtered by the title column
* @method ChildOrderProductTax findOneByDescription(string $description) Return the first ChildOrderProductTax filtered by the description column
* @method ChildOrderProductTax findOneByAmount(double $amount) Return the first ChildOrderProductTax filtered by the amount column
* @method ChildOrderProductTax findOneByCreatedAt(string $created_at) Return the first ChildOrderProductTax filtered by the created_at column
* @method ChildOrderProductTax findOneByUpdatedAt(string $updated_at) Return the first ChildOrderProductTax filtered by the updated_at column
* *
* @method ChildFeatureCategory findOneById(int $id) Return the first ChildFeatureCategory filtered by the id column * @method array findById(int $id) Return ChildOrderProductTax objects filtered by the id column
* @method ChildFeatureCategory findOneByFeatureId(int $feature_id) Return the first ChildFeatureCategory filtered by the feature_id column * @method array findByOrderProductId(int $order_product_id) Return ChildOrderProductTax objects filtered by the order_product_id column
* @method ChildFeatureCategory findOneByCategoryId(int $category_id) Return the first ChildFeatureCategory filtered by the category_id column * @method array findByTitle(string $title) Return ChildOrderProductTax objects filtered by the title column
* @method ChildFeatureCategory findOneByCreatedAt(string $created_at) Return the first ChildFeatureCategory filtered by the created_at column * @method array findByDescription(string $description) Return ChildOrderProductTax objects filtered by the description column
* @method ChildFeatureCategory findOneByUpdatedAt(string $updated_at) Return the first ChildFeatureCategory filtered by the updated_at column * @method array findByAmount(double $amount) Return ChildOrderProductTax objects filtered by the amount column
* * @method array findByCreatedAt(string $created_at) Return ChildOrderProductTax objects filtered by the created_at column
* @method array findById(int $id) Return ChildFeatureCategory objects filtered by the id column * @method array findByUpdatedAt(string $updated_at) Return ChildOrderProductTax objects filtered by the updated_at column
* @method array findByFeatureId(int $feature_id) Return ChildFeatureCategory objects filtered by the feature_id column
* @method array findByCategoryId(int $category_id) Return ChildFeatureCategory objects filtered by the category_id column
* @method array findByCreatedAt(string $created_at) Return ChildFeatureCategory objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildFeatureCategory objects filtered by the updated_at column
* *
*/ */
abstract class FeatureCategoryQuery extends ModelCriteria abstract class OrderProductTaxQuery extends ModelCriteria
{ {
/** /**
* Initializes internal state of \Thelia\Model\Base\FeatureCategoryQuery object. * Initializes internal state of \Thelia\Model\Base\OrderProductTaxQuery object.
* *
* @param string $dbName The database name * @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book' * @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' * @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/ */
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\FeatureCategory', $modelAlias = null) public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\OrderProductTax', $modelAlias = null)
{ {
parent::__construct($dbName, $modelName, $modelAlias); parent::__construct($dbName, $modelName, $modelAlias);
} }
/** /**
* Returns a new ChildFeatureCategoryQuery object. * Returns a new ChildOrderProductTaxQuery object.
* *
* @param string $modelAlias The alias of a model in the query * @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from * @param Criteria $criteria Optional Criteria to build the query from
* *
* @return ChildFeatureCategoryQuery * @return ChildOrderProductTaxQuery
*/ */
public static function create($modelAlias = null, $criteria = null) public static function create($modelAlias = null, $criteria = null)
{ {
if ($criteria instanceof \Thelia\Model\FeatureCategoryQuery) { if ($criteria instanceof \Thelia\Model\OrderProductTaxQuery) {
return $criteria; return $criteria;
} }
$query = new \Thelia\Model\FeatureCategoryQuery(); $query = new \Thelia\Model\OrderProductTaxQuery();
if (null !== $modelAlias) { if (null !== $modelAlias) {
$query->setModelAlias($modelAlias); $query->setModelAlias($modelAlias);
} }
@@ -112,19 +116,19 @@ abstract class FeatureCategoryQuery extends ModelCriteria
* @param mixed $key Primary key to use for the query * @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object * @param ConnectionInterface $con an optional connection object
* *
* @return ChildFeatureCategory|array|mixed the result, formatted by the current formatter * @return ChildOrderProductTax|array|mixed the result, formatted by the current formatter
*/ */
public function findPk($key, $con = null) public function findPk($key, $con = null)
{ {
if ($key === null) { if ($key === null) {
return null; return null;
} }
if ((null !== ($obj = FeatureCategoryTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { if ((null !== ($obj = OrderProductTaxTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool // the object is already in the instance pool
return $obj; return $obj;
} }
if ($con === null) { if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(FeatureCategoryTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getReadConnection(OrderProductTaxTableMap::DATABASE_NAME);
} }
$this->basePreSelect($con); $this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select if ($this->formatter || $this->modelAlias || $this->with || $this->select
@@ -143,11 +147,11 @@ abstract class FeatureCategoryQuery extends ModelCriteria
* @param mixed $key Primary key to use for the query * @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object * @param ConnectionInterface $con A connection object
* *
* @return ChildFeatureCategory A model object, or null if the key is not found * @return ChildOrderProductTax A model object, or null if the key is not found
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, FEATURE_ID, CATEGORY_ID, CREATED_AT, UPDATED_AT FROM feature_category WHERE ID = :p0'; $sql = 'SELECT ID, ORDER_PRODUCT_ID, TITLE, DESCRIPTION, AMOUNT, CREATED_AT, UPDATED_AT FROM order_product_tax WHERE ID = :p0';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -158,9 +162,9 @@ abstract class FeatureCategoryQuery extends ModelCriteria
} }
$obj = null; $obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildFeatureCategory(); $obj = new ChildOrderProductTax();
$obj->hydrate($row); $obj->hydrate($row);
FeatureCategoryTableMap::addInstanceToPool($obj, (string) $key); OrderProductTaxTableMap::addInstanceToPool($obj, (string) $key);
} }
$stmt->closeCursor(); $stmt->closeCursor();
@@ -173,7 +177,7 @@ abstract class FeatureCategoryQuery extends ModelCriteria
* @param mixed $key Primary key to use for the query * @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object * @param ConnectionInterface $con A connection object
* *
* @return ChildFeatureCategory|array|mixed the result, formatted by the current formatter * @return ChildOrderProductTax|array|mixed the result, formatted by the current formatter
*/ */
protected function findPkComplex($key, $con) protected function findPkComplex($key, $con)
{ {
@@ -215,12 +219,12 @@ abstract class FeatureCategoryQuery extends ModelCriteria
* *
* @param mixed $key Primary key to use for the query * @param mixed $key Primary key to use for the query
* *
* @return ChildFeatureCategoryQuery The current query, for fluid interface * @return ChildOrderProductTaxQuery The current query, for fluid interface
*/ */
public function filterByPrimaryKey($key) public function filterByPrimaryKey($key)
{ {
return $this->addUsingAlias(FeatureCategoryTableMap::ID, $key, Criteria::EQUAL); return $this->addUsingAlias(OrderProductTaxTableMap::ID, $key, Criteria::EQUAL);
} }
/** /**
@@ -228,12 +232,12 @@ abstract class FeatureCategoryQuery extends ModelCriteria
* *
* @param array $keys The list of primary key to use for the query * @param array $keys The list of primary key to use for the query
* *
* @return ChildFeatureCategoryQuery The current query, for fluid interface * @return ChildOrderProductTaxQuery The current query, for fluid interface
*/ */
public function filterByPrimaryKeys($keys) public function filterByPrimaryKeys($keys)
{ {
return $this->addUsingAlias(FeatureCategoryTableMap::ID, $keys, Criteria::IN); return $this->addUsingAlias(OrderProductTaxTableMap::ID, $keys, Criteria::IN);
} }
/** /**
@@ -252,18 +256,18 @@ abstract class FeatureCategoryQuery extends ModelCriteria
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildFeatureCategoryQuery The current query, for fluid interface * @return ChildOrderProductTaxQuery The current query, for fluid interface
*/ */
public function filterById($id = null, $comparison = null) public function filterById($id = null, $comparison = null)
{ {
if (is_array($id)) { if (is_array($id)) {
$useMinMax = false; $useMinMax = false;
if (isset($id['min'])) { if (isset($id['min'])) {
$this->addUsingAlias(FeatureCategoryTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(OrderProductTaxTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($id['max'])) { if (isset($id['max'])) {
$this->addUsingAlias(FeatureCategoryTableMap::ID, $id['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(OrderProductTaxTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -274,39 +278,39 @@ abstract class FeatureCategoryQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(FeatureCategoryTableMap::ID, $id, $comparison); return $this->addUsingAlias(OrderProductTaxTableMap::ID, $id, $comparison);
} }
/** /**
* Filter the query on the feature_id column * Filter the query on the order_product_id column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByFeatureId(1234); // WHERE feature_id = 1234 * $query->filterByOrderProductId(1234); // WHERE order_product_id = 1234
* $query->filterByFeatureId(array(12, 34)); // WHERE feature_id IN (12, 34) * $query->filterByOrderProductId(array(12, 34)); // WHERE order_product_id IN (12, 34)
* $query->filterByFeatureId(array('min' => 12)); // WHERE feature_id > 12 * $query->filterByOrderProductId(array('min' => 12)); // WHERE order_product_id > 12
* </code> * </code>
* *
* @see filterByFeature() * @see filterByOrderProduct()
* *
* @param mixed $featureId The value to use as filter. * @param mixed $orderProductId The value to use as filter.
* Use scalar values for equality. * Use scalar values for equality.
* Use array values for in_array() equivalent. * Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildFeatureCategoryQuery The current query, for fluid interface * @return ChildOrderProductTaxQuery The current query, for fluid interface
*/ */
public function filterByFeatureId($featureId = null, $comparison = null) public function filterByOrderProductId($orderProductId = null, $comparison = null)
{ {
if (is_array($featureId)) { if (is_array($orderProductId)) {
$useMinMax = false; $useMinMax = false;
if (isset($featureId['min'])) { if (isset($orderProductId['min'])) {
$this->addUsingAlias(FeatureCategoryTableMap::FEATURE_ID, $featureId['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(OrderProductTaxTableMap::ORDER_PRODUCT_ID, $orderProductId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($featureId['max'])) { if (isset($orderProductId['max'])) {
$this->addUsingAlias(FeatureCategoryTableMap::FEATURE_ID, $featureId['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(OrderProductTaxTableMap::ORDER_PRODUCT_ID, $orderProductId['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -317,39 +321,95 @@ abstract class FeatureCategoryQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(FeatureCategoryTableMap::FEATURE_ID, $featureId, $comparison); return $this->addUsingAlias(OrderProductTaxTableMap::ORDER_PRODUCT_ID, $orderProductId, $comparison);
} }
/** /**
* Filter the query on the category_id column * Filter the query on the title column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByCategoryId(1234); // WHERE category_id = 1234 * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
* $query->filterByCategoryId(array(12, 34)); // WHERE category_id IN (12, 34) * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
* $query->filterByCategoryId(array('min' => 12)); // WHERE category_id > 12
* </code> * </code>
* *
* @see filterByCategory() * @param string $title 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
* *
* @param mixed $categoryId The value to use as filter. * @return ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function filterByTitle($title = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($title)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $title)) {
$title = str_replace('*', '%', $title);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTaxTableMap::TITLE, $title, $comparison);
}
/**
* Filter the query on the description column
*
* Example usage:
* <code>
* $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
* $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
* </code>
*
* @param string $description 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 ChildOrderProductTaxQuery The current query, for fluid interface
*/
public function filterByDescription($description = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($description)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $description)) {
$description = str_replace('*', '%', $description);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderProductTaxTableMap::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the amount column
*
* Example usage:
* <code>
* $query->filterByAmount(1234); // WHERE amount = 1234
* $query->filterByAmount(array(12, 34)); // WHERE amount IN (12, 34)
* $query->filterByAmount(array('min' => 12)); // WHERE amount > 12
* </code>
*
* @param mixed $amount The value to use as filter.
* Use scalar values for equality. * Use scalar values for equality.
* Use array values for in_array() equivalent. * Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildFeatureCategoryQuery The current query, for fluid interface * @return ChildOrderProductTaxQuery The current query, for fluid interface
*/ */
public function filterByCategoryId($categoryId = null, $comparison = null) public function filterByAmount($amount = null, $comparison = null)
{ {
if (is_array($categoryId)) { if (is_array($amount)) {
$useMinMax = false; $useMinMax = false;
if (isset($categoryId['min'])) { if (isset($amount['min'])) {
$this->addUsingAlias(FeatureCategoryTableMap::CATEGORY_ID, $categoryId['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(OrderProductTaxTableMap::AMOUNT, $amount['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($categoryId['max'])) { if (isset($amount['max'])) {
$this->addUsingAlias(FeatureCategoryTableMap::CATEGORY_ID, $categoryId['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(OrderProductTaxTableMap::AMOUNT, $amount['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -360,7 +420,7 @@ abstract class FeatureCategoryQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(FeatureCategoryTableMap::CATEGORY_ID, $categoryId, $comparison); return $this->addUsingAlias(OrderProductTaxTableMap::AMOUNT, $amount, $comparison);
} }
/** /**
@@ -381,18 +441,18 @@ abstract class FeatureCategoryQuery extends ModelCriteria
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildFeatureCategoryQuery The current query, for fluid interface * @return ChildOrderProductTaxQuery The current query, for fluid interface
*/ */
public function filterByCreatedAt($createdAt = null, $comparison = null) public function filterByCreatedAt($createdAt = null, $comparison = null)
{ {
if (is_array($createdAt)) { if (is_array($createdAt)) {
$useMinMax = false; $useMinMax = false;
if (isset($createdAt['min'])) { if (isset($createdAt['min'])) {
$this->addUsingAlias(FeatureCategoryTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(OrderProductTaxTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($createdAt['max'])) { if (isset($createdAt['max'])) {
$this->addUsingAlias(FeatureCategoryTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(OrderProductTaxTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -403,7 +463,7 @@ abstract class FeatureCategoryQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(FeatureCategoryTableMap::CREATED_AT, $createdAt, $comparison); return $this->addUsingAlias(OrderProductTaxTableMap::CREATED_AT, $createdAt, $comparison);
} }
/** /**
@@ -424,18 +484,18 @@ abstract class FeatureCategoryQuery extends ModelCriteria
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildFeatureCategoryQuery The current query, for fluid interface * @return ChildOrderProductTaxQuery The current query, for fluid interface
*/ */
public function filterByUpdatedAt($updatedAt = null, $comparison = null) public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{ {
if (is_array($updatedAt)) { if (is_array($updatedAt)) {
$useMinMax = false; $useMinMax = false;
if (isset($updatedAt['min'])) { if (isset($updatedAt['min'])) {
$this->addUsingAlias(FeatureCategoryTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(OrderProductTaxTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($updatedAt['max'])) { if (isset($updatedAt['max'])) {
$this->addUsingAlias(FeatureCategoryTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(OrderProductTaxTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -446,46 +506,46 @@ abstract class FeatureCategoryQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(FeatureCategoryTableMap::UPDATED_AT, $updatedAt, $comparison); return $this->addUsingAlias(OrderProductTaxTableMap::UPDATED_AT, $updatedAt, $comparison);
} }
/** /**
* Filter the query by a related \Thelia\Model\Category object * Filter the query by a related \Thelia\Model\OrderProduct object
* *
* @param \Thelia\Model\Category|ObjectCollection $category The related object(s) to use as filter * @param \Thelia\Model\OrderProduct|ObjectCollection $orderProduct The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildFeatureCategoryQuery The current query, for fluid interface * @return ChildOrderProductTaxQuery The current query, for fluid interface
*/ */
public function filterByCategory($category, $comparison = null) public function filterByOrderProduct($orderProduct, $comparison = null)
{ {
if ($category instanceof \Thelia\Model\Category) { if ($orderProduct instanceof \Thelia\Model\OrderProduct) {
return $this return $this
->addUsingAlias(FeatureCategoryTableMap::CATEGORY_ID, $category->getId(), $comparison); ->addUsingAlias(OrderProductTaxTableMap::ORDER_PRODUCT_ID, $orderProduct->getId(), $comparison);
} elseif ($category instanceof ObjectCollection) { } elseif ($orderProduct instanceof ObjectCollection) {
if (null === $comparison) { if (null === $comparison) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} }
return $this return $this
->addUsingAlias(FeatureCategoryTableMap::CATEGORY_ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison); ->addUsingAlias(OrderProductTaxTableMap::ORDER_PRODUCT_ID, $orderProduct->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else { } else {
throw new PropelException('filterByCategory() only accepts arguments of type \Thelia\Model\Category or Collection'); throw new PropelException('filterByOrderProduct() only accepts arguments of type \Thelia\Model\OrderProduct or Collection');
} }
} }
/** /**
* Adds a JOIN clause to the query using the Category relation * Adds a JOIN clause to the query using the OrderProduct relation
* *
* @param string $relationAlias optional alias for the relation * @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return ChildFeatureCategoryQuery The current query, for fluid interface * @return ChildOrderProductTaxQuery The current query, for fluid interface
*/ */
public function joinCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function joinOrderProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Category'); $relationMap = $tableMap->getRelation('OrderProduct');
// create a ModelJoin object for this join // create a ModelJoin object for this join
$join = new ModelJoin(); $join = new ModelJoin();
@@ -500,14 +560,14 @@ abstract class FeatureCategoryQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias); $this->addJoinObject($join, $relationAlias);
} else { } else {
$this->addJoinObject($join, 'Category'); $this->addJoinObject($join, 'OrderProduct');
} }
return $this; return $this;
} }
/** /**
* Use the Category relation Category object * Use the OrderProduct relation OrderProduct object
* *
* @see useQuery() * @see useQuery()
* *
@@ -515,108 +575,33 @@ abstract class FeatureCategoryQuery extends ModelCriteria
* to be used as main alias in the secondary query * to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return \Thelia\Model\CategoryQuery A secondary query class using the current class as primary query * @return \Thelia\Model\OrderProductQuery A secondary query class using the current class as primary query
*/ */
public function useCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function useOrderProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinCategory($relationAlias, $joinType) ->joinOrderProduct($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Category', '\Thelia\Model\CategoryQuery'); ->useQuery($relationAlias ? $relationAlias : 'OrderProduct', '\Thelia\Model\OrderProductQuery');
}
/**
* 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 ChildFeatureCategoryQuery The current query, for fluid interface
*/
public function filterByFeature($feature, $comparison = null)
{
if ($feature instanceof \Thelia\Model\Feature) {
return $this
->addUsingAlias(FeatureCategoryTableMap::FEATURE_ID, $feature->getId(), $comparison);
} elseif ($feature instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(FeatureCategoryTableMap::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 ChildFeatureCategoryQuery 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');
} }
/** /**
* Exclude object from result * Exclude object from result
* *
* @param ChildFeatureCategory $featureCategory Object to remove from the list of results * @param ChildOrderProductTax $orderProductTax Object to remove from the list of results
* *
* @return ChildFeatureCategoryQuery The current query, for fluid interface * @return ChildOrderProductTaxQuery The current query, for fluid interface
*/ */
public function prune($featureCategory = null) public function prune($orderProductTax = null)
{ {
if ($featureCategory) { if ($orderProductTax) {
$this->addUsingAlias(FeatureCategoryTableMap::ID, $featureCategory->getId(), Criteria::NOT_EQUAL); $this->addUsingAlias(OrderProductTaxTableMap::ID, $orderProductTax->getId(), Criteria::NOT_EQUAL);
} }
return $this; return $this;
} }
/** /**
* Deletes all rows from the feature_category table. * Deletes all rows from the order_product_tax table.
* *
* @param ConnectionInterface $con the connection to use * @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). * @return int The number of affected rows (if supported by underlying database driver).
@@ -624,7 +609,7 @@ abstract class FeatureCategoryQuery extends ModelCriteria
public function doDeleteAll(ConnectionInterface $con = null) public function doDeleteAll(ConnectionInterface $con = null)
{ {
if (null === $con) { if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(FeatureCategoryTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getWriteConnection(OrderProductTaxTableMap::DATABASE_NAME);
} }
$affectedRows = 0; // initialize var to track total num of affected rows $affectedRows = 0; // initialize var to track total num of affected rows
try { try {
@@ -635,8 +620,8 @@ abstract class FeatureCategoryQuery extends ModelCriteria
// Because this db requires some delete cascade/set null emulation, we have to // Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since // clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein). // instances get re-added by the select statement contained therein).
FeatureCategoryTableMap::clearInstancePool(); OrderProductTaxTableMap::clearInstancePool();
FeatureCategoryTableMap::clearRelatedInstancePool(); OrderProductTaxTableMap::clearRelatedInstancePool();
$con->commit(); $con->commit();
} catch (PropelException $e) { } catch (PropelException $e) {
@@ -648,9 +633,9 @@ abstract class FeatureCategoryQuery extends ModelCriteria
} }
/** /**
* Performs a DELETE on the database, given a ChildFeatureCategory or Criteria object OR a primary key value. * Performs a DELETE on the database, given a ChildOrderProductTax or Criteria object OR a primary key value.
* *
* @param mixed $values Criteria or ChildFeatureCategory object or primary key or array of primary keys * @param mixed $values Criteria or ChildOrderProductTax object or primary key or array of primary keys
* which is used to create the DELETE statement * which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use * @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 * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
@@ -661,13 +646,13 @@ abstract class FeatureCategoryQuery extends ModelCriteria
public function delete(ConnectionInterface $con = null) public function delete(ConnectionInterface $con = null)
{ {
if (null === $con) { if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(FeatureCategoryTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getWriteConnection(OrderProductTaxTableMap::DATABASE_NAME);
} }
$criteria = $this; $criteria = $this;
// Set the correct dbName // Set the correct dbName
$criteria->setDbName(FeatureCategoryTableMap::DATABASE_NAME); $criteria->setDbName(OrderProductTaxTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows $affectedRows = 0; // initialize var to track total num of affected rows
@@ -677,10 +662,10 @@ abstract class FeatureCategoryQuery extends ModelCriteria
$con->beginTransaction(); $con->beginTransaction();
FeatureCategoryTableMap::removeInstanceFromPool($criteria); OrderProductTaxTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con); $affectedRows += ModelCriteria::delete($con);
FeatureCategoryTableMap::clearRelatedInstancePool(); OrderProductTaxTableMap::clearRelatedInstancePool();
$con->commit(); $con->commit();
return $affectedRows; return $affectedRows;
@@ -697,11 +682,11 @@ abstract class FeatureCategoryQuery extends ModelCriteria
* *
* @param int $nbDays Maximum age of the latest update in days * @param int $nbDays Maximum age of the latest update in days
* *
* @return ChildFeatureCategoryQuery The current query, for fluid interface * @return ChildOrderProductTaxQuery The current query, for fluid interface
*/ */
public function recentlyUpdated($nbDays = 7) public function recentlyUpdated($nbDays = 7)
{ {
return $this->addUsingAlias(FeatureCategoryTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); return $this->addUsingAlias(OrderProductTaxTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
} }
/** /**
@@ -709,51 +694,51 @@ abstract class FeatureCategoryQuery extends ModelCriteria
* *
* @param int $nbDays Maximum age of in days * @param int $nbDays Maximum age of in days
* *
* @return ChildFeatureCategoryQuery The current query, for fluid interface * @return ChildOrderProductTaxQuery The current query, for fluid interface
*/ */
public function recentlyCreated($nbDays = 7) public function recentlyCreated($nbDays = 7)
{ {
return $this->addUsingAlias(FeatureCategoryTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); return $this->addUsingAlias(OrderProductTaxTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
} }
/** /**
* Order by update date desc * Order by update date desc
* *
* @return ChildFeatureCategoryQuery The current query, for fluid interface * @return ChildOrderProductTaxQuery The current query, for fluid interface
*/ */
public function lastUpdatedFirst() public function lastUpdatedFirst()
{ {
return $this->addDescendingOrderByColumn(FeatureCategoryTableMap::UPDATED_AT); return $this->addDescendingOrderByColumn(OrderProductTaxTableMap::UPDATED_AT);
} }
/** /**
* Order by update date asc * Order by update date asc
* *
* @return ChildFeatureCategoryQuery The current query, for fluid interface * @return ChildOrderProductTaxQuery The current query, for fluid interface
*/ */
public function firstUpdatedFirst() public function firstUpdatedFirst()
{ {
return $this->addAscendingOrderByColumn(FeatureCategoryTableMap::UPDATED_AT); return $this->addAscendingOrderByColumn(OrderProductTaxTableMap::UPDATED_AT);
} }
/** /**
* Order by create date desc * Order by create date desc
* *
* @return ChildFeatureCategoryQuery The current query, for fluid interface * @return ChildOrderProductTaxQuery The current query, for fluid interface
*/ */
public function lastCreatedFirst() public function lastCreatedFirst()
{ {
return $this->addDescendingOrderByColumn(FeatureCategoryTableMap::CREATED_AT); return $this->addDescendingOrderByColumn(OrderProductTaxTableMap::CREATED_AT);
} }
/** /**
* Order by create date asc * Order by create date asc
* *
* @return ChildFeatureCategoryQuery The current query, for fluid interface * @return ChildOrderProductTaxQuery The current query, for fluid interface
*/ */
public function firstCreatedFirst() public function firstCreatedFirst()
{ {
return $this->addAscendingOrderByColumn(FeatureCategoryTableMap::CREATED_AT); return $this->addAscendingOrderByColumn(OrderProductTaxTableMap::CREATED_AT);
} }
} // FeatureCategoryQuery } // OrderProductTaxQuery

View File

@@ -857,7 +857,7 @@ abstract class ProductQuery extends ModelCriteria
* *
* @return ChildProductQuery The current query, for fluid interface * @return ChildProductQuery The current query, for fluid interface
*/ */
public function joinTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function joinTemplate($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Template'); $relationMap = $tableMap->getRelation('Template');
@@ -892,7 +892,7 @@ abstract class ProductQuery extends ModelCriteria
* *
* @return \Thelia\Model\TemplateQuery A secondary query class using the current class as primary query * @return \Thelia\Model\TemplateQuery A secondary query class using the current class as primary query
*/ */
public function useTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function useTemplateQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{ {
return $this return $this
->joinTemplate($relationAlias, $joinType) ->joinTemplate($relationAlias, $joinType)

View File

@@ -67,6 +67,13 @@ abstract class TaxRule implements ActiveRecordInterface
*/ */
protected $id; protected $id;
/**
* The value for the is_default field.
* Note: this column has a database default value of: false
* @var boolean
*/
protected $is_default;
/** /**
* The value for the created_at field. * The value for the created_at field.
* @var string * @var string
@@ -137,11 +144,24 @@ abstract class TaxRule implements ActiveRecordInterface
*/ */
protected $taxRuleI18nsScheduledForDeletion = null; protected $taxRuleI18nsScheduledForDeletion = null;
/**
* Applies default values to this object.
* This method should be called from the object's constructor (or
* equivalent initialization method).
* @see __construct()
*/
public function applyDefaultValues()
{
$this->is_default = false;
}
/** /**
* Initializes internal state of Thelia\Model\Base\TaxRule object. * Initializes internal state of Thelia\Model\Base\TaxRule object.
* @see applyDefaults()
*/ */
public function __construct() public function __construct()
{ {
$this->applyDefaultValues();
} }
/** /**
@@ -402,6 +422,17 @@ abstract class TaxRule implements ActiveRecordInterface
return $this->id; return $this->id;
} }
/**
* Get the [is_default] column value.
*
* @return boolean
*/
public function getIsDefault()
{
return $this->is_default;
}
/** /**
* Get the [optionally formatted] temporal [created_at] column value. * Get the [optionally formatted] temporal [created_at] column value.
* *
@@ -463,6 +494,35 @@ abstract class TaxRule implements ActiveRecordInterface
return $this; return $this;
} // setId() } // setId()
/**
* Sets the value of the [is_default] column.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
*
* @param boolean|integer|string $v The new value
* @return \Thelia\Model\TaxRule The current object (for fluent API support)
*/
public function setIsDefault($v)
{
if ($v !== null) {
if (is_string($v)) {
$v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
} else {
$v = (boolean) $v;
}
}
if ($this->is_default !== $v) {
$this->is_default = $v;
$this->modifiedColumns[] = TaxRuleTableMap::IS_DEFAULT;
}
return $this;
} // setIsDefault()
/** /**
* Sets the value of [created_at] column to a normalized version of the date/time value specified. * Sets the value of [created_at] column to a normalized version of the date/time value specified.
* *
@@ -515,6 +575,10 @@ abstract class TaxRule implements ActiveRecordInterface
*/ */
public function hasOnlyDefaultValues() public function hasOnlyDefaultValues()
{ {
if ($this->is_default !== false) {
return false;
}
// otherwise, everything was equal, so return TRUE // otherwise, everything was equal, so return TRUE
return true; return true;
} // hasOnlyDefaultValues() } // hasOnlyDefaultValues()
@@ -545,13 +609,16 @@ abstract class TaxRule implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : TaxRuleTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : TaxRuleTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
$this->id = (null !== $col) ? (int) $col : null; $this->id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : TaxRuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : TaxRuleTableMap::translateFieldName('IsDefault', TableMap::TYPE_PHPNAME, $indexType)];
$this->is_default = (null !== $col) ? (boolean) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : TaxRuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : TaxRuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : TaxRuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
@@ -564,7 +631,7 @@ abstract class TaxRule implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 3; // 3 = TaxRuleTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 4; // 4 = TaxRuleTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\TaxRule object", 0, $e); throw new PropelException("Error populating \Thelia\Model\TaxRule object", 0, $e);
@@ -845,6 +912,9 @@ abstract class TaxRule implements ActiveRecordInterface
if ($this->isColumnModified(TaxRuleTableMap::ID)) { if ($this->isColumnModified(TaxRuleTableMap::ID)) {
$modifiedColumns[':p' . $index++] = 'ID'; $modifiedColumns[':p' . $index++] = 'ID';
} }
if ($this->isColumnModified(TaxRuleTableMap::IS_DEFAULT)) {
$modifiedColumns[':p' . $index++] = 'IS_DEFAULT';
}
if ($this->isColumnModified(TaxRuleTableMap::CREATED_AT)) { if ($this->isColumnModified(TaxRuleTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT'; $modifiedColumns[':p' . $index++] = 'CREATED_AT';
} }
@@ -865,6 +935,9 @@ abstract class TaxRule implements ActiveRecordInterface
case 'ID': case 'ID':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break; break;
case 'IS_DEFAULT':
$stmt->bindValue($identifier, (int) $this->is_default, PDO::PARAM_INT);
break;
case 'CREATED_AT': case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break; break;
@@ -937,9 +1010,12 @@ abstract class TaxRule implements ActiveRecordInterface
return $this->getId(); return $this->getId();
break; break;
case 1: case 1:
return $this->getCreatedAt(); return $this->getIsDefault();
break; break;
case 2: case 2:
return $this->getCreatedAt();
break;
case 3:
return $this->getUpdatedAt(); return $this->getUpdatedAt();
break; break;
default: default:
@@ -972,8 +1048,9 @@ abstract class TaxRule implements ActiveRecordInterface
$keys = TaxRuleTableMap::getFieldNames($keyType); $keys = TaxRuleTableMap::getFieldNames($keyType);
$result = array( $result = array(
$keys[0] => $this->getId(), $keys[0] => $this->getId(),
$keys[1] => $this->getCreatedAt(), $keys[1] => $this->getIsDefault(),
$keys[2] => $this->getUpdatedAt(), $keys[2] => $this->getCreatedAt(),
$keys[3] => $this->getUpdatedAt(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn) foreach($virtualColumns as $key => $virtualColumn)
@@ -1029,9 +1106,12 @@ abstract class TaxRule implements ActiveRecordInterface
$this->setId($value); $this->setId($value);
break; break;
case 1: case 1:
$this->setCreatedAt($value); $this->setIsDefault($value);
break; break;
case 2: case 2:
$this->setCreatedAt($value);
break;
case 3:
$this->setUpdatedAt($value); $this->setUpdatedAt($value);
break; break;
} // switch() } // switch()
@@ -1059,8 +1139,9 @@ abstract class TaxRule implements ActiveRecordInterface
$keys = TaxRuleTableMap::getFieldNames($keyType); $keys = TaxRuleTableMap::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setCreatedAt($arr[$keys[1]]); if (array_key_exists($keys[1], $arr)) $this->setIsDefault($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setUpdatedAt($arr[$keys[2]]); if (array_key_exists($keys[2], $arr)) $this->setCreatedAt($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setUpdatedAt($arr[$keys[3]]);
} }
/** /**
@@ -1073,6 +1154,7 @@ abstract class TaxRule implements ActiveRecordInterface
$criteria = new Criteria(TaxRuleTableMap::DATABASE_NAME); $criteria = new Criteria(TaxRuleTableMap::DATABASE_NAME);
if ($this->isColumnModified(TaxRuleTableMap::ID)) $criteria->add(TaxRuleTableMap::ID, $this->id); if ($this->isColumnModified(TaxRuleTableMap::ID)) $criteria->add(TaxRuleTableMap::ID, $this->id);
if ($this->isColumnModified(TaxRuleTableMap::IS_DEFAULT)) $criteria->add(TaxRuleTableMap::IS_DEFAULT, $this->is_default);
if ($this->isColumnModified(TaxRuleTableMap::CREATED_AT)) $criteria->add(TaxRuleTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(TaxRuleTableMap::CREATED_AT)) $criteria->add(TaxRuleTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(TaxRuleTableMap::UPDATED_AT)) $criteria->add(TaxRuleTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(TaxRuleTableMap::UPDATED_AT)) $criteria->add(TaxRuleTableMap::UPDATED_AT, $this->updated_at);
@@ -1138,6 +1220,7 @@ abstract class TaxRule implements ActiveRecordInterface
*/ */
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{ {
$copyObj->setIsDefault($this->getIsDefault());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
@@ -1961,10 +2044,12 @@ abstract class TaxRule implements ActiveRecordInterface
public function clear() public function clear()
{ {
$this->id = null; $this->id = null;
$this->is_default = null;
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
$this->clearAllReferences(); $this->clearAllReferences();
$this->applyDefaultValues();
$this->resetModified(); $this->resetModified();
$this->setNew(true); $this->setNew(true);
$this->setDeleted(false); $this->setDeleted(false);

View File

@@ -23,10 +23,12 @@ use Thelia\Model\Map\TaxRuleTableMap;
* *
* *
* @method ChildTaxRuleQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildTaxRuleQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildTaxRuleQuery orderByIsDefault($order = Criteria::ASC) Order by the is_default column
* @method ChildTaxRuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildTaxRuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildTaxRuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildTaxRuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* *
* @method ChildTaxRuleQuery groupById() Group by the id column * @method ChildTaxRuleQuery groupById() Group by the id column
* @method ChildTaxRuleQuery groupByIsDefault() Group by the is_default column
* @method ChildTaxRuleQuery groupByCreatedAt() Group by the created_at column * @method ChildTaxRuleQuery groupByCreatedAt() Group by the created_at column
* @method ChildTaxRuleQuery groupByUpdatedAt() Group by the updated_at column * @method ChildTaxRuleQuery groupByUpdatedAt() Group by the updated_at column
* *
@@ -50,10 +52,12 @@ use Thelia\Model\Map\TaxRuleTableMap;
* @method ChildTaxRule findOneOrCreate(ConnectionInterface $con = null) Return the first ChildTaxRule matching the query, or a new ChildTaxRule object populated from the query conditions when no match is found * @method ChildTaxRule findOneOrCreate(ConnectionInterface $con = null) Return the first ChildTaxRule matching the query, or a new ChildTaxRule object populated from the query conditions when no match is found
* *
* @method ChildTaxRule findOneById(int $id) Return the first ChildTaxRule filtered by the id column * @method ChildTaxRule findOneById(int $id) Return the first ChildTaxRule filtered by the id column
* @method ChildTaxRule findOneByIsDefault(boolean $is_default) Return the first ChildTaxRule filtered by the is_default column
* @method ChildTaxRule findOneByCreatedAt(string $created_at) Return the first ChildTaxRule filtered by the created_at column * @method ChildTaxRule findOneByCreatedAt(string $created_at) Return the first ChildTaxRule filtered by the created_at column
* @method ChildTaxRule findOneByUpdatedAt(string $updated_at) Return the first ChildTaxRule filtered by the updated_at column * @method ChildTaxRule findOneByUpdatedAt(string $updated_at) Return the first ChildTaxRule filtered by the updated_at column
* *
* @method array findById(int $id) Return ChildTaxRule objects filtered by the id column * @method array findById(int $id) Return ChildTaxRule objects filtered by the id column
* @method array findByIsDefault(boolean $is_default) Return ChildTaxRule objects filtered by the is_default column
* @method array findByCreatedAt(string $created_at) Return ChildTaxRule objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildTaxRule objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildTaxRule objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildTaxRule objects filtered by the updated_at column
* *
@@ -144,7 +148,7 @@ abstract class TaxRuleQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, CREATED_AT, UPDATED_AT FROM tax_rule WHERE ID = :p0'; $sql = 'SELECT ID, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM tax_rule WHERE ID = :p0';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -274,6 +278,33 @@ abstract class TaxRuleQuery extends ModelCriteria
return $this->addUsingAlias(TaxRuleTableMap::ID, $id, $comparison); return $this->addUsingAlias(TaxRuleTableMap::ID, $id, $comparison);
} }
/**
* Filter the query on the is_default column
*
* Example usage:
* <code>
* $query->filterByIsDefault(true); // WHERE is_default = true
* $query->filterByIsDefault('yes'); // WHERE is_default = true
* </code>
*
* @param boolean|string $isDefault The value to use as filter.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildTaxRuleQuery The current query, for fluid interface
*/
public function filterByIsDefault($isDefault = null, $comparison = null)
{
if (is_string($isDefault)) {
$is_default = in_array(strtolower($isDefault), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(TaxRuleTableMap::IS_DEFAULT, $isDefault, $comparison);
}
/** /**
* Filter the query on the created_at column * Filter the query on the created_at column
* *

View File

@@ -864,9 +864,10 @@ abstract class Template implements ActiveRecordInterface
if ($this->productsScheduledForDeletion !== null) { if ($this->productsScheduledForDeletion !== null) {
if (!$this->productsScheduledForDeletion->isEmpty()) { if (!$this->productsScheduledForDeletion->isEmpty()) {
\Thelia\Model\ProductQuery::create() foreach ($this->productsScheduledForDeletion as $product) {
->filterByPrimaryKeys($this->productsScheduledForDeletion->getPrimaryKeys(false)) // need to save related object because we set the relation to null
->delete($con); $product->save($con);
}
$this->productsScheduledForDeletion = null; $this->productsScheduledForDeletion = null;
} }
} }
@@ -1553,7 +1554,7 @@ abstract class Template implements ActiveRecordInterface
$this->productsScheduledForDeletion = clone $this->collProducts; $this->productsScheduledForDeletion = clone $this->collProducts;
$this->productsScheduledForDeletion->clear(); $this->productsScheduledForDeletion->clear();
} }
$this->productsScheduledForDeletion[]= clone $product; $this->productsScheduledForDeletion[]= $product;
$product->setTemplate(null); $product->setTemplate(null);
} }

View File

@@ -395,7 +395,7 @@ abstract class TemplateQuery extends ModelCriteria
* *
* @return ChildTemplateQuery The current query, for fluid interface * @return ChildTemplateQuery The current query, for fluid interface
*/ */
public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function joinProduct($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Product'); $relationMap = $tableMap->getRelation('Product');
@@ -430,7 +430,7 @@ abstract class TemplateQuery extends ModelCriteria
* *
* @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query * @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query
*/ */
public function useProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function useProductQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{ {
return $this return $this
->joinProduct($relationAlias, $joinType) ->joinProduct($relationAlias, $joinType)

View File

@@ -28,7 +28,7 @@ class Category extends BaseCategory
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected function getRewritenUrlViewName() { protected function getRewrittenUrlViewName() {
return 'category'; return 'category';
} }
@@ -69,8 +69,6 @@ class Category extends BaseCategory
{ {
$this->setPosition($this->getNextPosition()); $this->setPosition($this->getNextPosition());
$this->generateRewritenUrl($this->getLocale());
$this->dispatchEvent(TheliaEvents::BEFORE_CREATECATEGORY, new CategoryEvent($this)); $this->dispatchEvent(TheliaEvents::BEFORE_CREATECATEGORY, new CategoryEvent($this));
return true; return true;

View File

@@ -3,7 +3,66 @@
namespace Thelia\Model; namespace Thelia\Model;
use Thelia\Model\Base\CategoryAssociatedContent as BaseCategoryAssociatedContent; use Thelia\Model\Base\CategoryAssociatedContent as BaseCategoryAssociatedContent;
use Thelia\Core\Event\CategoryAssociatedContentEvent;
use Thelia\Core\Event\TheliaEvents;
use Propel\Runtime\Connection\ConnectionInterface;
class CategoryAssociatedContent extends BaseCategoryAssociatedContent { class CategoryAssociatedContent extends BaseCategoryAssociatedContent {
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_CREATECATEGORY_ASSOCIATED_CONTENT, new CategoryAssociatedContentEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_CREATECATEGORY_ASSOCIATED_CONTENT, new CategoryAssociatedContentEvent($this));
}
/**
* {@inheritDoc}
*/
public function preUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATECATEGORY_ASSOCIATED_CONTENT, new CategoryAssociatedContentEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_UPDATECATEGORY_ASSOCIATED_CONTENT, new CategoryAssociatedContentEvent($this));
}
/**
* {@inheritDoc}
*/
public function preDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_DELETECATEGORY_ASSOCIATED_CONTENT, new CategoryAssociatedContentEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_DELETECATEGORY_ASSOCIATED_CONTENT, new CategoryAssociatedContentEvent($this));
}
} }

View File

@@ -2,8 +2,13 @@
namespace Thelia\Model; namespace Thelia\Model;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Base\CategoryI18n as BaseCategoryI18n; use Thelia\Model\Base\CategoryI18n as BaseCategoryI18n;
class CategoryI18n extends BaseCategoryI18n { class CategoryI18n extends BaseCategoryI18n {
public function postInsert(ConnectionInterface $con = null)
{
$category = $this->getCategory();
$category->generateRewrittenUrl($this->getLocale());
}
} }

Some files were not shown because too many files have changed in this diff Show More