Merge branch 'template'
This commit is contained in:
@@ -23,18 +23,31 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\ActiveRecord\ActiveRecordInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Base\AddressQuery;
|
||||
use Thelia\Exception\OrderException;
|
||||
use Thelia\Model\AttributeAvI18n;
|
||||
use Thelia\Model\AttributeAvI18nQuery;
|
||||
use Thelia\Model\AttributeI18n;
|
||||
use Thelia\Model\AttributeI18nQuery;
|
||||
use Thelia\Model\AttributeQuery;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\OrderAttributeCombination;
|
||||
use Thelia\Model\ProductI18nQuery;
|
||||
use Thelia\Model\Lang;
|
||||
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\ProductI18n;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -108,14 +121,17 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
/* 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);
|
||||
$invoiceAddress = AddressQuery::create()->findPk($sessionOrder->chosenInvoiceAddress);
|
||||
$cart = $this->getSession()->getCart();
|
||||
$cartItems = $cart->getCartItems();
|
||||
|
||||
$paymentModule = ModuleQuery::findPk($placedOrder->getPaymentModuleId());
|
||||
$paymentModule = ModuleQuery::create()->findPk($placedOrder->getPaymentModuleId());
|
||||
|
||||
/* fulfill order */
|
||||
$placedOrder->setCustomerId($customer->getId());
|
||||
@@ -163,24 +179,100 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
$placedOrder->save($con);
|
||||
|
||||
/* fulfill order_products and decrease stock // @todo dispatch event */
|
||||
/* fulfill order_products and decrease stock */
|
||||
|
||||
foreach($cartItems as $cartItem) {
|
||||
$product = $cartItem->getProduct();
|
||||
|
||||
/* get customer translation */
|
||||
$productI18n = $this->getI18n(ProductI18nQuery::create(), new ProductI18n(), $product->getId());
|
||||
|
||||
$pse = $cartItem->getProductSaleElements();
|
||||
|
||||
/* check still in stock */
|
||||
if($cartItem->getQuantity() > $pse->getQuantity()) {
|
||||
$e = new OrderException("Not enough stock", OrderException::NOT_ENOUGH_STOCK);
|
||||
$e->cartItem = $cartItem;
|
||||
throw $e;
|
||||
}
|
||||
|
||||
/* decrease stock */
|
||||
$pse->setQuantity(
|
||||
$pse->getQuantity() - $cartItem->getQuantity()
|
||||
);
|
||||
$pse->save();
|
||||
|
||||
$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())
|
||||
;
|
||||
$orderProduct->setDispatcher($this->getDispatcher());
|
||||
$orderProduct->save();
|
||||
|
||||
/* fulfill order_attribute_combination and decrease stock */
|
||||
foreach($pse->getAttributeCombinations() as $attributeCombination) {
|
||||
$attribute = $this->getI18n(AttributeI18nQuery::create(), new AttributeI18n(), $attributeCombination->getAttributeId());
|
||||
$attributeAv = $this->getI18n(AttributeAvI18nQuery::create(), new AttributeAvI18n(), $attributeCombination->getAttributeAvId());
|
||||
|
||||
$orderAttributeCombination = new OrderAttributeCombination();
|
||||
$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();
|
||||
}
|
||||
}
|
||||
|
||||
/* discount @todo */
|
||||
|
||||
$con->commit();
|
||||
|
||||
/* T1style : dispatch mail event ? */
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_BEFORE_PAYMENT, new OrderEvent($placedOrder));
|
||||
|
||||
/* clear session ? */
|
||||
/* clear session */
|
||||
$sessionOrder = new \Thelia\Model\Order();
|
||||
$event->setOrder($sessionOrder);
|
||||
$this->getSession()->setOrder($sessionOrder);
|
||||
|
||||
/* empty cart */
|
||||
$this->getSession()->getCart()->clear();
|
||||
|
||||
/* call pay method */
|
||||
$paymentModuleReflection = new \ReflectionClass($paymentModule->getFullNamespace());
|
||||
$paymentModuleInstance = $paymentModuleReflection->newInstance();
|
||||
|
||||
$paymentModuleInstance->setRequest($this->request);
|
||||
$paymentModuleInstance->setDispatcher($this->dispatcher);
|
||||
$paymentModuleInstance->setRequest($this->getRequest());
|
||||
$paymentModuleInstance->setDispatcher($this->getDispatcher());
|
||||
|
||||
$paymentModuleInstance->pay();
|
||||
$paymentModuleInstance->pay($placedOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Thelia\Core\Event\OrderEvent $event
|
||||
*/
|
||||
public function sendOrderEmail(OrderEvent $event)
|
||||
{
|
||||
/* @todo */
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -188,14 +280,13 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
*/
|
||||
public function setReference(OrderEvent $event)
|
||||
{
|
||||
$x = true;
|
||||
|
||||
$this->setRef($this->generateRef());
|
||||
$event->getOrder()->setRef($this->generateRef());
|
||||
}
|
||||
|
||||
public function generateRef()
|
||||
{
|
||||
return sprintf('O', uniqid('', true), $this->getId());
|
||||
/* order addresses are unique */
|
||||
return uniqid('ORD', true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,7 +317,8 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
TheliaEvents::ORDER_SET_INVOICE_ADDRESS => array("setInvoiceAddress", 128),
|
||||
TheliaEvents::ORDER_SET_PAYMENT_MODULE => array("setPaymentModule", 128),
|
||||
TheliaEvents::ORDER_PAY => array("create", 128),
|
||||
TheliaEvents::ORDER_SET_REFERENCE => array("setReference", 128),
|
||||
TheliaEvents::ORDER_BEFORE_CREATE => array("setReference", 128),
|
||||
TheliaEvents::ORDER_BEFORE_PAYMENT => array("sendOrderEmail", 128),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -259,4 +351,42 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
return $request->getSession();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ModelCriteria $query
|
||||
* @param ActiveRecordInterface $object
|
||||
* @param $id
|
||||
* @param array $needed = array('Title')
|
||||
*
|
||||
* @return ProductI18n
|
||||
*/
|
||||
protected function getI18n(ModelCriteria $query, ActiveRecordInterface $object, $id, $needed = array('Title'))
|
||||
{
|
||||
$i18n = $query
|
||||
->filterById($id)
|
||||
->filterByLocale(
|
||||
$this->getSession()->getLang()->getLocale()
|
||||
)->findOne();
|
||||
/* or default translation */
|
||||
if(null === $i18n) {
|
||||
$i18n = $query
|
||||
->filterById($id)
|
||||
->filterByLocale(
|
||||
Lang::getDefaultLanguage()->getLocale()
|
||||
)->findOne();
|
||||
}
|
||||
if(null === $i18n) { // @todo something else ?
|
||||
$i18n = $object;
|
||||
foreach($needed as $need) {
|
||||
$method = sprintf('get%s', $need);
|
||||
if(method_exists($i18n, $method)) {
|
||||
$i18n->$method('DEFAULT ' . strtoupper($need));
|
||||
} else {
|
||||
// @todo throw sg ?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $i18n;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ namespace Thelia\Controller\Front;
|
||||
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Controller\BaseController;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
class BaseFrontController extends BaseController
|
||||
@@ -69,7 +71,7 @@ class BaseFrontController extends BaseController
|
||||
protected function checkValidDelivery()
|
||||
{
|
||||
$order = $this->getSession()->getOrder();
|
||||
if(null === $order || null === $order->chosenDeliveryAddress || null === $order->getDeliveryModuleId()) {
|
||||
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");
|
||||
}
|
||||
}
|
||||
@@ -77,7 +79,7 @@ class BaseFrontController extends BaseController
|
||||
protected function checkValidInvoice()
|
||||
{
|
||||
$order = $this->getSession()->getOrder();
|
||||
if(null === $order || null === $order->chosenInvoiceAddress || null === $order->getPaymentModuleId()) {
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,11 +78,8 @@ class OrderController extends BaseFrontController
|
||||
throw new \Exception("Delivery module cannot be use with selected delivery address");
|
||||
}
|
||||
|
||||
/* try to get postage amount */
|
||||
/* get postage amount */
|
||||
$moduleReflection = new \ReflectionClass($deliveryModule->getFullNamespace());
|
||||
if ($moduleReflection->isSubclassOf("Thelia\Module\DeliveryModuleInterface") === false) {
|
||||
throw new \RuntimeException(sprintf("delivery module %s is not a Thelia\Module\DeliveryModuleInterface", $deliveryModule->getCode()));
|
||||
}
|
||||
$moduleInstance = $moduleReflection->newInstance();
|
||||
$postage = $moduleInstance->getPostage($deliveryAddress->getCountry());
|
||||
|
||||
|
||||
@@ -257,7 +257,12 @@ final class TheliaEvents
|
||||
const ORDER_SET_INVOICE_ADDRESS = "action.order.setInvoiceAddress";
|
||||
const ORDER_SET_PAYMENT_MODULE = "action.order.setPaymentModule";
|
||||
const ORDER_PAY = "action.order.pay";
|
||||
const ORDER_SET_REFERENCE = "action.order.setReference";
|
||||
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
|
||||
|
||||
@@ -30,6 +30,7 @@ class OrderException extends \RuntimeException
|
||||
*/
|
||||
public $cartRoute = "cart.view";
|
||||
public $orderDeliveryRoute = "order.delivery";
|
||||
public $cartItem = null;
|
||||
|
||||
public $arguments = array();
|
||||
|
||||
@@ -39,6 +40,8 @@ class OrderException extends \RuntimeException
|
||||
|
||||
const UNDEFINED_DELIVERY = 200;
|
||||
|
||||
const NOT_ENOUGH_STOCK = 300;
|
||||
|
||||
public function __construct($message, $code = null, $arguments = array(), $previous = null)
|
||||
{
|
||||
if(is_array($arguments)) {
|
||||
|
||||
@@ -80,7 +80,7 @@ class OrderDelivery extends BaseForm
|
||||
->filterByType(BaseModule::DELIVERY_MODULE_TYPE)
|
||||
->filterByActivate(1)
|
||||
->filterById($value)
|
||||
->find();
|
||||
->findOne();
|
||||
|
||||
if(null === $module) {
|
||||
$context->addViolation("Delivery module ID not found");
|
||||
|
||||
1824
core/lib/Thelia/Model/Base/OrderAttributeCombination.php
Normal file
1824
core/lib/Thelia/Model/Base/OrderAttributeCombination.php
Normal file
File diff suppressed because it is too large
Load Diff
897
core/lib/Thelia/Model/Base/OrderAttributeCombinationQuery.php
Normal file
897
core/lib/Thelia/Model/Base/OrderAttributeCombinationQuery.php
Normal 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\OrderAttributeCombination as ChildOrderAttributeCombination;
|
||||
use Thelia\Model\OrderAttributeCombinationQuery as ChildOrderAttributeCombinationQuery;
|
||||
use Thelia\Model\Map\OrderAttributeCombinationTableMap;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'order_attribute_combination' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildOrderAttributeCombinationQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildOrderAttributeCombinationQuery orderByOrderProductId($order = Criteria::ASC) Order by the order_product_id column
|
||||
* @method ChildOrderAttributeCombinationQuery orderByAttributeTitle($order = Criteria::ASC) Order by the attribute_title column
|
||||
* @method ChildOrderAttributeCombinationQuery orderByAttributeChapo($order = Criteria::ASC) Order by the attribute_chapo column
|
||||
* @method ChildOrderAttributeCombinationQuery orderByAttributeDescription($order = Criteria::ASC) Order by the attribute_description column
|
||||
* @method ChildOrderAttributeCombinationQuery orderByAttributePostscriptumn($order = Criteria::ASC) Order by the attribute_postscriptumn column
|
||||
* @method ChildOrderAttributeCombinationQuery orderByAttributeAvTitle($order = Criteria::ASC) Order by the attribute_av_title column
|
||||
* @method ChildOrderAttributeCombinationQuery orderByAttributeAvChapo($order = Criteria::ASC) Order by the attribute_av_chapo column
|
||||
* @method ChildOrderAttributeCombinationQuery orderByAttributeAvDescription($order = Criteria::ASC) Order by the attribute_av_description column
|
||||
* @method ChildOrderAttributeCombinationQuery orderByAttributeAvPostscriptum($order = Criteria::ASC) Order by the attribute_av_postscriptum column
|
||||
* @method ChildOrderAttributeCombinationQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildOrderAttributeCombinationQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
* @method ChildOrderAttributeCombinationQuery groupById() Group by the id column
|
||||
* @method ChildOrderAttributeCombinationQuery groupByOrderProductId() Group by the order_product_id column
|
||||
* @method ChildOrderAttributeCombinationQuery groupByAttributeTitle() Group by the attribute_title column
|
||||
* @method ChildOrderAttributeCombinationQuery groupByAttributeChapo() Group by the attribute_chapo column
|
||||
* @method ChildOrderAttributeCombinationQuery groupByAttributeDescription() Group by the attribute_description column
|
||||
* @method ChildOrderAttributeCombinationQuery groupByAttributePostscriptumn() Group by the attribute_postscriptumn column
|
||||
* @method ChildOrderAttributeCombinationQuery groupByAttributeAvTitle() Group by the attribute_av_title column
|
||||
* @method ChildOrderAttributeCombinationQuery groupByAttributeAvChapo() Group by the attribute_av_chapo column
|
||||
* @method ChildOrderAttributeCombinationQuery groupByAttributeAvDescription() Group by the attribute_av_description column
|
||||
* @method ChildOrderAttributeCombinationQuery groupByAttributeAvPostscriptum() Group by the attribute_av_postscriptum column
|
||||
* @method ChildOrderAttributeCombinationQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildOrderAttributeCombinationQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
* @method ChildOrderAttributeCombinationQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildOrderAttributeCombinationQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildOrderAttributeCombinationQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildOrderAttributeCombinationQuery leftJoinOrderProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderProduct relation
|
||||
* @method ChildOrderAttributeCombinationQuery rightJoinOrderProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProduct relation
|
||||
* @method ChildOrderAttributeCombinationQuery innerJoinOrderProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProduct relation
|
||||
*
|
||||
* @method ChildOrderAttributeCombination findOne(ConnectionInterface $con = null) Return the first ChildOrderAttributeCombination matching the query
|
||||
* @method ChildOrderAttributeCombination findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderAttributeCombination matching the query, or a new ChildOrderAttributeCombination object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildOrderAttributeCombination findOneById(int $id) Return the first ChildOrderAttributeCombination filtered by the id column
|
||||
* @method ChildOrderAttributeCombination findOneByOrderProductId(int $order_product_id) Return the first ChildOrderAttributeCombination filtered by the order_product_id column
|
||||
* @method ChildOrderAttributeCombination findOneByAttributeTitle(string $attribute_title) Return the first ChildOrderAttributeCombination filtered by the attribute_title column
|
||||
* @method ChildOrderAttributeCombination findOneByAttributeChapo(string $attribute_chapo) Return the first ChildOrderAttributeCombination filtered by the attribute_chapo column
|
||||
* @method ChildOrderAttributeCombination findOneByAttributeDescription(string $attribute_description) Return the first ChildOrderAttributeCombination filtered by the attribute_description column
|
||||
* @method ChildOrderAttributeCombination findOneByAttributePostscriptumn(string $attribute_postscriptumn) Return the first ChildOrderAttributeCombination filtered by the attribute_postscriptumn column
|
||||
* @method ChildOrderAttributeCombination findOneByAttributeAvTitle(string $attribute_av_title) Return the first ChildOrderAttributeCombination filtered by the attribute_av_title column
|
||||
* @method ChildOrderAttributeCombination findOneByAttributeAvChapo(string $attribute_av_chapo) Return the first ChildOrderAttributeCombination filtered by the attribute_av_chapo column
|
||||
* @method ChildOrderAttributeCombination findOneByAttributeAvDescription(string $attribute_av_description) Return the first ChildOrderAttributeCombination filtered by the attribute_av_description column
|
||||
* @method ChildOrderAttributeCombination findOneByAttributeAvPostscriptum(string $attribute_av_postscriptum) Return the first ChildOrderAttributeCombination filtered by the attribute_av_postscriptum column
|
||||
* @method ChildOrderAttributeCombination findOneByCreatedAt(string $created_at) Return the first ChildOrderAttributeCombination filtered by the created_at column
|
||||
* @method ChildOrderAttributeCombination findOneByUpdatedAt(string $updated_at) Return the first ChildOrderAttributeCombination filtered by the updated_at column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildOrderAttributeCombination objects filtered by the id column
|
||||
* @method array findByOrderProductId(int $order_product_id) Return ChildOrderAttributeCombination objects filtered by the order_product_id column
|
||||
* @method array findByAttributeTitle(string $attribute_title) Return ChildOrderAttributeCombination objects filtered by the attribute_title column
|
||||
* @method array findByAttributeChapo(string $attribute_chapo) Return ChildOrderAttributeCombination objects filtered by the attribute_chapo column
|
||||
* @method array findByAttributeDescription(string $attribute_description) Return ChildOrderAttributeCombination objects filtered by the attribute_description column
|
||||
* @method array findByAttributePostscriptumn(string $attribute_postscriptumn) Return ChildOrderAttributeCombination objects filtered by the attribute_postscriptumn column
|
||||
* @method array findByAttributeAvTitle(string $attribute_av_title) Return ChildOrderAttributeCombination objects filtered by the attribute_av_title column
|
||||
* @method array findByAttributeAvChapo(string $attribute_av_chapo) Return ChildOrderAttributeCombination objects filtered by the attribute_av_chapo column
|
||||
* @method array findByAttributeAvDescription(string $attribute_av_description) Return ChildOrderAttributeCombination objects filtered by the attribute_av_description column
|
||||
* @method array findByAttributeAvPostscriptum(string $attribute_av_postscriptum) Return ChildOrderAttributeCombination objects filtered by the attribute_av_postscriptum column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildOrderAttributeCombination objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildOrderAttributeCombination objects filtered by the updated_at column
|
||||
*
|
||||
*/
|
||||
abstract class OrderAttributeCombinationQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \Thelia\Model\Base\OrderAttributeCombinationQuery 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\\OrderAttributeCombination', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildOrderAttributeCombinationQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildOrderAttributeCombinationQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \Thelia\Model\OrderAttributeCombinationQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \Thelia\Model\OrderAttributeCombinationQuery();
|
||||
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 ChildOrderAttributeCombination|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = OrderAttributeCombinationTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombination 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_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 ChildOrderAttributeCombination();
|
||||
$obj->hydrate($row);
|
||||
OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombination|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 ChildOrderAttributeCombinationQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombinationQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombinationQuery 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(OrderAttributeCombinationTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(OrderAttributeCombinationTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombinationQuery 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(OrderAttributeCombinationTableMap::ORDER_PRODUCT_ID, $orderProductId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($orderProductId['max'])) {
|
||||
$this->addUsingAlias(OrderAttributeCombinationTableMap::ORDER_PRODUCT_ID, $orderProductId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombinationQuery 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(OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombinationQuery 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(OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombinationQuery 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(OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombinationQuery 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(OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombinationQuery 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(OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombinationQuery 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(OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombinationQuery 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(OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombinationQuery 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(OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombinationQuery 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(OrderAttributeCombinationTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($createdAt['max'])) {
|
||||
$this->addUsingAlias(OrderAttributeCombinationTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombinationQuery 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(OrderAttributeCombinationTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($updatedAt['max'])) {
|
||||
$this->addUsingAlias(OrderAttributeCombinationTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombinationQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByOrderProduct($orderProduct, $comparison = null)
|
||||
{
|
||||
if ($orderProduct instanceof \Thelia\Model\OrderProduct) {
|
||||
return $this
|
||||
->addUsingAlias(OrderAttributeCombinationTableMap::ORDER_PRODUCT_ID, $orderProduct->getId(), $comparison);
|
||||
} elseif ($orderProduct instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombinationQuery 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 ChildOrderAttributeCombination $orderAttributeCombination Object to remove from the list of results
|
||||
*
|
||||
* @return ChildOrderAttributeCombinationQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($orderAttributeCombination = null)
|
||||
{
|
||||
if ($orderAttributeCombination) {
|
||||
$this->addUsingAlias(OrderAttributeCombinationTableMap::ID, $orderAttributeCombination->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the order_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(OrderAttributeCombinationTableMap::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).
|
||||
OrderAttributeCombinationTableMap::clearInstancePool();
|
||||
OrderAttributeCombinationTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildOrderAttributeCombination or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildOrderAttributeCombination 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(OrderAttributeCombinationTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(OrderAttributeCombinationTableMap::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();
|
||||
|
||||
|
||||
OrderAttributeCombinationTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
OrderAttributeCombinationTableMap::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 ChildOrderAttributeCombinationQuery The current query, for fluid interface
|
||||
*/
|
||||
public function recentlyUpdated($nbDays = 7)
|
||||
{
|
||||
return $this->addUsingAlias(OrderAttributeCombinationTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter by the latest created
|
||||
*
|
||||
* @param int $nbDays Maximum age of in days
|
||||
*
|
||||
* @return ChildOrderAttributeCombinationQuery The current query, for fluid interface
|
||||
*/
|
||||
public function recentlyCreated($nbDays = 7)
|
||||
{
|
||||
return $this->addUsingAlias(OrderAttributeCombinationTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by update date desc
|
||||
*
|
||||
* @return ChildOrderAttributeCombinationQuery The current query, for fluid interface
|
||||
*/
|
||||
public function lastUpdatedFirst()
|
||||
{
|
||||
return $this->addDescendingOrderByColumn(OrderAttributeCombinationTableMap::UPDATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by update date asc
|
||||
*
|
||||
* @return ChildOrderAttributeCombinationQuery The current query, for fluid interface
|
||||
*/
|
||||
public function firstUpdatedFirst()
|
||||
{
|
||||
return $this->addAscendingOrderByColumn(OrderAttributeCombinationTableMap::UPDATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by create date desc
|
||||
*
|
||||
* @return ChildOrderAttributeCombinationQuery The current query, for fluid interface
|
||||
*/
|
||||
public function lastCreatedFirst()
|
||||
{
|
||||
return $this->addDescendingOrderByColumn(OrderAttributeCombinationTableMap::CREATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by create date asc
|
||||
*
|
||||
* @return ChildOrderAttributeCombinationQuery The current query, for fluid interface
|
||||
*/
|
||||
public function firstCreatedFirst()
|
||||
{
|
||||
return $this->addAscendingOrderByColumn(OrderAttributeCombinationTableMap::CREATED_AT);
|
||||
}
|
||||
|
||||
} // OrderAttributeCombinationQuery
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,11 +24,17 @@ use Thelia\Model\Map\OrderProductTableMap;
|
||||
* @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 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 orderByDescription($order = Criteria::ASC) Order by the description 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 orderByPrice($order = Criteria::ASC) Order by the price 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 orderByTax($order = Criteria::ASC) Order by the tax column
|
||||
* @method ChildOrderProductQuery orderByParent($order = Criteria::ASC) Order by the parent column
|
||||
* @method ChildOrderProductQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
@@ -37,11 +43,17 @@ use Thelia\Model\Map\OrderProductTableMap;
|
||||
* @method ChildOrderProductQuery groupById() Group by the id column
|
||||
* @method ChildOrderProductQuery groupByOrderId() Group by the order_id 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 groupByDescription() Group by the description 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 groupByPrice() Group by the price 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 groupByTax() Group by the tax column
|
||||
* @method ChildOrderProductQuery groupByParent() Group by the parent column
|
||||
* @method ChildOrderProductQuery groupByCreatedAt() Group by the created_at column
|
||||
@@ -55,9 +67,9 @@ use Thelia\Model\Map\OrderProductTableMap;
|
||||
* @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 leftJoinOrderFeature($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderFeature relation
|
||||
* @method ChildOrderProductQuery rightJoinOrderFeature($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderFeature relation
|
||||
* @method ChildOrderProductQuery innerJoinOrderFeature($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderFeature relation
|
||||
* @method ChildOrderProductQuery leftJoinOrderAttributeCombination($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderAttributeCombination relation
|
||||
* @method ChildOrderProductQuery rightJoinOrderAttributeCombination($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderAttributeCombination relation
|
||||
* @method ChildOrderProductQuery innerJoinOrderAttributeCombination($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderAttributeCombination relation
|
||||
*
|
||||
* @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
|
||||
@@ -65,11 +77,17 @@ use Thelia\Model\Map\OrderProductTableMap;
|
||||
* @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 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 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 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 findOneByPrice(double $price) Return the first ChildOrderProduct filtered by the price 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 findOneByTax(double $tax) Return the first ChildOrderProduct filtered by the tax 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
|
||||
@@ -78,11 +96,17 @@ use Thelia\Model\Map\OrderProductTableMap;
|
||||
* @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 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 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 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 findByPrice(double $price) Return ChildOrderProduct objects filtered by the price 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 findByTax(double $tax) Return ChildOrderProduct objects filtered by the tax 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
|
||||
@@ -175,7 +199,7 @@ abstract class OrderProductQuery extends ModelCriteria
|
||||
*/
|
||||
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, PARENT, CREATED_AT, UPDATED_AT FROM order_product WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -377,6 +401,35 @@ abstract class OrderProductQuery extends ModelCriteria
|
||||
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
|
||||
*
|
||||
@@ -406,6 +459,35 @@ abstract class OrderProductQuery extends ModelCriteria
|
||||
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
|
||||
*
|
||||
@@ -436,32 +518,32 @@ abstract class OrderProductQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the chapo column
|
||||
* Filter the query on the postscriptum column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
|
||||
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
|
||||
* $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
|
||||
* $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
|
||||
* </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)
|
||||
* @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)
|
||||
public function filterByPostscriptum($postscriptum = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($chapo)) {
|
||||
if (is_array($postscriptum)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $chapo)) {
|
||||
$chapo = str_replace('*', '%', $chapo);
|
||||
} elseif (preg_match('/[\%\*]/', $postscriptum)) {
|
||||
$postscriptum = str_replace('*', '%', $postscriptum);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(OrderProductTableMap::CHAPO, $chapo, $comparison);
|
||||
return $this->addUsingAlias(OrderProductTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -546,6 +628,146 @@ abstract class OrderProductQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(OrderProductTableMap::PRICE, $price, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the promo_price column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByPromoPrice('fooValue'); // WHERE promo_price = 'fooValue'
|
||||
* $query->filterByPromoPrice('%fooValue%'); // WHERE promo_price LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @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 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 filterByWasNew($wasNew = null, $comparison = null)
|
||||
{
|
||||
if (is_array($wasNew)) {
|
||||
$useMinMax = false;
|
||||
if (isset($wasNew['min'])) {
|
||||
$this->addUsingAlias(OrderProductTableMap::WAS_NEW, $wasNew['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($wasNew['max'])) {
|
||||
$this->addUsingAlias(OrderProductTableMap::WAS_NEW, $wasNew['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
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 column
|
||||
*
|
||||
@@ -790,40 +1012,40 @@ abstract class OrderProductQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\OrderFeature object
|
||||
* Filter the query by a related \Thelia\Model\OrderAttributeCombination object
|
||||
*
|
||||
* @param \Thelia\Model\OrderFeature|ObjectCollection $orderFeature the related object to use as filter
|
||||
* @param \Thelia\Model\OrderAttributeCombination|ObjectCollection $orderAttributeCombination 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 filterByOrderFeature($orderFeature, $comparison = null)
|
||||
public function filterByOrderAttributeCombination($orderAttributeCombination, $comparison = null)
|
||||
{
|
||||
if ($orderFeature instanceof \Thelia\Model\OrderFeature) {
|
||||
if ($orderAttributeCombination instanceof \Thelia\Model\OrderAttributeCombination) {
|
||||
return $this
|
||||
->addUsingAlias(OrderProductTableMap::ID, $orderFeature->getOrderProductId(), $comparison);
|
||||
} elseif ($orderFeature instanceof ObjectCollection) {
|
||||
->addUsingAlias(OrderProductTableMap::ID, $orderAttributeCombination->getOrderProductId(), $comparison);
|
||||
} elseif ($orderAttributeCombination instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useOrderFeatureQuery()
|
||||
->filterByPrimaryKeys($orderFeature->getPrimaryKeys())
|
||||
->useOrderAttributeCombinationQuery()
|
||||
->filterByPrimaryKeys($orderAttributeCombination->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByOrderFeature() only accepts arguments of type \Thelia\Model\OrderFeature or Collection');
|
||||
throw new PropelException('filterByOrderAttributeCombination() only accepts arguments of type \Thelia\Model\OrderAttributeCombination or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the OrderFeature relation
|
||||
* Adds a JOIN clause to the query using the OrderAttributeCombination 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 joinOrderFeature($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinOrderAttributeCombination($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('OrderFeature');
|
||||
$relationMap = $tableMap->getRelation('OrderAttributeCombination');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
@@ -838,14 +1060,14 @@ abstract class OrderProductQuery extends ModelCriteria
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'OrderFeature');
|
||||
$this->addJoinObject($join, 'OrderAttributeCombination');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the OrderFeature relation OrderFeature object
|
||||
* Use the OrderAttributeCombination relation OrderAttributeCombination object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
@@ -853,13 +1075,13 @@ abstract class OrderProductQuery extends ModelCriteria
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\OrderFeatureQuery A secondary query class using the current class as primary query
|
||||
* @return \Thelia\Model\OrderAttributeCombinationQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useOrderFeatureQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useOrderAttributeCombinationQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinOrderFeature($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'OrderFeature', '\Thelia\Model\OrderFeatureQuery');
|
||||
->joinOrderAttributeCombination($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'OrderAttributeCombination', '\Thelia\Model\OrderAttributeCombinationQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
503
core/lib/Thelia/Model/Map/OrderAttributeCombinationTableMap.php
Normal file
503
core/lib/Thelia/Model/Map/OrderAttributeCombinationTableMap.php
Normal file
@@ -0,0 +1,503 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Map;
|
||||
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\RelationMap;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Map\TableMapTrait;
|
||||
use Thelia\Model\OrderAttributeCombination;
|
||||
use Thelia\Model\OrderAttributeCombinationQuery;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'order_attribute_combination' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This map class is used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
*/
|
||||
class OrderAttributeCombinationTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'Thelia.Model.Map.OrderAttributeCombinationTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'order_attribute_combination';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\Thelia\\Model\\OrderAttributeCombination';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'Thelia.Model.OrderAttributeCombination';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 12;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
*/
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 12;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'order_attribute_combination.ID';
|
||||
|
||||
/**
|
||||
* the column name for the ORDER_PRODUCT_ID field
|
||||
*/
|
||||
const ORDER_PRODUCT_ID = 'order_attribute_combination.ORDER_PRODUCT_ID';
|
||||
|
||||
/**
|
||||
* the column name for the ATTRIBUTE_TITLE field
|
||||
*/
|
||||
const ATTRIBUTE_TITLE = 'order_attribute_combination.ATTRIBUTE_TITLE';
|
||||
|
||||
/**
|
||||
* the column name for the ATTRIBUTE_CHAPO field
|
||||
*/
|
||||
const ATTRIBUTE_CHAPO = 'order_attribute_combination.ATTRIBUTE_CHAPO';
|
||||
|
||||
/**
|
||||
* the column name for the ATTRIBUTE_DESCRIPTION field
|
||||
*/
|
||||
const ATTRIBUTE_DESCRIPTION = 'order_attribute_combination.ATTRIBUTE_DESCRIPTION';
|
||||
|
||||
/**
|
||||
* the column name for the ATTRIBUTE_POSTSCRIPTUMN field
|
||||
*/
|
||||
const ATTRIBUTE_POSTSCRIPTUMN = 'order_attribute_combination.ATTRIBUTE_POSTSCRIPTUMN';
|
||||
|
||||
/**
|
||||
* the column name for the ATTRIBUTE_AV_TITLE field
|
||||
*/
|
||||
const ATTRIBUTE_AV_TITLE = 'order_attribute_combination.ATTRIBUTE_AV_TITLE';
|
||||
|
||||
/**
|
||||
* the column name for the ATTRIBUTE_AV_CHAPO field
|
||||
*/
|
||||
const ATTRIBUTE_AV_CHAPO = 'order_attribute_combination.ATTRIBUTE_AV_CHAPO';
|
||||
|
||||
/**
|
||||
* the column name for the ATTRIBUTE_AV_DESCRIPTION field
|
||||
*/
|
||||
const ATTRIBUTE_AV_DESCRIPTION = 'order_attribute_combination.ATTRIBUTE_AV_DESCRIPTION';
|
||||
|
||||
/**
|
||||
* the column name for the ATTRIBUTE_AV_POSTSCRIPTUM field
|
||||
*/
|
||||
const ATTRIBUTE_AV_POSTSCRIPTUM = 'order_attribute_combination.ATTRIBUTE_AV_POSTSCRIPTUM';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
const CREATED_AT = 'order_attribute_combination.CREATED_AT';
|
||||
|
||||
/**
|
||||
* the column name for the UPDATED_AT field
|
||||
*/
|
||||
const UPDATED_AT = 'order_attribute_combination.UPDATED_AT';
|
||||
|
||||
/**
|
||||
* The default string format for model objects of the related table
|
||||
*/
|
||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||
|
||||
/**
|
||||
* holds an array of fieldnames
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'OrderProductId', 'AttributeTitle', 'AttributeChapo', 'AttributeDescription', 'AttributePostscriptumn', 'AttributeAvTitle', 'AttributeAvChapo', 'AttributeAvDescription', 'AttributeAvPostscriptum', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'orderProductId', 'attributeTitle', 'attributeChapo', 'attributeDescription', 'attributePostscriptumn', 'attributeAvTitle', 'attributeAvChapo', 'attributeAvDescription', 'attributeAvPostscriptum', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(OrderAttributeCombinationTableMap::ID, OrderAttributeCombinationTableMap::ORDER_PRODUCT_ID, OrderAttributeCombinationTableMap::ATTRIBUTE_TITLE, OrderAttributeCombinationTableMap::ATTRIBUTE_CHAPO, OrderAttributeCombinationTableMap::ATTRIBUTE_DESCRIPTION, OrderAttributeCombinationTableMap::ATTRIBUTE_POSTSCRIPTUMN, OrderAttributeCombinationTableMap::ATTRIBUTE_AV_TITLE, OrderAttributeCombinationTableMap::ATTRIBUTE_AV_CHAPO, OrderAttributeCombinationTableMap::ATTRIBUTE_AV_DESCRIPTION, OrderAttributeCombinationTableMap::ATTRIBUTE_AV_POSTSCRIPTUM, OrderAttributeCombinationTableMap::CREATED_AT, OrderAttributeCombinationTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('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', ),
|
||||
self::TYPE_FIELDNAME => array('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', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'OrderProductId' => 1, 'AttributeTitle' => 2, 'AttributeChapo' => 3, 'AttributeDescription' => 4, 'AttributePostscriptumn' => 5, 'AttributeAvTitle' => 6, 'AttributeAvChapo' => 7, 'AttributeAvDescription' => 8, 'AttributeAvPostscriptum' => 9, 'CreatedAt' => 10, 'UpdatedAt' => 11, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderProductId' => 1, 'attributeTitle' => 2, 'attributeChapo' => 3, 'attributeDescription' => 4, 'attributePostscriptumn' => 5, 'attributeAvTitle' => 6, 'attributeAvChapo' => 7, 'attributeAvDescription' => 8, 'attributeAvPostscriptum' => 9, 'createdAt' => 10, 'updatedAt' => 11, ),
|
||||
self::TYPE_COLNAME => array(OrderAttributeCombinationTableMap::ID => 0, OrderAttributeCombinationTableMap::ORDER_PRODUCT_ID => 1, OrderAttributeCombinationTableMap::ATTRIBUTE_TITLE => 2, OrderAttributeCombinationTableMap::ATTRIBUTE_CHAPO => 3, OrderAttributeCombinationTableMap::ATTRIBUTE_DESCRIPTION => 4, OrderAttributeCombinationTableMap::ATTRIBUTE_POSTSCRIPTUMN => 5, OrderAttributeCombinationTableMap::ATTRIBUTE_AV_TITLE => 6, OrderAttributeCombinationTableMap::ATTRIBUTE_AV_CHAPO => 7, OrderAttributeCombinationTableMap::ATTRIBUTE_AV_DESCRIPTION => 8, OrderAttributeCombinationTableMap::ATTRIBUTE_AV_POSTSCRIPTUM => 9, OrderAttributeCombinationTableMap::CREATED_AT => 10, OrderAttributeCombinationTableMap::UPDATED_AT => 11, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_PRODUCT_ID' => 1, 'ATTRIBUTE_TITLE' => 2, 'ATTRIBUTE_CHAPO' => 3, 'ATTRIBUTE_DESCRIPTION' => 4, 'ATTRIBUTE_POSTSCRIPTUMN' => 5, 'ATTRIBUTE_AV_TITLE' => 6, 'ATTRIBUTE_AV_CHAPO' => 7, 'ATTRIBUTE_AV_DESCRIPTION' => 8, 'ATTRIBUTE_AV_POSTSCRIPTUM' => 9, 'CREATED_AT' => 10, 'UPDATED_AT' => 11, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'order_product_id' => 1, 'attribute_title' => 2, 'attribute_chapo' => 3, 'attribute_description' => 4, 'attribute_postscriptumn' => 5, 'attribute_av_title' => 6, 'attribute_av_chapo' => 7, 'attribute_av_description' => 8, 'attribute_av_postscriptum' => 9, 'created_at' => 10, 'updated_at' => 11, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialize the table attributes and columns
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('order_attribute_combination');
|
||||
$this->setPhpName('OrderAttributeCombination');
|
||||
$this->setClassName('\\Thelia\\Model\\OrderAttributeCombination');
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('ORDER_PRODUCT_ID', 'OrderProductId', 'INTEGER', 'order_product', 'ID', true, null, null);
|
||||
$this->addColumn('ATTRIBUTE_TITLE', 'AttributeTitle', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('ATTRIBUTE_CHAPO', 'AttributeChapo', 'LONGVARCHAR', false, null, null);
|
||||
$this->addColumn('ATTRIBUTE_DESCRIPTION', 'AttributeDescription', 'CLOB', false, null, null);
|
||||
$this->addColumn('ATTRIBUTE_POSTSCRIPTUMN', 'AttributePostscriptumn', 'LONGVARCHAR', false, null, null);
|
||||
$this->addColumn('ATTRIBUTE_AV_TITLE', 'AttributeAvTitle', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('ATTRIBUTE_AV_CHAPO', 'AttributeAvChapo', 'LONGVARCHAR', false, null, null);
|
||||
$this->addColumn('ATTRIBUTE_AV_DESCRIPTION', 'AttributeAvDescription', 'CLOB', false, null, null);
|
||||
$this->addColumn('ATTRIBUTE_AV_POSTSCRIPTUM', 'AttributeAvPostscriptum', 'LONGVARCHAR', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('OrderProduct', '\\Thelia\\Model\\OrderProduct', RelationMap::MANY_TO_ONE, array('order_product_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the list of behaviors registered for this table
|
||||
*
|
||||
* @return array Associative array (name => parameters) of behaviors
|
||||
*/
|
||||
public function getBehaviors()
|
||||
{
|
||||
return array(
|
||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
|
||||
);
|
||||
} // getBehaviors()
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
*
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*/
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// If the PK cannot be derived from the row, return NULL.
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the primary key from the DB resultset row
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*
|
||||
* @return mixed The primary key of the row
|
||||
*/
|
||||
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
|
||||
return (int) $row[
|
||||
$indexType == TableMap::TYPE_NUM
|
||||
? 0 + $offset
|
||||
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* The class that the tableMap will make instances of.
|
||||
*
|
||||
* If $withPrefix is true, the returned path
|
||||
* uses a dot-path notation which is translated into a path
|
||||
* relative to a location on the PHP include_path.
|
||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||
*
|
||||
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||
* @return string path.to.ClassName
|
||||
*/
|
||||
public static function getOMClass($withPrefix = true)
|
||||
{
|
||||
return $withPrefix ? OrderAttributeCombinationTableMap::CLASS_DEFAULT : OrderAttributeCombinationTableMap::OM_CLASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates an object of the default type or an object that inherit from the default.
|
||||
*
|
||||
* @param array $row row returned by DataFetcher->fetch().
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
|
||||
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
|
||||
*
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @return array (OrderAttributeCombination object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = OrderAttributeCombinationTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = OrderAttributeCombinationTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, $offset, true); // rehydrate
|
||||
$col = $offset + OrderAttributeCombinationTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = OrderAttributeCombinationTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
OrderAttributeCombinationTableMap::addInstanceToPool($obj, $key);
|
||||
}
|
||||
|
||||
return array($obj, $col);
|
||||
}
|
||||
|
||||
/**
|
||||
* The returned array will contain objects of the default type or
|
||||
* objects that inherit from the default.
|
||||
*
|
||||
* @param DataFetcherInterface $dataFetcher
|
||||
* @return array
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function populateObjects(DataFetcherInterface $dataFetcher)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = static::getOMClass(false);
|
||||
// populate the object(s)
|
||||
while ($row = $dataFetcher->fetch()) {
|
||||
$key = OrderAttributeCombinationTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = OrderAttributeCombinationTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, 0, true); // rehydrate
|
||||
$results[] = $obj;
|
||||
} else {
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($row);
|
||||
$results[] = $obj;
|
||||
OrderAttributeCombinationTableMap::addInstanceToPool($obj, $key);
|
||||
} // if key exists
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
/**
|
||||
* Add all the columns needed to create a new object.
|
||||
*
|
||||
* Note: any columns that were marked with lazyLoad="true" in the
|
||||
* XML schema will not be added to the select list and only loaded
|
||||
* on demand.
|
||||
*
|
||||
* @param Criteria $criteria object containing the columns to add.
|
||||
* @param string $alias optional table alias
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function addSelectColumns(Criteria $criteria, $alias = null)
|
||||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(OrderAttributeCombinationTableMap::ID);
|
||||
$criteria->addSelectColumn(OrderAttributeCombinationTableMap::ORDER_PRODUCT_ID);
|
||||
$criteria->addSelectColumn(OrderAttributeCombinationTableMap::ATTRIBUTE_TITLE);
|
||||
$criteria->addSelectColumn(OrderAttributeCombinationTableMap::ATTRIBUTE_CHAPO);
|
||||
$criteria->addSelectColumn(OrderAttributeCombinationTableMap::ATTRIBUTE_DESCRIPTION);
|
||||
$criteria->addSelectColumn(OrderAttributeCombinationTableMap::ATTRIBUTE_POSTSCRIPTUMN);
|
||||
$criteria->addSelectColumn(OrderAttributeCombinationTableMap::ATTRIBUTE_AV_TITLE);
|
||||
$criteria->addSelectColumn(OrderAttributeCombinationTableMap::ATTRIBUTE_AV_CHAPO);
|
||||
$criteria->addSelectColumn(OrderAttributeCombinationTableMap::ATTRIBUTE_AV_DESCRIPTION);
|
||||
$criteria->addSelectColumn(OrderAttributeCombinationTableMap::ATTRIBUTE_AV_POSTSCRIPTUM);
|
||||
$criteria->addSelectColumn(OrderAttributeCombinationTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(OrderAttributeCombinationTableMap::UPDATED_AT);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.ORDER_PRODUCT_ID');
|
||||
$criteria->addSelectColumn($alias . '.ATTRIBUTE_TITLE');
|
||||
$criteria->addSelectColumn($alias . '.ATTRIBUTE_CHAPO');
|
||||
$criteria->addSelectColumn($alias . '.ATTRIBUTE_DESCRIPTION');
|
||||
$criteria->addSelectColumn($alias . '.ATTRIBUTE_POSTSCRIPTUMN');
|
||||
$criteria->addSelectColumn($alias . '.ATTRIBUTE_AV_TITLE');
|
||||
$criteria->addSelectColumn($alias . '.ATTRIBUTE_AV_CHAPO');
|
||||
$criteria->addSelectColumn($alias . '.ATTRIBUTE_AV_DESCRIPTION');
|
||||
$criteria->addSelectColumn($alias . '.ATTRIBUTE_AV_POSTSCRIPTUM');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TableMap related to this object.
|
||||
* This method is not needed for general use but a specific application could have a need.
|
||||
* @return TableMap
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getTableMap()
|
||||
{
|
||||
return Propel::getServiceContainer()->getDatabaseMap(OrderAttributeCombinationTableMap::DATABASE_NAME)->getTable(OrderAttributeCombinationTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(OrderAttributeCombinationTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(OrderAttributeCombinationTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new OrderAttributeCombinationTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a OrderAttributeCombination or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or OrderAttributeCombination object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doDelete($values, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(OrderAttributeCombinationTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \Thelia\Model\OrderAttributeCombination) { // it's a model object
|
||||
// create criteria based on pk values
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else { // it's a primary key, or an array of pks
|
||||
$criteria = new Criteria(OrderAttributeCombinationTableMap::DATABASE_NAME);
|
||||
$criteria->add(OrderAttributeCombinationTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = OrderAttributeCombinationQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { OrderAttributeCombinationTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { OrderAttributeCombinationTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the order_attribute_combination table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public static function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
return OrderAttributeCombinationQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a OrderAttributeCombination or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or OrderAttributeCombination object containing data that is used to create the INSERT statement.
|
||||
* @param ConnectionInterface $con the ConnectionInterface connection to use
|
||||
* @return mixed The new primary key.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doInsert($criteria, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(OrderAttributeCombinationTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from OrderAttributeCombination object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(OrderAttributeCombinationTableMap::ID) && $criteria->keyContainsValue(OrderAttributeCombinationTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.OrderAttributeCombinationTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = OrderAttributeCombinationQuery::create()->mergeWith($criteria);
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table (I guess, conceivably)
|
||||
$con->beginTransaction();
|
||||
$pk = $query->doInsert($con);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
} // OrderAttributeCombinationTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
OrderAttributeCombinationTableMap::buildTableMap();
|
||||
@@ -57,7 +57,7 @@ class OrderProductTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 12;
|
||||
const NUM_COLUMNS = 18;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class OrderProductTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 12;
|
||||
const NUM_HYDRATE_COLUMNS = 18;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -84,20 +84,30 @@ class OrderProductTableMap extends TableMap
|
||||
*/
|
||||
const PRODUCT_REF = 'order_product.PRODUCT_REF';
|
||||
|
||||
/**
|
||||
* the column name for the PRODUCT_SALE_ELEMENTS_REF field
|
||||
*/
|
||||
const PRODUCT_SALE_ELEMENTS_REF = 'order_product.PRODUCT_SALE_ELEMENTS_REF';
|
||||
|
||||
/**
|
||||
* the column name for the TITLE field
|
||||
*/
|
||||
const TITLE = 'order_product.TITLE';
|
||||
|
||||
/**
|
||||
* the column name for the CHAPO field
|
||||
*/
|
||||
const CHAPO = 'order_product.CHAPO';
|
||||
|
||||
/**
|
||||
* the column name for the DESCRIPTION field
|
||||
*/
|
||||
const DESCRIPTION = 'order_product.DESCRIPTION';
|
||||
|
||||
/**
|
||||
* the column name for the CHAPO field
|
||||
* the column name for the POSTSCRIPTUM field
|
||||
*/
|
||||
const CHAPO = 'order_product.CHAPO';
|
||||
const POSTSCRIPTUM = 'order_product.POSTSCRIPTUM';
|
||||
|
||||
/**
|
||||
* the column name for the QUANTITY field
|
||||
@@ -109,6 +119,26 @@ class OrderProductTableMap extends TableMap
|
||||
*/
|
||||
const PRICE = 'order_product.PRICE';
|
||||
|
||||
/**
|
||||
* the column name for the PROMO_PRICE field
|
||||
*/
|
||||
const PROMO_PRICE = 'order_product.PROMO_PRICE';
|
||||
|
||||
/**
|
||||
* the column name for the WAS_NEW field
|
||||
*/
|
||||
const WAS_NEW = 'order_product.WAS_NEW';
|
||||
|
||||
/**
|
||||
* the column name for the WAS_IN_PROMO field
|
||||
*/
|
||||
const WAS_IN_PROMO = 'order_product.WAS_IN_PROMO';
|
||||
|
||||
/**
|
||||
* the column name for the WEIGHT field
|
||||
*/
|
||||
const WEIGHT = 'order_product.WEIGHT';
|
||||
|
||||
/**
|
||||
* the column name for the TAX field
|
||||
*/
|
||||
@@ -141,12 +171,12 @@ class OrderProductTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'OrderId', 'ProductRef', 'Title', 'Description', 'Chapo', 'Quantity', 'Price', 'Tax', 'Parent', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'productRef', 'title', 'description', 'chapo', 'quantity', 'price', 'tax', 'parent', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(OrderProductTableMap::ID, OrderProductTableMap::ORDER_ID, OrderProductTableMap::PRODUCT_REF, OrderProductTableMap::TITLE, OrderProductTableMap::DESCRIPTION, OrderProductTableMap::CHAPO, OrderProductTableMap::QUANTITY, OrderProductTableMap::PRICE, OrderProductTableMap::TAX, OrderProductTableMap::PARENT, OrderProductTableMap::CREATED_AT, OrderProductTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'PRODUCT_REF', 'TITLE', 'DESCRIPTION', 'CHAPO', 'QUANTITY', 'PRICE', 'TAX', 'PARENT', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'order_id', 'product_ref', 'title', 'description', 'chapo', 'quantity', 'price', 'tax', 'parent', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
|
||||
self::TYPE_PHPNAME => array('Id', 'OrderId', 'ProductRef', 'ProductSaleElementsRef', 'Title', 'Chapo', 'Description', 'Postscriptum', 'Quantity', 'Price', 'PromoPrice', 'WasNew', 'WasInPromo', 'Weight', 'Tax', 'Parent', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'productRef', 'productSaleElementsRef', 'title', 'chapo', 'description', 'postscriptum', 'quantity', 'price', 'promoPrice', 'wasNew', 'wasInPromo', 'weight', 'tax', 'parent', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(OrderProductTableMap::ID, OrderProductTableMap::ORDER_ID, OrderProductTableMap::PRODUCT_REF, OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF, OrderProductTableMap::TITLE, OrderProductTableMap::CHAPO, OrderProductTableMap::DESCRIPTION, OrderProductTableMap::POSTSCRIPTUM, OrderProductTableMap::QUANTITY, OrderProductTableMap::PRICE, OrderProductTableMap::PROMO_PRICE, OrderProductTableMap::WAS_NEW, OrderProductTableMap::WAS_IN_PROMO, OrderProductTableMap::WEIGHT, OrderProductTableMap::TAX, OrderProductTableMap::PARENT, OrderProductTableMap::CREATED_AT, OrderProductTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'PRODUCT_REF', 'PRODUCT_SALE_ELEMENTS_REF', 'TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'QUANTITY', 'PRICE', 'PROMO_PRICE', 'WAS_NEW', 'WAS_IN_PROMO', 'WEIGHT', 'TAX', 'PARENT', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'order_id', 'product_ref', 'product_sale_elements_ref', 'title', 'chapo', 'description', 'postscriptum', 'quantity', 'price', 'promo_price', 'was_new', 'was_in_promo', 'weight', 'tax', 'parent', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -156,12 +186,12 @@ class OrderProductTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'ProductRef' => 2, 'Title' => 3, 'Description' => 4, 'Chapo' => 5, 'Quantity' => 6, 'Price' => 7, 'Tax' => 8, 'Parent' => 9, 'CreatedAt' => 10, 'UpdatedAt' => 11, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'productRef' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'quantity' => 6, 'price' => 7, 'tax' => 8, 'parent' => 9, 'createdAt' => 10, 'updatedAt' => 11, ),
|
||||
self::TYPE_COLNAME => array(OrderProductTableMap::ID => 0, OrderProductTableMap::ORDER_ID => 1, OrderProductTableMap::PRODUCT_REF => 2, OrderProductTableMap::TITLE => 3, OrderProductTableMap::DESCRIPTION => 4, OrderProductTableMap::CHAPO => 5, OrderProductTableMap::QUANTITY => 6, OrderProductTableMap::PRICE => 7, OrderProductTableMap::TAX => 8, OrderProductTableMap::PARENT => 9, OrderProductTableMap::CREATED_AT => 10, OrderProductTableMap::UPDATED_AT => 11, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'PRODUCT_REF' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CHAPO' => 5, 'QUANTITY' => 6, 'PRICE' => 7, 'TAX' => 8, 'PARENT' => 9, 'CREATED_AT' => 10, 'UPDATED_AT' => 11, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'product_ref' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'quantity' => 6, 'price' => 7, 'tax' => 8, 'parent' => 9, 'created_at' => 10, 'updated_at' => 11, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'ProductRef' => 2, 'ProductSaleElementsRef' => 3, 'Title' => 4, 'Chapo' => 5, 'Description' => 6, 'Postscriptum' => 7, 'Quantity' => 8, 'Price' => 9, 'PromoPrice' => 10, 'WasNew' => 11, 'WasInPromo' => 12, 'Weight' => 13, 'Tax' => 14, 'Parent' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'productRef' => 2, 'productSaleElementsRef' => 3, 'title' => 4, 'chapo' => 5, 'description' => 6, 'postscriptum' => 7, 'quantity' => 8, 'price' => 9, 'promoPrice' => 10, 'wasNew' => 11, 'wasInPromo' => 12, 'weight' => 13, 'tax' => 14, 'parent' => 15, 'createdAt' => 16, 'updatedAt' => 17, ),
|
||||
self::TYPE_COLNAME => array(OrderProductTableMap::ID => 0, OrderProductTableMap::ORDER_ID => 1, OrderProductTableMap::PRODUCT_REF => 2, OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF => 3, OrderProductTableMap::TITLE => 4, OrderProductTableMap::CHAPO => 5, OrderProductTableMap::DESCRIPTION => 6, OrderProductTableMap::POSTSCRIPTUM => 7, OrderProductTableMap::QUANTITY => 8, OrderProductTableMap::PRICE => 9, OrderProductTableMap::PROMO_PRICE => 10, OrderProductTableMap::WAS_NEW => 11, OrderProductTableMap::WAS_IN_PROMO => 12, OrderProductTableMap::WEIGHT => 13, OrderProductTableMap::TAX => 14, OrderProductTableMap::PARENT => 15, OrderProductTableMap::CREATED_AT => 16, OrderProductTableMap::UPDATED_AT => 17, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'PRODUCT_REF' => 2, 'PRODUCT_SALE_ELEMENTS_REF' => 3, 'TITLE' => 4, 'CHAPO' => 5, 'DESCRIPTION' => 6, 'POSTSCRIPTUM' => 7, 'QUANTITY' => 8, 'PRICE' => 9, 'PROMO_PRICE' => 10, 'WAS_NEW' => 11, 'WAS_IN_PROMO' => 12, 'WEIGHT' => 13, 'TAX' => 14, 'PARENT' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'product_ref' => 2, 'product_sale_elements_ref' => 3, 'title' => 4, 'chapo' => 5, 'description' => 6, 'postscriptum' => 7, 'quantity' => 8, 'price' => 9, 'promo_price' => 10, 'was_new' => 11, 'was_in_promo' => 12, 'weight' => 13, 'tax' => 14, 'parent' => 15, 'created_at' => 16, 'updated_at' => 17, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -182,12 +212,18 @@ class OrderProductTableMap extends TableMap
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('ORDER_ID', 'OrderId', 'INTEGER', 'order', 'ID', true, null, null);
|
||||
$this->addColumn('PRODUCT_REF', 'ProductRef', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('PRODUCT_REF', 'ProductRef', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('PRODUCT_SALE_ELEMENTS_REF', 'ProductSaleElementsRef', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
|
||||
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
|
||||
$this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
|
||||
$this->addColumn('QUANTITY', 'Quantity', 'FLOAT', true, null, null);
|
||||
$this->addColumn('PRICE', 'Price', 'FLOAT', true, null, null);
|
||||
$this->addColumn('PROMO_PRICE', 'PromoPrice', 'VARCHAR', false, 45, null);
|
||||
$this->addColumn('WAS_NEW', 'WasNew', 'TINYINT', true, null, null);
|
||||
$this->addColumn('WAS_IN_PROMO', 'WasInPromo', 'TINYINT', true, null, null);
|
||||
$this->addColumn('WEIGHT', 'Weight', 'VARCHAR', false, 45, null);
|
||||
$this->addColumn('TAX', 'Tax', 'FLOAT', false, null, null);
|
||||
$this->addColumn('PARENT', 'Parent', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
@@ -200,7 +236,7 @@ class OrderProductTableMap extends TableMap
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('order_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('OrderFeature', '\\Thelia\\Model\\OrderFeature', RelationMap::ONE_TO_MANY, array('id' => 'order_product_id', ), 'CASCADE', 'RESTRICT', 'OrderFeatures');
|
||||
$this->addRelation('OrderAttributeCombination', '\\Thelia\\Model\\OrderAttributeCombination', RelationMap::ONE_TO_MANY, array('id' => 'order_product_id', ), 'CASCADE', 'RESTRICT', 'OrderAttributeCombinations');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
@@ -222,7 +258,7 @@ class OrderProductTableMap extends TableMap
|
||||
{
|
||||
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
OrderFeatureTableMap::clearInstancePool();
|
||||
OrderAttributeCombinationTableMap::clearInstancePool();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -366,11 +402,17 @@ class OrderProductTableMap extends TableMap
|
||||
$criteria->addSelectColumn(OrderProductTableMap::ID);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::ORDER_ID);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::PRODUCT_REF);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::TITLE);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::DESCRIPTION);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::CHAPO);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::DESCRIPTION);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::POSTSCRIPTUM);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::QUANTITY);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::PRICE);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::PROMO_PRICE);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::WAS_NEW);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::WAS_IN_PROMO);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::WEIGHT);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::TAX);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::PARENT);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::CREATED_AT);
|
||||
@@ -379,11 +421,17 @@ class OrderProductTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.ORDER_ID');
|
||||
$criteria->addSelectColumn($alias . '.PRODUCT_REF');
|
||||
$criteria->addSelectColumn($alias . '.PRODUCT_SALE_ELEMENTS_REF');
|
||||
$criteria->addSelectColumn($alias . '.TITLE');
|
||||
$criteria->addSelectColumn($alias . '.DESCRIPTION');
|
||||
$criteria->addSelectColumn($alias . '.CHAPO');
|
||||
$criteria->addSelectColumn($alias . '.DESCRIPTION');
|
||||
$criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
|
||||
$criteria->addSelectColumn($alias . '.QUANTITY');
|
||||
$criteria->addSelectColumn($alias . '.PRICE');
|
||||
$criteria->addSelectColumn($alias . '.PROMO_PRICE');
|
||||
$criteria->addSelectColumn($alias . '.WAS_NEW');
|
||||
$criteria->addSelectColumn($alias . '.WAS_IN_PROMO');
|
||||
$criteria->addSelectColumn($alias . '.WEIGHT');
|
||||
$criteria->addSelectColumn($alias . '.TAX');
|
||||
$criteria->addSelectColumn($alias . '.PARENT');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
|
||||
@@ -3,9 +3,12 @@
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Propel;
|
||||
use Thelia\Core\Event\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Base\Order as BaseOrder;
|
||||
use Thelia\Model\Map\OrderTableMap;
|
||||
use \PDO;
|
||||
|
||||
class Order extends BaseOrder
|
||||
{
|
||||
@@ -19,11 +22,19 @@ class Order extends BaseOrder
|
||||
*/
|
||||
public function preInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::ORDER_SET_REFERENCE, new OrderEvent($this));
|
||||
$this->dispatchEvent(TheliaEvents::ORDER_BEFORE_CREATE, new OrderEvent($this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function postInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::ORDER_AFTER_CREATE, new OrderEvent($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* calculate the total amount
|
||||
*
|
||||
@@ -35,4 +46,171 @@ class Order extends BaseOrder
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* PROPEL SHOULD FIX IT
|
||||
*
|
||||
* Insert the row in the database.
|
||||
*
|
||||
* @param ConnectionInterface $con
|
||||
*
|
||||
* @throws PropelException
|
||||
* @see doSave()
|
||||
*/
|
||||
protected function doInsert(ConnectionInterface $con)
|
||||
{
|
||||
$modifiedColumns = array();
|
||||
$index = 0;
|
||||
|
||||
$this->modifiedColumns[] = OrderTableMap::ID;
|
||||
if (null !== $this->id) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key (' . OrderTableMap::ID . ')');
|
||||
}
|
||||
|
||||
// check the columns in natural order for more readable SQL queries
|
||||
if ($this->isColumnModified(OrderTableMap::ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'ID';
|
||||
}
|
||||
if ($this->isColumnModified(OrderTableMap::REF)) {
|
||||
$modifiedColumns[':p' . $index++] = 'REF';
|
||||
}
|
||||
if ($this->isColumnModified(OrderTableMap::CUSTOMER_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CUSTOMER_ID';
|
||||
}
|
||||
if ($this->isColumnModified(OrderTableMap::INVOICE_ORDER_ADDRESS_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'INVOICE_ORDER_ADDRESS_ID';
|
||||
}
|
||||
if ($this->isColumnModified(OrderTableMap::DELIVERY_ORDER_ADDRESS_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'DELIVERY_ORDER_ADDRESS_ID';
|
||||
}
|
||||
if ($this->isColumnModified(OrderTableMap::INVOICE_DATE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'INVOICE_DATE';
|
||||
}
|
||||
if ($this->isColumnModified(OrderTableMap::CURRENCY_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CURRENCY_ID';
|
||||
}
|
||||
if ($this->isColumnModified(OrderTableMap::CURRENCY_RATE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CURRENCY_RATE';
|
||||
}
|
||||
if ($this->isColumnModified(OrderTableMap::TRANSACTION_REF)) {
|
||||
$modifiedColumns[':p' . $index++] = 'TRANSACTION_REF';
|
||||
}
|
||||
if ($this->isColumnModified(OrderTableMap::DELIVERY_REF)) {
|
||||
$modifiedColumns[':p' . $index++] = 'DELIVERY_REF';
|
||||
}
|
||||
if ($this->isColumnModified(OrderTableMap::INVOICE_REF)) {
|
||||
$modifiedColumns[':p' . $index++] = 'INVOICE_REF';
|
||||
}
|
||||
if ($this->isColumnModified(OrderTableMap::POSTAGE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'POSTAGE';
|
||||
}
|
||||
if ($this->isColumnModified(OrderTableMap::PAYMENT_MODULE_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'PAYMENT_MODULE_ID';
|
||||
}
|
||||
if ($this->isColumnModified(OrderTableMap::DELIVERY_MODULE_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'DELIVERY_MODULE_ID';
|
||||
}
|
||||
if ($this->isColumnModified(OrderTableMap::STATUS_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'STATUS_ID';
|
||||
}
|
||||
if ($this->isColumnModified(OrderTableMap::LANG_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'LANG_ID';
|
||||
}
|
||||
if ($this->isColumnModified(OrderTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||
}
|
||||
if ($this->isColumnModified(OrderTableMap::UPDATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'UPDATED_AT';
|
||||
}
|
||||
|
||||
$db = Propel::getServiceContainer()->getAdapter(OrderTableMap::DATABASE_NAME);
|
||||
|
||||
if ($db->useQuoteIdentifier()) {
|
||||
$tableName = $db->quoteIdentifierTable(OrderTableMap::TABLE_NAME);
|
||||
} else {
|
||||
$tableName = OrderTableMap::TABLE_NAME;
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'INSERT INTO %s (%s) VALUES (%s)',
|
||||
$tableName,
|
||||
implode(', ', $modifiedColumns),
|
||||
implode(', ', array_keys($modifiedColumns))
|
||||
);
|
||||
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
foreach ($modifiedColumns as $identifier => $columnName) {
|
||||
switch ($columnName) {
|
||||
case 'ID':
|
||||
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'REF':
|
||||
$stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'CUSTOMER_ID':
|
||||
$stmt->bindValue($identifier, $this->customer_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'INVOICE_ORDER_ADDRESS_ID':
|
||||
$stmt->bindValue($identifier, $this->invoice_order_address_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'DELIVERY_ORDER_ADDRESS_ID':
|
||||
$stmt->bindValue($identifier, $this->delivery_order_address_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'INVOICE_DATE':
|
||||
$stmt->bindValue($identifier, $this->invoice_date ? $this->invoice_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'CURRENCY_ID':
|
||||
$stmt->bindValue($identifier, $this->currency_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'CURRENCY_RATE':
|
||||
$stmt->bindValue($identifier, $this->currency_rate, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'TRANSACTION_REF':
|
||||
$stmt->bindValue($identifier, $this->transaction_ref, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'DELIVERY_REF':
|
||||
$stmt->bindValue($identifier, $this->delivery_ref, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'INVOICE_REF':
|
||||
$stmt->bindValue($identifier, $this->invoice_ref, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'POSTAGE':
|
||||
$stmt->bindValue($identifier, $this->postage, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'PAYMENT_MODULE_ID':
|
||||
$stmt->bindValue($identifier, $this->payment_module_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'DELIVERY_MODULE_ID':
|
||||
$stmt->bindValue($identifier, $this->delivery_module_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'STATUS_ID':
|
||||
$stmt->bindValue($identifier, $this->status_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'LANG_ID':
|
||||
$stmt->bindValue($identifier, $this->lang_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'CREATED_AT':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'UPDATED_AT':
|
||||
$stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$stmt->execute();
|
||||
} catch (Exception $e) {
|
||||
Propel::log($e->getMessage(), Propel::LOG_ERR);
|
||||
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
|
||||
}
|
||||
|
||||
try {
|
||||
$pk = $con->lastInsertId();
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException('Unable to get autoincrement id.', 0, $e);
|
||||
}
|
||||
$this->setId($pk);
|
||||
|
||||
$this->setNew(false);
|
||||
}
|
||||
}
|
||||
|
||||
10
core/lib/Thelia/Model/OrderAttributeCombination.php
Normal file
10
core/lib/Thelia/Model/OrderAttributeCombination.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\OrderAttributeCombination as BaseOrderAttributeCombination;
|
||||
|
||||
class OrderAttributeCombination extends BaseOrderAttributeCombination
|
||||
{
|
||||
|
||||
}
|
||||
21
core/lib/Thelia/Model/OrderAttributeCombinationQuery.php
Normal file
21
core/lib/Thelia/Model/OrderAttributeCombinationQuery.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\OrderAttributeCombinationQuery as BaseOrderAttributeCombinationQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'order_attribute_combination' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class OrderAttributeCombinationQuery extends BaseOrderAttributeCombinationQuery
|
||||
{
|
||||
|
||||
} // OrderAttributeCombinationQuery
|
||||
24
core/lib/Thelia/Model/OrderProduct.php
Executable file → Normal file
24
core/lib/Thelia/Model/OrderProduct.php
Executable file → Normal file
@@ -2,8 +2,30 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Thelia\Core\Event\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Base\OrderProduct as BaseOrderProduct;
|
||||
|
||||
class OrderProduct extends BaseOrderProduct {
|
||||
class OrderProduct extends BaseOrderProduct
|
||||
{
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::ORDER_PRODUCT_BEFORE_CREATE, new OrderEvent($this->getOrder()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function postInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::ORDER_PRODUCT_AFTER_CREATE, new OrderEvent($this->getOrder()));
|
||||
}
|
||||
}
|
||||
|
||||
3
core/lib/Thelia/Model/OrderProductQuery.php
Executable file → Normal file
3
core/lib/Thelia/Model/OrderProductQuery.php
Executable file → Normal file
@@ -15,6 +15,7 @@ use Thelia\Model\Base\OrderProductQuery as BaseOrderProductQuery;
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class OrderProductQuery extends BaseOrderProductQuery {
|
||||
class OrderProductQuery extends BaseOrderProductQuery
|
||||
{
|
||||
|
||||
} // OrderProductQuery
|
||||
|
||||
@@ -760,14 +760,20 @@ CREATE TABLE `order_product`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`order_id` INTEGER NOT NULL,
|
||||
`product_ref` VARCHAR(255),
|
||||
`product_ref` VARCHAR(255) NOT NULL,
|
||||
`product_sale_elements_ref` VARCHAR(255) NOT NULL,
|
||||
`title` VARCHAR(255),
|
||||
`description` TEXT,
|
||||
`chapo` TEXT,
|
||||
`description` LONGTEXT,
|
||||
`postscriptum` TEXT,
|
||||
`quantity` FLOAT NOT NULL,
|
||||
`price` FLOAT NOT NULL,
|
||||
`promo_price` VARCHAR(45),
|
||||
`was_new` TINYINT NOT NULL,
|
||||
`was_in_promo` TINYINT NOT NULL,
|
||||
`weight` VARCHAR(45),
|
||||
`tax` FLOAT,
|
||||
`parent` INTEGER,
|
||||
`parent` INTEGER COMMENT 'not managed yet',
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
@@ -796,17 +802,23 @@ CREATE TABLE `order_status`
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- order_feature
|
||||
-- order_attribute_combination
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `order_feature`;
|
||||
DROP TABLE IF EXISTS `order_attribute_combination`;
|
||||
|
||||
CREATE TABLE `order_feature`
|
||||
CREATE TABLE `order_attribute_combination`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`order_product_id` INTEGER NOT NULL,
|
||||
`feature_desc` VARCHAR(255),
|
||||
`feature_av_desc` VARCHAR(255),
|
||||
`attribute_title` VARCHAR(255) NOT NULL,
|
||||
`attribute_chapo` TEXT,
|
||||
`attribute_description` LONGTEXT,
|
||||
`attribute_postscriptumn` TEXT,
|
||||
`attribute_av_title` VARCHAR(255) NOT NULL,
|
||||
`attribute_av_chapo` TEXT,
|
||||
`attribute_av_description` LONGTEXT,
|
||||
`attribute_av_postscriptum` TEXT,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
|
||||
@@ -595,14 +595,20 @@
|
||||
<table name="order_product" namespace="Thelia\Model">
|
||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column name="order_id" required="true" type="INTEGER" />
|
||||
<column name="product_ref" size="255" type="VARCHAR" />
|
||||
<column name="product_ref" required="true" size="255" type="VARCHAR" />
|
||||
<column name="product_sale_elements_ref" required="true" size="255" type="VARCHAR" />
|
||||
<column name="title" size="255" type="VARCHAR" />
|
||||
<column name="description" type="LONGVARCHAR" />
|
||||
<column name="chapo" type="LONGVARCHAR" />
|
||||
<column name="description" type="CLOB" />
|
||||
<column name="postscriptum" type="LONGVARCHAR" />
|
||||
<column name="quantity" required="true" type="FLOAT" />
|
||||
<column name="price" required="true" type="FLOAT" />
|
||||
<column name="promo_price" size="45" type="VARCHAR" />
|
||||
<column name="was_new" required="true" type="TINYINT" />
|
||||
<column name="was_in_promo" required="true" type="TINYINT" />
|
||||
<column name="weight" size="45" type="VARCHAR" />
|
||||
<column name="tax" type="FLOAT" />
|
||||
<column name="parent" type="INTEGER" />
|
||||
<column description="not managed yet" name="parent" type="INTEGER" />
|
||||
<foreign-key foreignTable="order" name="fk_order_product_order_id" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="order_id" />
|
||||
</foreign-key>
|
||||
@@ -626,11 +632,17 @@
|
||||
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
|
||||
</behavior>
|
||||
</table>
|
||||
<table name="order_feature" namespace="Thelia\Model">
|
||||
<table name="order_attribute_combination" namespace="Thelia\Model">
|
||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column name="order_product_id" required="true" type="INTEGER" />
|
||||
<column name="feature_desc" size="255" type="VARCHAR" />
|
||||
<column name="feature_av_desc" size="255" type="VARCHAR" />
|
||||
<column name="attribute_title" required="true" size="255" type="VARCHAR" />
|
||||
<column name="attribute_chapo" type="LONGVARCHAR" />
|
||||
<column name="attribute_description" type="CLOB" />
|
||||
<column name="attribute_postscriptumn" type="LONGVARCHAR" />
|
||||
<column name="attribute_av_title" required="true" size="255" type="VARCHAR" />
|
||||
<column name="attribute_av_chapo" type="LONGVARCHAR" />
|
||||
<column name="attribute_av_description" type="CLOB" />
|
||||
<column name="attribute_av_postscriptum" type="LONGVARCHAR" />
|
||||
<foreign-key foreignTable="order_product" name="fk_order_feature_order_product_id" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="order_product_id" />
|
||||
</foreign-key>
|
||||
|
||||
Reference in New Issue
Block a user