Ajout et config du module Chronopost
This commit is contained in:
438
local/modules/ChronopostHomeDelivery/ChronopostHomeDelivery.php
Normal file
438
local/modules/ChronopostHomeDelivery/ChronopostHomeDelivery.php
Normal file
@@ -0,0 +1,438 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace ChronopostHomeDelivery;
|
||||
|
||||
use ChronopostHomeDelivery\Config\ChronopostHomeDeliveryConst;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshippingQuery;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryModeQuery;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPriceQuery;
|
||||
use PDO;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Propel;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Core\HttpFoundation\Session\Session;
|
||||
use Thelia\Install\Database;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\Country;
|
||||
use Thelia\Model\CountryArea;
|
||||
use Thelia\Model\Message;
|
||||
use Thelia\Model\MessageQuery;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
use Thelia\Module\AbstractDeliveryModule;
|
||||
use Thelia\Module\BaseModule;
|
||||
use Thelia\Module\Exception\DeliveryException;
|
||||
|
||||
class ChronopostHomeDelivery extends AbstractDeliveryModule
|
||||
{
|
||||
/** @var string */
|
||||
const DOMAIN_NAME = 'chronopostHomeDelivery';
|
||||
|
||||
const CHRONOPOST_CONFIRMATION_MESSAGE_NAME = 'chronopost_home_delivery_confirmation_message_name';
|
||||
|
||||
/**
|
||||
* @param ConnectionInterface|null $con
|
||||
*/
|
||||
public function postActivation(ConnectionInterface $con = null)
|
||||
{
|
||||
try {
|
||||
/** Security to not erase user configuration on reactivation */
|
||||
ChronopostHomeDeliveryDeliveryModeQuery::create()->findOne();
|
||||
ChronopostHomeDeliveryAreaFreeshippingQuery::create()->findOne();
|
||||
} catch (\Exception $e) {
|
||||
$database = new Database($con->getWrappedConnection());
|
||||
$database->insertSql(null, array(__DIR__ . '/Config/thelia.sql'));
|
||||
}
|
||||
|
||||
/** Default config values */
|
||||
$defaultConfig = [
|
||||
ChronopostHomeDeliveryConst::CHRONOPOST_HOME_DELIVERY_CODE_CLIENT => null,
|
||||
ChronopostHomeDeliveryConst::CHRONOPOST_HOME_DELIVERY_PASSWORD => null,
|
||||
];
|
||||
|
||||
/** Defaults the delivery types status as false */
|
||||
foreach (ChronopostHomeDeliveryConst::getDeliveryTypesStatusKeys() as $statusKey) {
|
||||
$defaultConfig[$statusKey] = false;
|
||||
}
|
||||
|
||||
/** Set the default config values in the DB table if it doesn't exists yet */
|
||||
foreach ($defaultConfig as $key => $value) {
|
||||
if (null === self::getConfigValue($key, null)) {
|
||||
self::setConfigValue($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/** Set the delivery types as not enabled in the ChronopostHomeDeliveryDeliveryMode table
|
||||
* when activating the module for the first time
|
||||
*/
|
||||
foreach (ChronopostHomeDeliveryConst::CHRONOPOST_HOME_DELIVERY_DELIVERY_CODES as $title => $code) {
|
||||
if (null === $this->isDeliveryTypeSet($code)) {
|
||||
$this->setDeliveryType($code, $title);
|
||||
}
|
||||
}
|
||||
|
||||
if (null === MessageQuery::create()->findOneByName(self::CHRONOPOST_CONFIRMATION_MESSAGE_NAME)) {
|
||||
$message = new Message();
|
||||
|
||||
$message
|
||||
->setName(self::CHRONOPOST_CONFIRMATION_MESSAGE_NAME)
|
||||
->setHtmlLayoutFileName('order_shipped.html')
|
||||
->setTextLayoutFileName('order_shipped.txt')
|
||||
->setLocale('en_US')
|
||||
->setTitle('Order send confirmation')
|
||||
->setSubject('Order send confirmation')
|
||||
|
||||
->setLocale('fr_FR')
|
||||
->setTitle('Confirmation d\'envoi de commande')
|
||||
->setSubject('Confirmation d\'envoi de commande')
|
||||
|
||||
->save()
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given delivery type exists in the ChronopostHomeDeliveryDeliveryMode table
|
||||
*
|
||||
* @param $code
|
||||
* @return ChronopostHomeDeliveryDeliveryMode
|
||||
*/
|
||||
public function isDeliveryTypeSet($code)
|
||||
{
|
||||
return ChronopostHomeDeliveryDeliveryModeQuery::create()->findOneByCode($code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a delivery type to the ChronopostHomeDeliveryDeliveryMode table
|
||||
*
|
||||
* @param $code
|
||||
* @param $title
|
||||
*/
|
||||
public function setDeliveryType($code, $title)
|
||||
{
|
||||
$newDeliveryType = new ChronopostHomeDeliveryDeliveryMode();
|
||||
|
||||
try {
|
||||
$newDeliveryType
|
||||
->setCode($code)
|
||||
->setTitle($title)
|
||||
->setFreeshippingActive(false)
|
||||
->setFreeshippingFrom(null)
|
||||
->save();
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if the are asked by the user is in the list of areas added to the shipping zones
|
||||
*
|
||||
* @param Country $country
|
||||
* @return bool
|
||||
*/
|
||||
public function isValidDelivery(Country $country)
|
||||
{
|
||||
if (empty($this->getAllAreasForCountry($country))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$countryAreas = $country->getCountryAreas();
|
||||
$areasArray = [];
|
||||
|
||||
/** @var CountryArea $countryArea */
|
||||
foreach ($countryAreas as $countryArea) {
|
||||
$areasArray[] = $countryArea->getAreaId();
|
||||
}
|
||||
|
||||
$prices = ChronopostHomeDeliveryPriceQuery::create()
|
||||
->filterByAreaId($areasArray)
|
||||
->findOne();
|
||||
|
||||
$freeShipping = ChronopostHomeDeliveryDeliveryModeQuery::create()
|
||||
->findOneByFreeshippingActive(true);
|
||||
|
||||
/** Check if Chronopost delivers in the asked area */
|
||||
if (null !== $prices || null !== $freeShipping) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the delivery type of an ongoing order.
|
||||
*
|
||||
* @param Request|Session $request
|
||||
* @return null|string
|
||||
*/
|
||||
public function getDeliveryType($request)
|
||||
{
|
||||
$deliveryMode = $request->get('chronopost-home-delivery-delivery-mode');
|
||||
|
||||
$deliveryCodes = array_change_key_case(ChronopostHomeDeliveryConst::CHRONOPOST_HOME_DELIVERY_DELIVERY_CODES, CASE_LOWER);
|
||||
|
||||
if ($deliveryMode) {
|
||||
return $deliveryCodes[strtolower($deliveryMode)];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the postage price for a given area, cart weight, cart amount, and delivery type
|
||||
*
|
||||
* @param $areaId
|
||||
* @param $weight
|
||||
* @param int $cartAmount
|
||||
* @param null $deliveryCode
|
||||
* @return int
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function getPostageAmount($areaId, $weight, $cartAmount = 0, $deliveryCode = null)
|
||||
{
|
||||
if (null === $deliveryType = ChronopostHomeDeliveryDeliveryModeQuery::create()->findOneByCode($deliveryCode)) {
|
||||
throw new \Exception("The delivery code given is not supported by the module.");
|
||||
}
|
||||
|
||||
/** Check if freeshipping is activated for this delivery type */
|
||||
try {
|
||||
$freeShipping = $deliveryType->getFreeshippingActive();
|
||||
} catch (\Exception $e) {
|
||||
$freeShipping = false;
|
||||
}
|
||||
|
||||
/** Get the total cart price needed to have a free shipping for all areas, if it exists */
|
||||
try {
|
||||
$freeShippingFrom = $deliveryType->getFreeshippingFrom();
|
||||
} catch (\Exception $er) {
|
||||
$freeShippingFrom = null;
|
||||
}
|
||||
|
||||
/** Set the initial postage price as 0 */
|
||||
$postage = 0;
|
||||
|
||||
/** If free shipping is enabled, skip and return 0 */
|
||||
if (!$freeShipping) {
|
||||
|
||||
/** If a minimum price for free shipping is defined and the amount of the cart reach this limit, return 0. */
|
||||
if (null !== $freeShippingFrom && $freeShippingFrom <= $cartAmount) {
|
||||
return $postage;
|
||||
}
|
||||
|
||||
/** Get the minimum price for free shipping in the area of the order */
|
||||
$cartAmountFreeShipping = ChronopostHomeDeliveryAreaFreeshippingQuery::create()
|
||||
->filterByAreaId($areaId)
|
||||
->filterByDeliveryModeId($deliveryType->getId())
|
||||
->findOne();
|
||||
|
||||
if (null !== $cartAmountFreeShipping) {
|
||||
$cartAmountFreeShipping = $cartAmountFreeShipping->getCartAmount();
|
||||
}
|
||||
|
||||
/** If the cart price is superior to the minimum price for free shipping in the area of the order,
|
||||
* return the postage as free.
|
||||
*/
|
||||
if ($cartAmountFreeShipping !== null && $cartAmountFreeShipping <= $cartAmount) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Search the list of prices and order it in ascending order */
|
||||
$areaPrices = ChronopostHomeDeliveryPriceQuery::create()
|
||||
->filterByDeliveryModeId($deliveryType->getId())
|
||||
->filterByAreaId($areaId)
|
||||
->filterByWeightMax($weight, Criteria::GREATER_EQUAL)
|
||||
->_or()
|
||||
->filterByWeightMax(null)
|
||||
->filterByPriceMax($cartAmount, Criteria::GREATER_EQUAL)
|
||||
->_or()
|
||||
->filterByPriceMax(null)
|
||||
->orderByWeightMax()
|
||||
->orderByPriceMax();
|
||||
|
||||
/** Find the correct postage price for the cart weight and price according to the area and delivery mode in $areaPrices*/
|
||||
$firstPrice = $areaPrices
|
||||
->find()
|
||||
->getFirst()
|
||||
;
|
||||
|
||||
/** If no price was found, return null */
|
||||
if (null === $firstPrice) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$postage = $firstPrice->getPrice();
|
||||
}
|
||||
|
||||
return $postage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the minimum postage price of a list of areas, for a given cart weight, price, and delivery type.
|
||||
*
|
||||
* @param $areaIdArray
|
||||
* @param $cartWeight
|
||||
* @param $cartAmount
|
||||
* @param $deliveryType
|
||||
* @return int|null
|
||||
*/
|
||||
public function getMinPostage($areaIdArray, $cartWeight, $cartAmount, $deliveryType)
|
||||
{
|
||||
$minPostage = null;
|
||||
|
||||
foreach ($areaIdArray as $areaId) {
|
||||
try {
|
||||
$postage = self::getPostageAmount($areaId, $cartWeight, $cartAmount, $deliveryType);
|
||||
if (null === $postage) {
|
||||
continue ;
|
||||
}
|
||||
if ($minPostage === null || $postage < $minPostage) {
|
||||
$minPostage = $postage;
|
||||
if ($minPostage === 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
throw new DeliveryException($ex->getMessage()); //todo : Make a better catch, duh
|
||||
}
|
||||
}
|
||||
|
||||
return $minPostage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of the codes of all delivery types that have been activated
|
||||
* in the backOffice configuration page.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getActivatedDeliveryTypes()
|
||||
{
|
||||
$config = ChronopostHomeDeliveryConst::getConfig();
|
||||
$deliveryTypes = ChronopostHomeDeliveryConst::CHRONOPOST_HOME_DELIVERY_DELIVERY_CODES;
|
||||
$activatedDeliveryTypes = [];
|
||||
|
||||
foreach (ChronopostHomeDeliveryConst::getDeliveryTypesStatusKeys() as $deliveryTypeName => $statusKey) {
|
||||
if (true === (bool)$config[$statusKey]) {
|
||||
$activatedDeliveryTypes[] = $deliveryTypes[$deliveryTypeName];
|
||||
}
|
||||
}
|
||||
|
||||
return $activatedDeliveryTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the postage of an ongoing order, or the minimum expected postage before the user chooses what delivery types he wants.
|
||||
*
|
||||
* @param Country $country
|
||||
* @return float|int|\Thelia\Model\OrderPostage
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function getPostage(Country $country)
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$cartWeight = $request->getSession()->getSessionCart($this->getDispatcher())->getWeight();
|
||||
$cartAmount = $request->getSession()->getSessionCart($this->getDispatcher())->getTaxedAmount($country);
|
||||
|
||||
|
||||
/** Get the delivery type of an ongoing order by looking at the request */
|
||||
$deliveryType = $this->getDeliveryType($request);
|
||||
|
||||
/** If no delivery type was found, search again in the session. */
|
||||
if (null === $deliveryType) {
|
||||
$deliveryType = $this->getDeliveryType($request->getSession());
|
||||
}
|
||||
|
||||
$deliveryArray[] = $deliveryType;
|
||||
|
||||
/** If still no delivery type is found, create an array of all activated delivery types to search
|
||||
* which one has the lowest delivery price.
|
||||
*/
|
||||
if (null === $deliveryType) {
|
||||
$deliveryArray = $this->getActivatedDeliveryTypes();
|
||||
}
|
||||
|
||||
/** Check what areas are covered in the shipping zones defined by the admin */
|
||||
$areaIdArray = $this->getAllAreasForCountry($country);
|
||||
if (empty($areaIdArray)) {
|
||||
throw new DeliveryException("Your delivery country is not covered by Chronopost");
|
||||
}
|
||||
|
||||
$postage = null;
|
||||
|
||||
/** If no delivery type was given, the loop should continue until the postage for each delivery types was
|
||||
* found, then return the minimum one. Otherwise, the loop should stop after the first iteration.
|
||||
*/
|
||||
if ($deliveryArray !== null) {
|
||||
$y = 0;
|
||||
$postage = $this->getMinPostage($areaIdArray, $cartWeight, $cartAmount, $deliveryArray[$y]);
|
||||
|
||||
while (isset($deliveryArray[$y]) && !empty($deliveryArray[$y]) && null !== $deliveryArray[$y]) {
|
||||
if (($postage > ($minPost = $this->getMinPostage($areaIdArray, $cartWeight, $cartAmount, $deliveryArray[$y])) || $postage === null)
|
||||
&& $minPost !== null
|
||||
) {
|
||||
$postage = $minPost;
|
||||
}
|
||||
$y++;
|
||||
}
|
||||
}
|
||||
|
||||
/** If no postage was found, we throw an exception */
|
||||
if (null === $postage) {
|
||||
throw new DeliveryException("Chronopost delivery unavailable for your cart weight or delivery country");
|
||||
}
|
||||
|
||||
/** Get the postage for the shipping zones we've just got */
|
||||
|
||||
///** If delivery is free, set it to a minimal number so the price will still appear. It will be rounded up to 0 */
|
||||
//if (0 == $postage) {
|
||||
// $postage = 0.000001;
|
||||
//}
|
||||
|
||||
return (float)$postage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns ids of area containing this country and covers by this module
|
||||
* @param Country $country
|
||||
* @return array Area ids
|
||||
*/
|
||||
public function getAllAreasForCountry(Country $country)
|
||||
{
|
||||
$areaArray = [];
|
||||
|
||||
$sql = "SELECT ca.area_id as area_id FROM country_area ca
|
||||
INNER JOIN area_delivery_module adm ON (ca.area_id = adm.area_id AND adm.delivery_module_id = :p0)
|
||||
WHERE ca.country_id = :p1";
|
||||
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $this->getModuleModel()->getId(), PDO::PARAM_INT);
|
||||
$stmt->bindValue(':p1', $country->getId(), PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$areaArray[] = $row['area_id'];
|
||||
}
|
||||
|
||||
return $areaArray;
|
||||
}
|
||||
|
||||
public function getDeliveryMode()
|
||||
{
|
||||
return "delivery";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Config;
|
||||
|
||||
|
||||
use ChronopostHomeDelivery\ChronopostHomeDelivery;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
class ChronopostHomeDeliveryConst
|
||||
{
|
||||
/** Delivery types Name => Code */
|
||||
const CHRONOPOST_HOME_DELIVERY_DELIVERY_CODES = [
|
||||
"Chrono13" => "1",
|
||||
"Chrono18" => "16",
|
||||
"ChronoExpress" => "17",
|
||||
"ChronoClassic" => "44",
|
||||
"Fresh13" => "2R",
|
||||
"Chrono10" => "2"
|
||||
];
|
||||
/** @TODO Add other delivery types */
|
||||
|
||||
/** Chronopost shipper identifiers */
|
||||
const CHRONOPOST_HOME_DELIVERY_CODE_CLIENT = "chronopost_home_delivery_code";
|
||||
const CHRONOPOST_HOME_DELIVERY_PASSWORD = "chronopost_home_delivery_password";
|
||||
|
||||
/** WSDL for the Chronopost Shipping Service */
|
||||
const CHRONOPOST_HOME_DELIVERY_SHIPPING_SERVICE_WSDL = "https://ws.chronopost.fr/shipping-cxf/ShippingServiceWS?wsdl";
|
||||
//const CHRONOPOST_HOME_DELIVERY_RELAY_SEARCH_SERVICE_WSDL = "https://ws.chronopost.fr/recherchebt-ws-cxf/PointRelaisServiceWS?wsdl";
|
||||
const CHRONOPOST_HOME_DELIVERY_COORDINATES_SERVICE_WSDL = "https://ws.chronopost.fr/rdv-cxf/services/CreneauServiceWS?wsdl";
|
||||
/** @TODO Add other WSDL config key */
|
||||
|
||||
/** @Unused */
|
||||
const CHRONOPOST_HOME_DELIVERY_TRACKING_URL = "https://ws.chronopost.fr/tracking-cxf/TrackingServiceWS/trackSkybillV2";
|
||||
|
||||
|
||||
/** @Unused */
|
||||
public function getTrackingURL()
|
||||
{
|
||||
$URL = self::CHRONOPOST_HOME_DELIVERY_TRACKING_URL;
|
||||
$URL .= "language=" . "fr_FR"; //todo Make locale a variable
|
||||
$URL .= "&skybillNumber=" . "XXX"; //todo Use real skybill Number -> getTrackingURL(variable)
|
||||
|
||||
return $URL;
|
||||
}
|
||||
|
||||
/** Local static config value, used to limit the number of calls to the DB */
|
||||
protected static $config = null;
|
||||
|
||||
/**
|
||||
* Set the local static config value
|
||||
*/
|
||||
public static function setConfig()
|
||||
{
|
||||
$config = [
|
||||
/** Chronopost basic informations */
|
||||
self::CHRONOPOST_HOME_DELIVERY_CODE_CLIENT => ChronopostHomeDelivery::getConfigValue(self::CHRONOPOST_HOME_DELIVERY_CODE_CLIENT),
|
||||
self::CHRONOPOST_HOME_DELIVERY_PASSWORD => ChronopostHomeDelivery::getConfigValue(self::CHRONOPOST_HOME_DELIVERY_PASSWORD),
|
||||
|
||||
/** END */
|
||||
];
|
||||
|
||||
/** Delivery types */
|
||||
foreach (self::getDeliveryTypesStatusKeys() as $statusKey) {
|
||||
$config[$statusKey] = ChronopostHomeDelivery::getConfigValue($statusKey);
|
||||
}
|
||||
|
||||
/** Set the local static config value */
|
||||
self::$config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the local static config value or the value of a given parameter
|
||||
*
|
||||
* @param null $parameter
|
||||
* @return array|mixed|null
|
||||
*/
|
||||
public static function getConfig($parameter = null)
|
||||
{
|
||||
/** Check if the local config value is set, and set it if it's not */
|
||||
if (null === self::$config) {
|
||||
self::setConfig();
|
||||
}
|
||||
|
||||
/** Return the value of the config parameter given, or null if it wasn't set */
|
||||
if (null !== $parameter) {
|
||||
return (isset(self::$config[$parameter])) ? self::$config[$parameter] : null;
|
||||
}
|
||||
|
||||
/** Return the local static config value */
|
||||
return self::$config;
|
||||
}
|
||||
|
||||
/** Status keys of the delivery types.
|
||||
* @return array
|
||||
*/
|
||||
public static function getDeliveryTypesStatusKeys()
|
||||
{
|
||||
$statusKeys = [];
|
||||
|
||||
foreach (self::CHRONOPOST_HOME_DELIVERY_DELIVERY_CODES as $name => $code) {
|
||||
$statusKeys[$name] = 'chronopost_home_delivery_delivery_' . strtolower($name) . '_status';
|
||||
}
|
||||
|
||||
return $statusKeys;
|
||||
}
|
||||
}
|
||||
51
local/modules/ChronopostHomeDelivery/Config/config.xml
Normal file
51
local/modules/ChronopostHomeDelivery/Config/config.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<config xmlns="http://thelia.net/schema/dic/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
<loops>
|
||||
<loop class="ChronopostHomeDelivery\Loop\ChronopostHomeDeliveryLoop" name="chronopost.home.delivery" />
|
||||
<loop class="ChronopostHomeDelivery\Loop\ChronopostHomeDeliveryDeliveryMode" name="chronopost.home.delivery.delivery.mode" />
|
||||
<loop class="ChronopostHomeDelivery\Loop\ChronopostHomeDeliveryAreaFreeshipping" name="chronopost.home.delivery.area.freeshipping" />
|
||||
</loops>
|
||||
|
||||
<forms>
|
||||
<form name="chronopost_home_delivery_configuration_form" class="ChronopostHomeDelivery\Form\ChronopostHomeDeliveryConfigurationForm" />
|
||||
<form name="chronopost.home.delivery.freeshipping.form" class="ChronopostHomeDelivery\Form\ChronopostHomeDeliveryFreeShippingForm" />
|
||||
<form name="chronopost.home.delivery.add.price.form" class="ChronopostHomeDelivery\Form\ChronopostHomeDeliveryAddPriceForm" />
|
||||
<form name="chronopost.home.delivery.update.price.form" class="ChronopostHomeDelivery\Form\ChronopostHomeDeliveryUpdatePriceForm" />
|
||||
</forms>
|
||||
|
||||
<services>
|
||||
<service id="hook.order.module.chronopost.home.delivery" class="ChronopostHomeDelivery\EventListeners\SetDeliveryType" scope="request">
|
||||
<argument type="service" id="request"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
<service id="chronopost.home.delivery.deliverytype.smarty.plugin" class="ChronopostHomeDelivery\Smarty\Plugins\ChronopostHomeDeliveryDeliveryType" scope="request">
|
||||
<argument type="service" id="request" />
|
||||
<argument type="service" id="event_dispatcher"/>
|
||||
<tag name="thelia.parser.register_plugin" />
|
||||
</service>
|
||||
<service id="api.chronopost.home.delivery" class="ChronopostHomeDelivery\EventListeners\APIListener" scope="request">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
<service id="chronopost.home.delivery.notification.mail" class="ChronopostHomeDelivery\EventListeners\ShippingNotificationSender">
|
||||
<argument type="service" id="thelia.parser" />
|
||||
<argument type="service" id="mailer"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<hooks>
|
||||
<hook id="chronopost.home.delivery.hook.back" class="ChronopostHomeDelivery\Hook\BackHook">
|
||||
<tag name="hook.event_listener" event="module.configuration" type="back" method="onModuleConfiguration" />
|
||||
<tag name="hook.event_listener" event="module.config-js" type="back" method="onModuleConfigJs" />
|
||||
</hook>
|
||||
<hook id="chronopost.home.delivery.hook.front" class="ChronopostHomeDelivery\Hook\FrontHook" scope="request">
|
||||
<tag name="hook.event_listener" event="order-delivery.extra" />
|
||||
</hook>
|
||||
</hooks>
|
||||
|
||||
</config>
|
||||
30
local/modules/ChronopostHomeDelivery/Config/module.xml
Normal file
30
local/modules/ChronopostHomeDelivery/Config/module.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module xmlns="http://thelia.net/schema/dic/module"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_2.xsd">
|
||||
<fullnamespace>ChronopostHomeDelivery\ChronopostHomeDelivery</fullnamespace>
|
||||
<descriptive locale="en_US">
|
||||
<title>ChronopostHomeDelivery</title>
|
||||
<subtitle>Chronopost home delivery module</subtitle>
|
||||
</descriptive>
|
||||
<descriptive locale="fr_FR">
|
||||
<title>ChronopostHomeDelivery</title>
|
||||
<subtitle>Module de livraison à domicile Chronopost</subtitle>
|
||||
</descriptive>
|
||||
<languages>
|
||||
<language>en_US</language>
|
||||
<language>fr_FR</language>
|
||||
</languages>
|
||||
<version>1.0.4</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Thelia</name>
|
||||
<email>info@thelia.net</email>
|
||||
</author>
|
||||
</authors>
|
||||
<type>classic</type>
|
||||
<thelia>2.3.4</thelia>
|
||||
<stability>other</stability>
|
||||
<mandatory>0</mandatory>
|
||||
<hidden>0</hidden>
|
||||
</module>
|
||||
44
local/modules/ChronopostHomeDelivery/Config/routing.xml
Normal file
44
local/modules/ChronopostHomeDelivery/Config/routing.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="chronopost.home.delivery.config.save" path="/admin/module/ChronopostHomeDelivery/config" methods="post">
|
||||
<default key="_controller">ChronopostHomeDelivery\Controller\ChronopostHomeDeliveryBackOfficeController::saveAction</default>
|
||||
</route>
|
||||
|
||||
<route id="chronopost.home.delivery.configShipper.save" path="/admin/module/ChronopostHomeDelivery/configShipper" methods="post">
|
||||
<default key="_controller">ChronopostHomeDelivery\Controller\ChronopostHomeDeliveryBackOfficeController::saveActionShipper</default>
|
||||
</route>
|
||||
|
||||
<route id="chronopost.home.delivery.save.label" path="/admin/module/ChronopostHomeDelivery/saveLabel">
|
||||
<default key="_controller">ChronopostHomeDelivery\Controller\ChronopostHomeDeliveryBackOfficeController::saveLabel</default>
|
||||
</route>
|
||||
|
||||
|
||||
<route id="chronopost.home.delivery.toggle.freeshipping" path="/admin/module/chronopost-home-delivery/freeshipping" methods="post">
|
||||
<default key="_controller">ChronopostHomeDelivery\Controller\ChronopostHomeDeliveryFreeShippingController::toggleFreeShippingActivation</default>
|
||||
</route>
|
||||
|
||||
<route id="chronopost.home.delivery.edit.freeshippingfrom" path="/admin/module/chronopost-home-delivery/freeshipping_from" methods="post">
|
||||
<default key="_controller">ChronopostHomeDelivery\Controller\ChronopostHomeDeliveryFreeShippingController::setFreeShippingFrom</default>
|
||||
</route>
|
||||
|
||||
<route id="chronopost.home.delivery.edit.areafreeshipping" path="/admin/module/chronopost-home-delivery/area_freeshipping" methods="post">
|
||||
<default key="_controller">ChronopostHomeDelivery\Controller\ChronopostHomeDeliveryFreeShippingController::setAreaFreeShipping</default>
|
||||
</route>
|
||||
|
||||
|
||||
<route id="chronopost.home.delivery.add.price" path="/admin/module/chronopost-home-delivery/slice/save" methods="post">
|
||||
<default key="_controller">ChronopostHomeDelivery\Controller\ChronopostHomeDeliverySliceController::saveSliceAction</default>
|
||||
</route>
|
||||
<route id="chronopost.home.delivery.update.price" path="/admin/module/chronopost-home-delivery/slice/delete" methods="post">
|
||||
<default key="_controller">ChronopostHomeDelivery\Controller\ChronopostHomeDeliverySliceController::deleteSliceAction</default>
|
||||
</route>
|
||||
|
||||
<route id="chronopost.home.delivery.get.coordinates" path="/admin/module/chronopost-home-delivery/coordinates">
|
||||
<default key="_controller">ChronopostHomeDelivery\Controller\ChronopostHomeDeliveryRelayController::findByAddress</default>
|
||||
</route>
|
||||
|
||||
</routes>
|
||||
58
local/modules/ChronopostHomeDelivery/Config/schema.xml
Normal file
58
local/modules/ChronopostHomeDelivery/Config/schema.xml
Normal file
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<database defaultIdMethod="native" name="thelia" namespace="ChronopostHomeDelivery\Model"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../vendor/propel/propel/resources/xsd/database.xsd" >
|
||||
|
||||
<table name="chronopost_home_delivery_order">
|
||||
<column name="id" autoIncrement="true" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column name="order_id" required="true" type="INTEGER" />
|
||||
|
||||
<column name="delivery_type" type="LONGVARCHAR" />
|
||||
<column name="delivery_code" type="LONGVARCHAR" />
|
||||
<column name="label_directory" type="LONGVARCHAR" />
|
||||
<column name="label_number" type="LONGVARCHAR" />
|
||||
|
||||
<foreign-key foreignTable="order" name="fk_chronopost_home_delivery_order_order_id" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="order_id" />
|
||||
</foreign-key>
|
||||
</table>
|
||||
|
||||
<table name="chronopost_home_delivery_delivery_mode">
|
||||
<column name="id" primaryKey="true" autoIncrement="true" required="true" type="INTEGER" />
|
||||
<column name="title" size="255" type="VARCHAR"/>
|
||||
<column name="code" size="55" type="VARCHAR" required="true"/>
|
||||
<column name="freeshipping_active" type="BOOLEAN"/>
|
||||
<column name="freeshipping_from" type="FLOAT"/>
|
||||
</table>
|
||||
|
||||
<table name="chronopost_home_delivery_price">
|
||||
<column name="id" primaryKey="true" autoIncrement="true" required="true" type="INTEGER" />
|
||||
<column name="area_id" required="true" type="INTEGER" />
|
||||
<column name="delivery_mode_id" required="true" type="INTEGER" />
|
||||
<column name="weight_max" type="FLOAT" />
|
||||
<column name="price_max" type="FLOAT" />
|
||||
<column name="franco_min_price" type="FLOAT" />
|
||||
<column name="price" required="true" type="FLOAT" />
|
||||
<foreign-key foreignTable="area" name="fk_chronopost_home_delivery_price_area_id" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="area_id" />
|
||||
</foreign-key>
|
||||
<foreign-key foreignTable="chronopost_home_delivery_delivery_mode" name="fk_chronopost_home_delivery_price_delivery_mode_id" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="delivery_mode_id" />
|
||||
</foreign-key>
|
||||
</table>
|
||||
|
||||
<table name="chronopost_home_delivery_area_freeshipping">
|
||||
<column name="id" primaryKey="true" autoIncrement="true" required="true" type="INTEGER" />
|
||||
<column name="area_id" required="true" type="INTEGER" />
|
||||
<column name="delivery_mode_id" required="true" type="INTEGER" />
|
||||
<column name="cart_amount" defaultValue="0.000000" scale="6" size="16" type="DECIMAL" />
|
||||
<foreign-key foreignTable="area" name="fk_chronopost_home_delivery_area_freeshipping_area_id" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="area_id" />
|
||||
</foreign-key>
|
||||
<foreign-key foreignTable="chronopost_home_delivery_delivery_mode" name="fk_chronopost_home_delivery_area_freeshipping_delivery_mode_id" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="delivery_mode_id" />
|
||||
</foreign-key>
|
||||
</table>
|
||||
|
||||
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
|
||||
</database>
|
||||
2
local/modules/ChronopostHomeDelivery/Config/sqldb.map
Normal file
2
local/modules/ChronopostHomeDelivery/Config/sqldb.map
Normal file
@@ -0,0 +1,2 @@
|
||||
# Sqlfile -> Database map
|
||||
thelia.sql=thelia
|
||||
103
local/modules/ChronopostHomeDelivery/Config/thelia.sql
Normal file
103
local/modules/ChronopostHomeDelivery/Config/thelia.sql
Normal file
@@ -0,0 +1,103 @@
|
||||
|
||||
# This is a fix for InnoDB in MySQL >= 4.1.x
|
||||
# It "suspends judgement" for fkey relationships until are tables are set.
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- chronopost_home_delivery_order
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `chronopost_home_delivery_order`;
|
||||
|
||||
CREATE TABLE `chronopost_home_delivery_order`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`order_id` INTEGER NOT NULL,
|
||||
`delivery_type` TEXT,
|
||||
`delivery_code` TEXT,
|
||||
`label_directory` TEXT,
|
||||
`label_number` TEXT,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `FI_chronopost_home_delivery_order_order_id` (`order_id`),
|
||||
CONSTRAINT `fk_chronopost_home_delivery_order_order_id`
|
||||
FOREIGN KEY (`order_id`)
|
||||
REFERENCES `order` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- chronopost_home_delivery_delivery_mode
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `chronopost_home_delivery_delivery_mode`;
|
||||
|
||||
CREATE TABLE `chronopost_home_delivery_delivery_mode`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`title` VARCHAR(255),
|
||||
`code` VARCHAR(55) NOT NULL,
|
||||
`freeshipping_active` TINYINT(1),
|
||||
`freeshipping_from` FLOAT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- chronopost_home_delivery_price
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `chronopost_home_delivery_price`;
|
||||
|
||||
CREATE TABLE `chronopost_home_delivery_price`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`area_id` INTEGER NOT NULL,
|
||||
`delivery_mode_id` INTEGER NOT NULL,
|
||||
`weight_max` FLOAT,
|
||||
`price_max` FLOAT,
|
||||
`franco_min_price` FLOAT,
|
||||
`price` FLOAT NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `FI_chronopost_home_delivery_price_area_id` (`area_id`),
|
||||
INDEX `FI_chronopost_home_delivery_price_delivery_mode_id` (`delivery_mode_id`),
|
||||
CONSTRAINT `fk_chronopost_home_delivery_price_area_id`
|
||||
FOREIGN KEY (`area_id`)
|
||||
REFERENCES `area` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `fk_chronopost_home_delivery_price_delivery_mode_id`
|
||||
FOREIGN KEY (`delivery_mode_id`)
|
||||
REFERENCES `chronopost_home_delivery_delivery_mode` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- chronopost_home_delivery_area_freeshipping
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `chronopost_home_delivery_area_freeshipping`;
|
||||
|
||||
CREATE TABLE `chronopost_home_delivery_area_freeshipping`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`area_id` INTEGER NOT NULL,
|
||||
`delivery_mode_id` INTEGER NOT NULL,
|
||||
`cart_amount` DECIMAL(16,6) DEFAULT 0.000000,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `FI_chronopost_home_delivery_area_freeshipping_area_id` (`area_id`),
|
||||
INDEX `FI_chronopost_home_delivery_area_freeshipping_delivery_mode_id` (`delivery_mode_id`),
|
||||
CONSTRAINT `fk_chronopost_home_delivery_area_freeshipping_area_id`
|
||||
FOREIGN KEY (`area_id`)
|
||||
REFERENCES `area` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `fk_chronopost_home_delivery_area_freeshipping_delivery_mode_id`
|
||||
FOREIGN KEY (`delivery_mode_id`)
|
||||
REFERENCES `chronopost_home_delivery_delivery_mode` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
# This restores the fkey checks, after having unset them earlier
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Controller;
|
||||
|
||||
|
||||
use ChronopostHomeDelivery\ChronopostHomeDelivery;
|
||||
use ChronopostHomeDelivery\Config\ChronopostHomeDeliveryConst;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class ChronopostHomeDeliveryBackOfficeController extends BaseAdminController
|
||||
{
|
||||
/**
|
||||
* Render the module config page
|
||||
*
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function viewAction($tab)
|
||||
{
|
||||
return $this->render(
|
||||
'module-configure',
|
||||
[
|
||||
'module_code' => 'ChronopostHomeDelivery',
|
||||
'current_tab' => $tab,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save configuration form - Chronopost informations
|
||||
*
|
||||
* @return mixed|null|\Symfony\Component\HttpFoundation\Response|\Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function saveAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth([AdminResources::MODULE], 'ChronopostHomeDelivery', AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$form = $this->createForm("chronopost_home_delivery_configuration_form");
|
||||
|
||||
try {
|
||||
$data = $this->validateForm($form)->getData();
|
||||
|
||||
/** Basic informations */
|
||||
ChronopostHomeDelivery::setConfigValue(ChronopostHomeDeliveryConst::CHRONOPOST_HOME_DELIVERY_CODE_CLIENT, $data[ChronopostHomeDeliveryConst::CHRONOPOST_HOME_DELIVERY_CODE_CLIENT]);
|
||||
ChronopostHomeDelivery::setConfigValue(ChronopostHomeDeliveryConst::CHRONOPOST_HOME_DELIVERY_PASSWORD, $data[ChronopostHomeDeliveryConst::CHRONOPOST_HOME_DELIVERY_PASSWORD]);
|
||||
|
||||
/** Delivery types */
|
||||
foreach (ChronopostHomeDeliveryConst::getDeliveryTypesStatusKeys() as $statusKey) {
|
||||
ChronopostHomeDelivery::setConfigValue($statusKey, $data[$statusKey]);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->setupFormErrorContext(
|
||||
Translator::getInstance()->trans(
|
||||
"Error",
|
||||
[],
|
||||
ChronopostHomeDelivery::DOMAIN_NAME
|
||||
),
|
||||
$e->getMessage(),
|
||||
$form
|
||||
);
|
||||
|
||||
return $this->viewAction('configure');
|
||||
}
|
||||
|
||||
return $this->generateSuccessRedirect($form);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Controller;
|
||||
|
||||
|
||||
use ChronopostHomeDelivery\Form\ChronopostHomeDeliveryFreeShippingForm;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshippingQuery;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryModeQuery;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Model\AreaQuery;
|
||||
|
||||
class ChronopostHomeDeliveryFreeShippingController extends BaseAdminController
|
||||
{
|
||||
/**
|
||||
* Toggle free shipping for the delivery type being edited.
|
||||
*
|
||||
* @return mixed|null|Response|static
|
||||
*/
|
||||
public function toggleFreeShippingActivation()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), array('ChronopostHomeDelivery'), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$form = new ChronopostHomeDeliveryFreeShippingForm($this->getRequest());
|
||||
$response = null;
|
||||
|
||||
try {
|
||||
$vform = $this->validateForm($form);
|
||||
$freeshipping = $vform->get('freeshipping')->getData();
|
||||
$deliveryModeId = $vform->get('delivery_mode')->getData();
|
||||
|
||||
$deliveryMode = ChronopostHomeDeliveryDeliveryModeQuery::create()->findOneById($deliveryModeId);
|
||||
$deliveryMode
|
||||
->setFreeshippingActive($freeshipping)
|
||||
->save();
|
||||
$response = Response::create('');
|
||||
} catch (\Exception $e) {
|
||||
$response = JsonResponse::create(array("error" => $e->getMessage()), 500);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed|Response
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function setFreeShippingFrom()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), array('ChronopostHomeDelivery'), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$data = $this->getRequest()->request;
|
||||
$deliveryMode = ChronopostHomeDeliveryDeliveryModeQuery::create()->findOneById($data->get('delivery-mode'));
|
||||
|
||||
$price = $data->get("price") === "" ? null : $data->get("price");
|
||||
|
||||
if ($price < 0) {
|
||||
$price = null;
|
||||
}
|
||||
$deliveryMode->setFreeshippingFrom($price)
|
||||
->save();
|
||||
|
||||
return $this->generateRedirectFromRoute(
|
||||
"admin.module.configure",
|
||||
array(),
|
||||
array(
|
||||
'current_tab'=>'prices_slices_tab_' . $data->get('delivery-mode'),
|
||||
'module_code'=>"ChronopostHomeDelivery",
|
||||
'_controller' => 'Thelia\\Controller\\Admin\\ModuleController::configureAction',
|
||||
'price_error_id' => null,
|
||||
'price_error' => null
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set free shipping for a given area of the delivery type being edited.
|
||||
*
|
||||
* @return mixed|null|Response
|
||||
*/
|
||||
public function setAreaFreeShipping()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), array('ChronopostHomeDelivery'), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$data = $this->getRequest()->request;
|
||||
|
||||
try {
|
||||
$data = $this->getRequest()->request;
|
||||
|
||||
$chronopostAreaId = $data->get('area-id');
|
||||
$chronopostDeliveryId = $data->get('delivery-mode');
|
||||
$cartAmount = $data->get("cart-amount");
|
||||
|
||||
if ($cartAmount < 0 || $cartAmount === '') {
|
||||
$cartAmount = null;
|
||||
}
|
||||
|
||||
$areaQuery = AreaQuery::create()->findOneById($chronopostAreaId);
|
||||
if (null === $areaQuery) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$deliveryModeQuery = ChronopostHomeDeliveryDeliveryModeQuery::create()->findOneById($chronopostDeliveryId);
|
||||
if (null === $deliveryModeQuery) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$chronopostFreeShipping = new ChronopostHomeDeliveryAreaFreeshipping();
|
||||
$chronopostFreeShippingQuery = ChronopostHomeDeliveryAreaFreeshippingQuery::create()
|
||||
->filterByAreaId($chronopostAreaId)
|
||||
->filterByDeliveryModeId($chronopostDeliveryId)
|
||||
->findOne();
|
||||
|
||||
if (null === $chronopostFreeShippingQuery) {
|
||||
$chronopostFreeShipping
|
||||
->setAreaId($chronopostAreaId)
|
||||
->setDeliveryModeId($chronopostDeliveryId)
|
||||
->setCartAmount($cartAmount)
|
||||
->save();
|
||||
}
|
||||
|
||||
$cartAmountQuery = ChronopostHomeDeliveryAreaFreeshippingQuery::create()
|
||||
->filterByAreaId($chronopostAreaId)
|
||||
->filterByDeliveryModeId($chronopostDeliveryId)
|
||||
->findOneOrCreate()
|
||||
->setCartAmount($cartAmount)
|
||||
->save();
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return $this->generateRedirectFromRoute(
|
||||
"admin.module.configure",
|
||||
array(),
|
||||
array(
|
||||
'current_tab' => 'prices_slices_tab_' . $data->get('delivery-mode'),
|
||||
'module_code' => "ChronopostHomeDelivery",
|
||||
'_controller' => 'Thelia\\Controller\\Admin\\ModuleController::configureAction',
|
||||
'price_error_id' => null,
|
||||
'price_error' => null
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Controller;
|
||||
|
||||
|
||||
use ChronopostHomeDelivery\ChronopostHomeDelivery;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPriceQuery;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
|
||||
class ChronopostHomeDeliverySliceController extends BaseAdminController
|
||||
{
|
||||
/**
|
||||
* Save/Create a price slice in the delivery type being edited
|
||||
*
|
||||
* @return mixed|null|\Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function saveSliceAction()
|
||||
{
|
||||
$response = $this->checkAuth([], ['chronopost'], AccessManager::UPDATE);
|
||||
|
||||
if (null !== $response) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
$responseData = [
|
||||
"sucess" => false,
|
||||
"message" => '',
|
||||
"slice" => null,
|
||||
];
|
||||
|
||||
$messages = [];
|
||||
$response = null;
|
||||
|
||||
try {
|
||||
$requestData = $this->getRequest()->request;
|
||||
|
||||
if (0 !== $id = (int)($requestData->get('id', 0))) {
|
||||
$slice = ChronopostHomeDeliveryPriceQuery::create()->findPk($id);
|
||||
} else {
|
||||
$slice = new ChronopostHomeDeliveryPrice();
|
||||
}
|
||||
|
||||
if (0 !== $areaId = (int)($requestData->get('area', 0))) {
|
||||
$slice->setAreaId($areaId);
|
||||
} else {
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
"The area is not valid",
|
||||
[],
|
||||
ChronopostHomeDelivery::DOMAIN_NAME
|
||||
);
|
||||
}
|
||||
|
||||
if (0 !== $deliveryMode = (int)($requestData->get("deliveryModeId", 0))) {
|
||||
$slice->setDeliveryModeId($deliveryMode);
|
||||
} else {
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
"The delivery type is not valid",
|
||||
[],
|
||||
ChronopostHomeDelivery::DOMAIN_NAME
|
||||
);
|
||||
}
|
||||
|
||||
$requestPriceMax = $requestData->get('priceMax', null);
|
||||
$requestWeightMax = $requestData->get('weightMax', null);
|
||||
|
||||
if (empty($requestPriceMax) && empty($requestWeightMax)) {
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
'You must specify at least a price max or a weight max value.',
|
||||
[],
|
||||
ChronopostHomeDelivery::DOMAIN_NAME
|
||||
);
|
||||
} else {
|
||||
if (!empty($requestPriceMax)) {
|
||||
$priceMax = $this->getFloatVal($requestPriceMax);
|
||||
if (0 < $priceMax) {
|
||||
$slice->setPriceMax($priceMax);
|
||||
} else {
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
'The price max value is not valid',
|
||||
[],
|
||||
ChronopostHomeDelivery::DOMAIN_NAME
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$slice->setPriceMax(null);
|
||||
}
|
||||
|
||||
if (!empty($requestWeightMax)) {
|
||||
$weightMax = $this->getFloatVal($requestWeightMax);
|
||||
if (0 < $weightMax) {
|
||||
$slice->setWeightMax($weightMax);
|
||||
} else {
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
'The weight max value is not valid',
|
||||
[],
|
||||
ChronopostHomeDelivery::DOMAIN_NAME
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$slice->setWeightMax(null);
|
||||
}
|
||||
}
|
||||
|
||||
$price = $this->getFloatVal($requestData->get('price', 0));
|
||||
if (0 <= $price) {
|
||||
$slice->setPrice($price);
|
||||
} else {
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
'The price value is not valid',
|
||||
[],
|
||||
ChronopostHomeDelivery::DOMAIN_NAME
|
||||
);
|
||||
}
|
||||
|
||||
if (0 === count($messages)) {
|
||||
$slice->save();
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
'Your slice has been saved',
|
||||
[],
|
||||
ChronopostHomeDelivery::DOMAIN_NAME
|
||||
);
|
||||
|
||||
$responseData['success'] = true;
|
||||
$responseData['slice'] = $slice->toArray(TableMap::TYPE_STUDLYPHPNAME);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$message[] = $e->getMessage();
|
||||
}
|
||||
|
||||
$responseData['message'] = $messages;
|
||||
|
||||
return $this->jsonResponse(json_encode($responseData));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $val
|
||||
* @param int $default
|
||||
* @return float|int|mixed
|
||||
*/
|
||||
protected function getFloatVal($val, $default = -1)
|
||||
{
|
||||
if (preg_match("#^([0-9\.,]+)$#", $val, $match)) {
|
||||
$val = $match[0];
|
||||
if (strstr($val, ",")) {
|
||||
$val = str_replace(".", "", $val);
|
||||
$val = str_replace(",", ".", $val);
|
||||
}
|
||||
$val = (float)($val);
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a price slice in the delivery type being edited
|
||||
*
|
||||
* @return mixed|null|\Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function deleteSliceAction()
|
||||
{
|
||||
$response = $this->checkAuth([], ['chronopost'], AccessManager::DELETE);
|
||||
|
||||
if (null !== $response) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
$responseData = [
|
||||
"success" => false,
|
||||
"message" => '',
|
||||
"slice" => null
|
||||
];
|
||||
|
||||
$response = null;
|
||||
|
||||
try {
|
||||
$requestData = $this->getRequest()->request;
|
||||
|
||||
if (0 !== $id = (int)($requestData->get('id', 0))) {
|
||||
$slice = ChronopostHomeDeliveryPriceQuery::create()->findPk($id);
|
||||
$slice->delete();
|
||||
$responseData['success'] = true;
|
||||
} else {
|
||||
$responseData['message'] = $this->getTranslator()->trans(
|
||||
'The slice has not been deleted',
|
||||
[],
|
||||
ChronopostHomeDelivery::DOMAIN_NAME
|
||||
);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$responseData['message'] = $e->getMessage();
|
||||
}
|
||||
|
||||
return $this->jsonResponse(json_encode($responseData));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace ChronopostHomeDelivery\EventListeners;
|
||||
|
||||
|
||||
use ChronopostHomeDelivery\ChronopostHomeDelivery;
|
||||
use ChronopostHomeDelivery\Config\ChronopostHomeDeliveryConst;
|
||||
use OpenApi\Events\DeliveryModuleOptionEvent;
|
||||
use OpenApi\Events\OpenApiEvents;
|
||||
use OpenApi\Model\Api\DeliveryModuleOption;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Model\CountryArea;
|
||||
use Thelia\Model\PickupLocation;
|
||||
use Thelia\Module\Exception\DeliveryException;
|
||||
|
||||
class APIListener implements EventSubscriberInterface
|
||||
{
|
||||
protected $container;
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of delivery types
|
||||
*
|
||||
* @param DeliveryModuleOptionEvent $deliveryModuleOptionEvent
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function getDeliveryModuleOptions(DeliveryModuleOptionEvent $deliveryModuleOptionEvent)
|
||||
{
|
||||
if ($deliveryModuleOptionEvent->getModule()->getId() !== ChronopostHomeDelivery::getModuleId()) {
|
||||
return ;
|
||||
}
|
||||
|
||||
$activatedDeliveryTypes = ChronopostHomeDelivery::getActivatedDeliveryTypes();
|
||||
|
||||
foreach (ChronopostHomeDeliveryConst::CHRONOPOST_HOME_DELIVERY_DELIVERY_CODES as $name => $code) {
|
||||
if (!in_array($code, $activatedDeliveryTypes, false)) {
|
||||
continue ;
|
||||
}
|
||||
|
||||
$isValid = true;
|
||||
$postage = null;
|
||||
$postageTax = null;
|
||||
|
||||
try {
|
||||
$module = new ChronopostHomeDelivery();
|
||||
$country = $deliveryModuleOptionEvent->getCountry();
|
||||
|
||||
if (empty($module->getAllAreasForCountry($country))) {
|
||||
throw new DeliveryException(Translator::getInstance()->trans("Your delivery country is not covered by Chronopost"));
|
||||
}
|
||||
|
||||
$countryAreas = $country->getCountryAreas();
|
||||
$areasArray = [];
|
||||
|
||||
/** @var CountryArea $countryArea */
|
||||
foreach ($countryAreas as $countryArea) {
|
||||
$areasArray[] = $countryArea->getAreaId();
|
||||
}
|
||||
|
||||
$postage = $module->getMinPostage(
|
||||
$areasArray,
|
||||
$deliveryModuleOptionEvent->getCart()->getWeight(),
|
||||
$deliveryModuleOptionEvent->getCart()->getTaxedAmount($country),
|
||||
$code
|
||||
);
|
||||
|
||||
$postageTax = 0; //TODO
|
||||
|
||||
if (null === $postage) {
|
||||
$isValid = false;
|
||||
}
|
||||
|
||||
} catch (\Exception $exception) {
|
||||
$isValid = false;
|
||||
}
|
||||
|
||||
$minimumDeliveryDate = ''; // TODO (with a const array code => timeToDeliver to calculate delivery date from day of order)
|
||||
$maximumDeliveryDate = ''; // TODO (with a const array code => timeToDeliver to calculate delivery date from day of order)
|
||||
|
||||
/** @var DeliveryModuleOption $deliveryModuleOption */
|
||||
$deliveryModuleOption = ($this->container->get('open_api.model.factory'))->buildModel('DeliveryModuleOption');
|
||||
$deliveryModuleOption
|
||||
->setCode($code)
|
||||
->setValid($isValid)
|
||||
->setTitle($name)
|
||||
->setImage('')
|
||||
->setMinimumDeliveryDate($minimumDeliveryDate)
|
||||
->setMaximumDeliveryDate($maximumDeliveryDate)
|
||||
->setPostage($postage)
|
||||
->setPostageTax($postageTax)
|
||||
->setPostageUntaxed($postage - $postageTax)
|
||||
;
|
||||
|
||||
$deliveryModuleOptionEvent->appendDeliveryModuleOptions($deliveryModuleOption);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
$listenedEvents = [];
|
||||
|
||||
/** Check for old versions of Thelia where the events used by the API didn't exists */
|
||||
if (class_exists(DeliveryModuleOptionEvent::class)) {
|
||||
$listenedEvents[OpenApiEvents::MODULE_DELIVERY_GET_OPTIONS] = array("getDeliveryModuleOptions", 131);
|
||||
}
|
||||
|
||||
return $listenedEvents;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\EventListeners;
|
||||
|
||||
|
||||
use ChronopostHomeDelivery\ChronopostHomeDelivery;
|
||||
use ChronopostHomeDelivery\Config\ChronopostHomeDeliveryConst;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrder;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
|
||||
|
||||
|
||||
class SetDeliveryType implements EventSubscriberInterface
|
||||
{
|
||||
/** @var Request */
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* SetDeliveryType constructor.
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Request
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return bool
|
||||
*/
|
||||
protected function checkModule($id)
|
||||
{
|
||||
return $id == ChronopostHomeDelivery::getModuleId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OrderEvent $orderEvent
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function saveChronopostHomeDeliveryOrder(OrderEvent $orderEvent)
|
||||
{
|
||||
if ($this->checkModule($orderEvent->getOrder()->getDeliveryModuleId())) {
|
||||
|
||||
$request = $this->getRequest();
|
||||
$chronopostOrder = new ChronopostHomeDeliveryOrder();
|
||||
|
||||
$orderId = $orderEvent->getOrder()->getId();
|
||||
|
||||
foreach (ChronopostHomeDeliveryConst::CHRONOPOST_HOME_DELIVERY_DELIVERY_CODES as $name => $code) {
|
||||
if ($code === $request->getSession()->get('ChronopostHomeDeliveryDeliveryType')) {
|
||||
$chronopostOrder
|
||||
->setDeliveryType($name)
|
||||
->setDeliveryCode($code)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
$chronopostOrder
|
||||
->setOrderId($orderId)
|
||||
->save();
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OrderEvent $orderEvent
|
||||
* @return null
|
||||
*/
|
||||
public function setChronopostHomeDeliveryDeliveryType(OrderEvent $orderEvent)
|
||||
{
|
||||
if ($this->checkModule($orderEvent->getDeliveryModule())) {
|
||||
$request = $this->getRequest();
|
||||
|
||||
$request->getSession()->set('ChronopostAddressId', $orderEvent->getDeliveryAddress());
|
||||
$request->getSession()->set('ChronopostHomeDeliveryDeliveryType', $request->get('deliveryModuleOptionCode'));
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of event names this subscriber wants to listen to.
|
||||
*
|
||||
* The array keys are event names and the value can be:
|
||||
*
|
||||
* * The method name to call (priority defaults to 0)
|
||||
* * An array composed of the method name to call and the priority
|
||||
* * An array of arrays composed of the method names to call and respective
|
||||
* priorities, or 0 if unset
|
||||
*
|
||||
* For instance:
|
||||
*
|
||||
* * array('eventName' => 'methodName')
|
||||
* * array('eventName' => array('methodName', $priority))
|
||||
* * array('eventName' => array(array('methodName1', $priority), array('methodName2'))
|
||||
*
|
||||
* @return array The event names to listen to
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::ORDER_SET_DELIVERY_MODULE => array('setChronopostHomeDeliveryDeliveryType', 64),
|
||||
TheliaEvents::ORDER_BEFORE_PAYMENT => array('saveChronopostHomeDeliveryOrder', 256),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: nicolasbarbey
|
||||
* Date: 21/07/2020
|
||||
* Time: 16:27
|
||||
*/
|
||||
|
||||
namespace ChronopostHomeDelivery\EventListeners;
|
||||
|
||||
|
||||
use ChronopostHomeDelivery\ChronopostHomeDelivery;
|
||||
use ChronopostLabel\ChronopostLabel;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Action\BaseAction;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Template\ParserInterface;
|
||||
use Thelia\Mailer\MailerFactory;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
|
||||
class ShippingNotificationSender extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
/** @var MailerFactory */
|
||||
protected $mailer;
|
||||
/** @var ParserInterface */
|
||||
protected $parser;
|
||||
|
||||
public function __construct(ParserInterface $parser, MailerFactory $mailer)
|
||||
{
|
||||
$this->parser = $parser;
|
||||
$this->mailer = $mailer;
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return [
|
||||
TheliaEvents::ORDER_UPDATE_STATUS => ['sendShippingNotification', 128]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OrderEvent $event
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function sendShippingNotification(OrderEvent $event)
|
||||
{
|
||||
if ($event->getOrder()->isSent() && (
|
||||
$event->getOrder()->getDeliveryModuleId() == ModuleQuery::create()->findOneByCode('ChronopostHomeDelivery')->getId())) {
|
||||
|
||||
$contactEmail = ConfigQuery::getStoreEmail();
|
||||
|
||||
if ($contactEmail) {
|
||||
$order = $event->getOrder();
|
||||
$customer = $order->getCustomer();
|
||||
|
||||
$this->mailer->sendEmailToCustomer(
|
||||
ChronopostHomeDelivery::CHRONOPOST_CONFIRMATION_MESSAGE_NAME,
|
||||
$order->getCustomer(),
|
||||
[
|
||||
'order_id' => $order->getId(),
|
||||
'order_ref' => $order->getRef(),
|
||||
'customer_id' => $customer->getId(),
|
||||
'order_date' => $order->getCreatedAt(),
|
||||
'update_date' => $order->getUpdatedAt(),
|
||||
'package' => $order->getDeliveryRef()
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Form;
|
||||
|
||||
use ChronopostHomeDelivery\ChronopostHomeDelivery;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryModeQuery;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Thelia\Model\AreaQuery;
|
||||
|
||||
class ChronopostHomeDeliveryAddPriceForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("area", "integer", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(array(
|
||||
"methods" => array(
|
||||
array($this,
|
||||
"verifyAreaExist")
|
||||
)
|
||||
))
|
||||
)
|
||||
))
|
||||
->add("delivery_mode", "integer", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(array(
|
||||
"methods" => array(
|
||||
array($this,
|
||||
"verifyDeliveryModeExist")
|
||||
)
|
||||
))
|
||||
)
|
||||
))
|
||||
->add("weight", "number", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(array(
|
||||
"methods" => array(
|
||||
array($this,
|
||||
"verifyValidWeight")
|
||||
)
|
||||
))
|
||||
)
|
||||
))
|
||||
->add("price", "number", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(array(
|
||||
"methods" => array(
|
||||
array($this,
|
||||
"verifyValidPrice")
|
||||
)
|
||||
))
|
||||
)
|
||||
))
|
||||
->add("franco", "number", array())
|
||||
;
|
||||
}
|
||||
|
||||
public function verifyAreaExist($value, ExecutionContextInterface $context)
|
||||
{
|
||||
$area = AreaQuery::create()->findPk($value);
|
||||
if (null === $area) {
|
||||
$context->addViolation(Translator::getInstance()->trans("This area doesn't exists.", [], ChronopostHomeDelivery::DOMAIN_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
public function verifyDeliveryModeExist($value, ExecutionContextInterface $context)
|
||||
{
|
||||
$mode = ChronopostHomeDeliveryDeliveryModeQuery::create()->findPk($value);
|
||||
if (null === $mode) {
|
||||
$context->addViolation(Translator::getInstance()->trans("This delivery mode doesn't exists.", [], ChronopostHomeDelivery::DOMAIN_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
public function verifyValidWeight($value, ExecutionContextInterface $context)
|
||||
{
|
||||
if (!preg_match("#^\d+\.?\d*$#", $value)) {
|
||||
$context->addViolation(Translator::getInstance()->trans("The weight value is not valid.", [], ChronopostHomeDelivery::DOMAIN_NAME));
|
||||
}
|
||||
|
||||
if ($value < 0) {
|
||||
$context->addViolation(Translator::getInstance()->trans("The weight value must be superior to 0.", [], ChronopostHomeDelivery::DOMAIN_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
public function verifyValidPrice($value, ExecutionContextInterface $context)
|
||||
{
|
||||
if (!preg_match("#^\d+\.?\d*$#", $value)) {
|
||||
$context->addViolation(Translator::getInstance()->trans("The price value is not valid.", [], ChronopostHomeDelivery::DOMAIN_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "chronopost_home_delivery_price_create";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Form;
|
||||
|
||||
|
||||
use ChronopostHomeDelivery\Config\ChronopostHomeDeliveryConst;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
class ChronopostHomeDeliveryConfigurationForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$config = ChronopostHomeDeliveryConst::getConfig();
|
||||
|
||||
$this->formBuilder
|
||||
|
||||
/** Chronopost basic informations */
|
||||
->add(
|
||||
ChronopostHomeDeliveryConst::CHRONOPOST_HOME_DELIVERY_CODE_CLIENT,
|
||||
"text",
|
||||
[
|
||||
'required' => true,
|
||||
'data' => $config[ChronopostHomeDeliveryConst::CHRONOPOST_HOME_DELIVERY_CODE_CLIENT],
|
||||
'label' => Translator::getInstance()->trans("Chronopost client ID"),
|
||||
'label_attr' => [
|
||||
'for' => 'title',
|
||||
],
|
||||
'attr' => [
|
||||
'placeholder' => Translator::getInstance()->trans("Your Chronopost client ID"),
|
||||
],
|
||||
]
|
||||
)
|
||||
->add(ChronopostHomeDeliveryConst::CHRONOPOST_HOME_DELIVERY_PASSWORD,
|
||||
"text",
|
||||
[
|
||||
'required' => true,
|
||||
'data' => $config[ChronopostHomeDeliveryConst::CHRONOPOST_HOME_DELIVERY_PASSWORD],
|
||||
'label' => Translator::getInstance()->trans("Chronopost password"),
|
||||
'label_attr' => [
|
||||
'for' => 'title',
|
||||
],
|
||||
'attr' => [
|
||||
'placeholder' => Translator::getInstance()->trans("Your Chronopost password"),
|
||||
],
|
||||
]
|
||||
)
|
||||
;
|
||||
|
||||
/** Delivery types */
|
||||
foreach (ChronopostHomeDeliveryConst::getDeliveryTypesStatusKeys() as $deliveryTypeName => $statusKey) {
|
||||
$this->formBuilder
|
||||
->add($statusKey,
|
||||
"checkbox",
|
||||
[
|
||||
'required' => false,
|
||||
'data' => (bool)$config[$statusKey],
|
||||
'label' => Translator::getInstance()->trans("\"" . $deliveryTypeName . "\" Delivery (Code : " . ChronopostHomeDeliveryConst::CHRONOPOST_HOME_DELIVERY_DELIVERY_CODES[$deliveryTypeName] . ")"),
|
||||
'label_attr' => [
|
||||
'for' => 'title',
|
||||
],
|
||||
]
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
/** BUILDFORM END */
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "chronopost_home_delivery_configuration_form";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Form;
|
||||
|
||||
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
class ChronopostHomeDeliveryFreeShippingForm extends BaseForm
|
||||
{
|
||||
/**
|
||||
* @return null|void
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
"delivery_mode",
|
||||
"integer"
|
||||
)
|
||||
->add(
|
||||
"freeshipping",
|
||||
"checkbox",
|
||||
[
|
||||
'label'=>Translator::getInstance()->trans("Activate free shipping: ")
|
||||
]
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of you form. This name must be unique
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "chronopost_home_delivery_freeshipping";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Form;
|
||||
|
||||
|
||||
use ChronopostHomeDelivery\ChronopostHomeDelivery;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryModeQuery;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Thelia\Model\AreaQuery;
|
||||
|
||||
class ChronopostHomeDeliveryUpdatePriceForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("area", "integer", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(array(
|
||||
"methods" => array(
|
||||
array($this,
|
||||
"verifyAreaExist")
|
||||
)
|
||||
))
|
||||
)
|
||||
))
|
||||
->add("delivery_mode", "integer", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(array(
|
||||
"methods" => array(
|
||||
array($this,
|
||||
"verifyDeliveryModeExist")
|
||||
)
|
||||
))
|
||||
)
|
||||
))
|
||||
->add("weight", "number", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
)
|
||||
))
|
||||
->add("price", "number", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(array(
|
||||
"methods" => array(
|
||||
array($this,
|
||||
"verifyValidPrice")
|
||||
)
|
||||
))
|
||||
)
|
||||
))
|
||||
->add("franco", "number", array())
|
||||
;
|
||||
}
|
||||
|
||||
public function verifyAreaExist($value, ExecutionContextInterface $context)
|
||||
{
|
||||
$area = AreaQuery::create()->findPk($value);
|
||||
if (null === $area) {
|
||||
$context->addViolation(Translator::getInstance()->trans("This area doesn't exists.", [], ChronopostHomeDelivery::DOMAIN_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
public function verifyDeliveryModeExist($value, ExecutionContextInterface $context)
|
||||
{
|
||||
$mode = ChronopostHomeDeliveryDeliveryModeQuery::create()->findPk($value);
|
||||
if (null === $mode) {
|
||||
$context->addViolation(Translator::getInstance()->trans("This delivery mode doesn't exists.", [], ChronopostHomeDelivery::DOMAIN_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
public function verifyValidPrice($value, ExecutionContextInterface $context)
|
||||
{
|
||||
if (!preg_match("#^\d+\.?\d*$#", $value)) {
|
||||
$context->addViolation(Translator::getInstance()->trans("The price value is not valid.", [], ChronopostHomeDelivery::DOMAIN_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "chronopost_home_delivery_price_create";
|
||||
}
|
||||
}
|
||||
20
local/modules/ChronopostHomeDelivery/Hook/BackHook.php
Normal file
20
local/modules/ChronopostHomeDelivery/Hook/BackHook.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Hook;
|
||||
|
||||
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
|
||||
class BackHook extends BaseHook
|
||||
{
|
||||
public function onModuleConfiguration(HookRenderEvent $event)
|
||||
{
|
||||
$event->add($this->render('ChronopostHomeDelivery/ChronopostHomeDeliveryConfig.html'));
|
||||
}
|
||||
|
||||
public function onModuleConfigJs(HookRenderEvent $event)
|
||||
{
|
||||
$event->add($this->render('ChronopostHomeDelivery/module-config-js.html'));
|
||||
}
|
||||
}
|
||||
16
local/modules/ChronopostHomeDelivery/Hook/FrontHook.php
Normal file
16
local/modules/ChronopostHomeDelivery/Hook/FrontHook.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Hook;
|
||||
|
||||
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
|
||||
class FrontHook extends BaseHook
|
||||
{
|
||||
public function onOrderDeliveryExtra(HookRenderEvent $event)
|
||||
{
|
||||
$content = $this->render("ChronopostHomeDelivery.html", $event->getArguments());
|
||||
$event->add($content);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Choose this delivery mode' => 'Choisissez votre formule de livraison',
|
||||
'Chrono 13H delivery' => 'Chronopost avant 13h',
|
||||
'Chrono 18H delivery' => 'Chronopost avant 18h',
|
||||
'Chrono Europe Classic delivery' => 'Livraison classique en Europe',
|
||||
'Chrono Europe Express delivery' => 'Livraison express en Europe',
|
||||
'Chrono10' => 'Chronopost avant 10h',
|
||||
'Delivery before 10H tomorrow.' => 'Livré avant le demain 10h',
|
||||
'Delivery of fresh products before 13H tomorrow.' => 'Produit frais livré avant le demain 13h',
|
||||
'Delivery to you or a personal address of your choice, anywhere in Europe in less than 3 days.' => 'Livré à l\'adresse de votre choix, partout en Europe, en moins de 3 jours',
|
||||
'Delivery to you or a personal address of your choice, anywhere in Europe.' => 'Livré à l\'adresse de votre choix, partout en Europe',
|
||||
'Delivery to you or a personal address of your choice, before tomorrow 13H.' => 'Livré à l\'adresse de votre choix, avant le demain 13h',
|
||||
'Delivery to you or a personal address of your choice, before tomorrow 18H.' => 'Livré à l\'adresse de votre choix, avant le demain 18h',
|
||||
'Fresh 13H delivery' => 'Chronofresh avant 13h',
|
||||
);
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Loop;
|
||||
|
||||
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshippingQuery;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
|
||||
class ChronopostHomeDeliveryAreaFreeshipping extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntTypeArgument('area_id'),
|
||||
Argument::createIntTypeArgument('delivery_mode_id')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ChronopostHomeDeliveryAreaFreeshippingQuery|ModelCriteria
|
||||
*/
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
$areaId = $this->getAreaId();
|
||||
$mode = $this->getDeliveryModeId();
|
||||
|
||||
$modes = ChronopostHomeDeliveryAreaFreeshippingQuery::create();
|
||||
|
||||
if (null !== $mode) {
|
||||
$modes->filterByDeliveryModeId($mode);
|
||||
}
|
||||
|
||||
if (null !== $areaId) {
|
||||
$modes->filterByAreaId($areaId);
|
||||
}
|
||||
|
||||
return $modes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LoopResult $loopResult
|
||||
* @return LoopResult
|
||||
*/
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
/** @var \ChronopostHomeDeliveryHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping $mode */
|
||||
foreach ($loopResult->getResultDataCollection() as $mode) {
|
||||
$loopResultRow = new LoopResultRow($mode);
|
||||
$loopResultRow->set("ID", $mode->getId())
|
||||
->set("AREA_ID", $mode->getAreaId())
|
||||
->set("DELIVERY_MODE_ID", $mode->getDeliveryModeId())
|
||||
->set("CART_AMOUNT", $mode->getCartAmount());
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
return $loopResult;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Loop;
|
||||
|
||||
|
||||
use ChronopostHomeDelivery\ChronopostHomeDelivery;
|
||||
use ChronopostHomeDelivery\Config\ChronopostHomeDeliveryConst;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryModeQuery;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
|
||||
class ChronopostHomeDeliveryDeliveryMode extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* Unused
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ChronopostHomeDeliveryDeliveryModeQuery|\Propel\Runtime\ActiveQuery\ModelCriteria
|
||||
*/
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
$config = ChronopostHomeDeliveryConst::getConfig();
|
||||
$modes = ChronopostHomeDeliveryDeliveryModeQuery::create();
|
||||
|
||||
$enabledDeliveryTypes = [];
|
||||
foreach (ChronopostHomeDeliveryConst::getDeliveryTypesStatusKeys() as $deliveryTypeName => $statusKey) {
|
||||
$enabledDeliveryTypes[] = $config[$statusKey] ? ChronopostHomeDeliveryConst::CHRONOPOST_HOME_DELIVERY_DELIVERY_CODES[$deliveryTypeName] : '';
|
||||
}
|
||||
|
||||
$modes->filterByCode($enabledDeliveryTypes, Criteria::IN);
|
||||
|
||||
return $modes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LoopResult $loopResult
|
||||
* @return LoopResult
|
||||
*/
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
/** @var \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode $mode */
|
||||
foreach ($loopResult->getResultDataCollection() as $mode) {
|
||||
$loopResultRow = new LoopResultRow($mode);
|
||||
$loopResultRow
|
||||
->set("ID", $mode->getId())
|
||||
->set("TITLE", $mode->getTitle())
|
||||
->set("CODE", $mode->getCode())
|
||||
->set("FREESHIPPING_ACTIVE", $mode->getFreeshippingActive())
|
||||
->set("FREESHIPPING_FROM", $mode->getFreeshippingFrom());
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Loop;
|
||||
|
||||
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPriceQuery;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
|
||||
/**
|
||||
* Class ChronopostHomeDeliveryLoop
|
||||
* @package ChronopostHomeDelivery\Loop
|
||||
*
|
||||
* @method integer getAreaId
|
||||
* @method integer getDeliveryModeId
|
||||
*/
|
||||
class ChronopostHomeDeliveryLoop extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntTypeArgument('area_id', null, true),
|
||||
Argument::createIntTypeArgument('delivery_mode_id', null, true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ChronopostHomeDeliveryPriceQuery|\Propel\Runtime\ActiveQuery\ModelCriteria
|
||||
*/
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
$areaId = $this->getAreaId();
|
||||
$modeId = $this->getDeliveryModeId();
|
||||
|
||||
$areaPrices = ChronopostHomeDeliveryPriceQuery::create()
|
||||
->filterByDeliveryModeId($modeId)
|
||||
->filterByAreaId($areaId)
|
||||
->orderByWeightMax();
|
||||
|
||||
return $areaPrices;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LoopResult $loopResult
|
||||
* @return LoopResult
|
||||
*/
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
/** @var ChronopostHomeDeliveryPrice $price */
|
||||
foreach ($loopResult->getResultDataCollection() as $price) {
|
||||
$loopResultRow = new LoopResultRow($price);
|
||||
$loopResultRow
|
||||
->set("SLICE_ID", $price->getId())
|
||||
->set("MAX_WEIGHT", $price->getWeightMax())
|
||||
->set("MAX_PRICE", $price->getPriceMax())
|
||||
->set("PRICE", $price->getPrice())
|
||||
->set("FRANCO", $price->getFrancoMinPrice())
|
||||
;
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,645 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping as ChildChronopostHomeDeliveryAreaFreeshipping;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshippingQuery as ChildChronopostHomeDeliveryAreaFreeshippingQuery;
|
||||
use ChronopostHomeDelivery\Model\Map\ChronopostHomeDeliveryAreaFreeshippingTableMap;
|
||||
use ChronopostHomeDelivery\Model\Thelia\Model\Area;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'chronopost_home_delivery_area_freeshipping' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshippingQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshippingQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshippingQuery orderByDeliveryModeId($order = Criteria::ASC) Order by the delivery_mode_id column
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshippingQuery orderByCartAmount($order = Criteria::ASC) Order by the cart_amount column
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshippingQuery groupById() Group by the id column
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshippingQuery groupByAreaId() Group by the area_id column
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshippingQuery groupByDeliveryModeId() Group by the delivery_mode_id column
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshippingQuery groupByCartAmount() Group by the cart_amount column
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshippingQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshippingQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshippingQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshippingQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshippingQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshippingQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshippingQuery leftJoinChronopostHomeDeliveryDeliveryMode($relationAlias = null) Adds a LEFT JOIN clause to the query using the ChronopostHomeDeliveryDeliveryMode relation
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshippingQuery rightJoinChronopostHomeDeliveryDeliveryMode($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ChronopostHomeDeliveryDeliveryMode relation
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshippingQuery innerJoinChronopostHomeDeliveryDeliveryMode($relationAlias = null) Adds a INNER JOIN clause to the query using the ChronopostHomeDeliveryDeliveryMode relation
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshipping findOne(ConnectionInterface $con = null) Return the first ChildChronopostHomeDeliveryAreaFreeshipping matching the query
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshipping findOneOrCreate(ConnectionInterface $con = null) Return the first ChildChronopostHomeDeliveryAreaFreeshipping matching the query, or a new ChildChronopostHomeDeliveryAreaFreeshipping object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshipping findOneById(int $id) Return the first ChildChronopostHomeDeliveryAreaFreeshipping filtered by the id column
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshipping findOneByAreaId(int $area_id) Return the first ChildChronopostHomeDeliveryAreaFreeshipping filtered by the area_id column
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshipping findOneByDeliveryModeId(int $delivery_mode_id) Return the first ChildChronopostHomeDeliveryAreaFreeshipping filtered by the delivery_mode_id column
|
||||
* @method ChildChronopostHomeDeliveryAreaFreeshipping findOneByCartAmount(string $cart_amount) Return the first ChildChronopostHomeDeliveryAreaFreeshipping filtered by the cart_amount column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildChronopostHomeDeliveryAreaFreeshipping objects filtered by the id column
|
||||
* @method array findByAreaId(int $area_id) Return ChildChronopostHomeDeliveryAreaFreeshipping objects filtered by the area_id column
|
||||
* @method array findByDeliveryModeId(int $delivery_mode_id) Return ChildChronopostHomeDeliveryAreaFreeshipping objects filtered by the delivery_mode_id column
|
||||
* @method array findByCartAmount(string $cart_amount) Return ChildChronopostHomeDeliveryAreaFreeshipping objects filtered by the cart_amount column
|
||||
*
|
||||
*/
|
||||
abstract class ChronopostHomeDeliveryAreaFreeshippingQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \ChronopostHomeDelivery\Model\Base\ChronopostHomeDeliveryAreaFreeshippingQuery 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 = '\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryAreaFreeshipping', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildChronopostHomeDeliveryAreaFreeshippingQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryAreaFreeshippingQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshippingQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshippingQuery();
|
||||
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 ChildChronopostHomeDeliveryAreaFreeshipping|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = ChronopostHomeDeliveryAreaFreeshippingTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(ChronopostHomeDeliveryAreaFreeshippingTableMap::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 ChildChronopostHomeDeliveryAreaFreeshipping A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, AREA_ID, DELIVERY_MODE_ID, CART_AMOUNT FROM chronopost_home_delivery_area_freeshipping 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 ChildChronopostHomeDeliveryAreaFreeshipping();
|
||||
$obj->hydrate($row);
|
||||
ChronopostHomeDeliveryAreaFreeshippingTableMap::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 ChildChronopostHomeDeliveryAreaFreeshipping|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 ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::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 ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::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 ChildChronopostHomeDeliveryAreaFreeshippingQuery 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(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the area_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByAreaId(1234); // WHERE area_id = 1234
|
||||
* $query->filterByAreaId(array(12, 34)); // WHERE area_id IN (12, 34)
|
||||
* $query->filterByAreaId(array('min' => 12)); // WHERE area_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByArea()
|
||||
*
|
||||
* @param mixed $areaId 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 ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAreaId($areaId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($areaId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($areaId['min'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($areaId['max'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID, $areaId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the delivery_mode_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByDeliveryModeId(1234); // WHERE delivery_mode_id = 1234
|
||||
* $query->filterByDeliveryModeId(array(12, 34)); // WHERE delivery_mode_id IN (12, 34)
|
||||
* $query->filterByDeliveryModeId(array('min' => 12)); // WHERE delivery_mode_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByChronopostHomeDeliveryDeliveryMode()
|
||||
*
|
||||
* @param mixed $deliveryModeId 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 ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDeliveryModeId($deliveryModeId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($deliveryModeId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($deliveryModeId['min'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID, $deliveryModeId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($deliveryModeId['max'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID, $deliveryModeId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID, $deliveryModeId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the cart_amount column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCartAmount(1234); // WHERE cart_amount = 1234
|
||||
* $query->filterByCartAmount(array(12, 34)); // WHERE cart_amount IN (12, 34)
|
||||
* $query->filterByCartAmount(array('min' => 12)); // WHERE cart_amount > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $cartAmount 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 ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCartAmount($cartAmount = null, $comparison = null)
|
||||
{
|
||||
if (is_array($cartAmount)) {
|
||||
$useMinMax = false;
|
||||
if (isset($cartAmount['min'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::CART_AMOUNT, $cartAmount['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($cartAmount['max'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::CART_AMOUNT, $cartAmount['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::CART_AMOUNT, $cartAmount, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \ChronopostHomeDelivery\Model\Thelia\Model\Area object
|
||||
*
|
||||
* @param \ChronopostHomeDelivery\Model\Thelia\Model\Area|ObjectCollection $area The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByArea($area, $comparison = null)
|
||||
{
|
||||
if ($area instanceof \ChronopostHomeDelivery\Model\Thelia\Model\Area) {
|
||||
return $this
|
||||
->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID, $area->getId(), $comparison);
|
||||
} elseif ($area instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByArea() only accepts arguments of type \ChronopostHomeDelivery\Model\Thelia\Model\Area or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Area relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinArea($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Area');
|
||||
|
||||
// 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, 'Area');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Area relation Area 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 \ChronopostHomeDelivery\Model\Thelia\Model\AreaQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAreaQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinArea($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Area', '\ChronopostHomeDelivery\Model\Thelia\Model\AreaQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode object
|
||||
*
|
||||
* @param \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode|ObjectCollection $chronopostHomeDeliveryDeliveryMode The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByChronopostHomeDeliveryDeliveryMode($chronopostHomeDeliveryDeliveryMode, $comparison = null)
|
||||
{
|
||||
if ($chronopostHomeDeliveryDeliveryMode instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode) {
|
||||
return $this
|
||||
->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID, $chronopostHomeDeliveryDeliveryMode->getId(), $comparison);
|
||||
} elseif ($chronopostHomeDeliveryDeliveryMode instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID, $chronopostHomeDeliveryDeliveryMode->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByChronopostHomeDeliveryDeliveryMode() only accepts arguments of type \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the ChronopostHomeDeliveryDeliveryMode relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinChronopostHomeDeliveryDeliveryMode($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('ChronopostHomeDeliveryDeliveryMode');
|
||||
|
||||
// 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, 'ChronopostHomeDeliveryDeliveryMode');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the ChronopostHomeDeliveryDeliveryMode relation ChronopostHomeDeliveryDeliveryMode 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 \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryModeQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useChronopostHomeDeliveryDeliveryModeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinChronopostHomeDeliveryDeliveryMode($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'ChronopostHomeDeliveryDeliveryMode', '\ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryModeQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildChronopostHomeDeliveryAreaFreeshipping $chronopostHomeDeliveryAreaFreeshipping Object to remove from the list of results
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($chronopostHomeDeliveryAreaFreeshipping = null)
|
||||
{
|
||||
if ($chronopostHomeDeliveryAreaFreeshipping) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID, $chronopostHomeDeliveryAreaFreeshipping->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the chronopost_home_delivery_area_freeshipping 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(ChronopostHomeDeliveryAreaFreeshippingTableMap::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).
|
||||
ChronopostHomeDeliveryAreaFreeshippingTableMap::clearInstancePool();
|
||||
ChronopostHomeDeliveryAreaFreeshippingTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildChronopostHomeDeliveryAreaFreeshipping or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildChronopostHomeDeliveryAreaFreeshipping 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(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(ChronopostHomeDeliveryAreaFreeshippingTableMap::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();
|
||||
|
||||
|
||||
ChronopostHomeDeliveryAreaFreeshippingTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
ChronopostHomeDeliveryAreaFreeshippingTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // ChronopostHomeDeliveryAreaFreeshippingQuery
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,643 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode as ChildChronopostHomeDeliveryDeliveryMode;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryModeQuery as ChildChronopostHomeDeliveryDeliveryModeQuery;
|
||||
use ChronopostHomeDelivery\Model\Map\ChronopostHomeDeliveryDeliveryModeTableMap;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'chronopost_home_delivery_delivery_mode' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery orderByTitle($order = Criteria::ASC) Order by the title column
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery orderByCode($order = Criteria::ASC) Order by the code column
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery orderByFreeshippingActive($order = Criteria::ASC) Order by the freeshipping_active column
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery orderByFreeshippingFrom($order = Criteria::ASC) Order by the freeshipping_from column
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery groupById() Group by the id column
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery groupByTitle() Group by the title column
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery groupByCode() Group by the code column
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery groupByFreeshippingActive() Group by the freeshipping_active column
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery groupByFreeshippingFrom() Group by the freeshipping_from column
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery leftJoinChronopostHomeDeliveryPrice($relationAlias = null) Adds a LEFT JOIN clause to the query using the ChronopostHomeDeliveryPrice relation
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery rightJoinChronopostHomeDeliveryPrice($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ChronopostHomeDeliveryPrice relation
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery innerJoinChronopostHomeDeliveryPrice($relationAlias = null) Adds a INNER JOIN clause to the query using the ChronopostHomeDeliveryPrice relation
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery leftJoinChronopostHomeDeliveryAreaFreeshipping($relationAlias = null) Adds a LEFT JOIN clause to the query using the ChronopostHomeDeliveryAreaFreeshipping relation
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery rightJoinChronopostHomeDeliveryAreaFreeshipping($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ChronopostHomeDeliveryAreaFreeshipping relation
|
||||
* @method ChildChronopostHomeDeliveryDeliveryModeQuery innerJoinChronopostHomeDeliveryAreaFreeshipping($relationAlias = null) Adds a INNER JOIN clause to the query using the ChronopostHomeDeliveryAreaFreeshipping relation
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryDeliveryMode findOne(ConnectionInterface $con = null) Return the first ChildChronopostHomeDeliveryDeliveryMode matching the query
|
||||
* @method ChildChronopostHomeDeliveryDeliveryMode findOneOrCreate(ConnectionInterface $con = null) Return the first ChildChronopostHomeDeliveryDeliveryMode matching the query, or a new ChildChronopostHomeDeliveryDeliveryMode object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryDeliveryMode findOneById(int $id) Return the first ChildChronopostHomeDeliveryDeliveryMode filtered by the id column
|
||||
* @method ChildChronopostHomeDeliveryDeliveryMode findOneByTitle(string $title) Return the first ChildChronopostHomeDeliveryDeliveryMode filtered by the title column
|
||||
* @method ChildChronopostHomeDeliveryDeliveryMode findOneByCode(string $code) Return the first ChildChronopostHomeDeliveryDeliveryMode filtered by the code column
|
||||
* @method ChildChronopostHomeDeliveryDeliveryMode findOneByFreeshippingActive(boolean $freeshipping_active) Return the first ChildChronopostHomeDeliveryDeliveryMode filtered by the freeshipping_active column
|
||||
* @method ChildChronopostHomeDeliveryDeliveryMode findOneByFreeshippingFrom(double $freeshipping_from) Return the first ChildChronopostHomeDeliveryDeliveryMode filtered by the freeshipping_from column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildChronopostHomeDeliveryDeliveryMode objects filtered by the id column
|
||||
* @method array findByTitle(string $title) Return ChildChronopostHomeDeliveryDeliveryMode objects filtered by the title column
|
||||
* @method array findByCode(string $code) Return ChildChronopostHomeDeliveryDeliveryMode objects filtered by the code column
|
||||
* @method array findByFreeshippingActive(boolean $freeshipping_active) Return ChildChronopostHomeDeliveryDeliveryMode objects filtered by the freeshipping_active column
|
||||
* @method array findByFreeshippingFrom(double $freeshipping_from) Return ChildChronopostHomeDeliveryDeliveryMode objects filtered by the freeshipping_from column
|
||||
*
|
||||
*/
|
||||
abstract class ChronopostHomeDeliveryDeliveryModeQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \ChronopostHomeDelivery\Model\Base\ChronopostHomeDeliveryDeliveryModeQuery 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 = '\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryDeliveryMode', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildChronopostHomeDeliveryDeliveryModeQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryDeliveryModeQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryModeQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryModeQuery();
|
||||
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 ChildChronopostHomeDeliveryDeliveryMode|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = ChronopostHomeDeliveryDeliveryModeTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(ChronopostHomeDeliveryDeliveryModeTableMap::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 ChildChronopostHomeDeliveryDeliveryMode A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, TITLE, CODE, FREESHIPPING_ACTIVE, FREESHIPPING_FROM FROM chronopost_home_delivery_delivery_mode 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 ChildChronopostHomeDeliveryDeliveryMode();
|
||||
$obj->hydrate($row);
|
||||
ChronopostHomeDeliveryDeliveryModeTableMap::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 ChildChronopostHomeDeliveryDeliveryMode|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 ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::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 ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::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 ChildChronopostHomeDeliveryDeliveryModeQuery 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(ChronopostHomeDeliveryDeliveryModeTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the title column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
|
||||
* $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $title The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByTitle($title = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($title)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $title)) {
|
||||
$title = str_replace('*', '%', $title);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::TITLE, $title, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the code column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCode('fooValue'); // WHERE code = 'fooValue'
|
||||
* $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $code 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 ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCode($code = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($code)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $code)) {
|
||||
$code = str_replace('*', '%', $code);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::CODE, $code, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the freeshipping_active column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByFreeshippingActive(true); // WHERE freeshipping_active = true
|
||||
* $query->filterByFreeshippingActive('yes'); // WHERE freeshipping_active = true
|
||||
* </code>
|
||||
*
|
||||
* @param boolean|string $freeshippingActive The value to use as filter.
|
||||
* Non-boolean arguments are converted using the following rules:
|
||||
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
|
||||
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
|
||||
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByFreeshippingActive($freeshippingActive = null, $comparison = null)
|
||||
{
|
||||
if (is_string($freeshippingActive)) {
|
||||
$freeshipping_active = in_array(strtolower($freeshippingActive), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_ACTIVE, $freeshippingActive, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the freeshipping_from column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByFreeshippingFrom(1234); // WHERE freeshipping_from = 1234
|
||||
* $query->filterByFreeshippingFrom(array(12, 34)); // WHERE freeshipping_from IN (12, 34)
|
||||
* $query->filterByFreeshippingFrom(array('min' => 12)); // WHERE freeshipping_from > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $freeshippingFrom 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 ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByFreeshippingFrom($freeshippingFrom = null, $comparison = null)
|
||||
{
|
||||
if (is_array($freeshippingFrom)) {
|
||||
$useMinMax = false;
|
||||
if (isset($freeshippingFrom['min'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_FROM, $freeshippingFrom['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($freeshippingFrom['max'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_FROM, $freeshippingFrom['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_FROM, $freeshippingFrom, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice object
|
||||
*
|
||||
* @param \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice|ObjectCollection $chronopostHomeDeliveryPrice the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByChronopostHomeDeliveryPrice($chronopostHomeDeliveryPrice, $comparison = null)
|
||||
{
|
||||
if ($chronopostHomeDeliveryPrice instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice) {
|
||||
return $this
|
||||
->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::ID, $chronopostHomeDeliveryPrice->getDeliveryModeId(), $comparison);
|
||||
} elseif ($chronopostHomeDeliveryPrice instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useChronopostHomeDeliveryPriceQuery()
|
||||
->filterByPrimaryKeys($chronopostHomeDeliveryPrice->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByChronopostHomeDeliveryPrice() only accepts arguments of type \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the ChronopostHomeDeliveryPrice relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinChronopostHomeDeliveryPrice($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('ChronopostHomeDeliveryPrice');
|
||||
|
||||
// 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, 'ChronopostHomeDeliveryPrice');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the ChronopostHomeDeliveryPrice relation ChronopostHomeDeliveryPrice 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 \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPriceQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useChronopostHomeDeliveryPriceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinChronopostHomeDeliveryPrice($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'ChronopostHomeDeliveryPrice', '\ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPriceQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping object
|
||||
*
|
||||
* @param \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping|ObjectCollection $chronopostHomeDeliveryAreaFreeshipping the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByChronopostHomeDeliveryAreaFreeshipping($chronopostHomeDeliveryAreaFreeshipping, $comparison = null)
|
||||
{
|
||||
if ($chronopostHomeDeliveryAreaFreeshipping instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping) {
|
||||
return $this
|
||||
->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::ID, $chronopostHomeDeliveryAreaFreeshipping->getDeliveryModeId(), $comparison);
|
||||
} elseif ($chronopostHomeDeliveryAreaFreeshipping instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useChronopostHomeDeliveryAreaFreeshippingQuery()
|
||||
->filterByPrimaryKeys($chronopostHomeDeliveryAreaFreeshipping->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByChronopostHomeDeliveryAreaFreeshipping() only accepts arguments of type \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the ChronopostHomeDeliveryAreaFreeshipping relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinChronopostHomeDeliveryAreaFreeshipping($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('ChronopostHomeDeliveryAreaFreeshipping');
|
||||
|
||||
// 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, 'ChronopostHomeDeliveryAreaFreeshipping');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the ChronopostHomeDeliveryAreaFreeshipping relation ChronopostHomeDeliveryAreaFreeshipping 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 \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshippingQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useChronopostHomeDeliveryAreaFreeshippingQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinChronopostHomeDeliveryAreaFreeshipping($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'ChronopostHomeDeliveryAreaFreeshipping', '\ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshippingQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildChronopostHomeDeliveryDeliveryMode $chronopostHomeDeliveryDeliveryMode Object to remove from the list of results
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($chronopostHomeDeliveryDeliveryMode = null)
|
||||
{
|
||||
if ($chronopostHomeDeliveryDeliveryMode) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::ID, $chronopostHomeDeliveryDeliveryMode->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the chronopost_home_delivery_delivery_mode 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(ChronopostHomeDeliveryDeliveryModeTableMap::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).
|
||||
ChronopostHomeDeliveryDeliveryModeTableMap::clearInstancePool();
|
||||
ChronopostHomeDeliveryDeliveryModeTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildChronopostHomeDeliveryDeliveryMode or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildChronopostHomeDeliveryDeliveryMode 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(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(ChronopostHomeDeliveryDeliveryModeTableMap::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();
|
||||
|
||||
|
||||
ChronopostHomeDeliveryDeliveryModeTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
ChronopostHomeDeliveryDeliveryModeTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // ChronopostHomeDeliveryDeliveryModeQuery
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,606 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrder as ChildChronopostHomeDeliveryOrder;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrderQuery as ChildChronopostHomeDeliveryOrderQuery;
|
||||
use ChronopostHomeDelivery\Model\Map\ChronopostHomeDeliveryOrderTableMap;
|
||||
use ChronopostHomeDelivery\Model\Thelia\Model\Order;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'chronopost_home_delivery_order' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery orderByOrderId($order = Criteria::ASC) Order by the order_id column
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery orderByDeliveryType($order = Criteria::ASC) Order by the delivery_type column
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery orderByDeliveryCode($order = Criteria::ASC) Order by the delivery_code column
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery orderByLabelDirectory($order = Criteria::ASC) Order by the label_directory column
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery orderByLabelNumber($order = Criteria::ASC) Order by the label_number column
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery groupById() Group by the id column
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery groupByOrderId() Group by the order_id column
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery groupByDeliveryType() Group by the delivery_type column
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery groupByDeliveryCode() Group by the delivery_code column
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery groupByLabelDirectory() Group by the label_directory column
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery groupByLabelNumber() Group by the label_number column
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery leftJoinOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the Order relation
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation
|
||||
* @method ChildChronopostHomeDeliveryOrderQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryOrder findOne(ConnectionInterface $con = null) Return the first ChildChronopostHomeDeliveryOrder matching the query
|
||||
* @method ChildChronopostHomeDeliveryOrder findOneOrCreate(ConnectionInterface $con = null) Return the first ChildChronopostHomeDeliveryOrder matching the query, or a new ChildChronopostHomeDeliveryOrder object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryOrder findOneById(int $id) Return the first ChildChronopostHomeDeliveryOrder filtered by the id column
|
||||
* @method ChildChronopostHomeDeliveryOrder findOneByOrderId(int $order_id) Return the first ChildChronopostHomeDeliveryOrder filtered by the order_id column
|
||||
* @method ChildChronopostHomeDeliveryOrder findOneByDeliveryType(string $delivery_type) Return the first ChildChronopostHomeDeliveryOrder filtered by the delivery_type column
|
||||
* @method ChildChronopostHomeDeliveryOrder findOneByDeliveryCode(string $delivery_code) Return the first ChildChronopostHomeDeliveryOrder filtered by the delivery_code column
|
||||
* @method ChildChronopostHomeDeliveryOrder findOneByLabelDirectory(string $label_directory) Return the first ChildChronopostHomeDeliveryOrder filtered by the label_directory column
|
||||
* @method ChildChronopostHomeDeliveryOrder findOneByLabelNumber(string $label_number) Return the first ChildChronopostHomeDeliveryOrder filtered by the label_number column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildChronopostHomeDeliveryOrder objects filtered by the id column
|
||||
* @method array findByOrderId(int $order_id) Return ChildChronopostHomeDeliveryOrder objects filtered by the order_id column
|
||||
* @method array findByDeliveryType(string $delivery_type) Return ChildChronopostHomeDeliveryOrder objects filtered by the delivery_type column
|
||||
* @method array findByDeliveryCode(string $delivery_code) Return ChildChronopostHomeDeliveryOrder objects filtered by the delivery_code column
|
||||
* @method array findByLabelDirectory(string $label_directory) Return ChildChronopostHomeDeliveryOrder objects filtered by the label_directory column
|
||||
* @method array findByLabelNumber(string $label_number) Return ChildChronopostHomeDeliveryOrder objects filtered by the label_number column
|
||||
*
|
||||
*/
|
||||
abstract class ChronopostHomeDeliveryOrderQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \ChronopostHomeDelivery\Model\Base\ChronopostHomeDeliveryOrderQuery 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 = '\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryOrder', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildChronopostHomeDeliveryOrderQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryOrderQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrderQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrderQuery();
|
||||
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 ChildChronopostHomeDeliveryOrder|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = ChronopostHomeDeliveryOrderTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(ChronopostHomeDeliveryOrderTableMap::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 ChildChronopostHomeDeliveryOrder A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, ORDER_ID, DELIVERY_TYPE, DELIVERY_CODE, LABEL_DIRECTORY, LABEL_NUMBER FROM chronopost_home_delivery_order 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 ChildChronopostHomeDeliveryOrder();
|
||||
$obj->hydrate($row);
|
||||
ChronopostHomeDeliveryOrderTableMap::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 ChildChronopostHomeDeliveryOrder|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 ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::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 ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::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 ChildChronopostHomeDeliveryOrderQuery 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(ChronopostHomeDeliveryOrderTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the order_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByOrderId(1234); // WHERE order_id = 1234
|
||||
* $query->filterByOrderId(array(12, 34)); // WHERE order_id IN (12, 34)
|
||||
* $query->filterByOrderId(array('min' => 12)); // WHERE order_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByOrder()
|
||||
*
|
||||
* @param mixed $orderId 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 ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByOrderId($orderId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($orderId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($orderId['min'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ORDER_ID, $orderId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($orderId['max'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ORDER_ID, $orderId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ORDER_ID, $orderId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the delivery_type column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByDeliveryType('fooValue'); // WHERE delivery_type = 'fooValue'
|
||||
* $query->filterByDeliveryType('%fooValue%'); // WHERE delivery_type LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $deliveryType 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 ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDeliveryType($deliveryType = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($deliveryType)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $deliveryType)) {
|
||||
$deliveryType = str_replace('*', '%', $deliveryType);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::DELIVERY_TYPE, $deliveryType, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the delivery_code column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByDeliveryCode('fooValue'); // WHERE delivery_code = 'fooValue'
|
||||
* $query->filterByDeliveryCode('%fooValue%'); // WHERE delivery_code LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $deliveryCode 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 ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDeliveryCode($deliveryCode = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($deliveryCode)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $deliveryCode)) {
|
||||
$deliveryCode = str_replace('*', '%', $deliveryCode);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::DELIVERY_CODE, $deliveryCode, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the label_directory column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByLabelDirectory('fooValue'); // WHERE label_directory = 'fooValue'
|
||||
* $query->filterByLabelDirectory('%fooValue%'); // WHERE label_directory LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $labelDirectory 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 ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByLabelDirectory($labelDirectory = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($labelDirectory)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $labelDirectory)) {
|
||||
$labelDirectory = str_replace('*', '%', $labelDirectory);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::LABEL_DIRECTORY, $labelDirectory, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the label_number column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByLabelNumber('fooValue'); // WHERE label_number = 'fooValue'
|
||||
* $query->filterByLabelNumber('%fooValue%'); // WHERE label_number LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $labelNumber 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 ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByLabelNumber($labelNumber = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($labelNumber)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $labelNumber)) {
|
||||
$labelNumber = str_replace('*', '%', $labelNumber);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::LABEL_NUMBER, $labelNumber, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \ChronopostHomeDelivery\Model\Thelia\Model\Order object
|
||||
*
|
||||
* @param \ChronopostHomeDelivery\Model\Thelia\Model\Order|ObjectCollection $order The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByOrder($order, $comparison = null)
|
||||
{
|
||||
if ($order instanceof \ChronopostHomeDelivery\Model\Thelia\Model\Order) {
|
||||
return $this
|
||||
->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ORDER_ID, $order->getId(), $comparison);
|
||||
} elseif ($order instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ORDER_ID, $order->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByOrder() only accepts arguments of type \ChronopostHomeDelivery\Model\Thelia\Model\Order or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Order relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Order');
|
||||
|
||||
// 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, 'Order');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Order relation Order 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 \ChronopostHomeDelivery\Model\Thelia\Model\OrderQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinOrder($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Order', '\ChronopostHomeDelivery\Model\Thelia\Model\OrderQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildChronopostHomeDeliveryOrder $chronopostHomeDeliveryOrder Object to remove from the list of results
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($chronopostHomeDeliveryOrder = null)
|
||||
{
|
||||
if ($chronopostHomeDeliveryOrder) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ID, $chronopostHomeDeliveryOrder->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the chronopost_home_delivery_order 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(ChronopostHomeDeliveryOrderTableMap::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).
|
||||
ChronopostHomeDeliveryOrderTableMap::clearInstancePool();
|
||||
ChronopostHomeDeliveryOrderTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildChronopostHomeDeliveryOrder or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildChronopostHomeDeliveryOrder 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(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(ChronopostHomeDeliveryOrderTableMap::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();
|
||||
|
||||
|
||||
ChronopostHomeDeliveryOrderTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
ChronopostHomeDeliveryOrderTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // ChronopostHomeDeliveryOrderQuery
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,780 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice as ChildChronopostHomeDeliveryPrice;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPriceQuery as ChildChronopostHomeDeliveryPriceQuery;
|
||||
use ChronopostHomeDelivery\Model\Map\ChronopostHomeDeliveryPriceTableMap;
|
||||
use ChronopostHomeDelivery\Model\Thelia\Model\Area;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'chronopost_home_delivery_price' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery orderByDeliveryModeId($order = Criteria::ASC) Order by the delivery_mode_id column
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery orderByWeightMax($order = Criteria::ASC) Order by the weight_max column
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery orderByPriceMax($order = Criteria::ASC) Order by the price_max column
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery orderByFrancoMinPrice($order = Criteria::ASC) Order by the franco_min_price column
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery orderByPrice($order = Criteria::ASC) Order by the price column
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery groupById() Group by the id column
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery groupByAreaId() Group by the area_id column
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery groupByDeliveryModeId() Group by the delivery_mode_id column
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery groupByWeightMax() Group by the weight_max column
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery groupByPriceMax() Group by the price_max column
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery groupByFrancoMinPrice() Group by the franco_min_price column
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery groupByPrice() Group by the price column
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery leftJoinChronopostHomeDeliveryDeliveryMode($relationAlias = null) Adds a LEFT JOIN clause to the query using the ChronopostHomeDeliveryDeliveryMode relation
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery rightJoinChronopostHomeDeliveryDeliveryMode($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ChronopostHomeDeliveryDeliveryMode relation
|
||||
* @method ChildChronopostHomeDeliveryPriceQuery innerJoinChronopostHomeDeliveryDeliveryMode($relationAlias = null) Adds a INNER JOIN clause to the query using the ChronopostHomeDeliveryDeliveryMode relation
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryPrice findOne(ConnectionInterface $con = null) Return the first ChildChronopostHomeDeliveryPrice matching the query
|
||||
* @method ChildChronopostHomeDeliveryPrice findOneOrCreate(ConnectionInterface $con = null) Return the first ChildChronopostHomeDeliveryPrice matching the query, or a new ChildChronopostHomeDeliveryPrice object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildChronopostHomeDeliveryPrice findOneById(int $id) Return the first ChildChronopostHomeDeliveryPrice filtered by the id column
|
||||
* @method ChildChronopostHomeDeliveryPrice findOneByAreaId(int $area_id) Return the first ChildChronopostHomeDeliveryPrice filtered by the area_id column
|
||||
* @method ChildChronopostHomeDeliveryPrice findOneByDeliveryModeId(int $delivery_mode_id) Return the first ChildChronopostHomeDeliveryPrice filtered by the delivery_mode_id column
|
||||
* @method ChildChronopostHomeDeliveryPrice findOneByWeightMax(double $weight_max) Return the first ChildChronopostHomeDeliveryPrice filtered by the weight_max column
|
||||
* @method ChildChronopostHomeDeliveryPrice findOneByPriceMax(double $price_max) Return the first ChildChronopostHomeDeliveryPrice filtered by the price_max column
|
||||
* @method ChildChronopostHomeDeliveryPrice findOneByFrancoMinPrice(double $franco_min_price) Return the first ChildChronopostHomeDeliveryPrice filtered by the franco_min_price column
|
||||
* @method ChildChronopostHomeDeliveryPrice findOneByPrice(double $price) Return the first ChildChronopostHomeDeliveryPrice filtered by the price column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildChronopostHomeDeliveryPrice objects filtered by the id column
|
||||
* @method array findByAreaId(int $area_id) Return ChildChronopostHomeDeliveryPrice objects filtered by the area_id column
|
||||
* @method array findByDeliveryModeId(int $delivery_mode_id) Return ChildChronopostHomeDeliveryPrice objects filtered by the delivery_mode_id column
|
||||
* @method array findByWeightMax(double $weight_max) Return ChildChronopostHomeDeliveryPrice objects filtered by the weight_max column
|
||||
* @method array findByPriceMax(double $price_max) Return ChildChronopostHomeDeliveryPrice objects filtered by the price_max column
|
||||
* @method array findByFrancoMinPrice(double $franco_min_price) Return ChildChronopostHomeDeliveryPrice objects filtered by the franco_min_price column
|
||||
* @method array findByPrice(double $price) Return ChildChronopostHomeDeliveryPrice objects filtered by the price column
|
||||
*
|
||||
*/
|
||||
abstract class ChronopostHomeDeliveryPriceQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \ChronopostHomeDelivery\Model\Base\ChronopostHomeDeliveryPriceQuery 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 = '\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryPrice', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildChronopostHomeDeliveryPriceQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryPriceQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPriceQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPriceQuery();
|
||||
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 ChildChronopostHomeDeliveryPrice|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = ChronopostHomeDeliveryPriceTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(ChronopostHomeDeliveryPriceTableMap::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 ChildChronopostHomeDeliveryPrice A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, AREA_ID, DELIVERY_MODE_ID, WEIGHT_MAX, PRICE_MAX, FRANCO_MIN_PRICE, PRICE FROM chronopost_home_delivery_price 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 ChildChronopostHomeDeliveryPrice();
|
||||
$obj->hydrate($row);
|
||||
ChronopostHomeDeliveryPriceTableMap::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 ChildChronopostHomeDeliveryPrice|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 ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::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 ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::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 ChildChronopostHomeDeliveryPriceQuery 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(ChronopostHomeDeliveryPriceTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the area_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByAreaId(1234); // WHERE area_id = 1234
|
||||
* $query->filterByAreaId(array(12, 34)); // WHERE area_id IN (12, 34)
|
||||
* $query->filterByAreaId(array('min' => 12)); // WHERE area_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByArea()
|
||||
*
|
||||
* @param mixed $areaId 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 ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAreaId($areaId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($areaId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($areaId['min'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($areaId['max'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::AREA_ID, $areaId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the delivery_mode_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByDeliveryModeId(1234); // WHERE delivery_mode_id = 1234
|
||||
* $query->filterByDeliveryModeId(array(12, 34)); // WHERE delivery_mode_id IN (12, 34)
|
||||
* $query->filterByDeliveryModeId(array('min' => 12)); // WHERE delivery_mode_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByChronopostHomeDeliveryDeliveryMode()
|
||||
*
|
||||
* @param mixed $deliveryModeId 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 ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDeliveryModeId($deliveryModeId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($deliveryModeId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($deliveryModeId['min'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID, $deliveryModeId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($deliveryModeId['max'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID, $deliveryModeId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID, $deliveryModeId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the weight_max column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByWeightMax(1234); // WHERE weight_max = 1234
|
||||
* $query->filterByWeightMax(array(12, 34)); // WHERE weight_max IN (12, 34)
|
||||
* $query->filterByWeightMax(array('min' => 12)); // WHERE weight_max > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $weightMax 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 ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByWeightMax($weightMax = null, $comparison = null)
|
||||
{
|
||||
if (is_array($weightMax)) {
|
||||
$useMinMax = false;
|
||||
if (isset($weightMax['min'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::WEIGHT_MAX, $weightMax['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($weightMax['max'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::WEIGHT_MAX, $weightMax['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::WEIGHT_MAX, $weightMax, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the price_max column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByPriceMax(1234); // WHERE price_max = 1234
|
||||
* $query->filterByPriceMax(array(12, 34)); // WHERE price_max IN (12, 34)
|
||||
* $query->filterByPriceMax(array('min' => 12)); // WHERE price_max > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $priceMax 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 ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPriceMax($priceMax = null, $comparison = null)
|
||||
{
|
||||
if (is_array($priceMax)) {
|
||||
$useMinMax = false;
|
||||
if (isset($priceMax['min'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::PRICE_MAX, $priceMax['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($priceMax['max'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::PRICE_MAX, $priceMax['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::PRICE_MAX, $priceMax, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the franco_min_price column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByFrancoMinPrice(1234); // WHERE franco_min_price = 1234
|
||||
* $query->filterByFrancoMinPrice(array(12, 34)); // WHERE franco_min_price IN (12, 34)
|
||||
* $query->filterByFrancoMinPrice(array('min' => 12)); // WHERE franco_min_price > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $francoMinPrice 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 ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByFrancoMinPrice($francoMinPrice = null, $comparison = null)
|
||||
{
|
||||
if (is_array($francoMinPrice)) {
|
||||
$useMinMax = false;
|
||||
if (isset($francoMinPrice['min'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::FRANCO_MIN_PRICE, $francoMinPrice['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($francoMinPrice['max'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::FRANCO_MIN_PRICE, $francoMinPrice['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::FRANCO_MIN_PRICE, $francoMinPrice, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the price column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByPrice(1234); // WHERE price = 1234
|
||||
* $query->filterByPrice(array(12, 34)); // WHERE price IN (12, 34)
|
||||
* $query->filterByPrice(array('min' => 12)); // WHERE price > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $price 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 ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrice($price = null, $comparison = null)
|
||||
{
|
||||
if (is_array($price)) {
|
||||
$useMinMax = false;
|
||||
if (isset($price['min'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::PRICE, $price['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($price['max'])) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::PRICE, $price['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::PRICE, $price, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \ChronopostHomeDelivery\Model\Thelia\Model\Area object
|
||||
*
|
||||
* @param \ChronopostHomeDelivery\Model\Thelia\Model\Area|ObjectCollection $area The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByArea($area, $comparison = null)
|
||||
{
|
||||
if ($area instanceof \ChronopostHomeDelivery\Model\Thelia\Model\Area) {
|
||||
return $this
|
||||
->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::AREA_ID, $area->getId(), $comparison);
|
||||
} elseif ($area instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByArea() only accepts arguments of type \ChronopostHomeDelivery\Model\Thelia\Model\Area or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Area relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinArea($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Area');
|
||||
|
||||
// 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, 'Area');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Area relation Area 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 \ChronopostHomeDelivery\Model\Thelia\Model\AreaQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAreaQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinArea($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Area', '\ChronopostHomeDelivery\Model\Thelia\Model\AreaQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode object
|
||||
*
|
||||
* @param \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode|ObjectCollection $chronopostHomeDeliveryDeliveryMode The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByChronopostHomeDeliveryDeliveryMode($chronopostHomeDeliveryDeliveryMode, $comparison = null)
|
||||
{
|
||||
if ($chronopostHomeDeliveryDeliveryMode instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode) {
|
||||
return $this
|
||||
->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID, $chronopostHomeDeliveryDeliveryMode->getId(), $comparison);
|
||||
} elseif ($chronopostHomeDeliveryDeliveryMode instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID, $chronopostHomeDeliveryDeliveryMode->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByChronopostHomeDeliveryDeliveryMode() only accepts arguments of type \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the ChronopostHomeDeliveryDeliveryMode relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinChronopostHomeDeliveryDeliveryMode($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('ChronopostHomeDeliveryDeliveryMode');
|
||||
|
||||
// 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, 'ChronopostHomeDeliveryDeliveryMode');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the ChronopostHomeDeliveryDeliveryMode relation ChronopostHomeDeliveryDeliveryMode 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 \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryModeQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useChronopostHomeDeliveryDeliveryModeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinChronopostHomeDeliveryDeliveryMode($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'ChronopostHomeDeliveryDeliveryMode', '\ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryModeQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildChronopostHomeDeliveryPrice $chronopostHomeDeliveryPrice Object to remove from the list of results
|
||||
*
|
||||
* @return ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($chronopostHomeDeliveryPrice = null)
|
||||
{
|
||||
if ($chronopostHomeDeliveryPrice) {
|
||||
$this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::ID, $chronopostHomeDeliveryPrice->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the chronopost_home_delivery_price 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(ChronopostHomeDeliveryPriceTableMap::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).
|
||||
ChronopostHomeDeliveryPriceTableMap::clearInstancePool();
|
||||
ChronopostHomeDeliveryPriceTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildChronopostHomeDeliveryPrice or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildChronopostHomeDeliveryPrice 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(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(ChronopostHomeDeliveryPriceTableMap::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();
|
||||
|
||||
|
||||
ChronopostHomeDeliveryPriceTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
ChronopostHomeDeliveryPriceTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // ChronopostHomeDeliveryPriceQuery
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Model;
|
||||
|
||||
use ChronopostHomeDelivery\Model\Base\ChronopostHomeDeliveryAreaFreeshipping as BaseChronopostHomeDeliveryAreaFreeshipping;
|
||||
|
||||
class ChronopostHomeDeliveryAreaFreeshipping extends BaseChronopostHomeDeliveryAreaFreeshipping
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Model;
|
||||
|
||||
use ChronopostHomeDelivery\Model\Base\ChronopostHomeDeliveryAreaFreeshippingQuery as BaseChronopostHomeDeliveryAreaFreeshippingQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'chronopost_home_delivery_area_freeshipping' 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 ChronopostHomeDeliveryAreaFreeshippingQuery extends BaseChronopostHomeDeliveryAreaFreeshippingQuery
|
||||
{
|
||||
|
||||
} // ChronopostHomeDeliveryAreaFreeshippingQuery
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Model;
|
||||
|
||||
use ChronopostHomeDelivery\Model\Base\ChronopostHomeDeliveryDeliveryMode as BaseChronopostHomeDeliveryDeliveryMode;
|
||||
|
||||
class ChronopostHomeDeliveryDeliveryMode extends BaseChronopostHomeDeliveryDeliveryMode
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Model;
|
||||
|
||||
use ChronopostHomeDelivery\Model\Base\ChronopostHomeDeliveryDeliveryModeQuery as BaseChronopostHomeDeliveryDeliveryModeQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'chronopost_home_delivery_delivery_mode' 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 ChronopostHomeDeliveryDeliveryModeQuery extends BaseChronopostHomeDeliveryDeliveryModeQuery
|
||||
{
|
||||
|
||||
} // ChronopostHomeDeliveryDeliveryModeQuery
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Model;
|
||||
|
||||
use ChronopostHomeDelivery\Model\Base\ChronopostHomeDeliveryOrder as BaseChronopostHomeDeliveryOrder;
|
||||
|
||||
class ChronopostHomeDeliveryOrder extends BaseChronopostHomeDeliveryOrder
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Model;
|
||||
|
||||
use ChronopostHomeDelivery\Model\Base\ChronopostHomeDeliveryOrderQuery as BaseChronopostHomeDeliveryOrderQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'chronopost_home_delivery_order' 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 ChronopostHomeDeliveryOrderQuery extends BaseChronopostHomeDeliveryOrderQuery
|
||||
{
|
||||
|
||||
} // ChronopostHomeDeliveryOrderQuery
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Model;
|
||||
|
||||
use ChronopostHomeDelivery\Model\Base\ChronopostHomeDeliveryPrice as BaseChronopostHomeDeliveryPrice;
|
||||
|
||||
class ChronopostHomeDeliveryPrice extends BaseChronopostHomeDeliveryPrice
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Model;
|
||||
|
||||
use ChronopostHomeDelivery\Model\Base\ChronopostHomeDeliveryPriceQuery as BaseChronopostHomeDeliveryPriceQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'chronopost_home_delivery_price' 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 ChronopostHomeDeliveryPriceQuery extends BaseChronopostHomeDeliveryPriceQuery
|
||||
{
|
||||
|
||||
} // ChronopostHomeDeliveryPriceQuery
|
||||
@@ -0,0 +1,428 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Model\Map;
|
||||
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshippingQuery;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\DataFetcher\DataFetcherInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\RelationMap;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Map\TableMapTrait;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'chronopost_home_delivery_area_freeshipping' 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 ChronopostHomeDeliveryAreaFreeshippingTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'ChronopostHomeDelivery.Model.Map.ChronopostHomeDeliveryAreaFreeshippingTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'chronopost_home_delivery_area_freeshipping';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryAreaFreeshipping';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'ChronopostHomeDelivery.Model.ChronopostHomeDeliveryAreaFreeshipping';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 4;
|
||||
|
||||
/**
|
||||
* 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 = 4;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'chronopost_home_delivery_area_freeshipping.ID';
|
||||
|
||||
/**
|
||||
* the column name for the AREA_ID field
|
||||
*/
|
||||
const AREA_ID = 'chronopost_home_delivery_area_freeshipping.AREA_ID';
|
||||
|
||||
/**
|
||||
* the column name for the DELIVERY_MODE_ID field
|
||||
*/
|
||||
const DELIVERY_MODE_ID = 'chronopost_home_delivery_area_freeshipping.DELIVERY_MODE_ID';
|
||||
|
||||
/**
|
||||
* the column name for the CART_AMOUNT field
|
||||
*/
|
||||
const CART_AMOUNT = 'chronopost_home_delivery_area_freeshipping.CART_AMOUNT';
|
||||
|
||||
/**
|
||||
* 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', 'AreaId', 'DeliveryModeId', 'CartAmount', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'deliveryModeId', 'cartAmount', ),
|
||||
self::TYPE_COLNAME => array(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID, ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID, ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID, ChronopostHomeDeliveryAreaFreeshippingTableMap::CART_AMOUNT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'DELIVERY_MODE_ID', 'CART_AMOUNT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'area_id', 'delivery_mode_id', 'cart_amount', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, )
|
||||
);
|
||||
|
||||
/**
|
||||
* 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, 'AreaId' => 1, 'DeliveryModeId' => 2, 'CartAmount' => 3, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'deliveryModeId' => 2, 'cartAmount' => 3, ),
|
||||
self::TYPE_COLNAME => array(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID => 0, ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID => 1, ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID => 2, ChronopostHomeDeliveryAreaFreeshippingTableMap::CART_AMOUNT => 3, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'DELIVERY_MODE_ID' => 2, 'CART_AMOUNT' => 3, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'delivery_mode_id' => 2, 'cart_amount' => 3, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, )
|
||||
);
|
||||
|
||||
/**
|
||||
* 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('chronopost_home_delivery_area_freeshipping');
|
||||
$this->setPhpName('ChronopostHomeDeliveryAreaFreeshipping');
|
||||
$this->setClassName('\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryAreaFreeshipping');
|
||||
$this->setPackage('ChronopostHomeDelivery.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', true, null, null);
|
||||
$this->addForeignKey('DELIVERY_MODE_ID', 'DeliveryModeId', 'INTEGER', 'chronopost_home_delivery_delivery_mode', 'ID', true, null, null);
|
||||
$this->addColumn('CART_AMOUNT', 'CartAmount', 'DECIMAL', false, 16, 0);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Area', '\\ChronopostHomeDelivery\\Model\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'RESTRICT', 'RESTRICT');
|
||||
$this->addRelation('ChronopostHomeDeliveryDeliveryMode', '\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryDeliveryMode', RelationMap::MANY_TO_ONE, array('delivery_mode_id' => 'id', ), 'RESTRICT', 'RESTRICT');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
*
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*/
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// 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 ? ChronopostHomeDeliveryAreaFreeshippingTableMap::CLASS_DEFAULT : ChronopostHomeDeliveryAreaFreeshippingTableMap::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 (ChronopostHomeDeliveryAreaFreeshipping object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = ChronopostHomeDeliveryAreaFreeshippingTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = ChronopostHomeDeliveryAreaFreeshippingTableMap::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 + ChronopostHomeDeliveryAreaFreeshippingTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = ChronopostHomeDeliveryAreaFreeshippingTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
ChronopostHomeDeliveryAreaFreeshippingTableMap::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 = ChronopostHomeDeliveryAreaFreeshippingTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = ChronopostHomeDeliveryAreaFreeshippingTableMap::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;
|
||||
ChronopostHomeDeliveryAreaFreeshippingTableMap::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(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryAreaFreeshippingTableMap::CART_AMOUNT);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.AREA_ID');
|
||||
$criteria->addSelectColumn($alias . '.DELIVERY_MODE_ID');
|
||||
$criteria->addSelectColumn($alias . '.CART_AMOUNT');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME)->getTable(ChronopostHomeDeliveryAreaFreeshippingTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(ChronopostHomeDeliveryAreaFreeshippingTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new ChronopostHomeDeliveryAreaFreeshippingTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChronopostHomeDeliveryAreaFreeshipping or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChronopostHomeDeliveryAreaFreeshipping 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(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping) { // 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(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
|
||||
$criteria->add(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = ChronopostHomeDeliveryAreaFreeshippingQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { ChronopostHomeDeliveryAreaFreeshippingTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { ChronopostHomeDeliveryAreaFreeshippingTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the chronopost_home_delivery_area_freeshipping 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 ChronopostHomeDeliveryAreaFreeshippingQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a ChronopostHomeDeliveryAreaFreeshipping or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or ChronopostHomeDeliveryAreaFreeshipping 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(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from ChronopostHomeDeliveryAreaFreeshipping object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID) && $criteria->keyContainsValue(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ChronopostHomeDeliveryAreaFreeshippingTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = ChronopostHomeDeliveryAreaFreeshippingQuery::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;
|
||||
}
|
||||
|
||||
} // ChronopostHomeDeliveryAreaFreeshippingTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
ChronopostHomeDeliveryAreaFreeshippingTableMap::buildTableMap();
|
||||
@@ -0,0 +1,436 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Model\Map;
|
||||
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryModeQuery;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\DataFetcher\DataFetcherInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\RelationMap;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Map\TableMapTrait;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'chronopost_home_delivery_delivery_mode' 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 ChronopostHomeDeliveryDeliveryModeTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'ChronopostHomeDelivery.Model.Map.ChronopostHomeDeliveryDeliveryModeTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'chronopost_home_delivery_delivery_mode';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryDeliveryMode';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'ChronopostHomeDelivery.Model.ChronopostHomeDeliveryDeliveryMode';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 5;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
*/
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 5;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'chronopost_home_delivery_delivery_mode.ID';
|
||||
|
||||
/**
|
||||
* the column name for the TITLE field
|
||||
*/
|
||||
const TITLE = 'chronopost_home_delivery_delivery_mode.TITLE';
|
||||
|
||||
/**
|
||||
* the column name for the CODE field
|
||||
*/
|
||||
const CODE = 'chronopost_home_delivery_delivery_mode.CODE';
|
||||
|
||||
/**
|
||||
* the column name for the FREESHIPPING_ACTIVE field
|
||||
*/
|
||||
const FREESHIPPING_ACTIVE = 'chronopost_home_delivery_delivery_mode.FREESHIPPING_ACTIVE';
|
||||
|
||||
/**
|
||||
* the column name for the FREESHIPPING_FROM field
|
||||
*/
|
||||
const FREESHIPPING_FROM = 'chronopost_home_delivery_delivery_mode.FREESHIPPING_FROM';
|
||||
|
||||
/**
|
||||
* 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', 'Title', 'Code', 'FreeshippingActive', 'FreeshippingFrom', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'title', 'code', 'freeshippingActive', 'freeshippingFrom', ),
|
||||
self::TYPE_COLNAME => array(ChronopostHomeDeliveryDeliveryModeTableMap::ID, ChronopostHomeDeliveryDeliveryModeTableMap::TITLE, ChronopostHomeDeliveryDeliveryModeTableMap::CODE, ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_ACTIVE, ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_FROM, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'TITLE', 'CODE', 'FREESHIPPING_ACTIVE', 'FREESHIPPING_FROM', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'title', 'code', 'freeshipping_active', 'freeshipping_from', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Title' => 1, 'Code' => 2, 'FreeshippingActive' => 3, 'FreeshippingFrom' => 4, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'freeshippingActive' => 3, 'freeshippingFrom' => 4, ),
|
||||
self::TYPE_COLNAME => array(ChronopostHomeDeliveryDeliveryModeTableMap::ID => 0, ChronopostHomeDeliveryDeliveryModeTableMap::TITLE => 1, ChronopostHomeDeliveryDeliveryModeTableMap::CODE => 2, ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_ACTIVE => 3, ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_FROM => 4, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE' => 1, 'CODE' => 2, 'FREESHIPPING_ACTIVE' => 3, 'FREESHIPPING_FROM' => 4, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'freeshipping_active' => 3, 'freeshipping_from' => 4, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialize the table attributes and columns
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('chronopost_home_delivery_delivery_mode');
|
||||
$this->setPhpName('ChronopostHomeDeliveryDeliveryMode');
|
||||
$this->setClassName('\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryDeliveryMode');
|
||||
$this->setPackage('ChronopostHomeDelivery.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 55, null);
|
||||
$this->addColumn('FREESHIPPING_ACTIVE', 'FreeshippingActive', 'BOOLEAN', false, 1, null);
|
||||
$this->addColumn('FREESHIPPING_FROM', 'FreeshippingFrom', 'FLOAT', false, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('ChronopostHomeDeliveryPrice', '\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryPrice', RelationMap::ONE_TO_MANY, array('id' => 'delivery_mode_id', ), 'RESTRICT', 'RESTRICT', 'ChronopostHomeDeliveryPrices');
|
||||
$this->addRelation('ChronopostHomeDeliveryAreaFreeshipping', '\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryAreaFreeshipping', RelationMap::ONE_TO_MANY, array('id' => 'delivery_mode_id', ), 'RESTRICT', 'RESTRICT', 'ChronopostHomeDeliveryAreaFreeshippings');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
*
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*/
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// 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 ? ChronopostHomeDeliveryDeliveryModeTableMap::CLASS_DEFAULT : ChronopostHomeDeliveryDeliveryModeTableMap::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 (ChronopostHomeDeliveryDeliveryMode object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = ChronopostHomeDeliveryDeliveryModeTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = ChronopostHomeDeliveryDeliveryModeTableMap::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 + ChronopostHomeDeliveryDeliveryModeTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = ChronopostHomeDeliveryDeliveryModeTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
ChronopostHomeDeliveryDeliveryModeTableMap::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 = ChronopostHomeDeliveryDeliveryModeTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = ChronopostHomeDeliveryDeliveryModeTableMap::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;
|
||||
ChronopostHomeDeliveryDeliveryModeTableMap::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(ChronopostHomeDeliveryDeliveryModeTableMap::ID);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryDeliveryModeTableMap::TITLE);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryDeliveryModeTableMap::CODE);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_ACTIVE);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_FROM);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.TITLE');
|
||||
$criteria->addSelectColumn($alias . '.CODE');
|
||||
$criteria->addSelectColumn($alias . '.FREESHIPPING_ACTIVE');
|
||||
$criteria->addSelectColumn($alias . '.FREESHIPPING_FROM');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME)->getTable(ChronopostHomeDeliveryDeliveryModeTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(ChronopostHomeDeliveryDeliveryModeTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new ChronopostHomeDeliveryDeliveryModeTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChronopostHomeDeliveryDeliveryMode or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChronopostHomeDeliveryDeliveryMode 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(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode) { // 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(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
|
||||
$criteria->add(ChronopostHomeDeliveryDeliveryModeTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = ChronopostHomeDeliveryDeliveryModeQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { ChronopostHomeDeliveryDeliveryModeTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { ChronopostHomeDeliveryDeliveryModeTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the chronopost_home_delivery_delivery_mode 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 ChronopostHomeDeliveryDeliveryModeQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a ChronopostHomeDeliveryDeliveryMode or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or ChronopostHomeDeliveryDeliveryMode 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(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from ChronopostHomeDeliveryDeliveryMode object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(ChronopostHomeDeliveryDeliveryModeTableMap::ID) && $criteria->keyContainsValue(ChronopostHomeDeliveryDeliveryModeTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ChronopostHomeDeliveryDeliveryModeTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = ChronopostHomeDeliveryDeliveryModeQuery::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;
|
||||
}
|
||||
|
||||
} // ChronopostHomeDeliveryDeliveryModeTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
ChronopostHomeDeliveryDeliveryModeTableMap::buildTableMap();
|
||||
@@ -0,0 +1,443 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Model\Map;
|
||||
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrder;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrderQuery;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\DataFetcher\DataFetcherInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\RelationMap;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Map\TableMapTrait;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'chronopost_home_delivery_order' 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 ChronopostHomeDeliveryOrderTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'ChronopostHomeDelivery.Model.Map.ChronopostHomeDeliveryOrderTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'chronopost_home_delivery_order';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryOrder';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'ChronopostHomeDelivery.Model.ChronopostHomeDeliveryOrder';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 6;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
*/
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 6;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'chronopost_home_delivery_order.ID';
|
||||
|
||||
/**
|
||||
* the column name for the ORDER_ID field
|
||||
*/
|
||||
const ORDER_ID = 'chronopost_home_delivery_order.ORDER_ID';
|
||||
|
||||
/**
|
||||
* the column name for the DELIVERY_TYPE field
|
||||
*/
|
||||
const DELIVERY_TYPE = 'chronopost_home_delivery_order.DELIVERY_TYPE';
|
||||
|
||||
/**
|
||||
* the column name for the DELIVERY_CODE field
|
||||
*/
|
||||
const DELIVERY_CODE = 'chronopost_home_delivery_order.DELIVERY_CODE';
|
||||
|
||||
/**
|
||||
* the column name for the LABEL_DIRECTORY field
|
||||
*/
|
||||
const LABEL_DIRECTORY = 'chronopost_home_delivery_order.LABEL_DIRECTORY';
|
||||
|
||||
/**
|
||||
* the column name for the LABEL_NUMBER field
|
||||
*/
|
||||
const LABEL_NUMBER = 'chronopost_home_delivery_order.LABEL_NUMBER';
|
||||
|
||||
/**
|
||||
* 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', 'OrderId', 'DeliveryType', 'DeliveryCode', 'LabelDirectory', 'LabelNumber', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'deliveryType', 'deliveryCode', 'labelDirectory', 'labelNumber', ),
|
||||
self::TYPE_COLNAME => array(ChronopostHomeDeliveryOrderTableMap::ID, ChronopostHomeDeliveryOrderTableMap::ORDER_ID, ChronopostHomeDeliveryOrderTableMap::DELIVERY_TYPE, ChronopostHomeDeliveryOrderTableMap::DELIVERY_CODE, ChronopostHomeDeliveryOrderTableMap::LABEL_DIRECTORY, ChronopostHomeDeliveryOrderTableMap::LABEL_NUMBER, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'DELIVERY_TYPE', 'DELIVERY_CODE', 'LABEL_DIRECTORY', 'LABEL_NUMBER', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'order_id', 'delivery_type', 'delivery_code', 'label_directory', 'label_number', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'DeliveryType' => 2, 'DeliveryCode' => 3, 'LabelDirectory' => 4, 'LabelNumber' => 5, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'deliveryType' => 2, 'deliveryCode' => 3, 'labelDirectory' => 4, 'labelNumber' => 5, ),
|
||||
self::TYPE_COLNAME => array(ChronopostHomeDeliveryOrderTableMap::ID => 0, ChronopostHomeDeliveryOrderTableMap::ORDER_ID => 1, ChronopostHomeDeliveryOrderTableMap::DELIVERY_TYPE => 2, ChronopostHomeDeliveryOrderTableMap::DELIVERY_CODE => 3, ChronopostHomeDeliveryOrderTableMap::LABEL_DIRECTORY => 4, ChronopostHomeDeliveryOrderTableMap::LABEL_NUMBER => 5, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'DELIVERY_TYPE' => 2, 'DELIVERY_CODE' => 3, 'LABEL_DIRECTORY' => 4, 'LABEL_NUMBER' => 5, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'delivery_type' => 2, 'delivery_code' => 3, 'label_directory' => 4, 'label_number' => 5, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialize the table attributes and columns
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('chronopost_home_delivery_order');
|
||||
$this->setPhpName('ChronopostHomeDeliveryOrder');
|
||||
$this->setClassName('\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryOrder');
|
||||
$this->setPackage('ChronopostHomeDelivery.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('ORDER_ID', 'OrderId', 'INTEGER', 'order', 'ID', true, null, null);
|
||||
$this->addColumn('DELIVERY_TYPE', 'DeliveryType', 'LONGVARCHAR', false, null, null);
|
||||
$this->addColumn('DELIVERY_CODE', 'DeliveryCode', 'LONGVARCHAR', false, null, null);
|
||||
$this->addColumn('LABEL_DIRECTORY', 'LabelDirectory', 'LONGVARCHAR', false, null, null);
|
||||
$this->addColumn('LABEL_NUMBER', 'LabelNumber', 'LONGVARCHAR', false, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Order', '\\ChronopostHomeDelivery\\Model\\Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('order_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
*
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*/
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// 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 ? ChronopostHomeDeliveryOrderTableMap::CLASS_DEFAULT : ChronopostHomeDeliveryOrderTableMap::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 (ChronopostHomeDeliveryOrder object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = ChronopostHomeDeliveryOrderTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = ChronopostHomeDeliveryOrderTableMap::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 + ChronopostHomeDeliveryOrderTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = ChronopostHomeDeliveryOrderTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
ChronopostHomeDeliveryOrderTableMap::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 = ChronopostHomeDeliveryOrderTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = ChronopostHomeDeliveryOrderTableMap::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;
|
||||
ChronopostHomeDeliveryOrderTableMap::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(ChronopostHomeDeliveryOrderTableMap::ID);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryOrderTableMap::ORDER_ID);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryOrderTableMap::DELIVERY_TYPE);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryOrderTableMap::DELIVERY_CODE);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryOrderTableMap::LABEL_DIRECTORY);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryOrderTableMap::LABEL_NUMBER);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.ORDER_ID');
|
||||
$criteria->addSelectColumn($alias . '.DELIVERY_TYPE');
|
||||
$criteria->addSelectColumn($alias . '.DELIVERY_CODE');
|
||||
$criteria->addSelectColumn($alias . '.LABEL_DIRECTORY');
|
||||
$criteria->addSelectColumn($alias . '.LABEL_NUMBER');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME)->getTable(ChronopostHomeDeliveryOrderTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(ChronopostHomeDeliveryOrderTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new ChronopostHomeDeliveryOrderTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChronopostHomeDeliveryOrder or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChronopostHomeDeliveryOrder 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(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrder) { // 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(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
|
||||
$criteria->add(ChronopostHomeDeliveryOrderTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = ChronopostHomeDeliveryOrderQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { ChronopostHomeDeliveryOrderTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { ChronopostHomeDeliveryOrderTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the chronopost_home_delivery_order 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 ChronopostHomeDeliveryOrderQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a ChronopostHomeDeliveryOrder or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or ChronopostHomeDeliveryOrder 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(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from ChronopostHomeDeliveryOrder object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(ChronopostHomeDeliveryOrderTableMap::ID) && $criteria->keyContainsValue(ChronopostHomeDeliveryOrderTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ChronopostHomeDeliveryOrderTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = ChronopostHomeDeliveryOrderQuery::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;
|
||||
}
|
||||
|
||||
} // ChronopostHomeDeliveryOrderTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
ChronopostHomeDeliveryOrderTableMap::buildTableMap();
|
||||
@@ -0,0 +1,452 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Model\Map;
|
||||
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice;
|
||||
use ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPriceQuery;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\DataFetcher\DataFetcherInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\RelationMap;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Map\TableMapTrait;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'chronopost_home_delivery_price' 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 ChronopostHomeDeliveryPriceTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'ChronopostHomeDelivery.Model.Map.ChronopostHomeDeliveryPriceTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'chronopost_home_delivery_price';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryPrice';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'ChronopostHomeDelivery.Model.ChronopostHomeDeliveryPrice';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 7;
|
||||
|
||||
/**
|
||||
* 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 = 7;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'chronopost_home_delivery_price.ID';
|
||||
|
||||
/**
|
||||
* the column name for the AREA_ID field
|
||||
*/
|
||||
const AREA_ID = 'chronopost_home_delivery_price.AREA_ID';
|
||||
|
||||
/**
|
||||
* the column name for the DELIVERY_MODE_ID field
|
||||
*/
|
||||
const DELIVERY_MODE_ID = 'chronopost_home_delivery_price.DELIVERY_MODE_ID';
|
||||
|
||||
/**
|
||||
* the column name for the WEIGHT_MAX field
|
||||
*/
|
||||
const WEIGHT_MAX = 'chronopost_home_delivery_price.WEIGHT_MAX';
|
||||
|
||||
/**
|
||||
* the column name for the PRICE_MAX field
|
||||
*/
|
||||
const PRICE_MAX = 'chronopost_home_delivery_price.PRICE_MAX';
|
||||
|
||||
/**
|
||||
* the column name for the FRANCO_MIN_PRICE field
|
||||
*/
|
||||
const FRANCO_MIN_PRICE = 'chronopost_home_delivery_price.FRANCO_MIN_PRICE';
|
||||
|
||||
/**
|
||||
* the column name for the PRICE field
|
||||
*/
|
||||
const PRICE = 'chronopost_home_delivery_price.PRICE';
|
||||
|
||||
/**
|
||||
* 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', 'AreaId', 'DeliveryModeId', 'WeightMax', 'PriceMax', 'FrancoMinPrice', 'Price', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'deliveryModeId', 'weightMax', 'priceMax', 'francoMinPrice', 'price', ),
|
||||
self::TYPE_COLNAME => array(ChronopostHomeDeliveryPriceTableMap::ID, ChronopostHomeDeliveryPriceTableMap::AREA_ID, ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID, ChronopostHomeDeliveryPriceTableMap::WEIGHT_MAX, ChronopostHomeDeliveryPriceTableMap::PRICE_MAX, ChronopostHomeDeliveryPriceTableMap::FRANCO_MIN_PRICE, ChronopostHomeDeliveryPriceTableMap::PRICE, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'DELIVERY_MODE_ID', 'WEIGHT_MAX', 'PRICE_MAX', 'FRANCO_MIN_PRICE', 'PRICE', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'area_id', 'delivery_mode_id', 'weight_max', 'price_max', 'franco_min_price', 'price', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
||||
);
|
||||
|
||||
/**
|
||||
* 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, 'AreaId' => 1, 'DeliveryModeId' => 2, 'WeightMax' => 3, 'PriceMax' => 4, 'FrancoMinPrice' => 5, 'Price' => 6, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'deliveryModeId' => 2, 'weightMax' => 3, 'priceMax' => 4, 'francoMinPrice' => 5, 'price' => 6, ),
|
||||
self::TYPE_COLNAME => array(ChronopostHomeDeliveryPriceTableMap::ID => 0, ChronopostHomeDeliveryPriceTableMap::AREA_ID => 1, ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID => 2, ChronopostHomeDeliveryPriceTableMap::WEIGHT_MAX => 3, ChronopostHomeDeliveryPriceTableMap::PRICE_MAX => 4, ChronopostHomeDeliveryPriceTableMap::FRANCO_MIN_PRICE => 5, ChronopostHomeDeliveryPriceTableMap::PRICE => 6, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'DELIVERY_MODE_ID' => 2, 'WEIGHT_MAX' => 3, 'PRICE_MAX' => 4, 'FRANCO_MIN_PRICE' => 5, 'PRICE' => 6, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'delivery_mode_id' => 2, 'weight_max' => 3, 'price_max' => 4, 'franco_min_price' => 5, 'price' => 6, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
||||
);
|
||||
|
||||
/**
|
||||
* 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('chronopost_home_delivery_price');
|
||||
$this->setPhpName('ChronopostHomeDeliveryPrice');
|
||||
$this->setClassName('\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryPrice');
|
||||
$this->setPackage('ChronopostHomeDelivery.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', true, null, null);
|
||||
$this->addForeignKey('DELIVERY_MODE_ID', 'DeliveryModeId', 'INTEGER', 'chronopost_home_delivery_delivery_mode', 'ID', true, null, null);
|
||||
$this->addColumn('WEIGHT_MAX', 'WeightMax', 'FLOAT', false, null, null);
|
||||
$this->addColumn('PRICE_MAX', 'PriceMax', 'FLOAT', false, null, null);
|
||||
$this->addColumn('FRANCO_MIN_PRICE', 'FrancoMinPrice', 'FLOAT', false, null, null);
|
||||
$this->addColumn('PRICE', 'Price', 'FLOAT', true, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Area', '\\ChronopostHomeDelivery\\Model\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'RESTRICT', 'RESTRICT');
|
||||
$this->addRelation('ChronopostHomeDeliveryDeliveryMode', '\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryDeliveryMode', RelationMap::MANY_TO_ONE, array('delivery_mode_id' => 'id', ), 'RESTRICT', 'RESTRICT');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
*
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*/
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// 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 ? ChronopostHomeDeliveryPriceTableMap::CLASS_DEFAULT : ChronopostHomeDeliveryPriceTableMap::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 (ChronopostHomeDeliveryPrice object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = ChronopostHomeDeliveryPriceTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = ChronopostHomeDeliveryPriceTableMap::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 + ChronopostHomeDeliveryPriceTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = ChronopostHomeDeliveryPriceTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
ChronopostHomeDeliveryPriceTableMap::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 = ChronopostHomeDeliveryPriceTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = ChronopostHomeDeliveryPriceTableMap::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;
|
||||
ChronopostHomeDeliveryPriceTableMap::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(ChronopostHomeDeliveryPriceTableMap::ID);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryPriceTableMap::AREA_ID);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryPriceTableMap::WEIGHT_MAX);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryPriceTableMap::PRICE_MAX);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryPriceTableMap::FRANCO_MIN_PRICE);
|
||||
$criteria->addSelectColumn(ChronopostHomeDeliveryPriceTableMap::PRICE);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.AREA_ID');
|
||||
$criteria->addSelectColumn($alias . '.DELIVERY_MODE_ID');
|
||||
$criteria->addSelectColumn($alias . '.WEIGHT_MAX');
|
||||
$criteria->addSelectColumn($alias . '.PRICE_MAX');
|
||||
$criteria->addSelectColumn($alias . '.FRANCO_MIN_PRICE');
|
||||
$criteria->addSelectColumn($alias . '.PRICE');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME)->getTable(ChronopostHomeDeliveryPriceTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(ChronopostHomeDeliveryPriceTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new ChronopostHomeDeliveryPriceTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChronopostHomeDeliveryPrice or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChronopostHomeDeliveryPrice 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(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice) { // 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(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
|
||||
$criteria->add(ChronopostHomeDeliveryPriceTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = ChronopostHomeDeliveryPriceQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { ChronopostHomeDeliveryPriceTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { ChronopostHomeDeliveryPriceTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the chronopost_home_delivery_price 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 ChronopostHomeDeliveryPriceQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a ChronopostHomeDeliveryPrice or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or ChronopostHomeDeliveryPrice 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(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from ChronopostHomeDeliveryPrice object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(ChronopostHomeDeliveryPriceTableMap::ID) && $criteria->keyContainsValue(ChronopostHomeDeliveryPriceTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ChronopostHomeDeliveryPriceTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = ChronopostHomeDeliveryPriceQuery::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;
|
||||
}
|
||||
|
||||
} // ChronopostHomeDeliveryPriceTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
ChronopostHomeDeliveryPriceTableMap::buildTableMap();
|
||||
103
local/modules/ChronopostHomeDelivery/README.md
Normal file
103
local/modules/ChronopostHomeDelivery/README.md
Normal file
@@ -0,0 +1,103 @@
|
||||
# ChronopostHomeDelivery
|
||||
|
||||
Allows you to choose between differents delivery modes offered by Chronopost.
|
||||
Activating one or more of them will let your customers choose which one
|
||||
they want.
|
||||
|
||||
Delivery types currently availables :
|
||||
|
||||
- Chrono13
|
||||
- Chrono18
|
||||
- Chrono Classic (Delivery in Europe)
|
||||
- Chrono Express (Express delivery in Europe)
|
||||
- Fresh13
|
||||
- Others will be added in future versions
|
||||
|
||||
NB1 : You need IDs provided by Chronopost to use this module.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
### Manually
|
||||
|
||||
* Copy the module into ```<thelia_root>/local/modules/``` directory and be sure that the name of the module is Chronopost.
|
||||
* Activate it in your thelia administration panel
|
||||
|
||||
### Composer
|
||||
|
||||
Add it in your main thelia composer.json file
|
||||
|
||||
```
|
||||
composer require thelia/chronopost-home-delivery-module:~1.0
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
First, go to your back office, tab Modules, and activate the module Chronopost.
|
||||
Then go to Chronopost configuration page, tab "Advanced Configuration" and fill the required fields.
|
||||
|
||||
After activating the delivery types you wih to use, new tabs will appear. With these, you can
|
||||
change the shipping prices according to the delivery type and the area, and/or activate free shipping for a given price and/or given area, or just
|
||||
activate it no matter the are and cart amount.
|
||||
|
||||
If you also have the ChronopostLabel module, you can then generate and download labels from the Chronopost Label page accessible from the toolbar on the left of the BackOffice, or directly from the order page.
|
||||
|
||||
|
||||
## Loop
|
||||
|
||||
###[chronopost.home.delivery]
|
||||
|
||||
### Input arguments
|
||||
|
||||
|Argument |Description |
|
||||
|--- |--- |
|
||||
|**area_id** | **Mandatory** ID of the area from which you want to know the prices. |
|
||||
|**delivery_mode_id** | **Mandatory** ID of the delivery mode of which you want to know the prices. |
|
||||
|
||||
### Output arguments
|
||||
|
||||
|Variable |Description |
|
||||
|--- |--- |
|
||||
|$SLICE_ID | ID of the price slice |
|
||||
|$MAX_WEIGHT | Max weight for this slice price |
|
||||
|$MAX_PRICE | Max untaxed price of a cart for this price |
|
||||
|$PRICE | Price for this slice |
|
||||
|$FRANCO | Price of the Franco for this slice |
|
||||
|
||||
###[chronopost.home.delivery.delivery.mode]
|
||||
|
||||
### Input arguments
|
||||
|
||||
None
|
||||
|
||||
### Output arguments
|
||||
|
||||
|Variable |Description |
|
||||
|--- |--- |
|
||||
|$ID | The delivery mode ID in the table |
|
||||
|$TITLE | The delivery mode title (ex : Fresh13) |
|
||||
|$CODE | The delivery mode code (ex : 2R) |
|
||||
|$FREESHIPPING_ACTIVE | 0 or 1 depending on whether the total freeshipping is active or not |
|
||||
|$FREESHIPPING_FROM | Cart price needed for freeshipping |
|
||||
|
||||
###[chronopost.home.delivery.area.freeshipping]
|
||||
|
||||
### Input arguments
|
||||
|
||||
|Argument |Description |
|
||||
|--- |--- |
|
||||
|**area_id** | ID of the area from which you want to know the free shipping minimum amount needed. |
|
||||
|**delivery_mode_id** | ID of the delivery mode of which you want to know the free shipping minimum amount needed. |
|
||||
|
||||
### Output arguments
|
||||
|
||||
|Variable |Description |
|
||||
|--- |--- |
|
||||
|$AREA_ID | ID of the area |
|
||||
|$DELIVERY_MODE_ID | ID of the delivery mode |
|
||||
|$CART_AMOUNT | Cart amount needed for free shipping in this area and for this delivery mode |
|
||||
|
||||
##Integration
|
||||
|
||||
Templates are examples of integration for the default theme of Thelia and should probably be
|
||||
modified to suit your website better.
|
||||
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace ChronopostHomeDelivery\Smarty\Plugins;
|
||||
|
||||
|
||||
use ChronopostHomeDelivery\ChronopostHomeDelivery;
|
||||
use ChronopostHomeDelivery\Config\ChronopostHomeDeliveryConst;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Model\CountryArea;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Model\Coupon;
|
||||
use Thelia\Model\CouponQuery;
|
||||
use Thelia\Module\Exception\DeliveryException;
|
||||
use TheliaSmarty\Template\AbstractSmartyPlugin;
|
||||
use TheliaSmarty\Template\SmartyPluginDescriptor;
|
||||
|
||||
class ChronopostHomeDeliveryDeliveryType extends AbstractSmartyPlugin
|
||||
{
|
||||
protected $request;
|
||||
protected $dispatcher;
|
||||
|
||||
/**
|
||||
* ChronopostHomeDeliveryDeliveryType constructor.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param EventDispatcherInterface|null $dispatcher
|
||||
*/
|
||||
public function __construct(Request $request, EventDispatcherInterface $dispatcher = null)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|SmartyPluginDescriptor[]
|
||||
*/
|
||||
public function getPluginDescriptors()
|
||||
{
|
||||
return array(
|
||||
new SmartyPluginDescriptor("function", "chronopostHomeDeliveryDeliveryType", $this, "chronopostHomeDeliveryDeliveryType"),
|
||||
new SmartyPluginDescriptor("function", "chronopostHomeDeliveryDeliveryPrice", $this, "chronopostHomeDeliveryDeliveryPrice"),
|
||||
new SmartyPluginDescriptor("function", "chronopostHomeDeliveryGetDeliveryTypesStatusKeys", $this, "chronopostHomeDeliveryGetDeliveryTypesStatusKeys"),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $params
|
||||
* @param $smarty
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function chronopostHomeDeliveryDeliveryPrice($params, $smarty)
|
||||
{
|
||||
$deliveryMode = $params["delivery-mode"];
|
||||
$country = CountryQuery::create()->findOneById($params["country"]);
|
||||
|
||||
$cartWeight = $this->request->getSession()->getSessionCart($this->dispatcher)->getWeight();
|
||||
$cartAmount = $this->request->getSession()->getSessionCart($this->dispatcher)->getTaxedAmount($country);
|
||||
|
||||
try {
|
||||
|
||||
$countryAreas = $country->getCountryAreas();
|
||||
$areasArray = [];
|
||||
|
||||
/** @var CountryArea $countryArea */
|
||||
foreach ($countryAreas as $countryArea) {
|
||||
$areasArray[] = $countryArea->getAreaId();
|
||||
}
|
||||
|
||||
$price = (new ChronopostHomeDelivery)->getMinPostage(
|
||||
$areasArray,
|
||||
$cartWeight,
|
||||
$cartAmount,
|
||||
$deliveryMode
|
||||
);
|
||||
|
||||
$consumedCouponsCodes = $this->request->getSession()->getConsumedCoupons();
|
||||
|
||||
foreach ($consumedCouponsCodes as $consumedCouponCode) {
|
||||
$coupon = CouponQuery::create()
|
||||
->filterByCode($consumedCouponCode)
|
||||
->findOne();
|
||||
|
||||
/** @var Coupon $coupon */
|
||||
if(null !== $coupon){
|
||||
if($coupon->getIsRemovingPostage()){
|
||||
$price = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (DeliveryException $ex) {
|
||||
$smarty->assign('isValidMode', false);
|
||||
}
|
||||
|
||||
$smarty->assign('chronopostHomeDeliveryDeliveryModePrice', $price);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $params
|
||||
* @param $smarty
|
||||
*/
|
||||
public function chronopostHomeDeliveryDeliveryType($params, $smarty)
|
||||
{
|
||||
foreach (ChronopostHomeDeliveryConst::getDeliveryTypesStatusKeys() as $deliveryTypeName => $statusKey) {
|
||||
$smarty->assign('is' . $deliveryTypeName . 'Enabled', (bool)ChronopostHomeDelivery::getConfigValue($statusKey));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $params
|
||||
* @param $smarty
|
||||
*/
|
||||
public function chronopostHomeDeliveryGetDeliveryTypesStatusKeys($params, $smarty)
|
||||
{
|
||||
$smarty->assign('chronopostHomeDeliveryDeliveryTypesStatusKeys', ChronopostHomeDeliveryConst::getDeliveryTypesStatusKeys());
|
||||
}
|
||||
|
||||
}
|
||||
12
local/modules/ChronopostHomeDelivery/composer.json
Normal file
12
local/modules/ChronopostHomeDelivery/composer.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "thelia/chronopost-home-delivery-module",
|
||||
"license": "LGPL-3.0+",
|
||||
"type": "thelia-module",
|
||||
"require": {
|
||||
"thelia/installer": "~1.1"
|
||||
},
|
||||
"extra": {
|
||||
"installer-name": "ChronopostHomeDelivery"
|
||||
},
|
||||
"description": "Chronopost delivery module for home deliveries."
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<br>
|
||||
<div class="col-md-12 row form-container">
|
||||
{form name="chronopost_home_delivery_configuration_form" type="chronopost_home_delivery_configuration_form"}
|
||||
<form class="" action="{url path='/admin/module/ChronopostHomeDelivery/config'}" method="post">
|
||||
<div class="title">{intl l="Chronopost informations"}</div>
|
||||
{include
|
||||
file = "includes/inner-form-toolbar.html"
|
||||
hide_flags = true
|
||||
hide_save_and_close_button = true
|
||||
}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-title">{intl l="Service Configuration" d='chronopost.home.delivery.bo.default'}</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="col-md-6">
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{if $form_error}
|
||||
<div class="alert alert-danger">{$form_error_message}</div>
|
||||
{/if}
|
||||
|
||||
{render_form_field field="success_url" value={url path="/admin/module/ChronopostHomeDelivery"}}
|
||||
|
||||
{render_form_field field="chronopost_home_delivery_code"}
|
||||
|
||||
{render_form_field field="chronopost_home_delivery_password"}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<b>{intl l="Allowed shipping modes" d='chronopost.home.delivery.bo.default'}</b>
|
||||
|
||||
{chronopostHomeDeliveryGetDeliveryTypesStatusKeys}
|
||||
{foreach from=$chronopostHomeDeliveryDeliveryTypesStatusKeys key=k item=statusKey}
|
||||
{render_form_field field={$statusKey}}
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
@@ -0,0 +1,256 @@
|
||||
|
||||
{assign var="tab" value="configure"}
|
||||
{if isset($smarty.get.current_tab)}
|
||||
{assign var="tab" value=$smarty.get.current_tab}
|
||||
{/if}
|
||||
|
||||
{* default currency *}
|
||||
{loop type="currency" name="default_currency" default_only="1"}
|
||||
{$currencySymbol=$SYMBOL}
|
||||
{/loop}
|
||||
|
||||
|
||||
<div class="general-block-decorator">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<ul id="tabbed-menu" class="nav nav-tabs">
|
||||
|
||||
<li class="{if $tab eq "configure"}active{/if}"><a data-toggle="tab" href="#configure">{intl l="Advanced configuration" d='chronopost.home.delivery.bo.default'}</a></li>
|
||||
|
||||
{loop type="chronopost.home.delivery.delivery.mode" name="delivery_mode"}
|
||||
<li class="{if $tab eq "prices_slices_tab_{$ID}"}active{/if}"><a data-toggle="tab" href="#prices_slices_tab_{$ID}">{intl l="Price slices for \"%mode\"" d='chronopost.home.delivery.bo.default' mode={$TITLE}}</a></li>
|
||||
{/loop}
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div id="configure" class="tab-pane {if $tab eq "configure"}active{/if} form-container">
|
||||
{include file = "ChronopostHomeDelivery/ChronopostHomeDeliveryAdvancedConfig.html"}
|
||||
</div>
|
||||
|
||||
{loop type="chronopost.home.delivery.delivery.mode" name="delivery_mode"}
|
||||
{$deliveryModeId=$ID}
|
||||
<div id="prices_slices_tab_{$deliveryModeId}" class="tab-pane {if $tab eq "prices_slices_tab_$deliveryModeId" }active{/if} form-container">
|
||||
{if null !== $smarty.get.price_error && {$deliveryModeId} == $smarty.get.price_error_id}
|
||||
<div class="alert alert-danger" role="alert">{$smarty.get.price_error}</div>
|
||||
{/if}
|
||||
<br/>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<!-- checkbox free shipping -->
|
||||
{assign var="isChronopostHomeDeliveryFreeShipping" value=0}
|
||||
{form name="chronopost.home.delivery.freeshipping.form"}
|
||||
<form action="{url path="/admin/module/chronopost-home-delivery/freeshipping"}" method="post" id="freeshippingform-{$deliveryModeId}">
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field="delivery_mode"}
|
||||
<input type="hidden" name="{$name}" value="{$deliveryModeId}">
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="freeshipping"}
|
||||
<label>
|
||||
{intl l="Activate total free shipping " d="chronopost.home.delivery.bo.default"}
|
||||
</label>
|
||||
|
||||
<div class="switch-small freeshipping-activation-ChronopostHomeDelivery" data-id="{$deliveryModeId}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok-circle'></i>" data-off-label="<i class='glyphicon glyphicon-remove-circle'></i>">
|
||||
<input type="checkbox" name="{$name}" value="true" {if $FREESHIPPING_ACTIVE}checked{assign var="isChronopostHomeDeliveryFreeShipping" value=1}{/if} />
|
||||
</div>
|
||||
{/form_field}
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-md-6" id="freeshipping-from-{$deliveryModeId}" {if $isChronopostHomeDeliveryFreeShipping eq 1} style="display:none;" {/if}>
|
||||
<form action="{url path="/admin/module/chronopost-home-delivery/freeshipping_from"}" method="post">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon {if $FREESHIPPING_FROM}alert-success{/if}">{intl l="Or activate free shipping from (€) :" d="chronopost.home.delivery.bo.default"}</span>
|
||||
<input type="hidden" name="delivery-mode" value="{$deliveryModeId}">
|
||||
<input type="number" name="price" class="form-control" value="{$FREESHIPPING_FROM}">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="submit">{intl l="Save"}</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
<div class="alert alert-info">
|
||||
{intl l="You can create price slices by specifying a maximum cart weight and/or a maximum cart price." d='socolissimo.bo.default'}
|
||||
{intl l="The slices are ordered by maximum cart weight then by maximum cart price." d='socolissimo.bo.default'}
|
||||
{intl l="If a cart matches multiple slices, it will take the last slice following that order." d='socolissimo.bo.default'}
|
||||
{intl l="If you don't specify a cart weight in a slice, it will have priority over the slices with weight." d='socolissimo.bo.default'}
|
||||
{intl l="If you don't specify a cart price in a slice, it will have priority over the other slices with the same weight." d='socolissimo.bo.default'}
|
||||
{intl l="If you specify both, the cart will require to have a lower weight AND a lower price in order to match the slice." d='socolissimo.bo.default'}
|
||||
</div>
|
||||
|
||||
<div class="slices" class="form-container">
|
||||
|
||||
{loop type="module" name="module-id-loop" code="ChronopostHomeDelivery"}
|
||||
{assign var="module_id" value=$ID}
|
||||
{/loop}
|
||||
{loop type="area" name="area_loop" module_id=$module_id backend_context=true}
|
||||
{$area_id=$ID}
|
||||
<div class="col-md-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<label class="clearfix">
|
||||
<small>{intl d='chronopost.home.delivery.bo.default' l="Area : "}</small> {$NAME}
|
||||
</label>
|
||||
</th>
|
||||
<th width="40%">
|
||||
<div id="area-freeshipping-{$area_id}" {if $isChronopostHomeDeliveryFreeShipping eq 1} style="display:none;" {/if}>
|
||||
<form action="{url path="/admin/module/chronopost-home-delivery/area_freeshipping"}" method="post">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon {if $area_id }alert-success{/if}">{intl l="Activate free shipping from (€) :" d="chronopost.home.delivery.bo.default"}</span>
|
||||
<input type="hidden" name="area-id" value="{$area_id}">
|
||||
<input type="hidden" name="delivery-mode" value="{$deliveryModeId}">
|
||||
|
||||
{ifloop rel="area_freeshipping"}
|
||||
{loop type="chronopost.home.delivery.area.freeshipping" name="area_freeshipping" area_id=$area_id delivery_mode_id=$deliveryModeId}
|
||||
<input type="number" step="0.01" name="cart-amount" class="form-control" value="{$CART_AMOUNT}">
|
||||
{/loop}
|
||||
{/ifloop}
|
||||
{elseloop rel="area_freeshipping"}
|
||||
<input type="number" step="0.01" name="cart-amount" class="form-control" value="">
|
||||
{/elseloop}
|
||||
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="submit">{intl l="Save"}</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-md-3">{intl l="Weight up to ... kg" d='chronopost.home.delivery.bo.default'}</th>
|
||||
<th class="col-md-3">{intl l="Untaxed Price up to ... %symbol" symbol=$currencySymbol d='chronopost.home.delivery.bo.default'}</th>
|
||||
<th class="col-md-5">{intl l="Price (%symbol)" symbol=$currencySymbol d='chronopost.home.delivery.bo.default'}</th>
|
||||
<th class="col-md-1">{intl l="Actions" d='chronopost.home.delivery.bo.default'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{loop type="chronopost.home.delivery" name="chronopost_home_delivery_area_$ID" area_id={$area_id} delivery_mode_id={$deliveryModeId} }
|
||||
<tr class="js-slice" data-area="{$area_id}" data-id="{$SLICE_ID}" data-delivmode="{$deliveryModeId}">
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="weight-max" class="form-control js-slice-weight-max" value="{$MAX_WEIGHT}" data-old="{$MAX_WEIGHT}" />
|
||||
</th>
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="price-max" class="form-control js-slice-price-max" value="{$MAX_PRICE}" data-old="{$MAX_PRICE}" />
|
||||
</th>
|
||||
<th class="col-md-5">
|
||||
<input type="text" data-field="price" class="form-control js-slice-price" value="{$PRICE}" data-old="{$PRICE}" />
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="customdelivery" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs js-slice-save" title="{intl d='chronopost.home.delivery.bo.default' l='Save this price slice'}">
|
||||
<span class="glyphicon glyphicon-floppy-disk"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="customdelivery" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs js-slice-delete" title="{intl d='chronopost.home.delivery.bo.default' l='Delete this price slice'}" data-id="{$ID}">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{* New slice *}
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="chronopost" access="CREATE"}
|
||||
<tr class="js-slice-new" data-area="{$area_id}" data-id="0" data-delivmode="{$deliveryModeId}">
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="weight-max" class="form-control js-slice-weight-max" value="" />
|
||||
</th>
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="price-max" class="form-control js-slice-price-max" value="" />
|
||||
</th>
|
||||
<th class="col-md-5">
|
||||
<input type="text" data-field="price" class="form-control js-slice-price" value="" />
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
<a class="btn btn-default btn-xs js-slice-add" title="{intl d='chronopost.home.delivery.bo.default' l='Add this price slice'}" >
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/loop}
|
||||
{elseloop rel="area_loop"}
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-warning">
|
||||
{intl d='chronopost.home.delivery.bo.default' l="You should first attribute shipping zones to the modules: "}
|
||||
<a href="{url path="/admin/configuration/shipping_zones/update/$module_id"}">
|
||||
{intl d='chronopost.home.delivery.bo.default' l="manage shipping zones"}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{/elseloop}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{/loop}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{include
|
||||
file = "includes/generic-warning-dialog.html"
|
||||
|
||||
dialog_id = "chronopost_home_delivery_dialog"
|
||||
dialog_body = ""
|
||||
dialog_title = {intl d='chronopost.home.delivery.bo.default' l="Message"}
|
||||
}
|
||||
|
||||
{* JS Templates *}
|
||||
<script id="tpl-slice" type="text/html">
|
||||
<tr class="js-slice" data-area="<%=areaId %>" data-id="<%=id %>" data-delivmode="<%=deliveryModeId %>">
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="weight-max" class="form-control js-slice-weight-max" value="<%=weightMax %>" data-old="<%=weightMax %>" />
|
||||
</th>
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="price-max" class="form-control js-slice-price-max" value="<%=priceMax %>" data-old="<%=priceMax %>" />
|
||||
</th>
|
||||
<th class="col-md-5">
|
||||
<input type="text" data-field="price" class="form-control js-slice-price" value="<%=price %>" data-old="<%=price %>" />
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="chronopost" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs js-slice-save" title="{intl d='chronopost.home.delivery.bo.default' l='Save this price slice'}">
|
||||
<span class="glyphicon glyphicon-floppy-disk"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="chronopost" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs js-slice-delete" title="{intl d='chronopost.home.delivery.bo.default' l='Delete this price slice'}" data-id="<%=id %>">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
||||
<script src='{$asset_url}'></script>
|
||||
{/javascripts}
|
||||
|
||||
{javascripts file='assets/js/libs/underscore-min.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
var config = {
|
||||
'urlAdd': '{url path="/admin/module/chronopost-home-delivery/slice/save"}',
|
||||
'urlDelete': '{url path="/admin/module/chronopost-home-delivery/slice/delete"}',
|
||||
'urlSave': '{url path="/admin/module/chronopost-home-delivery/slice/save"}'
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
// Free shipping switch
|
||||
$(".freeshipping-activation-ChronopostHomeDelivery").bootstrapSwitch();
|
||||
|
||||
$(".freeshipping-activation-ChronopostHomeDelivery").on("switch-change", function(e, data){
|
||||
var is_checked = data.value;
|
||||
var mode = $(this).data("id");
|
||||
var form = $("#freeshippingform-"+mode);
|
||||
$('body').append('<div class="modal-backdrop fade in" id="loading-event"><div class="loading"></div></div>');
|
||||
$.ajax({
|
||||
url: form.attr('action'),
|
||||
type: form.attr('method'),
|
||||
data: form.serialize()
|
||||
}).done(function(){
|
||||
$("#loading-event").remove();
|
||||
})
|
||||
.success(function() {
|
||||
if (is_checked) {
|
||||
$('#config-btn-0').removeClass('disabled');
|
||||
$('#table-prices-chronopost-home-delivery-'+mode).hide('slow');
|
||||
$('#freeshipping-from-'+mode).hide('slow');
|
||||
} else {
|
||||
$('#config-btn-0').addClass('disabled');
|
||||
$('#table-prices-chronopost-home-delivery-'+mode).show('slow');
|
||||
$('#freeshipping-from-'+mode).show('slow');
|
||||
}
|
||||
})
|
||||
.fail(function(jqXHR, textStatus, errorThrown){
|
||||
$('#freeshipping-failed-body').html(jqXHR.responseJSON.error);
|
||||
$("#freeshipping-failed").modal("show");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Price slice
|
||||
|
||||
var tpl = _.template($("#tpl-slice").html());
|
||||
|
||||
var showMessage = function showMessage(message) {
|
||||
$('#chronopost_home_delivery_dialog')
|
||||
.find('.modal-body')
|
||||
.html(message)
|
||||
.end()
|
||||
.modal("show");
|
||||
};
|
||||
|
||||
var getSliceData = function getSliceData($slice) {
|
||||
var data = {
|
||||
id: $slice.data("id"),
|
||||
area: $slice.data("area"),
|
||||
deliveryModeId: $slice.data("delivmode"),
|
||||
price: $slice.find(".js-slice-price").first().val(),
|
||||
priceMax: $slice.find(".js-slice-price-max").first().val(),
|
||||
weightMax: $slice.find(".js-slice-weight-max").first().val()
|
||||
};
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
// add new slice
|
||||
$('.js-slice-add').on('click', function(){
|
||||
var $slice = $(this).parents('tr').first();
|
||||
var data = getSliceData($slice);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
url: config.urlAdd
|
||||
}).done(function(data, textStatus, jqXHR){
|
||||
var sliceHtml = '';
|
||||
if (data.success) {
|
||||
// reset form
|
||||
$slice.find('input').val('');
|
||||
// add slice
|
||||
sliceHtml = tpl(data.slice);
|
||||
|
||||
$(sliceHtml).insertBefore($slice);
|
||||
} else {
|
||||
showMessage(data.message.join('<br>'));
|
||||
}
|
||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
||||
console.log(jqXHR);
|
||||
showMessage(jqXHR.responseText);
|
||||
});
|
||||
});
|
||||
|
||||
// save new slice
|
||||
$('.slices').on('click', '.js-slice-save', function(){
|
||||
var $slice = $(this).parents('tr').first();
|
||||
var data = getSliceData($slice);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
url: config.urlAdd
|
||||
}).done(function(data, textStatus, jqXHR){
|
||||
if (!data.success) {
|
||||
showMessage(data.message.join('<br>'));
|
||||
} else {
|
||||
var sliceHtml = tpl(data.slice);
|
||||
$(sliceHtml).insertBefore($slice);
|
||||
$slice.remove();
|
||||
// $slice.find('.js-slice-save').removeClass('btn-success');
|
||||
}
|
||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
||||
console.log(jqXHR);
|
||||
showMessage(jqXHR.responseText);
|
||||
});
|
||||
});
|
||||
|
||||
$('.slices').on('change', '.js-slice input', function() {
|
||||
$(this).parents('tr').first().find('.js-slice-save').addClass('btn-success');
|
||||
});
|
||||
|
||||
// delete new slice
|
||||
$('.slices').on('click', '.js-slice-delete', function(){
|
||||
var $slice = $(this).parents('tr').first();
|
||||
var data = getSliceData($slice);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
url: config.urlDelete
|
||||
}).done(function(data, textStatus, jqXHR){
|
||||
var sliceHtml = '';
|
||||
if (data.success) {
|
||||
$slice.remove();
|
||||
} else {
|
||||
showMessage(data.message);
|
||||
}
|
||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
||||
console.log(jqXHR);
|
||||
showMessage(jqXHR.responseText);
|
||||
});
|
||||
});
|
||||
|
||||
// add new slice
|
||||
$('.js-slice input').on('change', function(){
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,34 @@
|
||||
{extends file="email-layout.tpl"}
|
||||
|
||||
{* Do not provide a "Open in browser" link *}
|
||||
{block name="browser"}{/block}
|
||||
{* No pre-header *}
|
||||
{block name="pre-header"}{/block}
|
||||
|
||||
{* Subject *}
|
||||
{block name="email-subject"}{intl l="Your order confirmation Nº %ref" ref={$order_ref}}{/block}
|
||||
|
||||
{* Title *}
|
||||
{block name="email-title"}{/block}
|
||||
|
||||
{* Content *}
|
||||
{block name="email-content"}
|
||||
|
||||
{loop type="customer" name="customer.politesse" id={$customer_id} current="0"}
|
||||
{assign var="customerRef" value=$REF}
|
||||
|
||||
<p>{if {$TITLE} == 9}{intl l="Dear Mr. "}
|
||||
{else}{intl l="Dear Ms. "}
|
||||
{/if}
|
||||
{$FIRSTNAME} {$LASTNAME},
|
||||
</p>
|
||||
|
||||
{/loop}
|
||||
|
||||
<p>{intl l="We are pleased to inform you that your order number"} {$order_ref} {intl l="has been shipped on"} {format_date date=$update_date output="date"} {intl l="with the tracking number"} <strong>{$package}</strong>.</p>
|
||||
|
||||
<p>{intl l='<a href="https://www.chronopost.fr/tracking-no-cms/suivi-page?listeNumerosLT=%package">Click here</a> to track your shipment.' package=$package}</p>
|
||||
<p>{intl l='Thank you for your shopping with us and hope to see you soon on <a href="#">www.yourshop.com</a>'}</p>
|
||||
<p>{intl l="Your on-line store Manager"}<br/>
|
||||
{intl l="Your shop"}</p>
|
||||
{/block}
|
||||
@@ -0,0 +1 @@
|
||||
{intl l="Please display this message in HTML"}
|
||||
@@ -0,0 +1,191 @@
|
||||
{loop type="delivery" name="chronopost-home-delivery" id=$module force_return="true"}
|
||||
<tr style="display: none;" id="deliverytype-chronopost-home-delivery-tr">
|
||||
<td colspan="3">
|
||||
<div id="point-chronopost">
|
||||
<div id="deliverytype-chronopost-home-delivery">
|
||||
|
||||
{chronopostHomeDeliveryDeliveryType}
|
||||
|
||||
{* Chrono13 *}
|
||||
{if $isChrono13Enabled !== false}
|
||||
{chronopostHomeDeliveryDeliveryPrice delivery-mode="1" country=$country}
|
||||
{if $chronopostHomeDeliveryDeliveryModePrice}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>{intl l="Chrono 13H delivery" d='chronoposthomedelivery.fo.default'}</strong> / {$chronopostHomeDeliveryDeliveryModePrice} {currency attr="symbol"}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div style="padding-top: 15px;">
|
||||
{intl l="Delivery to you or a personal address of your choice, before tomorrow 13H." d='chronoposthomedelivery.fo.default'}
|
||||
|
||||
<div class="clearfix">
|
||||
<button type="submit" name="chronopost-home-delivery-delivery-mode" value="1" class="btn btn-primary pull-right">{intl l="Choose this delivery mode" d='chronoposthomedelivery.fo.default'}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{* Chrono18 *}
|
||||
{if $isChrono18Enabled !== false}
|
||||
{chronopostHomeDeliveryDeliveryPrice delivery-mode="16" country=$country}
|
||||
{if $chronopostHomeDeliveryDeliveryModePrice}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>{intl l="Chrono 18H delivery" d='chronoposthomedelivery.fo.default'}</strong> / {$chronopostHomeDeliveryDeliveryModePrice} {currency attr="symbol"}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div style="padding-top: 15px;">
|
||||
{intl l="Delivery to you or a personal address of your choice, before tomorrow 18H." d='chronoposthomedelivery.fo.default'}
|
||||
|
||||
<div class="clearfix">
|
||||
<button type="submit" name="chronopost-home-delivery-delivery-mode" value="16" class="btn btn-primary pull-right">{intl l="Choose this delivery mode" d="chronoposthomedelivery.fo.default"}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{* Chrono Classic *}
|
||||
{if $isChronoClassicEnabled !== false}
|
||||
{chronopostHomeDeliveryDeliveryPrice delivery-mode="44" country=$country}
|
||||
{if $chronopostHomeDeliveryDeliveryModePrice}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>{intl l="Chrono Europe Classic delivery" d='chronoposthomedelivery.fo.default'}</strong> / {$chronopostHomeDeliveryDeliveryModePrice} {currency attr="symbol"}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div style="padding-top: 15px;">
|
||||
{intl l="Delivery to you or a personal address of your choice, anywhere in Europe." d='chronoposthomedelivery.fo.default'}
|
||||
|
||||
<div class="clearfix">
|
||||
<button type="submit" name="chronopost-home-delivery-delivery-mode" value="44" class="btn btn-primary pull-right">{intl l="Choose this delivery mode" d="chronoposthomedelivery.fo.default"}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{* Chrono Express *}
|
||||
{if $isChronoExpressEnabled !== false}
|
||||
{chronopostHomeDeliveryDeliveryPrice delivery-mode="17" country=$country}
|
||||
{if $chronopostHomeDeliveryDeliveryModePrice}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>{intl l="Chrono Europe Express delivery" d='chronoposthomedelivery.fo.default'}</strong> / {$chronopostHomeDeliveryDeliveryModePrice} {currency attr="symbol"}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div style="padding-top: 15px;">
|
||||
{intl l="Delivery to you or a personal address of your choice, anywhere in Europe in less than 3 days." d='chronoposthomedelivery.fo.default'}
|
||||
|
||||
<div class="clearfix">
|
||||
<button type="submit" name="chronopost-home-delivery-delivery-mode" value="17" class="btn btn-primary pull-right">{intl l="Choose this delivery mode" d='chronoposthomedelivery.fo.default'}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{* Fresh13 *}
|
||||
{if $isFresh13Enabled !== false}
|
||||
{chronopostHomeDeliveryDeliveryPrice delivery-mode="2R" country=$country}
|
||||
{if $chronopostHomeDeliveryDeliveryModePrice}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>{intl l="Fresh 13H delivery" d='chronoposthomedelivery.fo.default'}</strong> / {$chronopostHomeDeliveryDeliveryModePrice} {currency attr="symbol"}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div style="padding-top: 15px;">
|
||||
{intl l="Delivery of fresh products before 13H tomorrow." d='chronoposthomedelivery.fo.default'}
|
||||
|
||||
<div class="clearfix">
|
||||
<button type="submit" name="chronopost-home-delivery-delivery-mode" value="2R" class="btn btn-primary pull-right">{intl l="Choose this delivery mode" d='chronoposthomedelivery.fo.default'}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{* Chrono10 *}
|
||||
{if $isChrono10Enabled !== false}
|
||||
{chronopostHomeDeliveryDeliveryPrice delivery-mode="2" country=$country}
|
||||
{if $chronopostHomeDeliveryDeliveryModePrice}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>{intl l="Chrono10" d='chronoposthomedelivery.fo.default'}</strong> / {$chronopostHomeDeliveryDeliveryModePrice} {currency attr="symbol"}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div style="padding-top: 15px;">
|
||||
{intl l="Delivery before 10H tomorrow." d='chronoposthomedelivery.fo.default'}
|
||||
|
||||
<div class="clearfix">
|
||||
<button type="submit" name="chronopost-home-delivery-delivery-mode" value="2" class="btn btn-primary pull-right">{intl l="Choose this delivery mode" d='chronoposthomedelivery.fo.default'}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{* TODO Add other delivery types *}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<script>
|
||||
|
||||
function displayContentHomeDelivery () {
|
||||
$("#deliverytype-chronopost-home-delivery-tr").show(function () {
|
||||
$('.btn-checkout-next').hide();
|
||||
$('#form-cart-delivery').find("> button").hide();
|
||||
});
|
||||
}
|
||||
|
||||
$(function(){
|
||||
|
||||
if ($("#delivery-method_{$module}").is(':checked')) {
|
||||
displayContentHomeDelivery();
|
||||
}
|
||||
|
||||
$('[name="thelia_order_delivery[delivery-module]"]', '.table-delivery').on('change', function(){
|
||||
if($(this).attr('id') != 'delivery-method_{$module}') {
|
||||
$("#deliverytype-chronopost-home-delivery-tr").hide();
|
||||
$('.btn-checkout-next').show();
|
||||
$('#form-cart-delivery').find("> button").show();
|
||||
} else {
|
||||
displayContentHomeDelivery();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
{/loop}
|
||||
@@ -64,3 +64,6 @@
|
||||
margin-right: -30px;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
text-align: right;
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
div.container{width:90%!important}.container{width:95%}
|
||||
div.container{width:90%!important}.container{width:95%}.navbar li.cart-not-empty>a.cart:before{color:#fff}
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 2.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 2.4 KiB |
@@ -5,3 +5,7 @@ div.container {
|
||||
.container {
|
||||
width: 95%
|
||||
}
|
||||
|
||||
.navbar li.cart-not-empty>a.cart:before {
|
||||
color: white;
|
||||
}
|
||||
@@ -1595,14 +1595,6 @@ pre code {
|
||||
margin-left: -15px;
|
||||
margin-right: -15px;
|
||||
}
|
||||
|
||||
/* TheCoreDev le 2/09/2020 */
|
||||
.header-custom.row {
|
||||
margin-left: 0px;
|
||||
margin-right: 0px;
|
||||
}
|
||||
/**************************/
|
||||
|
||||
.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
|
||||
position: relative;
|
||||
min-height: 1px;
|
||||
@@ -11022,7 +11014,7 @@ td.product .name > a:focus,
|
||||
margin-bottom: 15px !important;
|
||||
}
|
||||
header a {
|
||||
color: #303c6e;
|
||||
color: #303C6E;
|
||||
}
|
||||
header .header {
|
||||
margin-top: 30px;
|
||||
@@ -11049,14 +11041,10 @@ header .header-custom {
|
||||
}
|
||||
header .logo-custom {
|
||||
grid-area: logo;
|
||||
width: 346px;
|
||||
height: 60px;
|
||||
width: 350px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
header .logo-custom img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
header .secondary-custom {
|
||||
grid-area: content;
|
||||
height: 45px;
|
||||
|
||||
Reference in New Issue
Block a user