Ajout du module SoColissimo

This commit is contained in:
2020-03-04 08:26:35 +01:00
parent aead9ef89b
commit 8347f7c299
123 changed files with 28430 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,31 @@
{loop name="check.module.socolissimo.order.edit" type="order" id=$ID status="2,3"}
{loop name="check.module.socolissimoid" type="socolissimoid"}
{if $MODULE_ID == $DELIVERY_MODULE}
<br/>
<div class="panel panel-default">
<div class="panel-heading">
{intl l="Export Coliship file" d='socolissimo.ai'}
</div>
<div class="panel-body">
{form name="socolissimo.export.inet"}
<form action="{url path="/admin/module/socolissimo/export"}" method="post">
{form_hidden_fields form=$form}
{form_field form=$form field="new_status_id"}
<input type="hidden" name="{$name}" value="nochange" />
{/form_field}
{form_field form=$form field="order_"|cat:$ID}
<input type="hidden" name="{$name}" value="true" />
{/form_field}
<button type="submit" name="export_order" value="stay" class="form-submit-button btn btn-sm btn-default" title="{intl l='Export' d='socolissimo.ai'}">{intl l='Export' d='socolissimo.ai'} <span class="glyphicon glyphicon-ok"></span></button>
</form>
{/form}
<br/>
Suivi du colis: <a href="">ici</a>
</div>
</div>
{/if}
{/loop}
{/loop}

View File

@@ -0,0 +1,76 @@
# 1.4.7
- Changing a relay point Free Shipping for a specific area does not add the price for every other area anymore.
# 1.4.6
- Displays an arror message instead of crashing when "mail_socolissimo" isn't created, thus allowing to not send any confirmation email.
# 1.4.5
- Fixed crash when using getCartAmount while cartAmount is null
# 1.4.4
- create loops: AreaFreeshippingDom and AreaFreeshippingPr
- update template for to add these loops
- update version module
# 1.4.3
- fix freeshipping.php
- add translate: l18n/backOffice/default/fr_FR.php
- update version module
# 1.4.2
Objective: Add a minimum cart amount to get the free shipping cost for "So Colissimo Domicile" by Area
- Add table socolissimo_area_freeshipping
- Update Routing.xml, Freeshipping.php, SoColissimo.php and Template BO
- Update version module.xml & CHANGELOG.md
# 1.4.1
- Fix bug area delivery
# 1.4.0
- Add price slices by cart price and weight
# 1.3.0
- International support of Relay Points
# 1.2.7
- Fix relais query on address with accent
# 1.2.6
- Fix delivery amount not recalculated correctly (ex when using a coupon)
# 1.2.5
- added franco per area and weight
# 1.2.4
- Feature/order date
# 1.2.3
- Bump version 1.2.3
# 1.2.2
- Bump version 1.2.2
# 1.2.1
- Change expeditor filename
# 1.1.4
- Remove duplicated address edition controls on delivery page
- Fix unopened HTML elements
# 1.1.3
- Fix support for relay search by Thelia address
# 1.1.2
- Set relay id to an empty string when exporting non-relay orders
# 1.1.1
- Fix routing for the csv export
# 1.1.0
- Add import csv for update the orders status

View File

@@ -0,0 +1,61 @@
<?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="SoColissimo\Loop\CheckRightsLoop" name="socolissimo.check.rights" />
<loop class="SoColissimo\Loop\SoColissimoDeliveryMode" name="socolissimo.delivery.mode" />
<loop class="SoColissimo\Loop\SoColissimoPrice" name="socolissimo" />
<loop class="SoColissimo\Loop\SoColissimoId" name="socolissimoid" />
<loop class="SoColissimo\Loop\GetRelais" name="socolissimo.around" />
<loop class="SoColissimo\Loop\SoColissimoAddress" name="address.socolissimo" />
<loop class="SoColissimo\Loop\NotSentOrders" name="order.notsent.socolissimo" />
<loop class="SoColissimo\Loop\SoColissimoOrderAddressLoop" name="socolissimo.order_address" />
<loop class="SoColissimo\Loop\AreaFreeshippingDom" name="socolissimo.area.freeshipping.dom" />
<loop class="SoColissimo\Loop\AreaFreeshippingPr" name="socolissimo.area.freeshipping.pr" />
</loops>
<forms>
<form name="socolissimo.freeshipping.form" class="SoColissimo\Form\FreeShipping" />
<form name="socolissimo.configure" class="SoColissimo\Form\ConfigureSoColissimo" />
<form name="socolissimo.export" class="SoColissimo\Form\ExportOrder" />
<form name="socolissimo.import" class="SoColissimo\Form\ImportForm"/>
<form name="socolissimo.add.price.form" class="SoColissimo\Form\AddPriceForm" />
<form name="socolissimo.update.price.form" class="SoColissimo\Form\UpdatePriceForm" />
</forms>
<services>
<service id="hook.order.module.socolissimo" class="SoColissimo\Listener\SetDeliveryModule" scope="request">
<argument type="service" id="request"/>
<tag name="kernel.event_subscriber"/>
</service>
<service id="send.socolissimo.mail" class="SoColissimo\Listener\SendMail" scope="request">
<argument type="service" id="thelia.parser" />
<argument type="service" id="mailer"/>
<tag name="kernel.event_subscriber"/>
</service>
<service id="socolissimo.price.smarty.plugin" class="SoColissimo\Smarty\Plugins\SocolissimoDeliveryPrice" scope="request">
<argument type="service" id="request" />
<argument type="service" id="event_dispatcher"/>
<tag name="thelia.parser.register_plugin" />
</service>
</services>
<hooks>
<hook id="socolissimo.hook.back" class="SoColissimo\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="socolissimo.hook.front" class="SoColissimo\Hook\FrontHook" scope="request">
<tag name="hook.event_listener" event="order-delivery.extra" />
<tag name="hook.event_listener" event="order-invoice.delivery-address" />
<tag name="hook.event_listener" event="main.head-bottom" />
</hook>
<hook id="socolissimo.hook.pdf" class="SoColissimo\Hook\PdfHook" scope="request">
<tag name="hook.event_listener" event="invoice.after-delivery-module" type="pdf" method="onInvoiceAfterDeliveryModule" />
</hook>
</hooks>
</config>

View File

@@ -0,0 +1,46 @@
# 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;
-- add domicile and relais delivery mode
INSERT INTO `socolissimo_delivery_mode` (`id`, `title`, `code`, `freeshipping_active`, `freeshipping_from`)
VALUES
(1, 'Domicile', 'dom', 0, NULL),
(2, 'Point relais', 'pr', 0, NULL);
-- add domicile delivery mode
INSERT INTO `socolissimo_area_freeshipping_dom` (`id`, `area_id`, `delivery_mode_id`, `cart_amount`)
VALUES
(1, '1', '1', NULL);
-- add relais delivery mode
INSERT INTO `socolissimo_area_freeshipping_pr` (`id`, `area_id`, `delivery_mode_id`, `cart_amount`)
VALUES
(1, '1', '2', NULL);
-- ---------------------------------------------------------------------
-- Mail templates for socolissimo
-- ---------------------------------------------------------------------
-- First, delete existing entries
SET @var := 0;
SELECT @var := `id` FROM `message` WHERE name="mail_socolissimo";
DELETE FROM `message` WHERE `id`=@var;
-- Try if ON DELETE constraint isn't set
DELETE FROM `message_i18n` WHERE `id`=@var;
-- Then add new entries
SELECT @max := MAX(`id`) FROM `message`;
SET @max := @max+1;
-- insert message
INSERT INTO `message` (`id`, `name`, `secured`) VALUES
(@max,
'mail_socolissimo',
'0'
);
-- and template fr_FR
INSERT INTO `message_i18n` (`id`, `locale`, `title`, `subject`, `text_message`, `html_message`) VALUES
(@max, 'fr_FR', 'mail livraison So Colissimo', 'Suivi So Colissimo commande : {$order_ref}', '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\n{$LASTNAME} {$FIRSTNAME},\r\n{/loop}\r\nNous vous remercions de votre commande sur notre site {config key="store_name"}\r\nUn colis concernant votre commande {$order_ref} du {format_date date=$order_date} a quitté nos entrepôts pour être pris en charge par La Poste le {format_date date=$update_date}.\r\nSon numéro de suivi est le suivant : {$package}\r\nIl vous permet de suivre votre colis en ligne sur le site de La Poste : www.coliposte.net\r\nNous restons à votre disposition pour toute information complémentaire.\r\nCordialement', '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\n{$LASTNAME} {$FIRSTNAME},\r\n{/loop}\r\nNous vous remercions de votre commande sur notre site {config key="store_name"}\r\nUn colis concernant votre commande {$order_ref} du {format_date date=$order_date} a quitté nos entrepôts pour être pris en charge par La Poste le {format_date date=$update_date}.\r\nSon numéro de suivi est le suivant : {$package}\r\nIl vous permet de suivre votre colis en ligne sur le site de La Poste : www.coliposte.net\r\nIl vous sera, par ailleurs, très utile si vous étiez absent au moment de la livraison de votre colis : en fournissant ce numéro de Colissimo Suivi, vous pourrez retirer votre colis dans le bureau de Poste le plus proche.\r\nATTENTION ! Si vous ne trouvez pas l''avis de passage normalement déposé dans votre boîte aux lettres au bout de 48 Heures jours ouvrables, n''hésitez pas à aller le réclamer à votre bureau de Poste, muni de votre numéro de Colissimo Suivi.\r\nNous restons à votre disposition pour toute information complémentaire.\r\nCordialement');
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<module>
<fullnamespace>SoColissimo\SoColissimo</fullnamespace>
<descriptive locale="en_US">
<title>So Colissimo</title>
</descriptive>
<descriptive locale="fr_FR">
<title>So Colissimo</title>
</descriptive>
<version>1.4.11</version>
<author>
<name>Thelia</name>
<email>info@thelia.net</email>
</author>
<type>delivery</type>
<thelia>2.1.0</thelia>
<stability>other</stability>
</module>

View File

@@ -0,0 +1 @@
{"1":{"_info":"area 1 : France","slices":{"0.25":"5.2","0.5":5.8,"0.75":6.56,"1":7.13,"2":8.08,"3":9.22,"5":"1","7":13.4,"10":16.53,"15":19.14,"30":26.93,"10000000000":"1"}},"2":{"_info":"area 2 : A Zone - Union Europ\u00e9enne et Suisse","slices":{"1":15.34,"2":16.96,"3":20.47,"4":23.99,"5":27.5,"6":31.02,"7":34.53,"8":38.05,"9":41.56,"10":45.08,"15":51.92,"20":58.76,"25":65.6,"30":72.44}},"3":{"_info":"area 3 : B Zone - Pays de l\u2019Europe de l\u2019Est (hors Union Europ\u00e9enne), Norv\u00e8ge, Maghreb","slices":{"1":18.81,"2":20.62,"3":24.94,"4":29.26,"5":33.58,"6":37.91,"7":42.23,"8":46.55,"9":50.87,"10":55.2,"15":65.08,"20":74.96}},"4":{"_info":"area 4 : C Zone - Pays d\u2019Afrique hors Maghreb, Canada, Etats-Unis, Proche et Moyen Orient","slices":{"1":22.04,"2":29.55,"3":38.86,"4":48.17,"5":57.48,"6":66.79,"7":76.1,"8":85.41,"9":94.72,"10":104.03,"15":126.92,"20":149.82}},"5":{"_info":"area 5 : D Zone - Autres destinations","slices":{"1":25.08,"2":37.72,"3":50.26,"4":62.8,"5":75.34,"6":87.88,"7":100.42,"8":112.96,"9":125.5,"10":138.04,"15":162.74,"20":187.44}},"6":{"_info":"area 6 : France OM1","slices":{"0.5":8.27,"1":12.49,"2":17.05,"3":21.61,"4":26.17,"5":30.73,"6":35.29,"7":39.85,"8":44.41,"9":48.97,"10":53.53,"15":76.33,"20":99.13,"25":121.93,"30":144.73}},"7":{"_info":"area 7 : France OM2","slices":{"0.5":9.88,"1":14.92,"2":26.32,"3":37.72,"4":49.12,"5":60.52,"6":71.92,"7":83.32,"8":94.72,"9":106.12,"10":117.52,"15":174.52,"20":231.52,"25":288.52,"30":345.52}}}

View File

@@ -0,0 +1 @@
{"1":{"_info":"area 1 : France","slices":{"0.25":"5.2","0.5":5.8,"0.75":6.56,"1":7.13,"2":8.08,"3":9.22,"5":"1","7":13.4,"10":16.53,"15":19.14,"30":26.93,"10000000000":"1"}},"2":{"_info":"area 2 : A Zone - Union Europ\u00e9enne et Suisse","slices":{"1":15.34,"2":16.96,"3":20.47,"4":23.99,"5":27.5,"6":31.02,"7":34.53,"8":38.05,"9":41.56,"10":45.08,"15":51.92,"20":58.76,"25":65.6,"30":72.44}},"3":{"_info":"area 3 : B Zone - Pays de l\u2019Europe de l\u2019Est (hors Union Europ\u00e9enne), Norv\u00e8ge, Maghreb","slices":{"1":18.81,"2":20.62,"3":24.94,"4":29.26,"5":33.58,"6":37.91,"7":42.23,"8":46.55,"9":50.87,"10":55.2,"15":65.08,"20":74.96}},"4":{"_info":"area 4 : C Zone - Pays d\u2019Afrique hors Maghreb, Canada, Etats-Unis, Proche et Moyen Orient","slices":{"1":22.04,"2":29.55,"3":38.86,"4":48.17,"5":57.48,"6":66.79,"7":76.1,"8":85.41,"9":94.72,"10":104.03,"15":126.92,"20":149.82}},"5":{"_info":"area 5 : D Zone - Autres destinations","slices":{"1":25.08,"2":37.72,"3":50.26,"4":62.8,"5":75.34,"6":87.88,"7":100.42,"8":112.96,"9":125.5,"10":138.04,"15":162.74,"20":187.44}},"6":{"_info":"area 6 : France OM1","slices":{"0.5":8.27,"1":12.49,"2":17.05,"3":21.61,"4":26.17,"5":30.73,"6":35.29,"7":39.85,"8":44.41,"9":48.97,"10":53.53,"15":76.33,"20":99.13,"25":121.93,"30":144.73}},"7":{"_info":"area 7 : France OM2","slices":{"0.5":9.88,"1":14.92,"2":26.32,"3":37.72,"4":49.12,"5":60.52,"6":71.92,"7":83.32,"8":94.72,"9":106.12,"10":117.52,"15":174.52,"20":231.52,"25":288.52,"30":345.52}}}

View File

@@ -0,0 +1,50 @@
<?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="socolissimo.add.price" path="/admin/module/socolissimo/slice/save" methods="post">
<default key="_controller">SoColissimo\Controller\SliceController::saveSliceAction</default>
</route>
<route id="socolissimo.update.price" path="/admin/module/socolissimo/slice/delete" methods="post">
<default key="_controller">SoColissimo\Controller\SliceController::deleteSliceAction</default>
</route>
<route id="socolissimo.toggle.freeshipping" path="/admin/module/socolissimo/freeshipping" methods="post">
<default key="_controller">SoColissimo\Controller\FreeShipping::toggleFreeShippingActivation</default>
</route>
<route id="socolissimo.edit.freeshippingfrom" path="/admin/module/socolissimo/freeshipping_from" methods="post">
<default key="_controller">SoColissimo\Controller\FreeShipping::setFreeShippingFrom</default>
</route>
<route id="socolissimo.edit.areafreeshipping" path="/admin/module/socolissimo/area_freeshipping" methods="post">
<default key="_controller">SoColissimo\Controller\FreeShipping::setAreaFreeShipping</default>
</route>
<route id="socolissimo.configure" path="/admin/module/socolissimo/configure" methods="post">
<default key="_controller">SoColissimo\Controller\SaveConfig::save</default>
</route>
<route id="socolissimo.get.specific.location" path="/module/socolissimo/{countryid}/{zipcode}/{city}/{address}" methods="get">
<default key="_controller">SoColissimo\Controller\GetSpecificLocation::get</default>
<default key="address"></default>
<requirement key="city">[a-zA-Z\- ]+</requirement>
</route>
<route id="socolissimo.point.info" path="/module/socolissimo/point/{point_id}">
<default key="_controller">SoColissimo\Controller\GetSpecificLocation::getPointInfo</default>
</route>
<route id="socolissimo.point.search" path="/module/socolissimo/points">
<default key="_controller">SoColissimo\Controller\GetSpecificLocation::search</default>
</route>
<route id="socolissimo.export" path="/admin/module/socolissimo/export" methods="post">
<default key="_controller">SoColissimo\Controller\Export::export</default>
</route>
<route id="socolissimo.import" path="/admin/module/socolissimo/import" methods="post">
<default key="_controller">SoColissimo:Import:import</default>
</route>
</routes>

View File

@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<database defaultIdMethod="native" name="thelia" namespace="SoColissimo\Model">
<table name="address_socolissimo">
<column name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="title_id" required="true" type="INTEGER" />
<column name="company" size="255" type="VARCHAR" />
<column name="firstname" required="true" size="255" type="VARCHAR" />
<column name="lastname" required="true" size="255" type="VARCHAR" />
<column name="address1" required="true" size="255" type="VARCHAR" />
<column name="address2" required="true" size="255" type="VARCHAR" />
<column name="address3" required="true" size="255" type="VARCHAR" />
<column name="zipcode" required="true" size="10" type="VARCHAR" />
<column name="city" required="true" size="255" type="VARCHAR" />
<column name="country_id" required="true" type="INTEGER" />
<column name="code" required="true" size="10" type="VARCHAR" />
<column name="type" required="true" size="10" type="VARCHAR" />
<column name="cellphone" required="false" size="20" type="VARCHAR" />
<foreign-key foreignTable="customer_title" name="fk_address_socolissimo_customer_title_id" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference foreign="id" local="title_id" />
</foreign-key>
<foreign-key foreignTable="country" name="fk_address_socolissimo_country_id" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference foreign="id" local="country_id" />
</foreign-key>
</table>
<table name="order_address_socolissimo">
<column name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="code" size="10" type="VARCHAR" required="true" />
<column name="type" size="10" type="VARCHAR" required="true" />
<foreign-key foreignTable="order_address" name="fk_order_address_socolissimo_order_address_id" onDelete="CASCADE" onUpdate="CASCADE">
<reference foreign="id" local="id" />
</foreign-key>
</table>
<table name="socolissimo_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="socolissimo_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_socolissimo_price_area_id" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference foreign="id" local="area_id" />
</foreign-key>
<foreign-key foreignTable="socolissimo_delivery_mode" name="fk_socolissimo_price_delivery_mode_id" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference foreign="id" local="delivery_mode_id" />
</foreign-key>
</table>
<table name="socolissimo_area_freeshipping_dom">
<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_socolissimo_area_freeshipping_dom_area_id" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference foreign="id" local="area_id" />
</foreign-key>
<foreign-key foreignTable="socolissimo_delivery_mode" name="fk_socolissimo_area_freeshipping_dom_delivery_mode_id" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference foreign="id" local="delivery_mode_id" />
</foreign-key>
</table>
<table name="socolissimo_area_freeshipping_pr">
<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_socolissimo_area_freeshipping_pr_area_id" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference foreign="id" local="area_id" />
</foreign-key>
<foreign-key foreignTable="socolissimo_delivery_mode" name="fk_socolissimo_area_freeshipping_pr_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>

View File

@@ -0,0 +1,163 @@
# 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;
-- ---------------------------------------------------------------------
-- address_socolissimo
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `address_socolissimo`;
CREATE TABLE `address_socolissimo`
(
`id` INTEGER NOT NULL,
`title_id` INTEGER NOT NULL,
`company` VARCHAR(255),
`firstname` VARCHAR(255) NOT NULL,
`lastname` VARCHAR(255) NOT NULL,
`address1` VARCHAR(255) NOT NULL,
`address2` VARCHAR(255) NOT NULL,
`address3` VARCHAR(255) NOT NULL,
`zipcode` VARCHAR(10) NOT NULL,
`city` VARCHAR(255) NOT NULL,
`country_id` INTEGER NOT NULL,
`code` VARCHAR(10) NOT NULL,
`type` VARCHAR(10) NOT NULL,
`cellphone` VARCHAR(20),
PRIMARY KEY (`id`),
INDEX `FI_address_socolissimo_customer_title_id` (`title_id`),
INDEX `FI_address_socolissimo_country_id` (`country_id`),
CONSTRAINT `fk_address_socolissimo_customer_title_id`
FOREIGN KEY (`title_id`)
REFERENCES `customer_title` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT,
CONSTRAINT `fk_address_socolissimo_country_id`
FOREIGN KEY (`country_id`)
REFERENCES `country` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- order_address_socolissimo
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `order_address_socolissimo`;
CREATE TABLE `order_address_socolissimo`
(
`id` INTEGER NOT NULL,
`code` VARCHAR(10) NOT NULL,
`type` VARCHAR(10) NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `fk_order_address_socolissimo_order_address_id`
FOREIGN KEY (`id`)
REFERENCES `order_address` (`id`)
ON UPDATE CASCADE
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- socolissimo_delivery_mode
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `socolissimo_delivery_mode`;
CREATE TABLE `socolissimo_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;
-- ---------------------------------------------------------------------
-- socolissimo_price
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `socolissimo_price`;
CREATE TABLE `socolissimo_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_socolissimo_price_area_id` (`area_id`),
INDEX `FI_socolissimo_price_delivery_mode_id` (`delivery_mode_id`),
CONSTRAINT `fk_socolissimo_price_area_id`
FOREIGN KEY (`area_id`)
REFERENCES `area` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT,
CONSTRAINT `fk_socolissimo_price_delivery_mode_id`
FOREIGN KEY (`delivery_mode_id`)
REFERENCES `socolissimo_delivery_mode` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- socolissimo_area_freeshipping_dom
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `socolissimo_area_freeshipping_dom`;
CREATE TABLE `socolissimo_area_freeshipping_dom`
(
`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_socolissimo_area_freeshipping_dom_area_id` (`area_id`),
INDEX `FI_socolissimo_area_freeshipping_dom_delivery_mode_id` (`delivery_mode_id`),
CONSTRAINT `fk_socolissimo_area_freeshipping_dom_area_id`
FOREIGN KEY (`area_id`)
REFERENCES `area` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT,
CONSTRAINT `fk_socolissimo_area_freeshipping_dom_delivery_mode_id`
FOREIGN KEY (`delivery_mode_id`)
REFERENCES `socolissimo_delivery_mode` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- socolissimo_area_freeshipping_pr
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `socolissimo_area_freeshipping_pr`;
CREATE TABLE `socolissimo_area_freeshipping_pr`
(
`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_socolissimo_area_freeshipping_pr_area_id` (`area_id`),
INDEX `FI_socolissimo_area_freeshipping_pr_delivery_mode_id` (`delivery_mode_id`),
CONSTRAINT `fk_socolissimo_area_freeshipping_pr_area_id`
FOREIGN KEY (`area_id`)
REFERENCES `area` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT,
CONSTRAINT `fk_socolissimo_area_freeshipping_pr_delivery_mode_id`
FOREIGN KEY (`delivery_mode_id`)
REFERENCES `socolissimo_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;

View File

@@ -0,0 +1,2 @@
ALTER TABLE `socolissimo_price`
ADD COLUMN `franco_min_price` FLOAT AFTER `weight_max`;

View File

@@ -0,0 +1,2 @@
ALTER TABLE `socolissimo_price` ADD COLUMN `price_max` FLOAT AFTER `weight_max`;
ALTER TABLE `socolissimo_price` MODIFY `weight_max` FLOAT NULL DEFAULT NULL;

View File

@@ -0,0 +1,56 @@
SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------------------------------------------------
-- socolissimo_area_freeshipping_dom
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `socolissimo_area_freeshipping_dom`;
CREATE TABLE `socolissimo_area_freeshipping_dom`
(
`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 NOT NULL,
PRIMARY KEY (`id`),
INDEX `FI_socolissimo_area_freeshipping_dom_area_id` (`area_id`),
INDEX `FI_socolissimo_area_freeshipping_dom_delivery_mode_id` (`delivery_mode_id`),
CONSTRAINT `fk_socolissimo_area_freeshipping_dom_area_id`
FOREIGN KEY (`area_id`)
REFERENCES `area` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT,
CONSTRAINT `fk_socolissimo_area_freeshipping_dom_delivery_mode_id`
FOREIGN KEY (`delivery_mode_id`)
REFERENCES `socolissimo_delivery_mode` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- socolissimo_area_freeshipping_pr
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `socolissimo_area_freeshipping_pr`;
CREATE TABLE `socolissimo_area_freeshipping_pr`
(
`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 NOT NULL,
PRIMARY KEY (`id`),
INDEX `FI_socolissimo_area_freeshipping_pr_area_id` (`area_id`),
INDEX `FI_socolissimo_area_freeshipping_pr_delivery_mode_id` (`delivery_mode_id`),
CONSTRAINT `fk_socolissimo_area_freeshipping_pr_area_id`
FOREIGN KEY (`area_id`)
REFERENCES `area` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT,
CONSTRAINT `fk_socolissimo_area_freeshipping_pr_delivery_mode_id`
FOREIGN KEY (`delivery_mode_id`)
REFERENCES `socolissimo_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;

View File

@@ -0,0 +1,2 @@
ALTER TABLE `socolissimo_area_freeshipping_dom` MODIFY `cart_amount` DECIMAL(16,6) DEFAULT 0.000000 NULL;
ALTER TABLE `socolissimo_area_freeshipping_pr` MODIFY `cart_amount` DECIMAL(16,6) DEFAULT 0.000000 NULL;

View File

@@ -0,0 +1,249 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace SoColissimo\Controller;
use Propel\Runtime\ActiveQuery\Criteria;
use SoColissimo\Form\ExportOrder;
use SoColissimo\Format\CSV;
use SoColissimo\Format\CSVLine;
use SoColissimo\Model\OrderAddressSocolissimoQuery;
use SoColissimo\SoColissimo;
use Symfony\Component\Config\Definition\Exception\Exception;
use Thelia\Controller\Admin\BaseAdminController;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\HttpFoundation\Response;
use Thelia\Model\Base\CountryQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Model\CustomerTitleI18nQuery;
use Thelia\Model\OrderAddressQuery;
use Thelia\Model\OrderQuery;
use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Model\OrderStatus;
use Thelia\Model\OrderStatusQuery;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Security\AccessManager;
/**
* Class Export
* @package SoColissimo\Controller
* @author Thelia <info@thelia.net>
*/
class Export extends BaseAdminController
{
const CSV_SEPARATOR = ";";
const DEFAULT_PHONE = "0100000000";
const DEFAULT_CELLPHONE = "0600000000";
public function export()
{
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), array('SoColissimo'), AccessManager::UPDATE)) {
return $response;
}
$csv = new CSV(self::CSV_SEPARATOR);
try {
$form = new ExportOrder($this->getRequest());
$vform = $this->validateForm($form);
// Check status_id
$status_id = $vform->get("new_status_id")->getData();
if (!preg_match("#^nochange|processing|sent$#",$status_id)) {
throw new Exception("Bad value for new_status_id field");
}
$status = OrderStatusQuery::create()
->filterByCode(
array(
OrderStatus::CODE_PAID,
OrderStatus::CODE_PROCESSING,
OrderStatus::CODE_SENT
),
Criteria::IN
)
->find()
->toArray("code")
;
$query = OrderQuery::create()
->filterByDeliveryModuleId(SoColissimo::getModCode())
->filterByStatusId(
array(
$status[OrderStatus::CODE_PAID]['Id'],
$status[OrderStatus::CODE_PROCESSING]['Id']),
Criteria::IN
)
->find();
// check form && exec csv
/** @var \Thelia\Model\Order $order */
foreach ($query as $order) {
$value = $vform->get('order_'.$order->getId())->getData();
// If checkbox is checked
if ($value) {
/**
* Retrieve user with the order
*/
$customer = $order->getCustomer();
/**
* Retrieve address with the order
*/
$address = OrderAddressQuery::create()
->findPk($order->getDeliveryOrderAddressId());
if ($address === null) {
throw new Exception("Could not find the order's invoice address");
}
/**
* Retrieve country with the address
*/
$country = CountryQuery::create()
->findPk($address->getCountryId());
if ($country === null) {
throw new Exception("Could not find the order's country");
}
/**
* Retrieve Title
*/
$title = CustomerTitleI18nQuery::create()
->filterById($customer->getTitleId())
->findOneByLocale(
$this->getSession()
->getAdminEditionLang()
->getLocale()
);
/**
* Get user's phone & cellphone
* First get invoice address phone,
* If empty, try to get default address' phone.
* If still empty, set default value
*/
$phone = $address->getPhone();
if (empty($phone)) {
$phone = $customer->getDefaultAddress()->getPhone();
if (empty($phone)) {
$phone = self::DEFAULT_PHONE;
}
}
/**
* Cellphone
*/
$cellphone = $customer->getDefaultAddress()->getCellphone();
if (empty($cellphone)) {
$cellphone = self::DEFAULT_CELLPHONE;
}
/**
* Compute package weight
*/
$weight = 0;
if ($vform->get('order_weight_'.$order->getId())->getData() == 0) {
/** @var \Thelia\Model\OrderProduct $product */
foreach ($order->getOrderProducts() as $product) {
$weight+=(double) $product->getWeight() * $product->getQuantity();
}
} else {
$weight = $vform->get('order_weight_'.$order->getId())->getData();
}
/**
* Get relay ID
*/
$relay_id = OrderAddressSocolissimoQuery::create()
->findPk($order->getDeliveryOrderAddressId());
/**
* Get store's name
*/
$store_name = ConfigQuery::read("store_name");
/**
* Write CSV line
*/
$csv->addLine(
CSVLine::create(
array(
$address->getFirstname(),
$address->getLastname(),
$address->getCompany(),
$address->getAddress1(),
$address->getAddress2(),
$address->getAddress3(),
$address->getZipcode(),
$address->getCity(),
$country->getIsoalpha2(),
$phone,
$cellphone,
$order->getRef(),
$title->getShort(),
// the Expeditor software used to accept a relay id of 0, but no longer does
($relay_id !== null) ? ($relay_id->getCode() == 0) ? '' : $relay_id->getCode() : 0,
$customer->getEmail(),
$weight,
$store_name,
($relay_id !== null) ? $relay_id->getType() : 0
)
)
);
/**
* Then update order's status if necessary
*/
if ($status_id == "processing") {
$event = new OrderEvent($order);
$event->setStatus($status[OrderStatus::CODE_PROCESSING]['Id']);
$this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
} elseif ($status_id == "sent") {
$event = new OrderEvent($order);
$event->setStatus($status[OrderStatus::CODE_SENT]['Id']);
$this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
}
}
}
} catch (\Exception $e) {
return Response::create($e->getMessage(),500);
}
return Response::create(
utf8_decode($csv->parse()),
200,
array(
"Content-Encoding"=>"ISO-8889-1",
"Content-Type"=>"application/csv-tab-delimited-table",
"Content-disposition"=>"filename=expeditor_thelia.csv"
)
);
}
}

View File

@@ -0,0 +1,195 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace SoColissimo\Controller;
use SoColissimo\Model\SocolissimoAreaFreeshippingDom;
use SoColissimo\Model\SocolissimoAreaFreeshippingDomQuery;
use SoColissimo\Model\SocolissimoAreaFreeshippingPr;
use SoColissimo\Model\SocolissimoAreaFreeshippingPrQuery;
use SoColissimo\Model\SocolissimoDeliveryModeQuery;
use Symfony\Component\HttpFoundation\JsonResponse;
use Thelia\Controller\Admin\BaseAdminController;
use Thelia\Core\HttpFoundation\Response;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Security\AccessManager;
use Thelia\Model\AreaQuery;
class FreeShipping extends BaseAdminController
{
public function toggleFreeShippingActivation()
{
if (null !== $response = $this
->checkAuth(array(AdminResources::MODULE), array('SoColissimo'), AccessManager::UPDATE)) {
return $response;
}
$form = new \SoColissimo\Form\FreeShipping($this->getRequest());
$response=null;
try {
$vform = $this->validateForm($form);
$freeshipping = $vform->get('freeshipping')->getData();
$deliveryModeId = $vform->get('delivery_mode')->getData();
$deliveryMode = SocolissimoDeliveryModeQuery::create()->findOneById($deliveryModeId);
$deliveryMode->setFreeshippingActive($freeshipping)
->save();
$response = Response::create('');
} catch (\Exception $e) {
$response = JsonResponse::create(array("error"=>$e->getMessage()), 500);
}
return $response;
}
public function setFreeShippingFrom()
{
if (null !== $response = $this
->checkAuth(array(AdminResources::MODULE), array('SoColissimo'), AccessManager::UPDATE)) {
return $response;
}
$data = $this->getRequest()->request;
$deliveryMode = SocolissimoDeliveryModeQuery::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'=>"SoColissimo",
'_controller' => 'Thelia\\Controller\\Admin\\ModuleController::configureAction',
'price_error_id' => null,
'price_error' => null
)
);
}
/**
* @return mixed|null|\Symfony\Component\HttpFoundation\Response
* @throws \Propel\Runtime\Exception\PropelException
*/
public function setAreaFreeShipping()
{
if (null !== $response = $this
->checkAuth(array(AdminResources::MODULE), array('SoColissimo'), AccessManager::UPDATE)) {
return $response;
}
$data = $this->getRequest()->request;
try {
$data = $this->getRequest()->request;
$socolissimo_area_id = $data->get('area-id');
$socolissimo_delivery_id = $data->get('delivery-mode');
$cartAmount = $data->get("cart-amount");
if ($cartAmount < 0 || $cartAmount === '') {
$cartAmount = null;
}
$aeraQuery = AreaQuery::create()->findOneById($socolissimo_area_id);
if (null === $aeraQuery) {
return null;
}
$deliveryModeQuery = SocolissimoDeliveryModeQuery::create()->findOneById($socolissimo_delivery_id);
if (null === $deliveryModeQuery) {
return null;
}
//Price slices for "Domicile"
if ($socolissimo_delivery_id === '1') {
$socolissimoFreeShippingDom = new SocolissimoAreaFreeshippingDom();
$socolissimoAreaFreeshippingDomQuery = SocolissimoAreaFreeshippingDomQuery::create()
->filterByAreaId($socolissimo_area_id)
->filterByDeliveryModeId($socolissimo_delivery_id)
->findOne();
if (null === $socolissimoAreaFreeshippingDomQuery) {
$socolissimoFreeShippingDom
->setAreaId($socolissimo_area_id)
->setDeliveryModeId($socolissimo_delivery_id)
->setCartAmount($cartAmount)
->save();
}
$cartAmountDomQuery = SocolissimoAreaFreeshippingDomQuery::create()
->filterByAreaId($socolissimo_area_id)
->filterByDeliveryModeId($socolissimo_delivery_id)
->findOneOrCreate()
->setCartAmount($cartAmount)
->save();
}
//Price slices for "Point Relais"
if ($socolissimo_delivery_id === '2') {
$socolissimoFreeShippingPr = new SocolissimoAreaFreeshippingPr();
$socolissimoAreaFreeshippingPrQuery = SocolissimoAreaFreeshippingPrQuery::create()
->filterByAreaId($socolissimo_area_id)
->filterByDeliveryModeId($socolissimo_delivery_id)
->findOne();
if (null === $socolissimoAreaFreeshippingPrQuery) {
$socolissimoFreeShippingPr
->setAreaId($socolissimo_area_id)
->setDeliveryModeId($socolissimo_delivery_id)
->setCartAmount($cartAmount)
->save();
}
$cartAmountPrQuery = SocolissimoAreaFreeshippingPrQuery::create()
->filterByAreaId($socolissimo_area_id)
->filterByDeliveryModeId($socolissimo_delivery_id)
->findOneOrCreate()
->setCartAmount($cartAmount)
->save();
}
} catch (\Exception $e) {
}
return $this->generateRedirectFromRoute(
"admin.module.configure",
array(),
array(
'current_tab' => 'prices_slices_tab_' . $data->get('area_freeshipping'),
'module_code' => "SoColissimo",
'_controller' => 'Thelia\\Controller\\Admin\\ModuleController::configureAction',
'price_error_id' => null,
'price_error' => null
)
);
}
}

View File

@@ -0,0 +1,100 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace SoColissimo\Controller;
use SoColissimo\WebService\FindById;
use Symfony\Component\HttpFoundation\JsonResponse;
use Thelia\Controller\Front\BaseFrontController;
use Thelia\Core\HttpFoundation\Response;
use Thelia\Core\Template\TemplateDefinition;
use Thelia\Model\ConfigQuery;
/**
* Class SearchCityController
* @package IciRelais\Controller
* @author Thelia <info@thelia.net>
*/
class GetSpecificLocation extends BaseFrontController
{
public function get($countryid, $zipcode, $city, $address="")
{
$content = $this->renderRaw(
"getSpecificLocationSoColissimo",
array(
"_countryid_" => $countryid,
"_zipcode_" => $zipcode,
"_city_" => $city,
"_address_" => $address
)
);
$response = new Response($content, 200, $headers = array('Content-Type' => 'application/json'));
return $response;
}
public function getPointInfo($point_id)
{
$req = new FindById();
$req->setId($point_id)
->setLangue("FR")
->setDate(date("d/m/Y"))
->setAccountNumber(ConfigQuery::read('socolissimo_login'))
->setPassword(ConfigQuery::read('socolissimo_pwd'))
;
$response = $req->exec();
$response = new JsonResponse($response);
return $response;
}
public function search()
{
$countryid = $this->getRequest()->query->get('countryid');
$zipcode = $this->getRequest()->query->get('zipcode');
$city = $this->getRequest()->query->get('city');
$addressId = $this->getRequest()->query->get('address');
return $this->get($countryid, $zipcode, $city, $addressId);
}
/**
* @return ParserInterface instance parser
*/
protected function getParser($template = null)
{
$parser = $this->container->get("thelia.parser");
// Define the template that should be used
$parser->setTemplateDefinition(
new TemplateDefinition(
'module_socolissimo',
TemplateDefinition::FRONT_OFFICE
)
);
return $parser;
}
}

View File

@@ -0,0 +1,127 @@
<?php
namespace SoColissimo\Controller;
use Propel\Runtime\Propel;
use SoColissimo\SoColissimo;
use Thelia\Controller\Admin\BaseAdminController;
use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Translation\Translator;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Model\Map\OrderTableMap;
use Thelia\Model\OrderQuery;
use Thelia\Model\OrderStatusQuery;
use Thelia\Tools\URL;
/**
* Class ImportController
* @package SoColissimo\Controller
* @author Etienne Perriere - OpenStudio <eperriere@openstudio.fr>
*/
class ImportController extends BaseAdminController
{
public function importAction()
{
$i = 0;
$con = Propel::getWriteConnection(OrderTableMap::DATABASE_NAME);
$con->beginTransaction();
$form = $this->createForm('socolissimo.import');
try {
$vForm = $this->validateForm($form);
// Get file
$importedFile = $vForm->getData()['import_file'];
// Check extension
if (strtolower($importedFile->getClientOriginalExtension()) !='csv') {
throw new FormValidationException(
Translator::getInstance()->trans('Bad file format. CSV expected.',
[],
SoColissimo::DOMAIN)
);
}
$csvData = file_get_contents($importedFile);
$lines = explode(PHP_EOL, $csvData);
// For each line, parse columns
foreach ($lines as $line) {
$parsedLine = str_getcsv($line, ";");
// Get delivery and order ref
$deliveryRef = $parsedLine[SoColissimo::IMPORT_DELIVERY_REF_COL];
$orderRef = $parsedLine[SoColissimo::IMPORT_ORDER_REF_COL];
// Save delivery ref if there is one
if (!empty($deliveryRef)) {
$this->importDeliveryRef($deliveryRef, $orderRef, $i);
}
}
$con->commit();
// Get number of affected rows to display
$this->getSession()->getFlashBag()->add(
'import-result',
Translator::getInstance()->trans(
'Operation successful. %i orders affected.',
['%i' => $i],
SoColissimo::DOMAIN
)
);
// Redirect
return $this->generateRedirect(URL::getInstance()->absoluteUrl($form->getSuccessUrl(), ['current_tab' => 'import']));
} catch (FormValidationException $e) {
$con->rollback();
$this->setupFormErrorContext(null, $e->getMessage(), $form);
return $this->render(
'module-configure',
[
'module_code' => SoColissimo::getModuleCode(),
'current_tab' => 'import'
]
);
}
}
/**
* Update order's delivery ref
*
* @param string $deliveryRef
* @param string $orderRef
* @param int $i
*/
public function importDeliveryRef($deliveryRef, $orderRef, &$i)
{
// Check if the order exists
if (null !== $order = OrderQuery::create()->findOneByRef($orderRef)) {
$event = new OrderEvent($order);
// Check if delivery refs are different
if ($order->getDeliveryRef() != $deliveryRef) {
$event->setDeliveryRef($deliveryRef);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_UPDATE_DELIVERY_REF, $event);
$sentStatusId = OrderStatusQuery::create()
->filterByCode('sent')
->select('ID')
->findOne();
// Set 'sent' order status if not already sent
if ($sentStatusId != null && $order->getStatusId() != $sentStatusId) {
$event->setStatus($sentStatusId);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
}
$i++;
}
}
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace SoColissimo\Controller;
use Thelia\Controller\Admin\BaseAdminController;
use SoColissimo\Form\ConfigureSoColissimo;
use Thelia\Core\Translation\Translator;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Security\AccessManager;
use Thelia\Model\ConfigQuery;
use Thelia\Tools\URL;
class SaveConfig extends BaseAdminController
{
public function save()
{
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), array('SoColissimo'), AccessManager::UPDATE)) {
return $response;
}
$form = new ConfigureSoColissimo($this->getRequest());
try {
$vform = $this->validateForm($form);
ConfigQuery::write('socolissimo_login', $vform->get('accountnumber')->getData(), 1, 1);
ConfigQuery::write('socolissimo_pwd', $vform->get('password')->getData(), 1, 1);
ConfigQuery::write('socolissimo_google_map_key', $vform->get('google_map_key')->getData(), 1, 1);
ConfigQuery::write('socolissimo_url_prod', $vform->get('url_prod')->getData(), 1, 1);
ConfigQuery::write('socolissimo_url_test', $vform->get('url_test')->getData(), 1, 1);
ConfigQuery::write('socolissimo_test_mode', $vform->get('test_mode')->getData(), 1, 1);
return $this->generateRedirect(
URL::getInstance()->absoluteUrl('/admin/module/SoColissimo', ['current_tab' => 'configure'])
);
} catch (\Exception $e) {
$this->setupFormErrorContext(
Translator::getInstance()->trans("So Colissimo update config"),
$e->getMessage(),
$form,
$e
);
return $this->render(
'module-configure',
[
'module_code' => 'SoColissimo',
'current_tab' => 'configure',
]
);
}
}
}

View File

@@ -0,0 +1,192 @@
<?php
namespace SoColissimo\Controller;
use Propel\Runtime\Map\TableMap;
use SoColissimo\Model\SocolissimoPrice;
use SoColissimo\Model\SocolissimoPriceQuery;
use SoColissimo\SoColissimo;
use Thelia\Controller\Admin\BaseAdminController;
use Thelia\Core\Security\AccessManager;
class SliceController extends BaseAdminController
{
public function saveSliceAction()
{
$response = $this->checkAuth([], ['socolissimo'], AccessManager::UPDATE);
if (null !== $response) {
return $response;
}
$this->checkXmlHttpRequest();
$responseData = [
"success" => false,
"message" => '',
"slice" => null
];
$messages = [];
$response = null;
try {
$requestData = $this->getRequest()->request;
if (0 !== $id = intval($requestData->get('id', 0))) {
$slice = SocolissimoPriceQuery::create()->findPk($id);
} else {
$slice = new SocolissimoPrice();
}
if (0 !== $areaId = intval($requestData->get('area', 0))) {
$slice->setAreaId($areaId);
} else {
$messages[] = $this->getTranslator()->trans(
'The area is not valid',
[],
SoColissimo::DOMAIN
);
}
if (0 !== $deliveryMode = intval($requestData->get('deliveryModeId', 0))) {
$slice->setDeliveryModeId($deliveryMode);
} else {
$messages[] = $this->getTranslator()->trans(
'The delivery mode is not valid',
[],
SoColissimo::DOMAIN
);
}
$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.',
[],
SoColissimo::DOMAIN
);
} 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',
[],
SoColissimo::DOMAIN
);
}
} 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',
[],
SoColissimo::DOMAIN
);
}
} 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',
[],
SoColissimo::DOMAIN
);
}
if (0 === count($messages)) {
$slice->save();
$messages[] = $this->getTranslator()->trans(
'Your slice has been saved',
[],
SoColissimo::DOMAIN
);
$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));
}
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 = floatval($val);
return $val;
}
return $default;
}
public function deleteSliceAction()
{
$response = $this->checkAuth([], ['socolissimo'], 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 = intval($requestData->get('id', 0))) {
$slice = SocolissimoPriceQuery::create()->findPk($id);
$slice->delete();
$responseData['success'] = true;
} else {
$responseData['message'] = $this->getTranslator()->trans(
'The slice has not been deleted',
[],
SoColissimo::DOMAIN
);
}
} catch (\Exception $e) {
$responseData['message'] = $e->getMessage();
}
return $this->jsonResponse(json_encode($responseData));
}
}

View File

@@ -0,0 +1,105 @@
<?php
namespace SoColissimo\Form;
use SoColissimo\Model\SocolissimoDeliveryModeQuery;
use SoColissimo\SoColissimo;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
use Thelia\Model\AreaQuery;
class AddPriceForm 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.", [], SoColissimo::DOMAIN));
}
}
public function verifyDeliveryModeExist($value, ExecutionContextInterface $context)
{
$mode = SocolissimoDeliveryModeQuery::create()->findPk($value);
if (null === $mode) {
$context->addViolation(Translator::getInstance()->trans("This delivery mode doesn't exists.", [], SoColissimo::DOMAIN));
}
}
public function verifyValidWeight($value, ExecutionContextInterface $context)
{
if (!preg_match("#^\d+\.?\d*$#", $value)) {
$context->addViolation(Translator::getInstance()->trans("The weight value is not valid.", [], SoColissimo::DOMAIN));
}
if ($value < 0) {
$context->addViolation(Translator::getInstance()->trans("The weight value must be superior to 0.", [], SoColissimo::DOMAIN));
}
}
public function verifyValidPrice($value, ExecutionContextInterface $context)
{
if (!preg_match("#^\d+\.?\d*$#", $value)) {
$context->addViolation(Translator::getInstance()->trans("The price value is not valid.", [], SoColissimo::DOMAIN));
}
}
public function getName()
{
return "socolissimo_price_create";
}
}

View File

@@ -0,0 +1,144 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace SoColissimo\Form;
use SoColissimo\SoColissimo;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Url;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
use Thelia\Model\ConfigQuery;
/**
* Class ConfigureSoColissimo
* @package SoColissimo\Form
* @author Thelia <info@thelia.net>
*/
class ConfigureSoColissimo extends BaseForm
{
/**
*
* in this function you add all the fields you need for your Form.
* Form this you have to call add method on $this->formBuilder attribute :
*
* $this->formBuilder->add("name", "text")
* ->add("email", "email", array(
* "attr" => array(
* "class" => "field"
* ),
* "label" => "email",
* "constraints" => array(
* new \Symfony\Component\Validator\Constraints\NotBlank()
* )
* )
* )
* ->add('age', 'integer');
*
* @return null
*/
protected function buildForm()
{
$translator = Translator::getInstance();
$this->formBuilder
->add(
'accountnumber',
'text',
[
'constraints' => [new NotBlank()],
'data' => ConfigQuery::read('socolissimo_login'),
'label' => $translator->trans("Account number", [], SoColissimo::DOMAIN),
'label_attr' => ['for' => 'accountnumber']
]
)
->add(
'password',
'text',
[
'constraints' => [new NotBlank()],
'data' => ConfigQuery::read('socolissimo_pwd'),
'label' => $translator->trans("Password", [], SoColissimo::DOMAIN),
'label_attr' => ['for' => 'password']
]
)
->add(
'url_prod',
'text',
[
'constraints' => [
new NotBlank(),
new Url([
'protocols' => ['https', 'http']
])
],
'data' => ConfigQuery::read('socolissimo_url_prod'),
'label' => $translator->trans("Colissimo URL prod", [], SoColissimo::DOMAIN),
'label_attr' => ['for' => 'socolissimo_url_prod']
]
)
->add(
'url_test',
'text',
[
'constraints' => [
new NotBlank(),
new Url([
'protocols' => ['https', 'http']
])
],
'data' => ConfigQuery::read('socolissimo_url_test'),
'label' => $translator->trans("Colissimo URL test", [], SoColissimo::DOMAIN),
'label_attr' => ['for' => 'socolissimo_url_test']
]
)
->add(
'test_mode',
'text',
[
'constraints' => [new NotBlank()],
'data' => ConfigQuery::read('socolissimo_test_mode'),
'label' => $translator->trans("Test mode", [], SoColissimo::DOMAIN),
'label_attr' => ['for' => 'test_mode']
]
)
->add(
'google_map_key',
'text',
[
'constraints' => [],
'data' => ConfigQuery::read('socolissimo_google_map_key'),
'label' => $translator->trans("Google map API key", [], SoColissimo::DOMAIN),
'label_attr' => ['for' => 'google_map_key']
]
)
;
}
/**
* @return string the name of you form. This name must be unique
*/
public function getName()
{
return "configuresocolissimo";
}
}

View File

@@ -0,0 +1,120 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace SoColissimo\Form;
use Propel\Runtime\ActiveQuery\Criteria;
use SoColissimo\SoColissimo;
use Thelia\Form\BaseForm;
use Thelia\Model\Base\OrderQuery;
use Thelia\Core\Translation\Translator;
use Thelia\Model\OrderStatusQuery;
use Thelia\Model\OrderStatus;
/**
* Class ExportOrder
* @package SoColissimo\Form
* @author Thelia <info@thelia.net>
*/
class ExportOrder extends BaseForm
{
/**
*
* in this function you add all the fields you need for your Form.
* Form this you have to call add method on $this->formBuilder attribute :
*
* $this->formBuilder->add("name", "text")
* ->add("email", "email", array(
* "attr" => array(
* "class" => "field"
* ),
* "label" => "email",
* "constraints" => array(
* new \Symfony\Component\Validator\Constraints\NotBlank()
* )
* )
* )
* ->add('age', 'integer');
*
* @return null
*/
protected function buildForm()
{
$status = OrderStatusQuery::create()
->filterByCode(
array(
OrderStatus::CODE_PAID,
OrderStatus::CODE_PROCESSING,
OrderStatus::CODE_SENT
),
Criteria::IN
)
->find()
->toArray("code")
;
$query = OrderQuery::create()
->filterByDeliveryModuleId(SoColissimo::getModCode())
->filterByStatusId(array($status['paid']['Id'], $status['processing']['Id']), Criteria::IN)
->find();
$this->formBuilder
->add('new_status_id', 'choice',array(
'label' => Translator::getInstance()->trans('server'),
'choices' => array(
"nochange" => Translator::getInstance()->trans("Do not change"),
"processing" => Translator::getInstance()->trans("Set orders status as processing"),
"sent" => Translator::getInstance()->trans("Set orders status as sent")
),
'required' => 'true',
'expanded'=>true,
'multiple'=>false,
'data'=>'nochange'
)
);
/** @var \Thelia\Model\Order $order */
foreach ($query as $order) {
$this->formBuilder
->add(
"order_".$order->getId(),
"checkbox",
[
'label'=>$order->getRef(),
'label_attr'=>['for'=>'export_'.$order->getId()]
]
)
->add(
"order_weight_".$order->getId(),
'number'
)
;
}
}
/**
* @return string the name of you form. This name must be unique
*/
public function getName()
{
return "exportsocolissimoorder";
}
}

View File

@@ -0,0 +1,70 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace SoColissimo\Form;
use SoColissimo\Model\SocolissimoFreeshippingQuery;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
class FreeShipping extends BaseForm
{
/**
*
* in this function you add all the fields you need for your Form.
* Form this you have to call add method on $this->formBuilder attribute :
*
* $this->formBuilder->add("name", "text")
* ->add("email", "email", array(
* "attr" => array(
* "class" => "field"
* ),
* "label" => "email",
* "constraints" => array(
* new \Symfony\Component\Validator\Constraints\NotBlank()
* )
* )
* )
* ->add('age', 'integer');
*
* @return null
*/
protected function buildForm()
{
$this->formBuilder
->add("delivery_mode", "integer")
->add("freeshipping", "checkbox", array(
'label'=>Translator::getInstance()->trans("Activate free shipping: ")
))
;
}
/**
* @return string the name of you form. This name must be unique
*/
public function getName()
{
return "socolissimofreeshipping";
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace SoColissimo\Form;
use SoColissimo\SoColissimo;
use Symfony\Component\Validator\Constraints;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
/**
* Class ImportForm
* @package SoColissimo\Form
* @author Etienne Perriere - OpenStudio <eperriere@openstudio.fr>
*/
class ImportForm extends BaseForm
{
public function getName()
{
return 'import_form';
}
protected function buildForm()
{
$this->formBuilder
->add(
'import_file', 'file',
[
'label' => Translator::getInstance()->trans('Select file to import', [], SoColissimo::DOMAIN),
'constraints' => [
new Constraints\NotBlank(),
new Constraints\File(['mimeTypes' => ['text/csv', 'text/plain']])
],
'label_attr' => ['for' => 'import_file']
]
);
}
}

View File

@@ -0,0 +1,88 @@
<?php
namespace SoColissimo\Form;
use SoColissimo\Model\SocolissimoDeliveryModeQuery;
use SoColissimo\SoColissimo;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
use Thelia\Model\AreaQuery;
class UpdatePriceForm 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.", [], SoColissimo::DOMAIN));
}
}
public function verifyDeliveryModeExist($value, ExecutionContextInterface $context)
{
$mode = SocolissimoDeliveryModeQuery::create()->findPk($value);
if (null === $mode) {
$context->addViolation(Translator::getInstance()->trans("This delivery mode doesn't exists.", [], SoColissimo::DOMAIN));
}
}
public function verifyValidPrice($value, ExecutionContextInterface $context)
{
if (!preg_match("#^\d+\.?\d*$#", $value)) {
$context->addViolation(Translator::getInstance()->trans("The price value is not valid.", [], SoColissimo::DOMAIN));
}
}
public function getName()
{
return "socolissimo_price_create";
}
}

View File

@@ -0,0 +1,99 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace SoColissimo\Format;
/**
* Class CSV
* @package SoColissimo\Format
* @author Thelia <info@thelia.net>
*/
class CSV
{
protected $separator;
protected $lines=array();
const CRLF = "\r\n";
/**
* @param $separator
* @param array $lines
*/
public function __construct($separator, array $lines=array())
{
$this->separator = $separator;
foreach ($lines as $line) {
if ($line instanceof CSVLine) {
$this->addLine($line);
}
}
}
/**
* @param $separator
* @param array $lines
* @return CSV
*/
public static function create($separator, array $lines=array())
{
return new static($separator, $lines);
}
/**
* @param CSVLine $line
* @return $this
*/
public function addLine(CSVLine $line)
{
$this->lines[] = $line;
return $this;
}
/**
* @return string parsed CSV
*/
public function parse()
{
$buffer = "";
for ($j=0; $j < ($lineslen=count($this->lines)); ++$j) {
/** @var CSVLine $line */
$line = $this->lines[$j];
$aline = $line->getValues();
for ($i=0; $i < ($linelen=count($aline)); ++$i) {
$buffer .= "\"".$aline[$i]."\"";
if ($i !== $linelen-1) {
$buffer .= $this->separator;
}
}
if ($j !== $lineslen-1) {
$buffer .= self::CRLF;
}
}
return $buffer;
}
}

View File

@@ -0,0 +1,67 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace SoColissimo\Format;
/**
* Class CSVLine
* @package SoColissimo\Format
* @author Thelia <info@thelia.net>
*/
class CSVLine
{
protected $values=array();
public function __construct(array $values)
{
$this->values = $values;
}
/**
* @param array $values
* @return CSVLine
*/
public static function create(array $values)
{
return new static($values);
}
/**
* @return array
*/
public function getValues()
{
return $this->values;
}
/**
* @param $value
* @return $this
*/
public function addValue($value)
{
$this->values[] = $value;
return $this;
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace SoColissimo\Hook;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
/**
* Class BackHook
* @package SoColissimo\Hook
*/
class BackHook extends BaseHook
{
public function onModuleConfiguration(HookRenderEvent $event)
{
$event->add($this->render('SoColissimo/module_configuration.html'));
}
public function onModuleConfigJs(HookRenderEvent $event)
{
$event->add($this->render('SoColissimo/module-config-js.html'));
}
}

View File

@@ -0,0 +1,44 @@
<?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 SoColissimo\Hook;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
/**
* Class FrontHook
* @package SoColissimo\Hook
* @author Michaël Espeche <mespeche@openstudio.fr>
*/
class FrontHook extends BaseHook {
public function onOrderDeliveryExtra(HookRenderEvent $event)
{
$content = $this->render("socolissimo.html", $event->getArguments());
$event->add($content);
}
public function onOrderInvoiceDeliveryAddress(HookRenderEvent $event)
{
$content = $this->render("delivery-address.html", $event->getArguments());
$event->add($content);
}
public function onMainHeadBottom(HookRenderEvent $event)
{
$content = $this->addCSS('assets/css/styles.css');
$event->add($content);
}
}

View File

@@ -0,0 +1,38 @@
<?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 SoColissimo\Hook;
use SoColissimo\SoColissimo;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
use Thelia\Model\OrderQuery;
class PdfHook extends BaseHook
{
public function onInvoiceAfterDeliveryModule(HookRenderEvent $event)
{
// No So Colissimo information if the delivery module is not SoColissimo
if (SoColissimo::getModuleId() == $event->getArgument('module_id')) {
return;
}
$order = OrderQuery::create()->findOneById($event->getArgument('order'));
if (!is_null($order)) {
$event->add($this->render(
'delivery_mode_infos.html',
['delivery_address_id' => $order->getDeliveryOrderAddressId()]
));
}
}
}

View File

@@ -0,0 +1,6 @@
<?php
return array(
'Export' => 'Export',
'Export Coliship file' => 'Export Coliship file',
);

View File

@@ -0,0 +1,6 @@
<?php
return array(
'Export' => 'Export',
'Export Coliship file' => 'Export de fichier Coliship',
);

View File

@@ -0,0 +1,49 @@
<?php
return array(
'*If you choose this option, the exported orders would not be available on this page anymore' => '*If you choose this option, the exported orders would not be available on this page anymore',
'Actions' => 'Actions',
'Activate total free shipping ' => 'Activate total free shipping ',
'Add this price slice' => 'Add this price slice',
'Advanced configuration' => 'Advanced configuration',
'An error occured' => 'An error occured',
'Area : ' => 'Area : ',
'Change orders status after export' => 'Change orders status after export',
'Check all' => 'Check all',
'Customer' => 'Customer',
'Date' => 'Date',
'Delete this price slice' => 'Delete this price slice',
'Do not change' => 'Do not change',
'Export' => 'Export',
'Export Coliship file' => 'Export Coliship file',
'If you don\'t specify a cart price in a slice, it will have priority over the other slices with the same weight.' => 'If you don\'t specify a cart price in a slice, it will have priority over the other slices with the same weight.',
'If you don\'t specify a cart weight in a slice, it will have priority over the slices with weight.' => 'If you don\'t specify a cart weight in a slice, it will have priority over the slices with weight.',
'Import Coliship file' => 'Import Coliship file',
'Message' => 'Message',
'Or activate free shipping from (€) :' => 'Or activate free shipping from (€) :',
'PRODUCTION' => 'PRODUCTION',
'Package weight' => 'Package weight',
'Please change the access rights' => 'Please change the access rights',
'Price (%symbol)' => 'Price (%symbol)',
'Price slices for "%mode"' => 'Price slices for "%mode"',
'Processing' => 'Processing',
'REF' => 'REF',
'Reverse selection' => 'Reverse selection',
'Save' => 'Save',
'Save changes' => 'Save changes',
'Save this price slice' => 'Save this price slice',
'Sent' => 'Sent',
'TEST' => 'TEST',
'The file has to be a CSV with 2 columns. The first contains the delivery reference, the second the order reference.' => 'The file has to be a CSV with 2 columns. The first contains the delivery reference, the second the order reference.',
'The slices are ordered by maximum cart weight then by maximum cart price.' => 'The slices are ordered by maximum cart weight then by maximum cart price.',
'Total taxed amount' => 'Total taxed amount',
'Uncheck all' => 'Uncheck all',
'Unknown customer' => 'Unknown customer',
'Untaxed Price up to ... %symbol' => 'Untaxed Price up to ... %symbol',
'Upload' => 'Upload',
'Weight up to ... kg' => 'Weight up to ... kg',
'You can create price slices by specifying a maximum cart weight and/or a maximum cart price.' => 'You can create price slices by specifying a maximum cart weight and/or a maximum cart price.',
'You should first attribute shipping zones to the modules: ' => 'You should first attribute shipping zones to the modules: ',
'manage shipping zones' => 'manage shipping zones',
'operations' => 'operations',
);

View File

@@ -0,0 +1,52 @@
<?php
return array(
'*If you choose this option, the exported orders would not be available on this page anymore' => '* Si vous choisissez cette option, les commandes exportées n\'apparaitront plus dans cette page',
'Actions' => 'Actions',
'Activate total free shipping ' => 'Activer les frais de port gratuits',
'Activate free shipping from (€) :' => 'Activer les frais de port gratuits à partir de (€)',
'Add this price slice' => 'Ajouter cette tranche de prix',
'Advanced configuration' => 'Configuration avancée',
'An error occured' => 'Une erreur est survenue',
'Area : ' => 'Zone :',
'Change orders status after export' => 'Modifier le statut des commandes après l\'export',
'Check all' => 'Tout cocher',
'Customer' => 'Client',
'Date' => 'Date',
'Delete this price slice' => 'Supprimer cette tranche de prix',
'Do not change' => 'Ne pas modifier',
'Export' => 'Export',
'Export Coliship file' => 'Export de fichier Coliship',
'If a cart matches multiple slices, it will take the last slice following that order.' => 'Si un panier correspond à plusieurs tranches, la dernière tranche sera prise en compte selon cet ordre.',
'If you don\'t specify a cart price in a slice, it will have priority over the other slices with the same weight.' => 'Si vous ne renseignez pas de prix de panier max dans une tranche, elle aura la priorité sur les autres tranches ayant le même poids.',
'If you don\'t specify a cart weight in a slice, it will have priority over the slices with weight.' => 'Si vous ne renseignez pas de poids max dans une tranche, elle aura la priorité sur les tranches ayant un poids.',
'If you specify both, the cart will require to have a lower weight AND a lower price in order to match the slice.' => 'Si vous renseignez les deux, le panier devra avoir à la fois un poids inférieur ET un prix inférieur pour correspondre à cette tranche.',
'Import Coliship file' => 'Import de fichier Coliship',
'Message' => 'Message',
'Or activate free shipping from (€) :' => 'Ou activer les frais de port gratuits à partir de (€)',
'PRODUCTION' => 'PRODUCTION',
'Package weight' => 'Poids des colis (kg)',
'Please change the access rights' => 'Merci de modifier les droits d\'accès',
'Price (%symbol)' => 'Frais de livraison (%symbol)',
'Price slices for "%mode"' => 'Tranche de prix pour "%mode"',
'Processing' => 'En cours',
'REF' => 'REF',
'Reverse selection' => 'Inverser la sélection',
'Save' => 'Sauvegarder',
'Save changes' => 'Enregistrer les modifications',
'Save this price slice' => 'Enregistrer cette tranche de prix',
'Sent' => 'Envoyé',
'TEST' => 'TEST',
'The file has to be a CSV with 2 columns. The first contains the delivery reference, the second the order reference.' => 'Le fichier doit être au format CSV et contenir 2 colonnes. La première indique les références colis, la seconde les références des commandes.',
'The slices are ordered by maximum cart weight then by maximum cart price.' => 'Les tranches sont triés pour poids de panier max puis par prix de panier max.',
'Total taxed amount' => 'Montant total (avec taxes)',
'Uncheck all' => 'Tout décocher',
'Unknown customer' => 'Client inconnu',
'Untaxed Price up to ... %symbol' => 'Prix HT max du panier (%symbol)',
'Upload' => 'Charger le fichier',
'Weight up to ... kg' => 'Poids maximum (kg)',
'You can create price slices by specifying a maximum cart weight and/or a maximum cart price.' => 'Vous pouvez créer des tranches de prix pour les frais de port en spécifiant un poids de panier maximum et/ou un prix de panier maximum.',
'You should first attribute shipping zones to the modules: ' => 'Vous devez d\'abord attribuer des zones de livraison à ce module :',
'manage shipping zones' => 'Configurer les zones de livraison',
'operations' => 'Opérations',
);

View File

@@ -0,0 +1,35 @@
<?php
return array(
'Account number' => 'Account number',
'Activate free shipping: ' => 'Activate free shipping: ',
'Bad file format. CSV expected.' => 'Bad file format. CSV expected.',
'Can\'t read Config directory' => 'Can\'t read Config directory',
'Can\'t read file' => 'Can\'t read file',
'Colissimo URL prod' => 'Colissimo URL prod',
'Colissimo URL test' => 'Colissimo URL test',
'Do not change' => 'Do not change',
'Google map API key' => 'Google map API key',
'No relay points were selected' => 'No relay points were selected',
'Operation successful. %i orders affected.' => 'Operation successful. %i orders affected.',
'Password' => 'Password',
'Select file to import' => 'Select file to import',
'Set orders status as processing' => 'Set orders status as processing',
'Set orders status as sent' => 'Set orders status as sent',
'So Colissimo update config' => 'So Colissimo update config',
'Test mode' => 'Test mode',
'The area is not valid' => 'The area is not valid',
'The delivery mode is not valid' => 'The delivery mode is not valid',
'The price max value is not valid' => 'The price max value is not valid',
'The price value is not valid' => 'The price value is not valid',
'The price value is not valid.' => 'The price value is not valid.',
'The slice has not been deleted' => 'The slice has not been deleted',
'The weight max value is not valid' => 'The weight max value is not valid',
'The weight value is not valid.' => 'The weight value is not valid.',
'The weight value must be superior to 0.' => 'The weight value must be superior to 0.',
'This area doesn\'t exists.' => 'This area doesn\'t exists.',
'This delivery mode doesn\'t exists.' => 'This delivery mode doesn\'t exists.',
'You must specify at least a price max or a weight max value.' => 'You must specify at least a price max or a weight max value.',
'Your slice has been saved' => 'Your slice has been saved',
'server' => 'server',
);

View File

@@ -0,0 +1,35 @@
<?php
return array(
'Account number' => 'Numéro de compte',
'Activate free shipping: ' => 'Livraison offerte: ',
'Bad file format. CSV expected.' => 'Mauvais format de fichier. CSV attendu.',
'Can\'t read Config directory' => 'Le dossier Config ne peut être lu',
'Can\'t read file' => 'Le fichier suivant ne peut être lu',
'Colissimo URL prod' => 'URL de Colissimo en production',
'Colissimo URL test' => 'URL de Colissimo en mode test',
'Do not change' => 'Ne pas changer',
'Google map API key' => 'Clé API Google map',
'No relay points were selected' => 'Aucun point relais n\'a été sélectionné',
'Operation successful. %i orders affected.' => 'Opération effectuée avec succès. %i commandes affectées.',
'Password' => 'Mot de passe',
'Select file to import' => 'Sélectionner un fichier à importer',
'Set orders status as processing' => 'En traitement',
'Set orders status as sent' => 'Envoyée',
'So Colissimo update config' => 'Mise à jour de la configuration de So Colissimo ',
'Test mode' => 'Mode test',
'The area is not valid' => 'La zone de livraison n\'est pas valide.',
'The delivery mode is not valid' => 'Le mode de livraison n\'est pas valide.',
'The price max value is not valid' => 'Le prix maximum n\'est pas valide.',
'The price value is not valid' => 'Les frais de livraison ne sont pas valides.',
'The price value is not valid.' => 'Le prix n\'est pas valide.',
'The slice has not been deleted' => 'La tranche n\'a pas été supprimée.',
'The weight max value is not valid' => 'Le poids maximum n\'est pas valide.',
'The weight value is not valid.' => 'Le poids n\'est pas valide.',
'The weight value must be superior to 0.' => 'Le poids doit être supérieur à 0.',
'This area doesn\'t exists.' => 'Cette zone n\'existe pas.',
'This delivery mode doesn\'t exists.' => 'Ce mode de livraison n\'existe pas.',
'You must specify at least a price max or a weight max value.' => 'Vous devez spécifier au moins un prix maximum ou un poids maximum.',
'Your slice has been saved' => 'Votre tranche a été enregistrée.',
'server' => 'Serveur',
);

View File

@@ -0,0 +1,33 @@
<?php
return array(
'Actual address can\'t be geolocated' => 'Actual address can\'t be geolocated',
'Automatic pickup point' => 'Automatic pickup point',
'Choose this delivery mode' => 'Choose this delivery mode',
'Colissimo is unavailable. Please choose another delivery method' => 'Colissimo is unavailable. Please choose another delivery method',
'Delivery address' => 'Delivery address',
'Delivery in France in one of the 500 automatic instructions 7/7 and 24h/24.' => 'Delivery in France in one of the 500 automatic instructions 7/7 and 24h/24.',
'Delivery in one of the 10,000 collection points La Poste in France or in a post office in Europe.' => 'Delivery in one of the 10,000 collection points La Poste in France or in a post office in Europe.',
'Delivery in one of the 7,500 shops in the PICKUP network.' => 'Delivery in one of the 7,500 shops in the PICKUP network.',
'Delivery to you or a personal address of your choice.' => 'Delivery to you or a personal address of your choice.',
'Friday' => 'Friday',
'Monday' => 'Monday',
'My home' => 'My home',
'Near you' => 'Near you',
'No relay points were selected' => 'No relay points were selected',
'Pickup shop' => 'Pickup shop',
'Please enter a city and a zipcode' => 'Please enter a city and a zipcode',
'Post office' => 'Post office',
'Saturday' => 'Saturday',
'Search' => 'Search',
'Search Colissimo relay in a city' => 'Search Colissimo relay in a city',
'Sunday' => 'Sunday',
'Thursday' => 'Thursday',
'Tuesday' => 'Tuesday',
'Wednesday' => 'Wednesday',
'address' => 'address',
'city' => 'city',
'home delivery' => 'home delivery',
'include in results' => 'include in results',
'zipcode' => 'zipcode',
);

View File

@@ -0,0 +1,33 @@
<?php
return array(
'Actual address can\'t be geolocated' => 'Actual address can\'t be geolocated ',
'Automatic pickup point' => 'En consigne Pickup Station',
'Choose this delivery mode' => 'Choisir ce mode de livraison',
'Colissimo is unavailable. Please choose another delivery method' => 'Colissimo est indisponible. Merci de choisir un autre moyen de livraison.',
'Delivery address' => 'Adresse de livraison',
'Delivery in France in one of the 500 automatic instructions 7/7 and 24h/24.' => 'Livraison en France dans lune des 500 consignes automatiques de retrait accessibles 7j/7 et 24h/24 (sauf consignes soumises aux horaires des galeries marchandes et zones de transports).',
'Delivery in one of the 10,000 collection points La Poste in France or in a post office in Europe.' => 'Livraison dans l\'un des 10 000 points de retrait La Poste en France ou dans un bureau de poste à l\'étranger.',
'Delivery in one of the 7,500 shops in the PICKUP network.' => 'Livraison dans lun des 7500 commerçants de proximité du réseau Pickup.',
'Delivery to you or a personal address of your choice.' => '<p>Livraison chez vous ou à une adresse personnelle de votre choix avec tentative de remise en mains propres ou en boîte aux lettres.</p> <p>En cas d\'absence, remise en bureau de poste.</p>',
'Friday' => 'Jeudi',
'Monday' => 'Lundi',
'My home' => 'Mon domicile',
'Near you' => 'A proximité de chez vous',
'No relay points were selected' => 'Aucun point relais n\'a été sélectionné',
'Pickup shop' => 'En relais Pickup',
'Please enter a city and a zipcode' => 'Merci de renseigner le code postal et la ville',
'Post office' => 'En bureau de poste',
'Saturday' => 'Samedi',
'Search' => 'Rechercher',
'Search Colissimo relay in a city' => 'Rechercher un point de retrait Colissimo dans une ville',
'Sunday' => 'Dimanche',
'Thursday' => 'Vendredi',
'Tuesday' => 'Mardi',
'Wednesday' => 'Mercredi',
'address' => 'adresse',
'city' => 'ville',
'home delivery' => 'Livraison à domicile',
'include in results' => 'inclure dans la recherche',
'zipcode' => 'code postal',
);

View File

@@ -0,0 +1,8 @@
<?php
return array(
'Delivered at a relay.' => 'Delivered at a relay.',
'Delivered at home.' => 'Delivered at home.',
'Relay address:' => 'Relay address:',
'no address' => 'no address',
);

View File

@@ -0,0 +1,8 @@
<?php
return array(
'Delivered at a relay.' => 'Livré en point relais.',
'Delivered at home.' => 'Livré à domicile.',
'Relay address:' => 'Adresse du point relais :',
'no address' => 'Aucune adresse',
);

View File

@@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View File

@@ -0,0 +1,123 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace SoColissimo\Listener;
use SoColissimo\SoColissimo;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
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\MessageQuery;
/**
* Class SendMail
* @package Colissimo\Listener
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class SendMail implements EventSubscriberInterface
{
protected $parser;
protected $mailer;
public function __construct(ParserInterface $parser, MailerFactory $mailer)
{
$this->parser = $parser;
$this->mailer = $mailer;
}
public function updateStatus(OrderEvent $event)
{
$order = $event->getOrder();
$socolissimo = new SoColissimo();
if ($order->isSent() && $order->getDeliveryModuleId() == $socolissimo->getModuleModel()->getId()) {
$contact_email = ConfigQuery::read('store_email');
if ($contact_email) {
$message = MessageQuery::create()
->filterByName('mail_socolissimo')
->findOne();
if (false === $message || null === $message) {
throw new \Exception("Failed to load message 'order_confirmation'.");
}
$order = $event->getOrder();
$customer = $order->getCustomer();
$this->parser->assign('customer_id', $customer->getId());
$this->parser->assign('order_ref', $order->getRef());
$this->parser->assign('order_date', $order->getCreatedAt());
$this->parser->assign('update_date', $order->getUpdatedAt());
$this->parser->assign('package', $order->getDeliveryRef());
$message
->setLocale($order->getLang()->getLocale());
$instance = \Swift_Message::newInstance()
->addTo($customer->getEmail(), $customer->getFirstname()." ".$customer->getLastname())
->addFrom($contact_email, ConfigQuery::read('store_name'))
;
// Build subject and body
$message->buildMessage($this->parser, $instance);
$this->mailer->send($instance);
}
}
}
/**
* 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_UPDATE_STATUS => array("updateStatus", 128)
);
}
}

View File

@@ -0,0 +1,300 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace SoColissimo\Listener;
use SoColissimo\Utils\ColissimoCodeReseau;
use SoColissimo\WebService\FindById;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\Delivery\DeliveryPostageEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Translation\Translator;
use Thelia\Model\Address;
use Thelia\Model\ConfigQuery;
use Thelia\Model\CountryQuery;
use Thelia\Model\OrderAddressQuery;
use SoColissimo\SoColissimo;
use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Model\AddressQuery;
use SoColissimo\Model\AddressSocolissimoQuery;
use SoColissimo\Model\AddressSocolissimo;
use SoColissimo\Model\OrderAddressSocolissimo;
/**
* Class SetDeliveryModule
* @package SoColissimo\Listener
* @author Thelia <info@thelia.net>
*/
class SetDeliveryModule implements EventSubscriberInterface
{
protected $request;
public function __construct(Request $request)
{
$this->request = $request;
}
public function getRequest()
{
return $this->request;
}
protected function check_module($id)
{
return $id == SoColissimo::getModCode();
}
private function callWebServiceFindRelayPointByIdFromRequest(Request $request)
{
$relay_infos = explode(':', $request->get('socolissimo_code'));
$pr_code = $relay_infos[0];
$relayType = count($relay_infos) > 1 ? $relay_infos[1] : null ;
$relayCountryCode = count($relay_infos) > 2 ? $relay_infos[2] : null ;
if (!empty($pr_code)) {
$req = new FindById();
$req->setId($pr_code)
->setLangue("FR")
->setDate(date("d/m/Y"))
->setAccountNumber(ConfigQuery::read('socolissimo_login'))
->setPassword(ConfigQuery::read('socolissimo_pwd'));
// An argument "Code réseau" is now required in addition to the Relay Point Code to identify a relay point outside France.
// This argument is optional for relay points inside France.
if ($relayType != null && $relayCountryCode != null) {
$codeReseau = ColissimoCodeReseau::getCodeReseau($relayCountryCode, $relayType);
if ($codeReseau !== null) {
$req->setReseau($codeReseau);
}
}
return $req->exec();
} else {
return null;
}
}
public function isModuleSoColissimo(OrderEvent $event)
{
if ($this->check_module($event->getDeliveryModule())) {
$request = $this->getRequest();
$dom = $request->get('socolissimo-home');
$request->getSession()->set('SoColissimoDeliveryId', 0);
$request->getSession()->set('SoColissimoDomicile', 0);
$customer_name = AddressQuery::create()
->findPk($event->getDeliveryAddress());
$address = AddressSocolissimoQuery::create()
->findPk($event->getDeliveryAddress());
$request->getSession()->set('SoColissimoDeliveryId', $event->getDeliveryAddress());
if ($address === null) {
$address = new AddressSocolissimo();
$address->setId($event->getDeliveryAddress());
}
if ($dom) {
$request->getSession()->set('SoColissimoDomicile', 1);
$address->setCode(null)
->setType("DOM")
->setCompany($customer_name->getCompany())
->setAddress1($customer_name->getAddress1())
->setAddress2($customer_name->getAddress2())
->setAddress3($customer_name->getAddress3())
->setZipcode($customer_name->getZipcode())
->setCity($customer_name->getCity())
->setFirstname($customer_name->getFirstname())
->setLastname($customer_name->getLastname())
->setTitleId($customer_name->getTitleId())
->setCountryId($customer_name->getCountryId())
->setCellphone(null)
->save();
} else {
$response = $this->callWebServiceFindRelayPointByIdFromRequest($request);
if ($response !== null) {
$customer_name = AddressQuery::create()
->findPk($event->getDeliveryAddress());
$address = AddressSocolissimoQuery::create()
->findPk($event->getDeliveryAddress());
$request->getSession()->set('SoColissimoDeliveryId', $event->getDeliveryAddress());
if ($address === null) {
$address = new AddressSocolissimo();
$address->setId($event->getDeliveryAddress());
}
$relayCountry = CountryQuery::create()->findOneByIsoalpha2($response->codePays);
if ($relayCountry == null) {
$relayCountry = $customer_name->getCountry();
}
$address->setCode($response->identifiant)
->setType($response->typeDePoint)
->setCompany($response->nom)
->setAddress1($response->adresse1)
->setAddress2($response->adresse2)
->setAddress3($response->adresse3)
->setZipcode($response->codePostal)
->setCity($response->localite)
->setFirstname($customer_name->getFirstname())
->setLastname($customer_name->getLastname())
->setTitleId($customer_name->getTitleId())
->setCountryId($relayCountry->getId())
->save();
} else {
$message = Translator::getInstance()->trans('No relay points were selected', [], SoColissimo::DOMAIN);
throw new \Exception($message);
}
}
}
}
public function updateDeliveryAddress(OrderEvent $event)
{
if ($this->check_module($event->getOrder()->getDeliveryModuleId())) {
$request = $this->getRequest();
if ($request->getSession()->get('SoColissimoDomicile') == 1) {
$tmp_address = AddressSoColissimoQuery::create()
->findPk($request->getSession()->get('SoColissimoDeliveryId'));
if ($tmp_address === null) {
throw new \ErrorException("Got an error with So Colissimo module. Please try again to checkout.");
}
$savecode = new OrderAddressSocolissimo();
$savecode->setId($event->getOrder()->getDeliveryOrderAddressId())
->setCode(0)
->setType($tmp_address->getType())
->save();
$update = OrderAddressQuery::create()
->findPK($event->getOrder()->getDeliveryOrderAddressId())
->setCompany($tmp_address->getCompany())
->setAddress1($tmp_address->getAddress1())
->setAddress2($tmp_address->getAddress2())
->setAddress3($tmp_address->getAddress3())
->setZipcode($tmp_address->getZipcode())
->setCity($tmp_address->getCity())
->save();
} else {
$tmp_address = AddressSoColissimoQuery::create()
->findPk($request->getSession()->get('SoColissimoDeliveryId'));
if ($tmp_address === null) {
throw new \ErrorException("Got an error with So Colissimo module. Please try again to checkout.");
}
$savecode = new OrderAddressSocolissimo();
$savecode->setId($event->getOrder()->getDeliveryOrderAddressId())
->setCode($tmp_address->getCode())
->setType($tmp_address->getType())
->save();
$update = OrderAddressQuery::create()
->findPK($event->getOrder()->getDeliveryOrderAddressId())
->setCompany($tmp_address->getCompany())
->setAddress1($tmp_address->getAddress1())
->setAddress2($tmp_address->getAddress2())
->setAddress3($tmp_address->getAddress3())
->setZipcode($tmp_address->getZipcode())
->setCity($tmp_address->getCity())
->save();
}
}
}
public function getPostageRelayPoint(DeliveryPostageEvent $event)
{
if ($this->check_module($event->getModule()->getModuleModel()->getId())) {
$request = $this->getRequest();
$dom = $request->get('socolissimo-home');
if (!$dom) {
// If the relay point service was chosen, we store the address of the chosen relay point in
// the DeliveryPostageEvent in order for Thelia to recalculate the postage cost from this address.
$response = $this->callWebServiceFindRelayPointByIdFromRequest($request);
if ($response !== null) {
$address = new Address();
$relayCountry = CountryQuery::create()->findOneByIsoalpha2($response->codePays);
$address->setCompany($response->nom)
->setAddress1($response->adresse1)
->setAddress2($response->adresse2)
->setAddress3($response->adresse3)
->setZipcode($response->codePostal)
->setCity($response->localite)
->setCountryId($relayCountry->getId());
$event->setAddress($address);
}
}
}
}
/**
* 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('isModuleSoColissimo', 64),
TheliaEvents::ORDER_BEFORE_PAYMENT => array('updateDeliveryAddress', 256),
TheliaEvents::MODULE_DELIVERY_GET_POSTAGE => array('getPostageRelayPoint', 257)
);
}
}

View File

@@ -0,0 +1,58 @@
<?php
namespace SoColissimo\Loop;
use SoColissimo\Model\SocolissimoAreaFreeshippingDomQuery;
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 AreaFreeshippingDom extends BaseLoop implements PropelSearchLoopInterface
{
/**
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntTypeArgument('area_id'),
Argument::createIntTypeArgument('delivery_mode_id')
);
}
public function buildModelCriteria()
{
$areaId = $this->getAreaId();
$mode = $this->getDeliveryModeId();
$modes = SocolissimoAreaFreeshippingDomQuery::create();
if (null !== $mode) {
$modes->filterByDeliveryModeId($mode);
}
if (null !== $areaId) {
$modes->filterByAreaId($areaId);
}
return $modes;
}
public function parseResults(LoopResult $loopResult)
{
/** @var \SoColissimo\Model\SocolissimoAreaFreeshippingDom $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;
}
}

View File

@@ -0,0 +1,58 @@
<?php
namespace SoColissimo\Loop;
use SoColissimo\Model\SocolissimoAreaFreeshippingPrQuery;
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 AreaFreeshippingPr extends BaseLoop implements PropelSearchLoopInterface
{
/**
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntTypeArgument('area_id'),
Argument::createIntTypeArgument('delivery_mode_id')
);
}
public function buildModelCriteria()
{
$areaId = $this->getAreaId();
$mode = $this->getDeliveryModeId();
$modes = SocolissimoAreaFreeshippingPrQuery::create();
if (null !== $mode) {
$modes->filterByDeliveryModeId($mode);
}
if (null !== $areaId) {
$modes->filterByAreaId($areaId);
}
return $modes;
}
public function parseResults(LoopResult $loopResult)
{
/** @var \SoColissimo\Model\SocolissimoAreaFreeshippingPr $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;
}
}

View File

@@ -0,0 +1,76 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace SoColissimo\Loop;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\ArraySearchLoopInterface;
use Thelia\Core\Translation\Translator;
/**
* Class CheckRightsLoop
* @package Colissimo\Looop
* @author Thelia <info@thelia.net>
*/
class CheckRightsLoop extends BaseLoop implements ArraySearchLoopInterface
{
protected function getArgDefinitions()
{
return new ArgumentCollection();
}
public function buildArray()
{
$ret = array();
$dir = __DIR__."/../Config/";
if (!is_readable($dir)) {
$ret[] = array("ERRMES"=>Translator::getInstance()->trans("Can't read Config directory"), "ERRFILE"=>"");
}
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if (strlen($file) > 5 && substr($file, -5) === ".json") {
if (!is_readable($dir.$file)) {
$ret[] = array("ERRMES"=>Translator::getInstance()->trans("Can't read file"), "ERRFILE"=>"Colissimo/Config/".$file);
}
}
}
}
return $ret;
}
public function parseResults(LoopResult $loopResult)
{
foreach ($loopResult->getResultDataCollection() as $arr) {
$loopResultRow = new LoopResultRow();
$loopResultRow->set("ERRMES", $arr["ERRMES"])
->set("ERRFILE", $arr["ERRFILE"]);
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

View File

@@ -0,0 +1,178 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace SoColissimo\Loop;
use SoColissimo\SoColissimo;
use SoColissimo\WebService\FindByAddress;
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
use Thelia\Core\Template\Element\ArraySearchLoopInterface;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Log\Tlog;
use Thelia\Model\AddressQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Model\CountryQuery;
/**
* Class GetRelais
* @package SoColissimo\Loop
* @author Thelia <info@thelia.net>
*/
class GetRelais extends BaseLoop implements ArraySearchLoopInterface
{
/**
* @return array|mixed
* @throws \ErrorException
*/
public function buildArray()
{
// Find the address ... To find ! \m/
$zipcode = $this->getZipcode();
$city = $this->getCity();
$countryId = $this->getCountryid();
$addressId = $this->getAddress();
if (!empty($addressId) && (!empty($zipcode) || !empty($city))) {
throw new \InvalidArgumentException(
"Cannot have argument 'address' and 'zipcode' or 'city' at the same time."
);
}
if (null !== $addressModel = AddressQuery::create()->findPk($addressId)) {
$address = array(
"zipcode" => $addressModel->getZipcode(),
"city" => $addressModel->getCity(),
"address" => $addressModel->getAddress1(),
"countrycode"=> $addressModel->getCountry()->getIsoalpha2()
);
} elseif (empty($zipcode) || empty($city)) {
$search = AddressQuery::create();
$customer = $this->securityContext->getCustomerUser();
if ($customer !== null) {
$search->filterByCustomerId($customer->getId());
$search->filterByIsDefault("1");
} else {
throw new \ErrorException("Customer not connected.");
}
$search = $search->findOne();
$address["zipcode"] = $search->getZipcode();
$address["city"] = $search->getCity();
$address["address"] = $search->getAddress1();
$address["countrycode"] = $search->getCountry()->getIsoalpha2();
} else {
$address = array(
"zipcode" => $zipcode,
"city" => $city,
"address" => "",
"countrycode" => CountryQuery::create()
->findOneById($countryId)
->getIsoalpha2()
);
}
// Then ask the Web Service
$request = new FindByAddress();
$request
->setAddress($address["address"])
->setZipCode($address["zipcode"])
->setCity($address["city"])
->setCountryCode($address["countrycode"])
->setFilterRelay("1")
->setRequestId(md5(microtime()))
->setLang("FR")
->setOptionInter("1")
->setShippingDate(date("d/m/Y"))
->setAccountNumber(ConfigQuery::read('socolissimo_login'))
->setPassword(ConfigQuery::read('socolissimo_pwd'))
;
try {
$response = $request->exec();
} catch (InvalidArgumentException $e) {
$response = array();
} catch (\SoapFault $e) {
$response = array();
}
if (!is_array($response) && $response !== null) {
$newResponse[] = $response;
$response = $newResponse;
}
return $response;
}
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
foreach ($loopResult->getResultDataCollection() as $item) {
$loopResultRow = new LoopResultRow();
//Tlog::getInstance()->addDebug(print_r($item, true));
foreach ($item as $key => $value) {
$loopResultRow->set($key, $value);
}
// format distance
$distance = (string) $loopResultRow->get("distanceEnMetre");
if (strlen($distance) < 4) {
$distance .= " m";
} else {
$distance = (string) floatval($distance) / 1000;
while (substr($distance, strlen($distance) - 1, 1) == "0") {
$distance = substr($distance, 0, strlen($distance) - 1);
}
$distance = str_replace(".", ",", $distance) . " km";
}
$loopResultRow->set('distance', $distance);
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
/**
* @inheritdoc
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntTypeArgument("countryid", ""),
Argument::createAnyTypeArgument("zipcode", ""),
Argument::createAnyTypeArgument("city", ""),
Argument::createIntTypeArgument("address")
);
}
}

View File

@@ -0,0 +1,75 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace SoColissimo\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use SoColissimo\SoColissimo;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\OrderQuery;
use Thelia\Core\Template\Loop\Order;
use Thelia\Model\OrderStatus;
use Thelia\Model\OrderStatusQuery;
/**
* Class NotSentOrders
* @package SoColissimo\Loop
* @author Thelia <info@thelia.net>
*/
class NotSentOrders extends Order
{
public function getArgDefinitions()
{
return new ArgumentCollection(Argument::createBooleanTypeArgument('with_prev_next_info', false));
}
/**
* this method returns a Propel ModelCriteria
*
* @return \Propel\Runtime\ActiveQuery\ModelCriteria
*/
public function buildModelCriteria()
{
$status = OrderStatusQuery::create()
->filterByCode(
array(
OrderStatus::CODE_PAID,
OrderStatus::CODE_PROCESSING,
),
Criteria::IN
)
->find()
->toArray("code");
$query = OrderQuery::create()
->filterByDeliveryModuleId(SoColissimo::getModCode())
->filterByStatusId(
array(
$status[OrderStatus::CODE_PAID]['Id'],
$status[OrderStatus::CODE_PROCESSING]['Id']),
Criteria::IN
);
return $query;
}
}

View File

@@ -0,0 +1,78 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace SoColissimo\Loop;
use SoColissimo\Model\AddressSocolissimoQuery;
use Thelia\Core\Template\Loop\Address;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
/**
* Class SoColissimoDelivery
* @package SoColissimo\Loop
* @author Thelia <info@thelia.net>
*/
class SoColissimoAddress extends Address
{
protected $exists = false;
protected $timestampable = false;
protected function setExists($id)
{
$this->exists = AddressSocolissimoQuery::create()->findPK($id) !== null;
}
public function buildModelCriteria()
{
$id = $this->getId();
$this->setExists($id[0]);
return $this->exists ?
AddressSoColissimoQuery::create()->filterById($id[0]) :
parent::buildModelCriteria();
}
public function parseResults(LoopResult $loopResult)
{
if (!$this->exists) {
return parent::parseResults($loopResult);
} else {
/** @var \SoColissimo\Model\AddressSocolissimo $address */
foreach ($loopResult->getResultDataCollection() as $address) {
$loopResultRow = new LoopResultRow();
$loopResultRow->set("TITLE", $address->getTitleId())
->set("COMPANY", $address->getCompany())
->set("FIRSTNAME", $address->getFirstname())
->set("LASTNAME", $address->getLastname())
->set("ADDRESS1", $address->getAddress1())
->set("ADDRESS2", $address->getAddress2())
->set("ADDRESS3", $address->getAddress3())
->set("ZIPCODE", $address->getZipcode())
->set("CITY", $address->getCity())
->set("COUNTRY", $address->getCountryId())
->set("CELLPHONE", $address->getCellphone())
; $loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace SoColissimo\Loop;
use SoColissimo\Model\SocolissimoDeliveryModeQuery;
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 SoColissimoDeliveryMode extends BaseLoop implements PropelSearchLoopInterface
{
/**
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntTypeArgument('id')
);
}
public function buildModelCriteria()
{
$mode = $this->getId();
$modes = SocolissimoDeliveryModeQuery::create();
if (null !== $mode) {
$modes->filterById($mode);
}
return $modes;
}
public function parseResults(LoopResult $loopResult)
{
/** @var \SoColissimo\Model\SocolissimoDeliveryMode $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;
}
}

View File

@@ -0,0 +1,71 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace SoColissimo\Loop;
use SoColissimo\SoColissimo;
use Thelia\Core\Template\Element\ArraySearchLoopInterface;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
/**
* Class SoColissimoId
* @package SoColissimo\Loop
* @author Thelia <info@thelia.net>
*/
class SoColissimoId extends BaseLoop implements ArraySearchLoopInterface
{
/**
* this method returns an array
*
* @return array
*/
public function buildArray()
{
return array(SoColissimo::getModCode());
}
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
foreach ($loopResult->getResultDataCollection() as $id) {
$loopResultRow = new LoopResultRow();
$loopResult->addRow(
$loopResultRow->set('MODULE_ID', $id)
);
}
return $loopResult;
}
protected function getArgDefinitions()
{
return new ArgumentCollection();
}
}

View File

@@ -0,0 +1,91 @@
<?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 SoColissimo\Loop;
use SoColissimo\Model\OrderAddressSocolissimo;
use SoColissimo\Model\OrderAddressSocolissimoQuery;
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 SoColissimoOrderAddressLoop extends BaseLoop implements PropelSearchLoopInterface
{
/**
* Definition of loop arguments
*
* example :
*
* public function getArgDefinitions()
* {
* return new ArgumentCollection(
*
* Argument::createIntListTypeArgument('id'),
* new Argument(
* 'ref',
* new TypeCollection(
* new Type\AlphaNumStringListType()
* )
* ),
* Argument::createIntListTypeArgument('category'),
* Argument::createBooleanTypeArgument('new'),
* ...
* );
* }
*
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntTypeArgument('id', null, true)
);
}
/**
* this method returns a Propel ModelCriteria
*
* @return \Propel\Runtime\ActiveQuery\ModelCriteria
*/
public function buildModelCriteria()
{
$query = OrderAddressSocolissimoQuery::create();
if (!is_null($id = $this->getId())) {
$query->filterById(intval($id));
}
return $query;
}
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
/** @var OrderAddressSocolissimo $orderAddressSocolissimo */
foreach ($loopResult->getResultDataCollection() as $orderAddressSocolissimo) {
$row = new LoopResultRow();
$row->set('ID', $orderAddressSocolissimo->getId());
$row->set('CODE', $orderAddressSocolissimo->getCode());
$row->set('TYPE', $orderAddressSocolissimo->getType());
$loopResult->addRow($row);
}
return $loopResult;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace SoColissimo\Loop;
use SoColissimo\Model\SocolissimoPriceQuery;
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 SoColissimoPrice 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)
);
}
public function buildModelCriteria()
{
$areaId = $this->getAreaId();
$modeId = $this->getDeliveryModeId();
$areaPrices = SocolissimoPriceQuery::create()
->filterByDeliveryModeId($modeId)
->filterByAreaId($areaId)
->orderByWeightMax();
return $areaPrices;
}
public function parseResults(LoopResult $loopResult)
{
/** @var \SoColissimo\Model\SocolissimoPrice $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;
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace SoColissimo\Model;
use SoColissimo\Model\Base\AddressSocolissimo as BaseAddressSocolissimo;
class AddressSocolissimo extends BaseAddressSocolissimo
{
}

View File

@@ -0,0 +1,20 @@
<?php
namespace SoColissimo\Model;
use SoColissimo\Model\Base\AddressSocolissimoQuery as BaseAddressSocolissimoQuery;
/**
* Skeleton subclass for performing query and update operations on the 'address_socolissimo' 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 AddressSocolissimoQuery extends BaseAddressSocolissimoQuery
{
} // AddressSocolissimoQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,964 @@
<?php
namespace SoColissimo\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use SoColissimo\Model\AddressSocolissimo as ChildAddressSocolissimo;
use SoColissimo\Model\AddressSocolissimoQuery as ChildAddressSocolissimoQuery;
use SoColissimo\Model\Map\AddressSocolissimoTableMap;
use SoColissimo\Model\Thelia\Model\Country;
use SoColissimo\Model\Thelia\Model\CustomerTitle;
/**
* Base class that represents a query for the 'address_socolissimo' table.
*
*
*
* @method ChildAddressSocolissimoQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildAddressSocolissimoQuery orderByTitleId($order = Criteria::ASC) Order by the title_id column
* @method ChildAddressSocolissimoQuery orderByCompany($order = Criteria::ASC) Order by the company column
* @method ChildAddressSocolissimoQuery orderByFirstname($order = Criteria::ASC) Order by the firstname column
* @method ChildAddressSocolissimoQuery orderByLastname($order = Criteria::ASC) Order by the lastname column
* @method ChildAddressSocolissimoQuery orderByAddress1($order = Criteria::ASC) Order by the address1 column
* @method ChildAddressSocolissimoQuery orderByAddress2($order = Criteria::ASC) Order by the address2 column
* @method ChildAddressSocolissimoQuery orderByAddress3($order = Criteria::ASC) Order by the address3 column
* @method ChildAddressSocolissimoQuery orderByZipcode($order = Criteria::ASC) Order by the zipcode column
* @method ChildAddressSocolissimoQuery orderByCity($order = Criteria::ASC) Order by the city column
* @method ChildAddressSocolissimoQuery orderByCountryId($order = Criteria::ASC) Order by the country_id column
* @method ChildAddressSocolissimoQuery orderByCode($order = Criteria::ASC) Order by the code column
* @method ChildAddressSocolissimoQuery orderByType($order = Criteria::ASC) Order by the type column
* @method ChildAddressSocolissimoQuery orderByCellphone($order = Criteria::ASC) Order by the cellphone column
*
* @method ChildAddressSocolissimoQuery groupById() Group by the id column
* @method ChildAddressSocolissimoQuery groupByTitleId() Group by the title_id column
* @method ChildAddressSocolissimoQuery groupByCompany() Group by the company column
* @method ChildAddressSocolissimoQuery groupByFirstname() Group by the firstname column
* @method ChildAddressSocolissimoQuery groupByLastname() Group by the lastname column
* @method ChildAddressSocolissimoQuery groupByAddress1() Group by the address1 column
* @method ChildAddressSocolissimoQuery groupByAddress2() Group by the address2 column
* @method ChildAddressSocolissimoQuery groupByAddress3() Group by the address3 column
* @method ChildAddressSocolissimoQuery groupByZipcode() Group by the zipcode column
* @method ChildAddressSocolissimoQuery groupByCity() Group by the city column
* @method ChildAddressSocolissimoQuery groupByCountryId() Group by the country_id column
* @method ChildAddressSocolissimoQuery groupByCode() Group by the code column
* @method ChildAddressSocolissimoQuery groupByType() Group by the type column
* @method ChildAddressSocolissimoQuery groupByCellphone() Group by the cellphone column
*
* @method ChildAddressSocolissimoQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildAddressSocolissimoQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildAddressSocolissimoQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildAddressSocolissimoQuery leftJoinCustomerTitle($relationAlias = null) Adds a LEFT JOIN clause to the query using the CustomerTitle relation
* @method ChildAddressSocolissimoQuery rightJoinCustomerTitle($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CustomerTitle relation
* @method ChildAddressSocolissimoQuery innerJoinCustomerTitle($relationAlias = null) Adds a INNER JOIN clause to the query using the CustomerTitle relation
*
* @method ChildAddressSocolissimoQuery leftJoinCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the Country relation
* @method ChildAddressSocolissimoQuery rightJoinCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Country relation
* @method ChildAddressSocolissimoQuery innerJoinCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the Country relation
*
* @method ChildAddressSocolissimo findOne(ConnectionInterface $con = null) Return the first ChildAddressSocolissimo matching the query
* @method ChildAddressSocolissimo findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAddressSocolissimo matching the query, or a new ChildAddressSocolissimo object populated from the query conditions when no match is found
*
* @method ChildAddressSocolissimo findOneById(int $id) Return the first ChildAddressSocolissimo filtered by the id column
* @method ChildAddressSocolissimo findOneByTitleId(int $title_id) Return the first ChildAddressSocolissimo filtered by the title_id column
* @method ChildAddressSocolissimo findOneByCompany(string $company) Return the first ChildAddressSocolissimo filtered by the company column
* @method ChildAddressSocolissimo findOneByFirstname(string $firstname) Return the first ChildAddressSocolissimo filtered by the firstname column
* @method ChildAddressSocolissimo findOneByLastname(string $lastname) Return the first ChildAddressSocolissimo filtered by the lastname column
* @method ChildAddressSocolissimo findOneByAddress1(string $address1) Return the first ChildAddressSocolissimo filtered by the address1 column
* @method ChildAddressSocolissimo findOneByAddress2(string $address2) Return the first ChildAddressSocolissimo filtered by the address2 column
* @method ChildAddressSocolissimo findOneByAddress3(string $address3) Return the first ChildAddressSocolissimo filtered by the address3 column
* @method ChildAddressSocolissimo findOneByZipcode(string $zipcode) Return the first ChildAddressSocolissimo filtered by the zipcode column
* @method ChildAddressSocolissimo findOneByCity(string $city) Return the first ChildAddressSocolissimo filtered by the city column
* @method ChildAddressSocolissimo findOneByCountryId(int $country_id) Return the first ChildAddressSocolissimo filtered by the country_id column
* @method ChildAddressSocolissimo findOneByCode(string $code) Return the first ChildAddressSocolissimo filtered by the code column
* @method ChildAddressSocolissimo findOneByType(string $type) Return the first ChildAddressSocolissimo filtered by the type column
* @method ChildAddressSocolissimo findOneByCellphone(string $cellphone) Return the first ChildAddressSocolissimo filtered by the cellphone column
*
* @method array findById(int $id) Return ChildAddressSocolissimo objects filtered by the id column
* @method array findByTitleId(int $title_id) Return ChildAddressSocolissimo objects filtered by the title_id column
* @method array findByCompany(string $company) Return ChildAddressSocolissimo objects filtered by the company column
* @method array findByFirstname(string $firstname) Return ChildAddressSocolissimo objects filtered by the firstname column
* @method array findByLastname(string $lastname) Return ChildAddressSocolissimo objects filtered by the lastname column
* @method array findByAddress1(string $address1) Return ChildAddressSocolissimo objects filtered by the address1 column
* @method array findByAddress2(string $address2) Return ChildAddressSocolissimo objects filtered by the address2 column
* @method array findByAddress3(string $address3) Return ChildAddressSocolissimo objects filtered by the address3 column
* @method array findByZipcode(string $zipcode) Return ChildAddressSocolissimo objects filtered by the zipcode column
* @method array findByCity(string $city) Return ChildAddressSocolissimo objects filtered by the city column
* @method array findByCountryId(int $country_id) Return ChildAddressSocolissimo objects filtered by the country_id column
* @method array findByCode(string $code) Return ChildAddressSocolissimo objects filtered by the code column
* @method array findByType(string $type) Return ChildAddressSocolissimo objects filtered by the type column
* @method array findByCellphone(string $cellphone) Return ChildAddressSocolissimo objects filtered by the cellphone column
*
*/
abstract class AddressSocolissimoQuery extends ModelCriteria
{
/**
* Initializes internal state of \SoColissimo\Model\Base\AddressSocolissimoQuery 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 = '\\SoColissimo\\Model\\AddressSocolissimo', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildAddressSocolissimoQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildAddressSocolissimoQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \SoColissimo\Model\AddressSocolissimoQuery) {
return $criteria;
}
$query = new \SoColissimo\Model\AddressSocolissimoQuery();
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 ChildAddressSocolissimo|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = AddressSocolissimoTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(AddressSocolissimoTableMap::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 ChildAddressSocolissimo A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, CODE, TYPE, CELLPHONE FROM address_socolissimo 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 ChildAddressSocolissimo();
$obj->hydrate($row);
AddressSocolissimoTableMap::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 ChildAddressSocolissimo|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 ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(AddressSocolissimoTableMap::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 ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(AddressSocolissimoTableMap::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 ChildAddressSocolissimoQuery 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(AddressSocolissimoTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(AddressSocolissimoTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AddressSocolissimoTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the title_id column
*
* Example usage:
* <code>
* $query->filterByTitleId(1234); // WHERE title_id = 1234
* $query->filterByTitleId(array(12, 34)); // WHERE title_id IN (12, 34)
* $query->filterByTitleId(array('min' => 12)); // WHERE title_id > 12
* </code>
*
* @see filterByCustomerTitle()
*
* @param mixed $titleId 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 ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByTitleId($titleId = null, $comparison = null)
{
if (is_array($titleId)) {
$useMinMax = false;
if (isset($titleId['min'])) {
$this->addUsingAlias(AddressSocolissimoTableMap::TITLE_ID, $titleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($titleId['max'])) {
$this->addUsingAlias(AddressSocolissimoTableMap::TITLE_ID, $titleId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AddressSocolissimoTableMap::TITLE_ID, $titleId, $comparison);
}
/**
* Filter the query on the company column
*
* Example usage:
* <code>
* $query->filterByCompany('fooValue'); // WHERE company = 'fooValue'
* $query->filterByCompany('%fooValue%'); // WHERE company LIKE '%fooValue%'
* </code>
*
* @param string $company 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 ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByCompany($company = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($company)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $company)) {
$company = str_replace('*', '%', $company);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressSocolissimoTableMap::COMPANY, $company, $comparison);
}
/**
* Filter the query on the firstname column
*
* Example usage:
* <code>
* $query->filterByFirstname('fooValue'); // WHERE firstname = 'fooValue'
* $query->filterByFirstname('%fooValue%'); // WHERE firstname LIKE '%fooValue%'
* </code>
*
* @param string $firstname 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 ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByFirstname($firstname = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($firstname)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $firstname)) {
$firstname = str_replace('*', '%', $firstname);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressSocolissimoTableMap::FIRSTNAME, $firstname, $comparison);
}
/**
* Filter the query on the lastname column
*
* Example usage:
* <code>
* $query->filterByLastname('fooValue'); // WHERE lastname = 'fooValue'
* $query->filterByLastname('%fooValue%'); // WHERE lastname LIKE '%fooValue%'
* </code>
*
* @param string $lastname 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 ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByLastname($lastname = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($lastname)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $lastname)) {
$lastname = str_replace('*', '%', $lastname);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressSocolissimoTableMap::LASTNAME, $lastname, $comparison);
}
/**
* Filter the query on the address1 column
*
* Example usage:
* <code>
* $query->filterByAddress1('fooValue'); // WHERE address1 = 'fooValue'
* $query->filterByAddress1('%fooValue%'); // WHERE address1 LIKE '%fooValue%'
* </code>
*
* @param string $address1 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 ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByAddress1($address1 = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($address1)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $address1)) {
$address1 = str_replace('*', '%', $address1);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressSocolissimoTableMap::ADDRESS1, $address1, $comparison);
}
/**
* Filter the query on the address2 column
*
* Example usage:
* <code>
* $query->filterByAddress2('fooValue'); // WHERE address2 = 'fooValue'
* $query->filterByAddress2('%fooValue%'); // WHERE address2 LIKE '%fooValue%'
* </code>
*
* @param string $address2 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 ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByAddress2($address2 = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($address2)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $address2)) {
$address2 = str_replace('*', '%', $address2);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressSocolissimoTableMap::ADDRESS2, $address2, $comparison);
}
/**
* Filter the query on the address3 column
*
* Example usage:
* <code>
* $query->filterByAddress3('fooValue'); // WHERE address3 = 'fooValue'
* $query->filterByAddress3('%fooValue%'); // WHERE address3 LIKE '%fooValue%'
* </code>
*
* @param string $address3 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 ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByAddress3($address3 = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($address3)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $address3)) {
$address3 = str_replace('*', '%', $address3);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressSocolissimoTableMap::ADDRESS3, $address3, $comparison);
}
/**
* Filter the query on the zipcode column
*
* Example usage:
* <code>
* $query->filterByZipcode('fooValue'); // WHERE zipcode = 'fooValue'
* $query->filterByZipcode('%fooValue%'); // WHERE zipcode LIKE '%fooValue%'
* </code>
*
* @param string $zipcode 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 ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByZipcode($zipcode = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($zipcode)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $zipcode)) {
$zipcode = str_replace('*', '%', $zipcode);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressSocolissimoTableMap::ZIPCODE, $zipcode, $comparison);
}
/**
* Filter the query on the city column
*
* Example usage:
* <code>
* $query->filterByCity('fooValue'); // WHERE city = 'fooValue'
* $query->filterByCity('%fooValue%'); // WHERE city LIKE '%fooValue%'
* </code>
*
* @param string $city 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 ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByCity($city = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($city)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $city)) {
$city = str_replace('*', '%', $city);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressSocolissimoTableMap::CITY, $city, $comparison);
}
/**
* Filter the query on the country_id column
*
* Example usage:
* <code>
* $query->filterByCountryId(1234); // WHERE country_id = 1234
* $query->filterByCountryId(array(12, 34)); // WHERE country_id IN (12, 34)
* $query->filterByCountryId(array('min' => 12)); // WHERE country_id > 12
* </code>
*
* @see filterByCountry()
*
* @param mixed $countryId 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 ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByCountryId($countryId = null, $comparison = null)
{
if (is_array($countryId)) {
$useMinMax = false;
if (isset($countryId['min'])) {
$this->addUsingAlias(AddressSocolissimoTableMap::COUNTRY_ID, $countryId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($countryId['max'])) {
$this->addUsingAlias(AddressSocolissimoTableMap::COUNTRY_ID, $countryId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AddressSocolissimoTableMap::COUNTRY_ID, $countryId, $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 ChildAddressSocolissimoQuery 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(AddressSocolissimoTableMap::CODE, $code, $comparison);
}
/**
* Filter the query on the type column
*
* Example usage:
* <code>
* $query->filterByType('fooValue'); // WHERE type = 'fooValue'
* $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%'
* </code>
*
* @param string $type 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 ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByType($type = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($type)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $type)) {
$type = str_replace('*', '%', $type);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressSocolissimoTableMap::TYPE, $type, $comparison);
}
/**
* Filter the query on the cellphone column
*
* Example usage:
* <code>
* $query->filterByCellphone('fooValue'); // WHERE cellphone = 'fooValue'
* $query->filterByCellphone('%fooValue%'); // WHERE cellphone LIKE '%fooValue%'
* </code>
*
* @param string $cellphone 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 ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByCellphone($cellphone = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($cellphone)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $cellphone)) {
$cellphone = str_replace('*', '%', $cellphone);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressSocolissimoTableMap::CELLPHONE, $cellphone, $comparison);
}
/**
* Filter the query by a related \SoColissimo\Model\Thelia\Model\CustomerTitle object
*
* @param \SoColissimo\Model\Thelia\Model\CustomerTitle|ObjectCollection $customerTitle The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByCustomerTitle($customerTitle, $comparison = null)
{
if ($customerTitle instanceof \SoColissimo\Model\Thelia\Model\CustomerTitle) {
return $this
->addUsingAlias(AddressSocolissimoTableMap::TITLE_ID, $customerTitle->getId(), $comparison);
} elseif ($customerTitle instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AddressSocolissimoTableMap::TITLE_ID, $customerTitle->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCustomerTitle() only accepts arguments of type \SoColissimo\Model\Thelia\Model\CustomerTitle or Collection');
}
}
/**
* Adds a JOIN clause to the query using the CustomerTitle relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function joinCustomerTitle($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CustomerTitle');
// 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, 'CustomerTitle');
}
return $this;
}
/**
* Use the CustomerTitle relation CustomerTitle 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 \SoColissimo\Model\Thelia\Model\CustomerTitleQuery A secondary query class using the current class as primary query
*/
public function useCustomerTitleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCustomerTitle($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CustomerTitle', '\SoColissimo\Model\Thelia\Model\CustomerTitleQuery');
}
/**
* Filter the query by a related \SoColissimo\Model\Thelia\Model\Country object
*
* @param \SoColissimo\Model\Thelia\Model\Country|ObjectCollection $country The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByCountry($country, $comparison = null)
{
if ($country instanceof \SoColissimo\Model\Thelia\Model\Country) {
return $this
->addUsingAlias(AddressSocolissimoTableMap::COUNTRY_ID, $country->getId(), $comparison);
} elseif ($country instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AddressSocolissimoTableMap::COUNTRY_ID, $country->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCountry() only accepts arguments of type \SoColissimo\Model\Thelia\Model\Country or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Country relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function joinCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Country');
// 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, 'Country');
}
return $this;
}
/**
* Use the Country relation Country 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 \SoColissimo\Model\Thelia\Model\CountryQuery A secondary query class using the current class as primary query
*/
public function useCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCountry($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Country', '\SoColissimo\Model\Thelia\Model\CountryQuery');
}
/**
* Exclude object from result
*
* @param ChildAddressSocolissimo $addressSocolissimo Object to remove from the list of results
*
* @return ChildAddressSocolissimoQuery The current query, for fluid interface
*/
public function prune($addressSocolissimo = null)
{
if ($addressSocolissimo) {
$this->addUsingAlias(AddressSocolissimoTableMap::ID, $addressSocolissimo->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the address_socolissimo 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(AddressSocolissimoTableMap::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).
AddressSocolissimoTableMap::clearInstancePool();
AddressSocolissimoTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildAddressSocolissimo or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildAddressSocolissimo 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(AddressSocolissimoTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(AddressSocolissimoTableMap::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();
AddressSocolissimoTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
AddressSocolissimoTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // AddressSocolissimoQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,495 @@
<?php
namespace SoColissimo\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use SoColissimo\Model\OrderAddressSocolissimo as ChildOrderAddressSocolissimo;
use SoColissimo\Model\OrderAddressSocolissimoQuery as ChildOrderAddressSocolissimoQuery;
use SoColissimo\Model\Map\OrderAddressSocolissimoTableMap;
use SoColissimo\Model\Thelia\Model\OrderAddress;
/**
* Base class that represents a query for the 'order_address_socolissimo' table.
*
*
*
* @method ChildOrderAddressSocolissimoQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildOrderAddressSocolissimoQuery orderByCode($order = Criteria::ASC) Order by the code column
* @method ChildOrderAddressSocolissimoQuery orderByType($order = Criteria::ASC) Order by the type column
*
* @method ChildOrderAddressSocolissimoQuery groupById() Group by the id column
* @method ChildOrderAddressSocolissimoQuery groupByCode() Group by the code column
* @method ChildOrderAddressSocolissimoQuery groupByType() Group by the type column
*
* @method ChildOrderAddressSocolissimoQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildOrderAddressSocolissimoQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildOrderAddressSocolissimoQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildOrderAddressSocolissimoQuery leftJoinOrderAddress($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderAddress relation
* @method ChildOrderAddressSocolissimoQuery rightJoinOrderAddress($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderAddress relation
* @method ChildOrderAddressSocolissimoQuery innerJoinOrderAddress($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderAddress relation
*
* @method ChildOrderAddressSocolissimo findOne(ConnectionInterface $con = null) Return the first ChildOrderAddressSocolissimo matching the query
* @method ChildOrderAddressSocolissimo findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderAddressSocolissimo matching the query, or a new ChildOrderAddressSocolissimo object populated from the query conditions when no match is found
*
* @method ChildOrderAddressSocolissimo findOneById(int $id) Return the first ChildOrderAddressSocolissimo filtered by the id column
* @method ChildOrderAddressSocolissimo findOneByCode(string $code) Return the first ChildOrderAddressSocolissimo filtered by the code column
* @method ChildOrderAddressSocolissimo findOneByType(string $type) Return the first ChildOrderAddressSocolissimo filtered by the type column
*
* @method array findById(int $id) Return ChildOrderAddressSocolissimo objects filtered by the id column
* @method array findByCode(string $code) Return ChildOrderAddressSocolissimo objects filtered by the code column
* @method array findByType(string $type) Return ChildOrderAddressSocolissimo objects filtered by the type column
*
*/
abstract class OrderAddressSocolissimoQuery extends ModelCriteria
{
/**
* Initializes internal state of \SoColissimo\Model\Base\OrderAddressSocolissimoQuery 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 = '\\SoColissimo\\Model\\OrderAddressSocolissimo', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildOrderAddressSocolissimoQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildOrderAddressSocolissimoQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \SoColissimo\Model\OrderAddressSocolissimoQuery) {
return $criteria;
}
$query = new \SoColissimo\Model\OrderAddressSocolissimoQuery();
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 ChildOrderAddressSocolissimo|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = OrderAddressSocolissimoTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(OrderAddressSocolissimoTableMap::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 ChildOrderAddressSocolissimo A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, CODE, TYPE FROM order_address_socolissimo 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 ChildOrderAddressSocolissimo();
$obj->hydrate($row);
OrderAddressSocolissimoTableMap::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 ChildOrderAddressSocolissimo|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 ChildOrderAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(OrderAddressSocolissimoTableMap::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 ChildOrderAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(OrderAddressSocolissimoTableMap::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>
*
* @see filterByOrderAddress()
*
* @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 ChildOrderAddressSocolissimoQuery 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(OrderAddressSocolissimoTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(OrderAddressSocolissimoTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderAddressSocolissimoTableMap::ID, $id, $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 ChildOrderAddressSocolissimoQuery 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(OrderAddressSocolissimoTableMap::CODE, $code, $comparison);
}
/**
* Filter the query on the type column
*
* Example usage:
* <code>
* $query->filterByType('fooValue'); // WHERE type = 'fooValue'
* $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%'
* </code>
*
* @param string $type 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 ChildOrderAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByType($type = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($type)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $type)) {
$type = str_replace('*', '%', $type);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(OrderAddressSocolissimoTableMap::TYPE, $type, $comparison);
}
/**
* Filter the query by a related \SoColissimo\Model\Thelia\Model\OrderAddress object
*
* @param \SoColissimo\Model\Thelia\Model\OrderAddress|ObjectCollection $orderAddress The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderAddressSocolissimoQuery The current query, for fluid interface
*/
public function filterByOrderAddress($orderAddress, $comparison = null)
{
if ($orderAddress instanceof \SoColissimo\Model\Thelia\Model\OrderAddress) {
return $this
->addUsingAlias(OrderAddressSocolissimoTableMap::ID, $orderAddress->getId(), $comparison);
} elseif ($orderAddress instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(OrderAddressSocolissimoTableMap::ID, $orderAddress->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByOrderAddress() only accepts arguments of type \SoColissimo\Model\Thelia\Model\OrderAddress or Collection');
}
}
/**
* Adds a JOIN clause to the query using the OrderAddress relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildOrderAddressSocolissimoQuery The current query, for fluid interface
*/
public function joinOrderAddress($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('OrderAddress');
// 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, 'OrderAddress');
}
return $this;
}
/**
* Use the OrderAddress relation OrderAddress 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 \SoColissimo\Model\Thelia\Model\OrderAddressQuery A secondary query class using the current class as primary query
*/
public function useOrderAddressQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinOrderAddress($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderAddress', '\SoColissimo\Model\Thelia\Model\OrderAddressQuery');
}
/**
* Exclude object from result
*
* @param ChildOrderAddressSocolissimo $orderAddressSocolissimo Object to remove from the list of results
*
* @return ChildOrderAddressSocolissimoQuery The current query, for fluid interface
*/
public function prune($orderAddressSocolissimo = null)
{
if ($orderAddressSocolissimo) {
$this->addUsingAlias(OrderAddressSocolissimoTableMap::ID, $orderAddressSocolissimo->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the order_address_socolissimo 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(OrderAddressSocolissimoTableMap::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).
OrderAddressSocolissimoTableMap::clearInstancePool();
OrderAddressSocolissimoTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildOrderAddressSocolissimo or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildOrderAddressSocolissimo 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(OrderAddressSocolissimoTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(OrderAddressSocolissimoTableMap::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();
OrderAddressSocolissimoTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
OrderAddressSocolissimoTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // OrderAddressSocolissimoQuery

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,645 @@
<?php
namespace SoColissimo\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use SoColissimo\Model\SocolissimoAreaFreeshippingDom as ChildSocolissimoAreaFreeshippingDom;
use SoColissimo\Model\SocolissimoAreaFreeshippingDomQuery as ChildSocolissimoAreaFreeshippingDomQuery;
use SoColissimo\Model\Map\SocolissimoAreaFreeshippingDomTableMap;
use SoColissimo\Model\Thelia\Model\Area;
/**
* Base class that represents a query for the 'socolissimo_area_freeshipping_dom' table.
*
*
*
* @method ChildSocolissimoAreaFreeshippingDomQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildSocolissimoAreaFreeshippingDomQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
* @method ChildSocolissimoAreaFreeshippingDomQuery orderByDeliveryModeId($order = Criteria::ASC) Order by the delivery_mode_id column
* @method ChildSocolissimoAreaFreeshippingDomQuery orderByCartAmount($order = Criteria::ASC) Order by the cart_amount column
*
* @method ChildSocolissimoAreaFreeshippingDomQuery groupById() Group by the id column
* @method ChildSocolissimoAreaFreeshippingDomQuery groupByAreaId() Group by the area_id column
* @method ChildSocolissimoAreaFreeshippingDomQuery groupByDeliveryModeId() Group by the delivery_mode_id column
* @method ChildSocolissimoAreaFreeshippingDomQuery groupByCartAmount() Group by the cart_amount column
*
* @method ChildSocolissimoAreaFreeshippingDomQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildSocolissimoAreaFreeshippingDomQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildSocolissimoAreaFreeshippingDomQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildSocolissimoAreaFreeshippingDomQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
* @method ChildSocolissimoAreaFreeshippingDomQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
* @method ChildSocolissimoAreaFreeshippingDomQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
*
* @method ChildSocolissimoAreaFreeshippingDomQuery leftJoinSocolissimoDeliveryMode($relationAlias = null) Adds a LEFT JOIN clause to the query using the SocolissimoDeliveryMode relation
* @method ChildSocolissimoAreaFreeshippingDomQuery rightJoinSocolissimoDeliveryMode($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SocolissimoDeliveryMode relation
* @method ChildSocolissimoAreaFreeshippingDomQuery innerJoinSocolissimoDeliveryMode($relationAlias = null) Adds a INNER JOIN clause to the query using the SocolissimoDeliveryMode relation
*
* @method ChildSocolissimoAreaFreeshippingDom findOne(ConnectionInterface $con = null) Return the first ChildSocolissimoAreaFreeshippingDom matching the query
* @method ChildSocolissimoAreaFreeshippingDom findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSocolissimoAreaFreeshippingDom matching the query, or a new ChildSocolissimoAreaFreeshippingDom object populated from the query conditions when no match is found
*
* @method ChildSocolissimoAreaFreeshippingDom findOneById(int $id) Return the first ChildSocolissimoAreaFreeshippingDom filtered by the id column
* @method ChildSocolissimoAreaFreeshippingDom findOneByAreaId(int $area_id) Return the first ChildSocolissimoAreaFreeshippingDom filtered by the area_id column
* @method ChildSocolissimoAreaFreeshippingDom findOneByDeliveryModeId(int $delivery_mode_id) Return the first ChildSocolissimoAreaFreeshippingDom filtered by the delivery_mode_id column
* @method ChildSocolissimoAreaFreeshippingDom findOneByCartAmount(string $cart_amount) Return the first ChildSocolissimoAreaFreeshippingDom filtered by the cart_amount column
*
* @method array findById(int $id) Return ChildSocolissimoAreaFreeshippingDom objects filtered by the id column
* @method array findByAreaId(int $area_id) Return ChildSocolissimoAreaFreeshippingDom objects filtered by the area_id column
* @method array findByDeliveryModeId(int $delivery_mode_id) Return ChildSocolissimoAreaFreeshippingDom objects filtered by the delivery_mode_id column
* @method array findByCartAmount(string $cart_amount) Return ChildSocolissimoAreaFreeshippingDom objects filtered by the cart_amount column
*
*/
abstract class SocolissimoAreaFreeshippingDomQuery extends ModelCriteria
{
/**
* Initializes internal state of \SoColissimo\Model\Base\SocolissimoAreaFreeshippingDomQuery 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 = '\\SoColissimo\\Model\\SocolissimoAreaFreeshippingDom', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildSocolissimoAreaFreeshippingDomQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildSocolissimoAreaFreeshippingDomQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \SoColissimo\Model\SocolissimoAreaFreeshippingDomQuery) {
return $criteria;
}
$query = new \SoColissimo\Model\SocolissimoAreaFreeshippingDomQuery();
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 ChildSocolissimoAreaFreeshippingDom|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = SocolissimoAreaFreeshippingDomTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(SocolissimoAreaFreeshippingDomTableMap::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 ChildSocolissimoAreaFreeshippingDom 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 socolissimo_area_freeshipping_dom 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 ChildSocolissimoAreaFreeshippingDom();
$obj->hydrate($row);
SocolissimoAreaFreeshippingDomTableMap::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 ChildSocolissimoAreaFreeshippingDom|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 ChildSocolissimoAreaFreeshippingDomQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(SocolissimoAreaFreeshippingDomTableMap::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 ChildSocolissimoAreaFreeshippingDomQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(SocolissimoAreaFreeshippingDomTableMap::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 ChildSocolissimoAreaFreeshippingDomQuery 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(SocolissimoAreaFreeshippingDomTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(SocolissimoAreaFreeshippingDomTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoAreaFreeshippingDomTableMap::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 ChildSocolissimoAreaFreeshippingDomQuery 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(SocolissimoAreaFreeshippingDomTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($areaId['max'])) {
$this->addUsingAlias(SocolissimoAreaFreeshippingDomTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoAreaFreeshippingDomTableMap::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 filterBySocolissimoDeliveryMode()
*
* @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 ChildSocolissimoAreaFreeshippingDomQuery 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(SocolissimoAreaFreeshippingDomTableMap::DELIVERY_MODE_ID, $deliveryModeId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($deliveryModeId['max'])) {
$this->addUsingAlias(SocolissimoAreaFreeshippingDomTableMap::DELIVERY_MODE_ID, $deliveryModeId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoAreaFreeshippingDomTableMap::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 ChildSocolissimoAreaFreeshippingDomQuery 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(SocolissimoAreaFreeshippingDomTableMap::CART_AMOUNT, $cartAmount['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($cartAmount['max'])) {
$this->addUsingAlias(SocolissimoAreaFreeshippingDomTableMap::CART_AMOUNT, $cartAmount['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoAreaFreeshippingDomTableMap::CART_AMOUNT, $cartAmount, $comparison);
}
/**
* Filter the query by a related \SoColissimo\Model\Thelia\Model\Area object
*
* @param \SoColissimo\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 ChildSocolissimoAreaFreeshippingDomQuery The current query, for fluid interface
*/
public function filterByArea($area, $comparison = null)
{
if ($area instanceof \SoColissimo\Model\Thelia\Model\Area) {
return $this
->addUsingAlias(SocolissimoAreaFreeshippingDomTableMap::AREA_ID, $area->getId(), $comparison);
} elseif ($area instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SocolissimoAreaFreeshippingDomTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByArea() only accepts arguments of type \SoColissimo\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 ChildSocolissimoAreaFreeshippingDomQuery 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 \SoColissimo\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', '\SoColissimo\Model\Thelia\Model\AreaQuery');
}
/**
* Filter the query by a related \SoColissimo\Model\SocolissimoDeliveryMode object
*
* @param \SoColissimo\Model\SocolissimoDeliveryMode|ObjectCollection $socolissimoDeliveryMode The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSocolissimoAreaFreeshippingDomQuery The current query, for fluid interface
*/
public function filterBySocolissimoDeliveryMode($socolissimoDeliveryMode, $comparison = null)
{
if ($socolissimoDeliveryMode instanceof \SoColissimo\Model\SocolissimoDeliveryMode) {
return $this
->addUsingAlias(SocolissimoAreaFreeshippingDomTableMap::DELIVERY_MODE_ID, $socolissimoDeliveryMode->getId(), $comparison);
} elseif ($socolissimoDeliveryMode instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SocolissimoAreaFreeshippingDomTableMap::DELIVERY_MODE_ID, $socolissimoDeliveryMode->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterBySocolissimoDeliveryMode() only accepts arguments of type \SoColissimo\Model\SocolissimoDeliveryMode or Collection');
}
}
/**
* Adds a JOIN clause to the query using the SocolissimoDeliveryMode relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSocolissimoAreaFreeshippingDomQuery The current query, for fluid interface
*/
public function joinSocolissimoDeliveryMode($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('SocolissimoDeliveryMode');
// 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, 'SocolissimoDeliveryMode');
}
return $this;
}
/**
* Use the SocolissimoDeliveryMode relation SocolissimoDeliveryMode 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 \SoColissimo\Model\SocolissimoDeliveryModeQuery A secondary query class using the current class as primary query
*/
public function useSocolissimoDeliveryModeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinSocolissimoDeliveryMode($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SocolissimoDeliveryMode', '\SoColissimo\Model\SocolissimoDeliveryModeQuery');
}
/**
* Exclude object from result
*
* @param ChildSocolissimoAreaFreeshippingDom $socolissimoAreaFreeshippingDom Object to remove from the list of results
*
* @return ChildSocolissimoAreaFreeshippingDomQuery The current query, for fluid interface
*/
public function prune($socolissimoAreaFreeshippingDom = null)
{
if ($socolissimoAreaFreeshippingDom) {
$this->addUsingAlias(SocolissimoAreaFreeshippingDomTableMap::ID, $socolissimoAreaFreeshippingDom->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the socolissimo_area_freeshipping_dom 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(SocolissimoAreaFreeshippingDomTableMap::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).
SocolissimoAreaFreeshippingDomTableMap::clearInstancePool();
SocolissimoAreaFreeshippingDomTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildSocolissimoAreaFreeshippingDom or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildSocolissimoAreaFreeshippingDom 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(SocolissimoAreaFreeshippingDomTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(SocolissimoAreaFreeshippingDomTableMap::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();
SocolissimoAreaFreeshippingDomTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
SocolissimoAreaFreeshippingDomTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // SocolissimoAreaFreeshippingDomQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,645 @@
<?php
namespace SoColissimo\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use SoColissimo\Model\SocolissimoAreaFreeshippingPr as ChildSocolissimoAreaFreeshippingPr;
use SoColissimo\Model\SocolissimoAreaFreeshippingPrQuery as ChildSocolissimoAreaFreeshippingPrQuery;
use SoColissimo\Model\Map\SocolissimoAreaFreeshippingPrTableMap;
use SoColissimo\Model\Thelia\Model\Area;
/**
* Base class that represents a query for the 'socolissimo_area_freeshipping_pr' table.
*
*
*
* @method ChildSocolissimoAreaFreeshippingPrQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildSocolissimoAreaFreeshippingPrQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
* @method ChildSocolissimoAreaFreeshippingPrQuery orderByDeliveryModeId($order = Criteria::ASC) Order by the delivery_mode_id column
* @method ChildSocolissimoAreaFreeshippingPrQuery orderByCartAmount($order = Criteria::ASC) Order by the cart_amount column
*
* @method ChildSocolissimoAreaFreeshippingPrQuery groupById() Group by the id column
* @method ChildSocolissimoAreaFreeshippingPrQuery groupByAreaId() Group by the area_id column
* @method ChildSocolissimoAreaFreeshippingPrQuery groupByDeliveryModeId() Group by the delivery_mode_id column
* @method ChildSocolissimoAreaFreeshippingPrQuery groupByCartAmount() Group by the cart_amount column
*
* @method ChildSocolissimoAreaFreeshippingPrQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildSocolissimoAreaFreeshippingPrQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildSocolissimoAreaFreeshippingPrQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildSocolissimoAreaFreeshippingPrQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
* @method ChildSocolissimoAreaFreeshippingPrQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
* @method ChildSocolissimoAreaFreeshippingPrQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
*
* @method ChildSocolissimoAreaFreeshippingPrQuery leftJoinSocolissimoDeliveryMode($relationAlias = null) Adds a LEFT JOIN clause to the query using the SocolissimoDeliveryMode relation
* @method ChildSocolissimoAreaFreeshippingPrQuery rightJoinSocolissimoDeliveryMode($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SocolissimoDeliveryMode relation
* @method ChildSocolissimoAreaFreeshippingPrQuery innerJoinSocolissimoDeliveryMode($relationAlias = null) Adds a INNER JOIN clause to the query using the SocolissimoDeliveryMode relation
*
* @method ChildSocolissimoAreaFreeshippingPr findOne(ConnectionInterface $con = null) Return the first ChildSocolissimoAreaFreeshippingPr matching the query
* @method ChildSocolissimoAreaFreeshippingPr findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSocolissimoAreaFreeshippingPr matching the query, or a new ChildSocolissimoAreaFreeshippingPr object populated from the query conditions when no match is found
*
* @method ChildSocolissimoAreaFreeshippingPr findOneById(int $id) Return the first ChildSocolissimoAreaFreeshippingPr filtered by the id column
* @method ChildSocolissimoAreaFreeshippingPr findOneByAreaId(int $area_id) Return the first ChildSocolissimoAreaFreeshippingPr filtered by the area_id column
* @method ChildSocolissimoAreaFreeshippingPr findOneByDeliveryModeId(int $delivery_mode_id) Return the first ChildSocolissimoAreaFreeshippingPr filtered by the delivery_mode_id column
* @method ChildSocolissimoAreaFreeshippingPr findOneByCartAmount(string $cart_amount) Return the first ChildSocolissimoAreaFreeshippingPr filtered by the cart_amount column
*
* @method array findById(int $id) Return ChildSocolissimoAreaFreeshippingPr objects filtered by the id column
* @method array findByAreaId(int $area_id) Return ChildSocolissimoAreaFreeshippingPr objects filtered by the area_id column
* @method array findByDeliveryModeId(int $delivery_mode_id) Return ChildSocolissimoAreaFreeshippingPr objects filtered by the delivery_mode_id column
* @method array findByCartAmount(string $cart_amount) Return ChildSocolissimoAreaFreeshippingPr objects filtered by the cart_amount column
*
*/
abstract class SocolissimoAreaFreeshippingPrQuery extends ModelCriteria
{
/**
* Initializes internal state of \SoColissimo\Model\Base\SocolissimoAreaFreeshippingPrQuery 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 = '\\SoColissimo\\Model\\SocolissimoAreaFreeshippingPr', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildSocolissimoAreaFreeshippingPrQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildSocolissimoAreaFreeshippingPrQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \SoColissimo\Model\SocolissimoAreaFreeshippingPrQuery) {
return $criteria;
}
$query = new \SoColissimo\Model\SocolissimoAreaFreeshippingPrQuery();
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 ChildSocolissimoAreaFreeshippingPr|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = SocolissimoAreaFreeshippingPrTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(SocolissimoAreaFreeshippingPrTableMap::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 ChildSocolissimoAreaFreeshippingPr 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 socolissimo_area_freeshipping_pr 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 ChildSocolissimoAreaFreeshippingPr();
$obj->hydrate($row);
SocolissimoAreaFreeshippingPrTableMap::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 ChildSocolissimoAreaFreeshippingPr|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 ChildSocolissimoAreaFreeshippingPrQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(SocolissimoAreaFreeshippingPrTableMap::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 ChildSocolissimoAreaFreeshippingPrQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(SocolissimoAreaFreeshippingPrTableMap::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 ChildSocolissimoAreaFreeshippingPrQuery 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(SocolissimoAreaFreeshippingPrTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(SocolissimoAreaFreeshippingPrTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoAreaFreeshippingPrTableMap::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 ChildSocolissimoAreaFreeshippingPrQuery 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(SocolissimoAreaFreeshippingPrTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($areaId['max'])) {
$this->addUsingAlias(SocolissimoAreaFreeshippingPrTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoAreaFreeshippingPrTableMap::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 filterBySocolissimoDeliveryMode()
*
* @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 ChildSocolissimoAreaFreeshippingPrQuery 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(SocolissimoAreaFreeshippingPrTableMap::DELIVERY_MODE_ID, $deliveryModeId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($deliveryModeId['max'])) {
$this->addUsingAlias(SocolissimoAreaFreeshippingPrTableMap::DELIVERY_MODE_ID, $deliveryModeId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoAreaFreeshippingPrTableMap::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 ChildSocolissimoAreaFreeshippingPrQuery 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(SocolissimoAreaFreeshippingPrTableMap::CART_AMOUNT, $cartAmount['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($cartAmount['max'])) {
$this->addUsingAlias(SocolissimoAreaFreeshippingPrTableMap::CART_AMOUNT, $cartAmount['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoAreaFreeshippingPrTableMap::CART_AMOUNT, $cartAmount, $comparison);
}
/**
* Filter the query by a related \SoColissimo\Model\Thelia\Model\Area object
*
* @param \SoColissimo\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 ChildSocolissimoAreaFreeshippingPrQuery The current query, for fluid interface
*/
public function filterByArea($area, $comparison = null)
{
if ($area instanceof \SoColissimo\Model\Thelia\Model\Area) {
return $this
->addUsingAlias(SocolissimoAreaFreeshippingPrTableMap::AREA_ID, $area->getId(), $comparison);
} elseif ($area instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SocolissimoAreaFreeshippingPrTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByArea() only accepts arguments of type \SoColissimo\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 ChildSocolissimoAreaFreeshippingPrQuery 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 \SoColissimo\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', '\SoColissimo\Model\Thelia\Model\AreaQuery');
}
/**
* Filter the query by a related \SoColissimo\Model\SocolissimoDeliveryMode object
*
* @param \SoColissimo\Model\SocolissimoDeliveryMode|ObjectCollection $socolissimoDeliveryMode The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSocolissimoAreaFreeshippingPrQuery The current query, for fluid interface
*/
public function filterBySocolissimoDeliveryMode($socolissimoDeliveryMode, $comparison = null)
{
if ($socolissimoDeliveryMode instanceof \SoColissimo\Model\SocolissimoDeliveryMode) {
return $this
->addUsingAlias(SocolissimoAreaFreeshippingPrTableMap::DELIVERY_MODE_ID, $socolissimoDeliveryMode->getId(), $comparison);
} elseif ($socolissimoDeliveryMode instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SocolissimoAreaFreeshippingPrTableMap::DELIVERY_MODE_ID, $socolissimoDeliveryMode->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterBySocolissimoDeliveryMode() only accepts arguments of type \SoColissimo\Model\SocolissimoDeliveryMode or Collection');
}
}
/**
* Adds a JOIN clause to the query using the SocolissimoDeliveryMode relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSocolissimoAreaFreeshippingPrQuery The current query, for fluid interface
*/
public function joinSocolissimoDeliveryMode($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('SocolissimoDeliveryMode');
// 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, 'SocolissimoDeliveryMode');
}
return $this;
}
/**
* Use the SocolissimoDeliveryMode relation SocolissimoDeliveryMode 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 \SoColissimo\Model\SocolissimoDeliveryModeQuery A secondary query class using the current class as primary query
*/
public function useSocolissimoDeliveryModeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinSocolissimoDeliveryMode($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SocolissimoDeliveryMode', '\SoColissimo\Model\SocolissimoDeliveryModeQuery');
}
/**
* Exclude object from result
*
* @param ChildSocolissimoAreaFreeshippingPr $socolissimoAreaFreeshippingPr Object to remove from the list of results
*
* @return ChildSocolissimoAreaFreeshippingPrQuery The current query, for fluid interface
*/
public function prune($socolissimoAreaFreeshippingPr = null)
{
if ($socolissimoAreaFreeshippingPr) {
$this->addUsingAlias(SocolissimoAreaFreeshippingPrTableMap::ID, $socolissimoAreaFreeshippingPr->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the socolissimo_area_freeshipping_pr 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(SocolissimoAreaFreeshippingPrTableMap::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).
SocolissimoAreaFreeshippingPrTableMap::clearInstancePool();
SocolissimoAreaFreeshippingPrTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildSocolissimoAreaFreeshippingPr or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildSocolissimoAreaFreeshippingPr 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(SocolissimoAreaFreeshippingPrTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(SocolissimoAreaFreeshippingPrTableMap::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();
SocolissimoAreaFreeshippingPrTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
SocolissimoAreaFreeshippingPrTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // SocolissimoAreaFreeshippingPrQuery

View File

@@ -0,0 +1,645 @@
<?php
namespace SoColissimo\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use SoColissimo\Model\SocolissimoAreaFreeshipping as ChildSocolissimoAreaFreeshipping;
use SoColissimo\Model\SocolissimoAreaFreeshippingQuery as ChildSocolissimoAreaFreeshippingQuery;
use SoColissimo\Model\Map\SocolissimoAreaFreeshippingTableMap;
use SoColissimo\Model\Thelia\Model\Area;
/**
* Base class that represents a query for the 'socolissimo_area_freeshipping' table.
*
*
*
* @method ChildSocolissimoAreaFreeshippingQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildSocolissimoAreaFreeshippingQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
* @method ChildSocolissimoAreaFreeshippingQuery orderByDeliveryModeId($order = Criteria::ASC) Order by the delivery_mode_id column
* @method ChildSocolissimoAreaFreeshippingQuery orderByCartAmount($order = Criteria::ASC) Order by the cart_amount column
*
* @method ChildSocolissimoAreaFreeshippingQuery groupById() Group by the id column
* @method ChildSocolissimoAreaFreeshippingQuery groupByAreaId() Group by the area_id column
* @method ChildSocolissimoAreaFreeshippingQuery groupByDeliveryModeId() Group by the delivery_mode_id column
* @method ChildSocolissimoAreaFreeshippingQuery groupByCartAmount() Group by the cart_amount column
*
* @method ChildSocolissimoAreaFreeshippingQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildSocolissimoAreaFreeshippingQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildSocolissimoAreaFreeshippingQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildSocolissimoAreaFreeshippingQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
* @method ChildSocolissimoAreaFreeshippingQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
* @method ChildSocolissimoAreaFreeshippingQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
*
* @method ChildSocolissimoAreaFreeshippingQuery leftJoinSocolissimoDeliveryMode($relationAlias = null) Adds a LEFT JOIN clause to the query using the SocolissimoDeliveryMode relation
* @method ChildSocolissimoAreaFreeshippingQuery rightJoinSocolissimoDeliveryMode($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SocolissimoDeliveryMode relation
* @method ChildSocolissimoAreaFreeshippingQuery innerJoinSocolissimoDeliveryMode($relationAlias = null) Adds a INNER JOIN clause to the query using the SocolissimoDeliveryMode relation
*
* @method ChildSocolissimoAreaFreeshipping findOne(ConnectionInterface $con = null) Return the first ChildSocolissimoAreaFreeshipping matching the query
* @method ChildSocolissimoAreaFreeshipping findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSocolissimoAreaFreeshipping matching the query, or a new ChildSocolissimoAreaFreeshipping object populated from the query conditions when no match is found
*
* @method ChildSocolissimoAreaFreeshipping findOneById(int $id) Return the first ChildSocolissimoAreaFreeshipping filtered by the id column
* @method ChildSocolissimoAreaFreeshipping findOneByAreaId(int $area_id) Return the first ChildSocolissimoAreaFreeshipping filtered by the area_id column
* @method ChildSocolissimoAreaFreeshipping findOneByDeliveryModeId(int $delivery_mode_id) Return the first ChildSocolissimoAreaFreeshipping filtered by the delivery_mode_id column
* @method ChildSocolissimoAreaFreeshipping findOneByCartAmount(string $cart_amount) Return the first ChildSocolissimoAreaFreeshipping filtered by the cart_amount column
*
* @method array findById(int $id) Return ChildSocolissimoAreaFreeshipping objects filtered by the id column
* @method array findByAreaId(int $area_id) Return ChildSocolissimoAreaFreeshipping objects filtered by the area_id column
* @method array findByDeliveryModeId(int $delivery_mode_id) Return ChildSocolissimoAreaFreeshipping objects filtered by the delivery_mode_id column
* @method array findByCartAmount(string $cart_amount) Return ChildSocolissimoAreaFreeshipping objects filtered by the cart_amount column
*
*/
abstract class SocolissimoAreaFreeshippingQuery extends ModelCriteria
{
/**
* Initializes internal state of \SoColissimo\Model\Base\SocolissimoAreaFreeshippingQuery 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 = '\\SoColissimo\\Model\\SocolissimoAreaFreeshipping', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildSocolissimoAreaFreeshippingQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildSocolissimoAreaFreeshippingQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \SoColissimo\Model\SocolissimoAreaFreeshippingQuery) {
return $criteria;
}
$query = new \SoColissimo\Model\SocolissimoAreaFreeshippingQuery();
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 ChildSocolissimoAreaFreeshipping|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = SocolissimoAreaFreeshippingTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(SocolissimoAreaFreeshippingTableMap::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 ChildSocolissimoAreaFreeshipping 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 socolissimo_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 ChildSocolissimoAreaFreeshipping();
$obj->hydrate($row);
SocolissimoAreaFreeshippingTableMap::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 ChildSocolissimoAreaFreeshipping|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 ChildSocolissimoAreaFreeshippingQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(SocolissimoAreaFreeshippingTableMap::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 ChildSocolissimoAreaFreeshippingQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(SocolissimoAreaFreeshippingTableMap::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 ChildSocolissimoAreaFreeshippingQuery 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(SocolissimoAreaFreeshippingTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(SocolissimoAreaFreeshippingTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoAreaFreeshippingTableMap::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 ChildSocolissimoAreaFreeshippingQuery 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(SocolissimoAreaFreeshippingTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($areaId['max'])) {
$this->addUsingAlias(SocolissimoAreaFreeshippingTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoAreaFreeshippingTableMap::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 filterBySocolissimoDeliveryMode()
*
* @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 ChildSocolissimoAreaFreeshippingQuery 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(SocolissimoAreaFreeshippingTableMap::DELIVERY_MODE_ID, $deliveryModeId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($deliveryModeId['max'])) {
$this->addUsingAlias(SocolissimoAreaFreeshippingTableMap::DELIVERY_MODE_ID, $deliveryModeId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoAreaFreeshippingTableMap::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 ChildSocolissimoAreaFreeshippingQuery 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(SocolissimoAreaFreeshippingTableMap::CART_AMOUNT, $cartAmount['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($cartAmount['max'])) {
$this->addUsingAlias(SocolissimoAreaFreeshippingTableMap::CART_AMOUNT, $cartAmount['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoAreaFreeshippingTableMap::CART_AMOUNT, $cartAmount, $comparison);
}
/**
* Filter the query by a related \SoColissimo\Model\Thelia\Model\Area object
*
* @param \SoColissimo\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 ChildSocolissimoAreaFreeshippingQuery The current query, for fluid interface
*/
public function filterByArea($area, $comparison = null)
{
if ($area instanceof \SoColissimo\Model\Thelia\Model\Area) {
return $this
->addUsingAlias(SocolissimoAreaFreeshippingTableMap::AREA_ID, $area->getId(), $comparison);
} elseif ($area instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SocolissimoAreaFreeshippingTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByArea() only accepts arguments of type \SoColissimo\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 ChildSocolissimoAreaFreeshippingQuery 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 \SoColissimo\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', '\SoColissimo\Model\Thelia\Model\AreaQuery');
}
/**
* Filter the query by a related \SoColissimo\Model\SocolissimoDeliveryMode object
*
* @param \SoColissimo\Model\SocolissimoDeliveryMode|ObjectCollection $socolissimoDeliveryMode The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSocolissimoAreaFreeshippingQuery The current query, for fluid interface
*/
public function filterBySocolissimoDeliveryMode($socolissimoDeliveryMode, $comparison = null)
{
if ($socolissimoDeliveryMode instanceof \SoColissimo\Model\SocolissimoDeliveryMode) {
return $this
->addUsingAlias(SocolissimoAreaFreeshippingTableMap::DELIVERY_MODE_ID, $socolissimoDeliveryMode->getId(), $comparison);
} elseif ($socolissimoDeliveryMode instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SocolissimoAreaFreeshippingTableMap::DELIVERY_MODE_ID, $socolissimoDeliveryMode->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterBySocolissimoDeliveryMode() only accepts arguments of type \SoColissimo\Model\SocolissimoDeliveryMode or Collection');
}
}
/**
* Adds a JOIN clause to the query using the SocolissimoDeliveryMode relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSocolissimoAreaFreeshippingQuery The current query, for fluid interface
*/
public function joinSocolissimoDeliveryMode($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('SocolissimoDeliveryMode');
// 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, 'SocolissimoDeliveryMode');
}
return $this;
}
/**
* Use the SocolissimoDeliveryMode relation SocolissimoDeliveryMode 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 \SoColissimo\Model\SocolissimoDeliveryModeQuery A secondary query class using the current class as primary query
*/
public function useSocolissimoDeliveryModeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinSocolissimoDeliveryMode($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SocolissimoDeliveryMode', '\SoColissimo\Model\SocolissimoDeliveryModeQuery');
}
/**
* Exclude object from result
*
* @param ChildSocolissimoAreaFreeshipping $socolissimoAreaFreeshipping Object to remove from the list of results
*
* @return ChildSocolissimoAreaFreeshippingQuery The current query, for fluid interface
*/
public function prune($socolissimoAreaFreeshipping = null)
{
if ($socolissimoAreaFreeshipping) {
$this->addUsingAlias(SocolissimoAreaFreeshippingTableMap::ID, $socolissimoAreaFreeshipping->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the socolissimo_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(SocolissimoAreaFreeshippingTableMap::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).
SocolissimoAreaFreeshippingTableMap::clearInstancePool();
SocolissimoAreaFreeshippingTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildSocolissimoAreaFreeshipping or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildSocolissimoAreaFreeshipping 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(SocolissimoAreaFreeshippingTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(SocolissimoAreaFreeshippingTableMap::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();
SocolissimoAreaFreeshippingTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
SocolissimoAreaFreeshippingTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // SocolissimoAreaFreeshippingQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,720 @@
<?php
namespace SoColissimo\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use SoColissimo\Model\SocolissimoDeliveryMode as ChildSocolissimoDeliveryMode;
use SoColissimo\Model\SocolissimoDeliveryModeQuery as ChildSocolissimoDeliveryModeQuery;
use SoColissimo\Model\Map\SocolissimoDeliveryModeTableMap;
/**
* Base class that represents a query for the 'socolissimo_delivery_mode' table.
*
*
*
* @method ChildSocolissimoDeliveryModeQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildSocolissimoDeliveryModeQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildSocolissimoDeliveryModeQuery orderByCode($order = Criteria::ASC) Order by the code column
* @method ChildSocolissimoDeliveryModeQuery orderByFreeshippingActive($order = Criteria::ASC) Order by the freeshipping_active column
* @method ChildSocolissimoDeliveryModeQuery orderByFreeshippingFrom($order = Criteria::ASC) Order by the freeshipping_from column
*
* @method ChildSocolissimoDeliveryModeQuery groupById() Group by the id column
* @method ChildSocolissimoDeliveryModeQuery groupByTitle() Group by the title column
* @method ChildSocolissimoDeliveryModeQuery groupByCode() Group by the code column
* @method ChildSocolissimoDeliveryModeQuery groupByFreeshippingActive() Group by the freeshipping_active column
* @method ChildSocolissimoDeliveryModeQuery groupByFreeshippingFrom() Group by the freeshipping_from column
*
* @method ChildSocolissimoDeliveryModeQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildSocolissimoDeliveryModeQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildSocolissimoDeliveryModeQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildSocolissimoDeliveryModeQuery leftJoinSocolissimoPrice($relationAlias = null) Adds a LEFT JOIN clause to the query using the SocolissimoPrice relation
* @method ChildSocolissimoDeliveryModeQuery rightJoinSocolissimoPrice($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SocolissimoPrice relation
* @method ChildSocolissimoDeliveryModeQuery innerJoinSocolissimoPrice($relationAlias = null) Adds a INNER JOIN clause to the query using the SocolissimoPrice relation
*
* @method ChildSocolissimoDeliveryModeQuery leftJoinSocolissimoAreaFreeshippingDom($relationAlias = null) Adds a LEFT JOIN clause to the query using the SocolissimoAreaFreeshippingDom relation
* @method ChildSocolissimoDeliveryModeQuery rightJoinSocolissimoAreaFreeshippingDom($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SocolissimoAreaFreeshippingDom relation
* @method ChildSocolissimoDeliveryModeQuery innerJoinSocolissimoAreaFreeshippingDom($relationAlias = null) Adds a INNER JOIN clause to the query using the SocolissimoAreaFreeshippingDom relation
*
* @method ChildSocolissimoDeliveryModeQuery leftJoinSocolissimoAreaFreeshippingPr($relationAlias = null) Adds a LEFT JOIN clause to the query using the SocolissimoAreaFreeshippingPr relation
* @method ChildSocolissimoDeliveryModeQuery rightJoinSocolissimoAreaFreeshippingPr($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SocolissimoAreaFreeshippingPr relation
* @method ChildSocolissimoDeliveryModeQuery innerJoinSocolissimoAreaFreeshippingPr($relationAlias = null) Adds a INNER JOIN clause to the query using the SocolissimoAreaFreeshippingPr relation
*
* @method ChildSocolissimoDeliveryMode findOne(ConnectionInterface $con = null) Return the first ChildSocolissimoDeliveryMode matching the query
* @method ChildSocolissimoDeliveryMode findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSocolissimoDeliveryMode matching the query, or a new ChildSocolissimoDeliveryMode object populated from the query conditions when no match is found
*
* @method ChildSocolissimoDeliveryMode findOneById(int $id) Return the first ChildSocolissimoDeliveryMode filtered by the id column
* @method ChildSocolissimoDeliveryMode findOneByTitle(string $title) Return the first ChildSocolissimoDeliveryMode filtered by the title column
* @method ChildSocolissimoDeliveryMode findOneByCode(string $code) Return the first ChildSocolissimoDeliveryMode filtered by the code column
* @method ChildSocolissimoDeliveryMode findOneByFreeshippingActive(boolean $freeshipping_active) Return the first ChildSocolissimoDeliveryMode filtered by the freeshipping_active column
* @method ChildSocolissimoDeliveryMode findOneByFreeshippingFrom(double $freeshipping_from) Return the first ChildSocolissimoDeliveryMode filtered by the freeshipping_from column
*
* @method array findById(int $id) Return ChildSocolissimoDeliveryMode objects filtered by the id column
* @method array findByTitle(string $title) Return ChildSocolissimoDeliveryMode objects filtered by the title column
* @method array findByCode(string $code) Return ChildSocolissimoDeliveryMode objects filtered by the code column
* @method array findByFreeshippingActive(boolean $freeshipping_active) Return ChildSocolissimoDeliveryMode objects filtered by the freeshipping_active column
* @method array findByFreeshippingFrom(double $freeshipping_from) Return ChildSocolissimoDeliveryMode objects filtered by the freeshipping_from column
*
*/
abstract class SocolissimoDeliveryModeQuery extends ModelCriteria
{
/**
* Initializes internal state of \SoColissimo\Model\Base\SocolissimoDeliveryModeQuery 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 = '\\SoColissimo\\Model\\SocolissimoDeliveryMode', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildSocolissimoDeliveryModeQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildSocolissimoDeliveryModeQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \SoColissimo\Model\SocolissimoDeliveryModeQuery) {
return $criteria;
}
$query = new \SoColissimo\Model\SocolissimoDeliveryModeQuery();
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 ChildSocolissimoDeliveryMode|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = SocolissimoDeliveryModeTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(SocolissimoDeliveryModeTableMap::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 ChildSocolissimoDeliveryMode 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 socolissimo_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 ChildSocolissimoDeliveryMode();
$obj->hydrate($row);
SocolissimoDeliveryModeTableMap::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 ChildSocolissimoDeliveryMode|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 ChildSocolissimoDeliveryModeQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(SocolissimoDeliveryModeTableMap::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 ChildSocolissimoDeliveryModeQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(SocolissimoDeliveryModeTableMap::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 ChildSocolissimoDeliveryModeQuery 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(SocolissimoDeliveryModeTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(SocolissimoDeliveryModeTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoDeliveryModeTableMap::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 ChildSocolissimoDeliveryModeQuery 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(SocolissimoDeliveryModeTableMap::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 ChildSocolissimoDeliveryModeQuery 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(SocolissimoDeliveryModeTableMap::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 ChildSocolissimoDeliveryModeQuery 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(SocolissimoDeliveryModeTableMap::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 ChildSocolissimoDeliveryModeQuery 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(SocolissimoDeliveryModeTableMap::FREESHIPPING_FROM, $freeshippingFrom['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($freeshippingFrom['max'])) {
$this->addUsingAlias(SocolissimoDeliveryModeTableMap::FREESHIPPING_FROM, $freeshippingFrom['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoDeliveryModeTableMap::FREESHIPPING_FROM, $freeshippingFrom, $comparison);
}
/**
* Filter the query by a related \SoColissimo\Model\SocolissimoPrice object
*
* @param \SoColissimo\Model\SocolissimoPrice|ObjectCollection $socolissimoPrice the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSocolissimoDeliveryModeQuery The current query, for fluid interface
*/
public function filterBySocolissimoPrice($socolissimoPrice, $comparison = null)
{
if ($socolissimoPrice instanceof \SoColissimo\Model\SocolissimoPrice) {
return $this
->addUsingAlias(SocolissimoDeliveryModeTableMap::ID, $socolissimoPrice->getDeliveryModeId(), $comparison);
} elseif ($socolissimoPrice instanceof ObjectCollection) {
return $this
->useSocolissimoPriceQuery()
->filterByPrimaryKeys($socolissimoPrice->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterBySocolissimoPrice() only accepts arguments of type \SoColissimo\Model\SocolissimoPrice or Collection');
}
}
/**
* Adds a JOIN clause to the query using the SocolissimoPrice relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSocolissimoDeliveryModeQuery The current query, for fluid interface
*/
public function joinSocolissimoPrice($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('SocolissimoPrice');
// 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, 'SocolissimoPrice');
}
return $this;
}
/**
* Use the SocolissimoPrice relation SocolissimoPrice 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 \SoColissimo\Model\SocolissimoPriceQuery A secondary query class using the current class as primary query
*/
public function useSocolissimoPriceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinSocolissimoPrice($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SocolissimoPrice', '\SoColissimo\Model\SocolissimoPriceQuery');
}
/**
* Filter the query by a related \SoColissimo\Model\SocolissimoAreaFreeshippingDom object
*
* @param \SoColissimo\Model\SocolissimoAreaFreeshippingDom|ObjectCollection $socolissimoAreaFreeshippingDom the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSocolissimoDeliveryModeQuery The current query, for fluid interface
*/
public function filterBySocolissimoAreaFreeshippingDom($socolissimoAreaFreeshippingDom, $comparison = null)
{
if ($socolissimoAreaFreeshippingDom instanceof \SoColissimo\Model\SocolissimoAreaFreeshippingDom) {
return $this
->addUsingAlias(SocolissimoDeliveryModeTableMap::ID, $socolissimoAreaFreeshippingDom->getDeliveryModeId(), $comparison);
} elseif ($socolissimoAreaFreeshippingDom instanceof ObjectCollection) {
return $this
->useSocolissimoAreaFreeshippingDomQuery()
->filterByPrimaryKeys($socolissimoAreaFreeshippingDom->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterBySocolissimoAreaFreeshippingDom() only accepts arguments of type \SoColissimo\Model\SocolissimoAreaFreeshippingDom or Collection');
}
}
/**
* Adds a JOIN clause to the query using the SocolissimoAreaFreeshippingDom relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSocolissimoDeliveryModeQuery The current query, for fluid interface
*/
public function joinSocolissimoAreaFreeshippingDom($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('SocolissimoAreaFreeshippingDom');
// 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, 'SocolissimoAreaFreeshippingDom');
}
return $this;
}
/**
* Use the SocolissimoAreaFreeshippingDom relation SocolissimoAreaFreeshippingDom 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 \SoColissimo\Model\SocolissimoAreaFreeshippingDomQuery A secondary query class using the current class as primary query
*/
public function useSocolissimoAreaFreeshippingDomQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinSocolissimoAreaFreeshippingDom($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SocolissimoAreaFreeshippingDom', '\SoColissimo\Model\SocolissimoAreaFreeshippingDomQuery');
}
/**
* Filter the query by a related \SoColissimo\Model\SocolissimoAreaFreeshippingPr object
*
* @param \SoColissimo\Model\SocolissimoAreaFreeshippingPr|ObjectCollection $socolissimoAreaFreeshippingPr the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSocolissimoDeliveryModeQuery The current query, for fluid interface
*/
public function filterBySocolissimoAreaFreeshippingPr($socolissimoAreaFreeshippingPr, $comparison = null)
{
if ($socolissimoAreaFreeshippingPr instanceof \SoColissimo\Model\SocolissimoAreaFreeshippingPr) {
return $this
->addUsingAlias(SocolissimoDeliveryModeTableMap::ID, $socolissimoAreaFreeshippingPr->getDeliveryModeId(), $comparison);
} elseif ($socolissimoAreaFreeshippingPr instanceof ObjectCollection) {
return $this
->useSocolissimoAreaFreeshippingPrQuery()
->filterByPrimaryKeys($socolissimoAreaFreeshippingPr->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterBySocolissimoAreaFreeshippingPr() only accepts arguments of type \SoColissimo\Model\SocolissimoAreaFreeshippingPr or Collection');
}
}
/**
* Adds a JOIN clause to the query using the SocolissimoAreaFreeshippingPr relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSocolissimoDeliveryModeQuery The current query, for fluid interface
*/
public function joinSocolissimoAreaFreeshippingPr($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('SocolissimoAreaFreeshippingPr');
// 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, 'SocolissimoAreaFreeshippingPr');
}
return $this;
}
/**
* Use the SocolissimoAreaFreeshippingPr relation SocolissimoAreaFreeshippingPr 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 \SoColissimo\Model\SocolissimoAreaFreeshippingPrQuery A secondary query class using the current class as primary query
*/
public function useSocolissimoAreaFreeshippingPrQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinSocolissimoAreaFreeshippingPr($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SocolissimoAreaFreeshippingPr', '\SoColissimo\Model\SocolissimoAreaFreeshippingPrQuery');
}
/**
* Exclude object from result
*
* @param ChildSocolissimoDeliveryMode $socolissimoDeliveryMode Object to remove from the list of results
*
* @return ChildSocolissimoDeliveryModeQuery The current query, for fluid interface
*/
public function prune($socolissimoDeliveryMode = null)
{
if ($socolissimoDeliveryMode) {
$this->addUsingAlias(SocolissimoDeliveryModeTableMap::ID, $socolissimoDeliveryMode->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the socolissimo_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(SocolissimoDeliveryModeTableMap::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).
SocolissimoDeliveryModeTableMap::clearInstancePool();
SocolissimoDeliveryModeTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildSocolissimoDeliveryMode or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildSocolissimoDeliveryMode 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(SocolissimoDeliveryModeTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(SocolissimoDeliveryModeTableMap::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();
SocolissimoDeliveryModeTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
SocolissimoDeliveryModeTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // SocolissimoDeliveryModeQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,535 @@
<?php
namespace SoColissimo\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use SoColissimo\Model\SocolissimoFreeshipping as ChildSocolissimoFreeshipping;
use SoColissimo\Model\SocolissimoFreeshippingQuery as ChildSocolissimoFreeshippingQuery;
use SoColissimo\Model\Map\SocolissimoFreeshippingTableMap;
/**
* Base class that represents a query for the 'socolissimo_freeshipping' table.
*
*
*
* @method ChildSocolissimoFreeshippingQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildSocolissimoFreeshippingQuery orderByActive($order = Criteria::ASC) Order by the active column
* @method ChildSocolissimoFreeshippingQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildSocolissimoFreeshippingQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildSocolissimoFreeshippingQuery groupById() Group by the id column
* @method ChildSocolissimoFreeshippingQuery groupByActive() Group by the active column
* @method ChildSocolissimoFreeshippingQuery groupByCreatedAt() Group by the created_at column
* @method ChildSocolissimoFreeshippingQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildSocolissimoFreeshippingQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildSocolissimoFreeshippingQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildSocolissimoFreeshippingQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildSocolissimoFreeshipping findOne(ConnectionInterface $con = null) Return the first ChildSocolissimoFreeshipping matching the query
* @method ChildSocolissimoFreeshipping findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSocolissimoFreeshipping matching the query, or a new ChildSocolissimoFreeshipping object populated from the query conditions when no match is found
*
* @method ChildSocolissimoFreeshipping findOneById(int $id) Return the first ChildSocolissimoFreeshipping filtered by the id column
* @method ChildSocolissimoFreeshipping findOneByActive(boolean $active) Return the first ChildSocolissimoFreeshipping filtered by the active column
* @method ChildSocolissimoFreeshipping findOneByCreatedAt(string $created_at) Return the first ChildSocolissimoFreeshipping filtered by the created_at column
* @method ChildSocolissimoFreeshipping findOneByUpdatedAt(string $updated_at) Return the first ChildSocolissimoFreeshipping filtered by the updated_at column
*
* @method array findById(int $id) Return ChildSocolissimoFreeshipping objects filtered by the id column
* @method array findByActive(boolean $active) Return ChildSocolissimoFreeshipping objects filtered by the active column
* @method array findByCreatedAt(string $created_at) Return ChildSocolissimoFreeshipping objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildSocolissimoFreeshipping objects filtered by the updated_at column
*
*/
abstract class SocolissimoFreeshippingQuery extends ModelCriteria
{
/**
* Initializes internal state of \SoColissimo\Model\Base\SocolissimoFreeshippingQuery 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 = '\\SoColissimo\\Model\\SocolissimoFreeshipping', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildSocolissimoFreeshippingQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildSocolissimoFreeshippingQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \SoColissimo\Model\SocolissimoFreeshippingQuery) {
return $criteria;
}
$query = new \SoColissimo\Model\SocolissimoFreeshippingQuery();
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 ChildSocolissimoFreeshipping|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = SocolissimoFreeshippingTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(SocolissimoFreeshippingTableMap::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 ChildSocolissimoFreeshipping A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, ACTIVE, CREATED_AT, UPDATED_AT FROM socolissimo_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 ChildSocolissimoFreeshipping();
$obj->hydrate($row);
SocolissimoFreeshippingTableMap::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 ChildSocolissimoFreeshipping|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 ChildSocolissimoFreeshippingQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(SocolissimoFreeshippingTableMap::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 ChildSocolissimoFreeshippingQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(SocolissimoFreeshippingTableMap::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 ChildSocolissimoFreeshippingQuery 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(SocolissimoFreeshippingTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(SocolissimoFreeshippingTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoFreeshippingTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the active column
*
* Example usage:
* <code>
* $query->filterByActive(true); // WHERE active = true
* $query->filterByActive('yes'); // WHERE active = true
* </code>
*
* @param boolean|string $active 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 ChildSocolissimoFreeshippingQuery The current query, for fluid interface
*/
public function filterByActive($active = null, $comparison = null)
{
if (is_string($active)) {
$active = in_array(strtolower($active), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(SocolissimoFreeshippingTableMap::ACTIVE, $active, $comparison);
}
/**
* Filter the query on the created_at column
*
* Example usage:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSocolissimoFreeshippingQuery The current query, for fluid interface
*/
public function filterByCreatedAt($createdAt = null, $comparison = null)
{
if (is_array($createdAt)) {
$useMinMax = false;
if (isset($createdAt['min'])) {
$this->addUsingAlias(SocolissimoFreeshippingTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(SocolissimoFreeshippingTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoFreeshippingTableMap::CREATED_AT, $createdAt, $comparison);
}
/**
* Filter the query on the updated_at column
*
* Example usage:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSocolissimoFreeshippingQuery The current query, for fluid interface
*/
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{
if (is_array($updatedAt)) {
$useMinMax = false;
if (isset($updatedAt['min'])) {
$this->addUsingAlias(SocolissimoFreeshippingTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(SocolissimoFreeshippingTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoFreeshippingTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Exclude object from result
*
* @param ChildSocolissimoFreeshipping $socolissimoFreeshipping Object to remove from the list of results
*
* @return ChildSocolissimoFreeshippingQuery The current query, for fluid interface
*/
public function prune($socolissimoFreeshipping = null)
{
if ($socolissimoFreeshipping) {
$this->addUsingAlias(SocolissimoFreeshippingTableMap::ID, $socolissimoFreeshipping->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the socolissimo_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(SocolissimoFreeshippingTableMap::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).
SocolissimoFreeshippingTableMap::clearInstancePool();
SocolissimoFreeshippingTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildSocolissimoFreeshipping or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildSocolissimoFreeshipping 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(SocolissimoFreeshippingTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(SocolissimoFreeshippingTableMap::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();
SocolissimoFreeshippingTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
SocolissimoFreeshippingTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildSocolissimoFreeshippingQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(SocolissimoFreeshippingTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildSocolissimoFreeshippingQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(SocolissimoFreeshippingTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildSocolissimoFreeshippingQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(SocolissimoFreeshippingTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildSocolissimoFreeshippingQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(SocolissimoFreeshippingTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildSocolissimoFreeshippingQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(SocolissimoFreeshippingTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildSocolissimoFreeshippingQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(SocolissimoFreeshippingTableMap::CREATED_AT);
}
} // SocolissimoFreeshippingQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,780 @@
<?php
namespace SoColissimo\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use SoColissimo\Model\SocolissimoPrice as ChildSocolissimoPrice;
use SoColissimo\Model\SocolissimoPriceQuery as ChildSocolissimoPriceQuery;
use SoColissimo\Model\Map\SocolissimoPriceTableMap;
use SoColissimo\Model\Thelia\Model\Area;
/**
* Base class that represents a query for the 'socolissimo_price' table.
*
*
*
* @method ChildSocolissimoPriceQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildSocolissimoPriceQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
* @method ChildSocolissimoPriceQuery orderByDeliveryModeId($order = Criteria::ASC) Order by the delivery_mode_id column
* @method ChildSocolissimoPriceQuery orderByWeightMax($order = Criteria::ASC) Order by the weight_max column
* @method ChildSocolissimoPriceQuery orderByPriceMax($order = Criteria::ASC) Order by the price_max column
* @method ChildSocolissimoPriceQuery orderByFrancoMinPrice($order = Criteria::ASC) Order by the franco_min_price column
* @method ChildSocolissimoPriceQuery orderByPrice($order = Criteria::ASC) Order by the price column
*
* @method ChildSocolissimoPriceQuery groupById() Group by the id column
* @method ChildSocolissimoPriceQuery groupByAreaId() Group by the area_id column
* @method ChildSocolissimoPriceQuery groupByDeliveryModeId() Group by the delivery_mode_id column
* @method ChildSocolissimoPriceQuery groupByWeightMax() Group by the weight_max column
* @method ChildSocolissimoPriceQuery groupByPriceMax() Group by the price_max column
* @method ChildSocolissimoPriceQuery groupByFrancoMinPrice() Group by the franco_min_price column
* @method ChildSocolissimoPriceQuery groupByPrice() Group by the price column
*
* @method ChildSocolissimoPriceQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildSocolissimoPriceQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildSocolissimoPriceQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildSocolissimoPriceQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
* @method ChildSocolissimoPriceQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
* @method ChildSocolissimoPriceQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
*
* @method ChildSocolissimoPriceQuery leftJoinSocolissimoDeliveryMode($relationAlias = null) Adds a LEFT JOIN clause to the query using the SocolissimoDeliveryMode relation
* @method ChildSocolissimoPriceQuery rightJoinSocolissimoDeliveryMode($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SocolissimoDeliveryMode relation
* @method ChildSocolissimoPriceQuery innerJoinSocolissimoDeliveryMode($relationAlias = null) Adds a INNER JOIN clause to the query using the SocolissimoDeliveryMode relation
*
* @method ChildSocolissimoPrice findOne(ConnectionInterface $con = null) Return the first ChildSocolissimoPrice matching the query
* @method ChildSocolissimoPrice findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSocolissimoPrice matching the query, or a new ChildSocolissimoPrice object populated from the query conditions when no match is found
*
* @method ChildSocolissimoPrice findOneById(int $id) Return the first ChildSocolissimoPrice filtered by the id column
* @method ChildSocolissimoPrice findOneByAreaId(int $area_id) Return the first ChildSocolissimoPrice filtered by the area_id column
* @method ChildSocolissimoPrice findOneByDeliveryModeId(int $delivery_mode_id) Return the first ChildSocolissimoPrice filtered by the delivery_mode_id column
* @method ChildSocolissimoPrice findOneByWeightMax(double $weight_max) Return the first ChildSocolissimoPrice filtered by the weight_max column
* @method ChildSocolissimoPrice findOneByPriceMax(double $price_max) Return the first ChildSocolissimoPrice filtered by the price_max column
* @method ChildSocolissimoPrice findOneByFrancoMinPrice(double $franco_min_price) Return the first ChildSocolissimoPrice filtered by the franco_min_price column
* @method ChildSocolissimoPrice findOneByPrice(double $price) Return the first ChildSocolissimoPrice filtered by the price column
*
* @method array findById(int $id) Return ChildSocolissimoPrice objects filtered by the id column
* @method array findByAreaId(int $area_id) Return ChildSocolissimoPrice objects filtered by the area_id column
* @method array findByDeliveryModeId(int $delivery_mode_id) Return ChildSocolissimoPrice objects filtered by the delivery_mode_id column
* @method array findByWeightMax(double $weight_max) Return ChildSocolissimoPrice objects filtered by the weight_max column
* @method array findByPriceMax(double $price_max) Return ChildSocolissimoPrice objects filtered by the price_max column
* @method array findByFrancoMinPrice(double $franco_min_price) Return ChildSocolissimoPrice objects filtered by the franco_min_price column
* @method array findByPrice(double $price) Return ChildSocolissimoPrice objects filtered by the price column
*
*/
abstract class SocolissimoPriceQuery extends ModelCriteria
{
/**
* Initializes internal state of \SoColissimo\Model\Base\SocolissimoPriceQuery 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 = '\\SoColissimo\\Model\\SocolissimoPrice', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildSocolissimoPriceQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildSocolissimoPriceQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \SoColissimo\Model\SocolissimoPriceQuery) {
return $criteria;
}
$query = new \SoColissimo\Model\SocolissimoPriceQuery();
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 ChildSocolissimoPrice|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = SocolissimoPriceTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(SocolissimoPriceTableMap::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 ChildSocolissimoPrice 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 socolissimo_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 ChildSocolissimoPrice();
$obj->hydrate($row);
SocolissimoPriceTableMap::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 ChildSocolissimoPrice|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 ChildSocolissimoPriceQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(SocolissimoPriceTableMap::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 ChildSocolissimoPriceQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(SocolissimoPriceTableMap::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 ChildSocolissimoPriceQuery 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(SocolissimoPriceTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(SocolissimoPriceTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoPriceTableMap::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 ChildSocolissimoPriceQuery 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(SocolissimoPriceTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($areaId['max'])) {
$this->addUsingAlias(SocolissimoPriceTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoPriceTableMap::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 filterBySocolissimoDeliveryMode()
*
* @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 ChildSocolissimoPriceQuery 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(SocolissimoPriceTableMap::DELIVERY_MODE_ID, $deliveryModeId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($deliveryModeId['max'])) {
$this->addUsingAlias(SocolissimoPriceTableMap::DELIVERY_MODE_ID, $deliveryModeId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoPriceTableMap::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 ChildSocolissimoPriceQuery 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(SocolissimoPriceTableMap::WEIGHT_MAX, $weightMax['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($weightMax['max'])) {
$this->addUsingAlias(SocolissimoPriceTableMap::WEIGHT_MAX, $weightMax['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoPriceTableMap::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 ChildSocolissimoPriceQuery 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(SocolissimoPriceTableMap::PRICE_MAX, $priceMax['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($priceMax['max'])) {
$this->addUsingAlias(SocolissimoPriceTableMap::PRICE_MAX, $priceMax['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoPriceTableMap::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 ChildSocolissimoPriceQuery 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(SocolissimoPriceTableMap::FRANCO_MIN_PRICE, $francoMinPrice['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($francoMinPrice['max'])) {
$this->addUsingAlias(SocolissimoPriceTableMap::FRANCO_MIN_PRICE, $francoMinPrice['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoPriceTableMap::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 ChildSocolissimoPriceQuery 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(SocolissimoPriceTableMap::PRICE, $price['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($price['max'])) {
$this->addUsingAlias(SocolissimoPriceTableMap::PRICE, $price['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SocolissimoPriceTableMap::PRICE, $price, $comparison);
}
/**
* Filter the query by a related \SoColissimo\Model\Thelia\Model\Area object
*
* @param \SoColissimo\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 ChildSocolissimoPriceQuery The current query, for fluid interface
*/
public function filterByArea($area, $comparison = null)
{
if ($area instanceof \SoColissimo\Model\Thelia\Model\Area) {
return $this
->addUsingAlias(SocolissimoPriceTableMap::AREA_ID, $area->getId(), $comparison);
} elseif ($area instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SocolissimoPriceTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByArea() only accepts arguments of type \SoColissimo\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 ChildSocolissimoPriceQuery 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 \SoColissimo\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', '\SoColissimo\Model\Thelia\Model\AreaQuery');
}
/**
* Filter the query by a related \SoColissimo\Model\SocolissimoDeliveryMode object
*
* @param \SoColissimo\Model\SocolissimoDeliveryMode|ObjectCollection $socolissimoDeliveryMode The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSocolissimoPriceQuery The current query, for fluid interface
*/
public function filterBySocolissimoDeliveryMode($socolissimoDeliveryMode, $comparison = null)
{
if ($socolissimoDeliveryMode instanceof \SoColissimo\Model\SocolissimoDeliveryMode) {
return $this
->addUsingAlias(SocolissimoPriceTableMap::DELIVERY_MODE_ID, $socolissimoDeliveryMode->getId(), $comparison);
} elseif ($socolissimoDeliveryMode instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SocolissimoPriceTableMap::DELIVERY_MODE_ID, $socolissimoDeliveryMode->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterBySocolissimoDeliveryMode() only accepts arguments of type \SoColissimo\Model\SocolissimoDeliveryMode or Collection');
}
}
/**
* Adds a JOIN clause to the query using the SocolissimoDeliveryMode relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSocolissimoPriceQuery The current query, for fluid interface
*/
public function joinSocolissimoDeliveryMode($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('SocolissimoDeliveryMode');
// 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, 'SocolissimoDeliveryMode');
}
return $this;
}
/**
* Use the SocolissimoDeliveryMode relation SocolissimoDeliveryMode 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 \SoColissimo\Model\SocolissimoDeliveryModeQuery A secondary query class using the current class as primary query
*/
public function useSocolissimoDeliveryModeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinSocolissimoDeliveryMode($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SocolissimoDeliveryMode', '\SoColissimo\Model\SocolissimoDeliveryModeQuery');
}
/**
* Exclude object from result
*
* @param ChildSocolissimoPrice $socolissimoPrice Object to remove from the list of results
*
* @return ChildSocolissimoPriceQuery The current query, for fluid interface
*/
public function prune($socolissimoPrice = null)
{
if ($socolissimoPrice) {
$this->addUsingAlias(SocolissimoPriceTableMap::ID, $socolissimoPrice->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the socolissimo_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(SocolissimoPriceTableMap::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).
SocolissimoPriceTableMap::clearInstancePool();
SocolissimoPriceTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildSocolissimoPrice or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildSocolissimoPrice 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(SocolissimoPriceTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(SocolissimoPriceTableMap::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();
SocolissimoPriceTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
SocolissimoPriceTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // SocolissimoPriceQuery

View File

@@ -0,0 +1,504 @@
<?php
namespace SoColissimo\Model\Map;
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;
use SoColissimo\Model\AddressSocolissimo;
use SoColissimo\Model\AddressSocolissimoQuery;
/**
* This class defines the structure of the 'address_socolissimo' 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 AddressSocolissimoTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'SoColissimo.Model.Map.AddressSocolissimoTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'address_socolissimo';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\SoColissimo\\Model\\AddressSocolissimo';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'SoColissimo.Model.AddressSocolissimo';
/**
* The total number of columns
*/
const NUM_COLUMNS = 14;
/**
* 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 = 14;
/**
* the column name for the ID field
*/
const ID = 'address_socolissimo.ID';
/**
* the column name for the TITLE_ID field
*/
const TITLE_ID = 'address_socolissimo.TITLE_ID';
/**
* the column name for the COMPANY field
*/
const COMPANY = 'address_socolissimo.COMPANY';
/**
* the column name for the FIRSTNAME field
*/
const FIRSTNAME = 'address_socolissimo.FIRSTNAME';
/**
* the column name for the LASTNAME field
*/
const LASTNAME = 'address_socolissimo.LASTNAME';
/**
* the column name for the ADDRESS1 field
*/
const ADDRESS1 = 'address_socolissimo.ADDRESS1';
/**
* the column name for the ADDRESS2 field
*/
const ADDRESS2 = 'address_socolissimo.ADDRESS2';
/**
* the column name for the ADDRESS3 field
*/
const ADDRESS3 = 'address_socolissimo.ADDRESS3';
/**
* the column name for the ZIPCODE field
*/
const ZIPCODE = 'address_socolissimo.ZIPCODE';
/**
* the column name for the CITY field
*/
const CITY = 'address_socolissimo.CITY';
/**
* the column name for the COUNTRY_ID field
*/
const COUNTRY_ID = 'address_socolissimo.COUNTRY_ID';
/**
* the column name for the CODE field
*/
const CODE = 'address_socolissimo.CODE';
/**
* the column name for the TYPE field
*/
const TYPE = 'address_socolissimo.TYPE';
/**
* the column name for the CELLPHONE field
*/
const CELLPHONE = 'address_socolissimo.CELLPHONE';
/**
* 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', 'TitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Code', 'Type', 'Cellphone', ),
self::TYPE_STUDLYPHPNAME => array('id', 'titleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'code', 'type', 'cellphone', ),
self::TYPE_COLNAME => array(AddressSocolissimoTableMap::ID, AddressSocolissimoTableMap::TITLE_ID, AddressSocolissimoTableMap::COMPANY, AddressSocolissimoTableMap::FIRSTNAME, AddressSocolissimoTableMap::LASTNAME, AddressSocolissimoTableMap::ADDRESS1, AddressSocolissimoTableMap::ADDRESS2, AddressSocolissimoTableMap::ADDRESS3, AddressSocolissimoTableMap::ZIPCODE, AddressSocolissimoTableMap::CITY, AddressSocolissimoTableMap::COUNTRY_ID, AddressSocolissimoTableMap::CODE, AddressSocolissimoTableMap::TYPE, AddressSocolissimoTableMap::CELLPHONE, ),
self::TYPE_RAW_COLNAME => array('ID', 'TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'CODE', 'TYPE', 'CELLPHONE', ),
self::TYPE_FIELDNAME => array('id', 'title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'code', 'type', 'cellphone', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
);
/**
* 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, 'TitleId' => 1, 'Company' => 2, 'Firstname' => 3, 'Lastname' => 4, 'Address1' => 5, 'Address2' => 6, 'Address3' => 7, 'Zipcode' => 8, 'City' => 9, 'CountryId' => 10, 'Code' => 11, 'Type' => 12, 'Cellphone' => 13, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'titleId' => 1, 'company' => 2, 'firstname' => 3, 'lastname' => 4, 'address1' => 5, 'address2' => 6, 'address3' => 7, 'zipcode' => 8, 'city' => 9, 'countryId' => 10, 'code' => 11, 'type' => 12, 'cellphone' => 13, ),
self::TYPE_COLNAME => array(AddressSocolissimoTableMap::ID => 0, AddressSocolissimoTableMap::TITLE_ID => 1, AddressSocolissimoTableMap::COMPANY => 2, AddressSocolissimoTableMap::FIRSTNAME => 3, AddressSocolissimoTableMap::LASTNAME => 4, AddressSocolissimoTableMap::ADDRESS1 => 5, AddressSocolissimoTableMap::ADDRESS2 => 6, AddressSocolissimoTableMap::ADDRESS3 => 7, AddressSocolissimoTableMap::ZIPCODE => 8, AddressSocolissimoTableMap::CITY => 9, AddressSocolissimoTableMap::COUNTRY_ID => 10, AddressSocolissimoTableMap::CODE => 11, AddressSocolissimoTableMap::TYPE => 12, AddressSocolissimoTableMap::CELLPHONE => 13, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE_ID' => 1, 'COMPANY' => 2, 'FIRSTNAME' => 3, 'LASTNAME' => 4, 'ADDRESS1' => 5, 'ADDRESS2' => 6, 'ADDRESS3' => 7, 'ZIPCODE' => 8, 'CITY' => 9, 'COUNTRY_ID' => 10, 'CODE' => 11, 'TYPE' => 12, 'CELLPHONE' => 13, ),
self::TYPE_FIELDNAME => array('id' => 0, 'title_id' => 1, 'company' => 2, 'firstname' => 3, 'lastname' => 4, 'address1' => 5, 'address2' => 6, 'address3' => 7, 'zipcode' => 8, 'city' => 9, 'country_id' => 10, 'code' => 11, 'type' => 12, 'cellphone' => 13, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
);
/**
* 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('address_socolissimo');
$this->setPhpName('AddressSocolissimo');
$this->setClassName('\\SoColissimo\\Model\\AddressSocolissimo');
$this->setPackage('SoColissimo.Model');
$this->setUseIdGenerator(false);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('TITLE_ID', 'TitleId', 'INTEGER', 'customer_title', 'ID', true, null, null);
$this->addColumn('COMPANY', 'Company', 'VARCHAR', false, 255, null);
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', true, 255, null);
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', true, 255, null);
$this->addColumn('ADDRESS1', 'Address1', 'VARCHAR', true, 255, null);
$this->addColumn('ADDRESS2', 'Address2', 'VARCHAR', true, 255, null);
$this->addColumn('ADDRESS3', 'Address3', 'VARCHAR', true, 255, null);
$this->addColumn('ZIPCODE', 'Zipcode', 'VARCHAR', true, 10, null);
$this->addColumn('CITY', 'City', 'VARCHAR', true, 255, null);
$this->addForeignKey('COUNTRY_ID', 'CountryId', 'INTEGER', 'country', 'ID', true, null, null);
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 10, null);
$this->addColumn('TYPE', 'Type', 'VARCHAR', true, 10, null);
$this->addColumn('CELLPHONE', 'Cellphone', 'VARCHAR', false, 20, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CustomerTitle', '\\SoColissimo\\Model\\Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('title_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('Country', '\\SoColissimo\\Model\\Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('country_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 ? AddressSocolissimoTableMap::CLASS_DEFAULT : AddressSocolissimoTableMap::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 (AddressSocolissimo object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = AddressSocolissimoTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = AddressSocolissimoTableMap::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 + AddressSocolissimoTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = AddressSocolissimoTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
AddressSocolissimoTableMap::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 = AddressSocolissimoTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = AddressSocolissimoTableMap::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;
AddressSocolissimoTableMap::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(AddressSocolissimoTableMap::ID);
$criteria->addSelectColumn(AddressSocolissimoTableMap::TITLE_ID);
$criteria->addSelectColumn(AddressSocolissimoTableMap::COMPANY);
$criteria->addSelectColumn(AddressSocolissimoTableMap::FIRSTNAME);
$criteria->addSelectColumn(AddressSocolissimoTableMap::LASTNAME);
$criteria->addSelectColumn(AddressSocolissimoTableMap::ADDRESS1);
$criteria->addSelectColumn(AddressSocolissimoTableMap::ADDRESS2);
$criteria->addSelectColumn(AddressSocolissimoTableMap::ADDRESS3);
$criteria->addSelectColumn(AddressSocolissimoTableMap::ZIPCODE);
$criteria->addSelectColumn(AddressSocolissimoTableMap::CITY);
$criteria->addSelectColumn(AddressSocolissimoTableMap::COUNTRY_ID);
$criteria->addSelectColumn(AddressSocolissimoTableMap::CODE);
$criteria->addSelectColumn(AddressSocolissimoTableMap::TYPE);
$criteria->addSelectColumn(AddressSocolissimoTableMap::CELLPHONE);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.TITLE_ID');
$criteria->addSelectColumn($alias . '.COMPANY');
$criteria->addSelectColumn($alias . '.FIRSTNAME');
$criteria->addSelectColumn($alias . '.LASTNAME');
$criteria->addSelectColumn($alias . '.ADDRESS1');
$criteria->addSelectColumn($alias . '.ADDRESS2');
$criteria->addSelectColumn($alias . '.ADDRESS3');
$criteria->addSelectColumn($alias . '.ZIPCODE');
$criteria->addSelectColumn($alias . '.CITY');
$criteria->addSelectColumn($alias . '.COUNTRY_ID');
$criteria->addSelectColumn($alias . '.CODE');
$criteria->addSelectColumn($alias . '.TYPE');
$criteria->addSelectColumn($alias . '.CELLPHONE');
}
}
/**
* 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(AddressSocolissimoTableMap::DATABASE_NAME)->getTable(AddressSocolissimoTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(AddressSocolissimoTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(AddressSocolissimoTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new AddressSocolissimoTableMap());
}
}
/**
* Performs a DELETE on the database, given a AddressSocolissimo or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or AddressSocolissimo 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(AddressSocolissimoTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \SoColissimo\Model\AddressSocolissimo) { // 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(AddressSocolissimoTableMap::DATABASE_NAME);
$criteria->add(AddressSocolissimoTableMap::ID, (array) $values, Criteria::IN);
}
$query = AddressSocolissimoQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { AddressSocolissimoTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { AddressSocolissimoTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the address_socolissimo 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 AddressSocolissimoQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a AddressSocolissimo or Criteria object.
*
* @param mixed $criteria Criteria or AddressSocolissimo 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(AddressSocolissimoTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from AddressSocolissimo object
}
// Set the correct dbName
$query = AddressSocolissimoQuery::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;
}
} // AddressSocolissimoTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
AddressSocolissimoTableMap::buildTableMap();

View File

@@ -0,0 +1,415 @@
<?php
namespace SoColissimo\Model\Map;
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;
use SoColissimo\Model\OrderAddressSocolissimo;
use SoColissimo\Model\OrderAddressSocolissimoQuery;
/**
* This class defines the structure of the 'order_address_socolissimo' 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 OrderAddressSocolissimoTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'SoColissimo.Model.Map.OrderAddressSocolissimoTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'order_address_socolissimo';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\SoColissimo\\Model\\OrderAddressSocolissimo';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'SoColissimo.Model.OrderAddressSocolissimo';
/**
* The total number of columns
*/
const NUM_COLUMNS = 3;
/**
* 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 = 3;
/**
* the column name for the ID field
*/
const ID = 'order_address_socolissimo.ID';
/**
* the column name for the CODE field
*/
const CODE = 'order_address_socolissimo.CODE';
/**
* the column name for the TYPE field
*/
const TYPE = 'order_address_socolissimo.TYPE';
/**
* The default string format for model objects of the related table
*/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', ),
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', ),
self::TYPE_COLNAME => array(OrderAddressSocolissimoTableMap::ID, OrderAddressSocolissimoTableMap::CODE, OrderAddressSocolissimoTableMap::TYPE, ),
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', ),
self::TYPE_FIELDNAME => array('id', 'code', 'type', ),
self::TYPE_NUM => array(0, 1, 2, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, ),
self::TYPE_COLNAME => array(OrderAddressSocolissimoTableMap::ID => 0, OrderAddressSocolissimoTableMap::CODE => 1, OrderAddressSocolissimoTableMap::TYPE => 2, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, ),
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, ),
self::TYPE_NUM => array(0, 1, 2, )
);
/**
* Initialize the table attributes and columns
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('order_address_socolissimo');
$this->setPhpName('OrderAddressSocolissimo');
$this->setClassName('\\SoColissimo\\Model\\OrderAddressSocolissimo');
$this->setPackage('SoColissimo.Model');
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'order_address', 'ID', true, null, null);
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 10, null);
$this->addColumn('TYPE', 'Type', 'VARCHAR', true, 10, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('OrderAddress', '\\SoColissimo\\Model\\Thelia\\Model\\OrderAddress', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', 'CASCADE');
} // 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 ? OrderAddressSocolissimoTableMap::CLASS_DEFAULT : OrderAddressSocolissimoTableMap::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 (OrderAddressSocolissimo object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = OrderAddressSocolissimoTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = OrderAddressSocolissimoTableMap::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 + OrderAddressSocolissimoTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = OrderAddressSocolissimoTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
OrderAddressSocolissimoTableMap::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 = OrderAddressSocolissimoTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = OrderAddressSocolissimoTableMap::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;
OrderAddressSocolissimoTableMap::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(OrderAddressSocolissimoTableMap::ID);
$criteria->addSelectColumn(OrderAddressSocolissimoTableMap::CODE);
$criteria->addSelectColumn(OrderAddressSocolissimoTableMap::TYPE);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.CODE');
$criteria->addSelectColumn($alias . '.TYPE');
}
}
/**
* 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(OrderAddressSocolissimoTableMap::DATABASE_NAME)->getTable(OrderAddressSocolissimoTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(OrderAddressSocolissimoTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(OrderAddressSocolissimoTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new OrderAddressSocolissimoTableMap());
}
}
/**
* Performs a DELETE on the database, given a OrderAddressSocolissimo or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or OrderAddressSocolissimo 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(OrderAddressSocolissimoTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \SoColissimo\Model\OrderAddressSocolissimo) { // 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(OrderAddressSocolissimoTableMap::DATABASE_NAME);
$criteria->add(OrderAddressSocolissimoTableMap::ID, (array) $values, Criteria::IN);
}
$query = OrderAddressSocolissimoQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { OrderAddressSocolissimoTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { OrderAddressSocolissimoTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the order_address_socolissimo 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 OrderAddressSocolissimoQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a OrderAddressSocolissimo or Criteria object.
*
* @param mixed $criteria Criteria or OrderAddressSocolissimo 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(OrderAddressSocolissimoTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from OrderAddressSocolissimo object
}
// Set the correct dbName
$query = OrderAddressSocolissimoQuery::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;
}
} // OrderAddressSocolissimoTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
OrderAddressSocolissimoTableMap::buildTableMap();

View File

@@ -0,0 +1,428 @@
<?php
namespace SoColissimo\Model\Map;
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;
use SoColissimo\Model\SocolissimoAreaFreeshippingDom;
use SoColissimo\Model\SocolissimoAreaFreeshippingDomQuery;
/**
* This class defines the structure of the 'socolissimo_area_freeshipping_dom' 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 SocolissimoAreaFreeshippingDomTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'SoColissimo.Model.Map.SocolissimoAreaFreeshippingDomTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'socolissimo_area_freeshipping_dom';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\SoColissimo\\Model\\SocolissimoAreaFreeshippingDom';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'SoColissimo.Model.SocolissimoAreaFreeshippingDom';
/**
* 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 = 'socolissimo_area_freeshipping_dom.ID';
/**
* the column name for the AREA_ID field
*/
const AREA_ID = 'socolissimo_area_freeshipping_dom.AREA_ID';
/**
* the column name for the DELIVERY_MODE_ID field
*/
const DELIVERY_MODE_ID = 'socolissimo_area_freeshipping_dom.DELIVERY_MODE_ID';
/**
* the column name for the CART_AMOUNT field
*/
const CART_AMOUNT = 'socolissimo_area_freeshipping_dom.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(SocolissimoAreaFreeshippingDomTableMap::ID, SocolissimoAreaFreeshippingDomTableMap::AREA_ID, SocolissimoAreaFreeshippingDomTableMap::DELIVERY_MODE_ID, SocolissimoAreaFreeshippingDomTableMap::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(SocolissimoAreaFreeshippingDomTableMap::ID => 0, SocolissimoAreaFreeshippingDomTableMap::AREA_ID => 1, SocolissimoAreaFreeshippingDomTableMap::DELIVERY_MODE_ID => 2, SocolissimoAreaFreeshippingDomTableMap::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('socolissimo_area_freeshipping_dom');
$this->setPhpName('SocolissimoAreaFreeshippingDom');
$this->setClassName('\\SoColissimo\\Model\\SocolissimoAreaFreeshippingDom');
$this->setPackage('SoColissimo.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', 'socolissimo_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', '\\SoColissimo\\Model\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('SocolissimoDeliveryMode', '\\SoColissimo\\Model\\SocolissimoDeliveryMode', 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 ? SocolissimoAreaFreeshippingDomTableMap::CLASS_DEFAULT : SocolissimoAreaFreeshippingDomTableMap::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 (SocolissimoAreaFreeshippingDom object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = SocolissimoAreaFreeshippingDomTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = SocolissimoAreaFreeshippingDomTableMap::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 + SocolissimoAreaFreeshippingDomTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = SocolissimoAreaFreeshippingDomTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
SocolissimoAreaFreeshippingDomTableMap::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 = SocolissimoAreaFreeshippingDomTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = SocolissimoAreaFreeshippingDomTableMap::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;
SocolissimoAreaFreeshippingDomTableMap::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(SocolissimoAreaFreeshippingDomTableMap::ID);
$criteria->addSelectColumn(SocolissimoAreaFreeshippingDomTableMap::AREA_ID);
$criteria->addSelectColumn(SocolissimoAreaFreeshippingDomTableMap::DELIVERY_MODE_ID);
$criteria->addSelectColumn(SocolissimoAreaFreeshippingDomTableMap::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(SocolissimoAreaFreeshippingDomTableMap::DATABASE_NAME)->getTable(SocolissimoAreaFreeshippingDomTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(SocolissimoAreaFreeshippingDomTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(SocolissimoAreaFreeshippingDomTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new SocolissimoAreaFreeshippingDomTableMap());
}
}
/**
* Performs a DELETE on the database, given a SocolissimoAreaFreeshippingDom or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or SocolissimoAreaFreeshippingDom 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(SocolissimoAreaFreeshippingDomTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \SoColissimo\Model\SocolissimoAreaFreeshippingDom) { // 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(SocolissimoAreaFreeshippingDomTableMap::DATABASE_NAME);
$criteria->add(SocolissimoAreaFreeshippingDomTableMap::ID, (array) $values, Criteria::IN);
}
$query = SocolissimoAreaFreeshippingDomQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { SocolissimoAreaFreeshippingDomTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { SocolissimoAreaFreeshippingDomTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the socolissimo_area_freeshipping_dom 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 SocolissimoAreaFreeshippingDomQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a SocolissimoAreaFreeshippingDom or Criteria object.
*
* @param mixed $criteria Criteria or SocolissimoAreaFreeshippingDom 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(SocolissimoAreaFreeshippingDomTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from SocolissimoAreaFreeshippingDom object
}
if ($criteria->containsKey(SocolissimoAreaFreeshippingDomTableMap::ID) && $criteria->keyContainsValue(SocolissimoAreaFreeshippingDomTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.SocolissimoAreaFreeshippingDomTableMap::ID.')');
}
// Set the correct dbName
$query = SocolissimoAreaFreeshippingDomQuery::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;
}
} // SocolissimoAreaFreeshippingDomTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
SocolissimoAreaFreeshippingDomTableMap::buildTableMap();

View File

@@ -0,0 +1,428 @@
<?php
namespace SoColissimo\Model\Map;
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;
use SoColissimo\Model\SocolissimoAreaFreeshippingPr;
use SoColissimo\Model\SocolissimoAreaFreeshippingPrQuery;
/**
* This class defines the structure of the 'socolissimo_area_freeshipping_pr' 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 SocolissimoAreaFreeshippingPrTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'SoColissimo.Model.Map.SocolissimoAreaFreeshippingPrTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'socolissimo_area_freeshipping_pr';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\SoColissimo\\Model\\SocolissimoAreaFreeshippingPr';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'SoColissimo.Model.SocolissimoAreaFreeshippingPr';
/**
* 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 = 'socolissimo_area_freeshipping_pr.ID';
/**
* the column name for the AREA_ID field
*/
const AREA_ID = 'socolissimo_area_freeshipping_pr.AREA_ID';
/**
* the column name for the DELIVERY_MODE_ID field
*/
const DELIVERY_MODE_ID = 'socolissimo_area_freeshipping_pr.DELIVERY_MODE_ID';
/**
* the column name for the CART_AMOUNT field
*/
const CART_AMOUNT = 'socolissimo_area_freeshipping_pr.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(SocolissimoAreaFreeshippingPrTableMap::ID, SocolissimoAreaFreeshippingPrTableMap::AREA_ID, SocolissimoAreaFreeshippingPrTableMap::DELIVERY_MODE_ID, SocolissimoAreaFreeshippingPrTableMap::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(SocolissimoAreaFreeshippingPrTableMap::ID => 0, SocolissimoAreaFreeshippingPrTableMap::AREA_ID => 1, SocolissimoAreaFreeshippingPrTableMap::DELIVERY_MODE_ID => 2, SocolissimoAreaFreeshippingPrTableMap::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('socolissimo_area_freeshipping_pr');
$this->setPhpName('SocolissimoAreaFreeshippingPr');
$this->setClassName('\\SoColissimo\\Model\\SocolissimoAreaFreeshippingPr');
$this->setPackage('SoColissimo.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', 'socolissimo_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', '\\SoColissimo\\Model\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('SocolissimoDeliveryMode', '\\SoColissimo\\Model\\SocolissimoDeliveryMode', 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 ? SocolissimoAreaFreeshippingPrTableMap::CLASS_DEFAULT : SocolissimoAreaFreeshippingPrTableMap::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 (SocolissimoAreaFreeshippingPr object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = SocolissimoAreaFreeshippingPrTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = SocolissimoAreaFreeshippingPrTableMap::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 + SocolissimoAreaFreeshippingPrTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = SocolissimoAreaFreeshippingPrTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
SocolissimoAreaFreeshippingPrTableMap::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 = SocolissimoAreaFreeshippingPrTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = SocolissimoAreaFreeshippingPrTableMap::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;
SocolissimoAreaFreeshippingPrTableMap::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(SocolissimoAreaFreeshippingPrTableMap::ID);
$criteria->addSelectColumn(SocolissimoAreaFreeshippingPrTableMap::AREA_ID);
$criteria->addSelectColumn(SocolissimoAreaFreeshippingPrTableMap::DELIVERY_MODE_ID);
$criteria->addSelectColumn(SocolissimoAreaFreeshippingPrTableMap::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(SocolissimoAreaFreeshippingPrTableMap::DATABASE_NAME)->getTable(SocolissimoAreaFreeshippingPrTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(SocolissimoAreaFreeshippingPrTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(SocolissimoAreaFreeshippingPrTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new SocolissimoAreaFreeshippingPrTableMap());
}
}
/**
* Performs a DELETE on the database, given a SocolissimoAreaFreeshippingPr or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or SocolissimoAreaFreeshippingPr 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(SocolissimoAreaFreeshippingPrTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \SoColissimo\Model\SocolissimoAreaFreeshippingPr) { // 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(SocolissimoAreaFreeshippingPrTableMap::DATABASE_NAME);
$criteria->add(SocolissimoAreaFreeshippingPrTableMap::ID, (array) $values, Criteria::IN);
}
$query = SocolissimoAreaFreeshippingPrQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { SocolissimoAreaFreeshippingPrTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { SocolissimoAreaFreeshippingPrTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the socolissimo_area_freeshipping_pr 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 SocolissimoAreaFreeshippingPrQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a SocolissimoAreaFreeshippingPr or Criteria object.
*
* @param mixed $criteria Criteria or SocolissimoAreaFreeshippingPr 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(SocolissimoAreaFreeshippingPrTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from SocolissimoAreaFreeshippingPr object
}
if ($criteria->containsKey(SocolissimoAreaFreeshippingPrTableMap::ID) && $criteria->keyContainsValue(SocolissimoAreaFreeshippingPrTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.SocolissimoAreaFreeshippingPrTableMap::ID.')');
}
// Set the correct dbName
$query = SocolissimoAreaFreeshippingPrQuery::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;
}
} // SocolissimoAreaFreeshippingPrTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
SocolissimoAreaFreeshippingPrTableMap::buildTableMap();

View File

@@ -0,0 +1,428 @@
<?php
namespace SoColissimo\Model\Map;
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;
use SoColissimo\Model\SocolissimoAreaFreeshipping;
use SoColissimo\Model\SocolissimoAreaFreeshippingQuery;
/**
* This class defines the structure of the 'socolissimo_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 SocolissimoAreaFreeshippingTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'SoColissimo.Model.Map.SocolissimoAreaFreeshippingTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'socolissimo_area_freeshipping';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\SoColissimo\\Model\\SocolissimoAreaFreeshipping';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'SoColissimo.Model.SocolissimoAreaFreeshipping';
/**
* 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 = 'socolissimo_area_freeshipping.ID';
/**
* the column name for the AREA_ID field
*/
const AREA_ID = 'socolissimo_area_freeshipping.AREA_ID';
/**
* the column name for the DELIVERY_MODE_ID field
*/
const DELIVERY_MODE_ID = 'socolissimo_area_freeshipping.DELIVERY_MODE_ID';
/**
* the column name for the CART_AMOUNT field
*/
const CART_AMOUNT = 'socolissimo_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(SocolissimoAreaFreeshippingTableMap::ID, SocolissimoAreaFreeshippingTableMap::AREA_ID, SocolissimoAreaFreeshippingTableMap::DELIVERY_MODE_ID, SocolissimoAreaFreeshippingTableMap::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(SocolissimoAreaFreeshippingTableMap::ID => 0, SocolissimoAreaFreeshippingTableMap::AREA_ID => 1, SocolissimoAreaFreeshippingTableMap::DELIVERY_MODE_ID => 2, SocolissimoAreaFreeshippingTableMap::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('socolissimo_area_freeshipping');
$this->setPhpName('SocolissimoAreaFreeshipping');
$this->setClassName('\\SoColissimo\\Model\\SocolissimoAreaFreeshipping');
$this->setPackage('SoColissimo.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', 'socolissimo_delivery_mode', 'ID', true, null, null);
$this->addColumn('CART_AMOUNT', 'CartAmount', 'DECIMAL', true, 16, 0);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('Area', '\\SoColissimo\\Model\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('SocolissimoDeliveryMode', '\\SoColissimo\\Model\\SocolissimoDeliveryMode', 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 ? SocolissimoAreaFreeshippingTableMap::CLASS_DEFAULT : SocolissimoAreaFreeshippingTableMap::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 (SocolissimoAreaFreeshipping object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = SocolissimoAreaFreeshippingTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = SocolissimoAreaFreeshippingTableMap::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 + SocolissimoAreaFreeshippingTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = SocolissimoAreaFreeshippingTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
SocolissimoAreaFreeshippingTableMap::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 = SocolissimoAreaFreeshippingTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = SocolissimoAreaFreeshippingTableMap::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;
SocolissimoAreaFreeshippingTableMap::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(SocolissimoAreaFreeshippingTableMap::ID);
$criteria->addSelectColumn(SocolissimoAreaFreeshippingTableMap::AREA_ID);
$criteria->addSelectColumn(SocolissimoAreaFreeshippingTableMap::DELIVERY_MODE_ID);
$criteria->addSelectColumn(SocolissimoAreaFreeshippingTableMap::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(SocolissimoAreaFreeshippingTableMap::DATABASE_NAME)->getTable(SocolissimoAreaFreeshippingTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(SocolissimoAreaFreeshippingTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(SocolissimoAreaFreeshippingTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new SocolissimoAreaFreeshippingTableMap());
}
}
/**
* Performs a DELETE on the database, given a SocolissimoAreaFreeshipping or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or SocolissimoAreaFreeshipping 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(SocolissimoAreaFreeshippingTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \SoColissimo\Model\SocolissimoAreaFreeshipping) { // 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(SocolissimoAreaFreeshippingTableMap::DATABASE_NAME);
$criteria->add(SocolissimoAreaFreeshippingTableMap::ID, (array) $values, Criteria::IN);
}
$query = SocolissimoAreaFreeshippingQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { SocolissimoAreaFreeshippingTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { SocolissimoAreaFreeshippingTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the socolissimo_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 SocolissimoAreaFreeshippingQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a SocolissimoAreaFreeshipping or Criteria object.
*
* @param mixed $criteria Criteria or SocolissimoAreaFreeshipping 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(SocolissimoAreaFreeshippingTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from SocolissimoAreaFreeshipping object
}
if ($criteria->containsKey(SocolissimoAreaFreeshippingTableMap::ID) && $criteria->keyContainsValue(SocolissimoAreaFreeshippingTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.SocolissimoAreaFreeshippingTableMap::ID.')');
}
// Set the correct dbName
$query = SocolissimoAreaFreeshippingQuery::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;
}
} // SocolissimoAreaFreeshippingTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
SocolissimoAreaFreeshippingTableMap::buildTableMap();

View File

@@ -0,0 +1,437 @@
<?php
namespace SoColissimo\Model\Map;
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;
use SoColissimo\Model\SocolissimoDeliveryMode;
use SoColissimo\Model\SocolissimoDeliveryModeQuery;
/**
* This class defines the structure of the 'socolissimo_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 SocolissimoDeliveryModeTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'SoColissimo.Model.Map.SocolissimoDeliveryModeTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'socolissimo_delivery_mode';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\SoColissimo\\Model\\SocolissimoDeliveryMode';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'SoColissimo.Model.SocolissimoDeliveryMode';
/**
* 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 = 'socolissimo_delivery_mode.ID';
/**
* the column name for the TITLE field
*/
const TITLE = 'socolissimo_delivery_mode.TITLE';
/**
* the column name for the CODE field
*/
const CODE = 'socolissimo_delivery_mode.CODE';
/**
* the column name for the FREESHIPPING_ACTIVE field
*/
const FREESHIPPING_ACTIVE = 'socolissimo_delivery_mode.FREESHIPPING_ACTIVE';
/**
* the column name for the FREESHIPPING_FROM field
*/
const FREESHIPPING_FROM = 'socolissimo_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(SocolissimoDeliveryModeTableMap::ID, SocolissimoDeliveryModeTableMap::TITLE, SocolissimoDeliveryModeTableMap::CODE, SocolissimoDeliveryModeTableMap::FREESHIPPING_ACTIVE, SocolissimoDeliveryModeTableMap::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(SocolissimoDeliveryModeTableMap::ID => 0, SocolissimoDeliveryModeTableMap::TITLE => 1, SocolissimoDeliveryModeTableMap::CODE => 2, SocolissimoDeliveryModeTableMap::FREESHIPPING_ACTIVE => 3, SocolissimoDeliveryModeTableMap::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('socolissimo_delivery_mode');
$this->setPhpName('SocolissimoDeliveryMode');
$this->setClassName('\\SoColissimo\\Model\\SocolissimoDeliveryMode');
$this->setPackage('SoColissimo.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('SocolissimoPrice', '\\SoColissimo\\Model\\SocolissimoPrice', RelationMap::ONE_TO_MANY, array('id' => 'delivery_mode_id', ), 'RESTRICT', 'RESTRICT', 'SocolissimoPrices');
$this->addRelation('SocolissimoAreaFreeshippingDom', '\\SoColissimo\\Model\\SocolissimoAreaFreeshippingDom', RelationMap::ONE_TO_MANY, array('id' => 'delivery_mode_id', ), 'RESTRICT', 'RESTRICT', 'SocolissimoAreaFreeshippingDoms');
$this->addRelation('SocolissimoAreaFreeshippingPr', '\\SoColissimo\\Model\\SocolissimoAreaFreeshippingPr', RelationMap::ONE_TO_MANY, array('id' => 'delivery_mode_id', ), 'RESTRICT', 'RESTRICT', 'SocolissimoAreaFreeshippingPrs');
} // 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 ? SocolissimoDeliveryModeTableMap::CLASS_DEFAULT : SocolissimoDeliveryModeTableMap::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 (SocolissimoDeliveryMode object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = SocolissimoDeliveryModeTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = SocolissimoDeliveryModeTableMap::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 + SocolissimoDeliveryModeTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = SocolissimoDeliveryModeTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
SocolissimoDeliveryModeTableMap::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 = SocolissimoDeliveryModeTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = SocolissimoDeliveryModeTableMap::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;
SocolissimoDeliveryModeTableMap::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(SocolissimoDeliveryModeTableMap::ID);
$criteria->addSelectColumn(SocolissimoDeliveryModeTableMap::TITLE);
$criteria->addSelectColumn(SocolissimoDeliveryModeTableMap::CODE);
$criteria->addSelectColumn(SocolissimoDeliveryModeTableMap::FREESHIPPING_ACTIVE);
$criteria->addSelectColumn(SocolissimoDeliveryModeTableMap::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(SocolissimoDeliveryModeTableMap::DATABASE_NAME)->getTable(SocolissimoDeliveryModeTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(SocolissimoDeliveryModeTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(SocolissimoDeliveryModeTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new SocolissimoDeliveryModeTableMap());
}
}
/**
* Performs a DELETE on the database, given a SocolissimoDeliveryMode or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or SocolissimoDeliveryMode 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(SocolissimoDeliveryModeTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \SoColissimo\Model\SocolissimoDeliveryMode) { // 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(SocolissimoDeliveryModeTableMap::DATABASE_NAME);
$criteria->add(SocolissimoDeliveryModeTableMap::ID, (array) $values, Criteria::IN);
}
$query = SocolissimoDeliveryModeQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { SocolissimoDeliveryModeTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { SocolissimoDeliveryModeTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the socolissimo_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 SocolissimoDeliveryModeQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a SocolissimoDeliveryMode or Criteria object.
*
* @param mixed $criteria Criteria or SocolissimoDeliveryMode 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(SocolissimoDeliveryModeTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from SocolissimoDeliveryMode object
}
if ($criteria->containsKey(SocolissimoDeliveryModeTableMap::ID) && $criteria->keyContainsValue(SocolissimoDeliveryModeTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.SocolissimoDeliveryModeTableMap::ID.')');
}
// Set the correct dbName
$query = SocolissimoDeliveryModeQuery::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;
}
} // SocolissimoDeliveryModeTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
SocolissimoDeliveryModeTableMap::buildTableMap();

View File

@@ -0,0 +1,439 @@
<?php
namespace SoColissimo\Model\Map;
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;
use SoColissimo\Model\SocolissimoFreeshipping;
use SoColissimo\Model\SocolissimoFreeshippingQuery;
/**
* This class defines the structure of the 'socolissimo_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 SocolissimoFreeshippingTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'SoColissimo.Model.Map.SocolissimoFreeshippingTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'socolissimo_freeshipping';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\SoColissimo\\Model\\SocolissimoFreeshipping';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'SoColissimo.Model.SocolissimoFreeshipping';
/**
* 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 = 'socolissimo_freeshipping.ID';
/**
* the column name for the ACTIVE field
*/
const ACTIVE = 'socolissimo_freeshipping.ACTIVE';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'socolissimo_freeshipping.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'socolissimo_freeshipping.UPDATED_AT';
/**
* The default string format for model objects of the related table
*/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Active', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'active', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(SocolissimoFreeshippingTableMap::ID, SocolissimoFreeshippingTableMap::ACTIVE, SocolissimoFreeshippingTableMap::CREATED_AT, SocolissimoFreeshippingTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'ACTIVE', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'active', 'created_at', 'updated_at', ),
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, 'Active' => 1, 'CreatedAt' => 2, 'UpdatedAt' => 3, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'active' => 1, 'createdAt' => 2, 'updatedAt' => 3, ),
self::TYPE_COLNAME => array(SocolissimoFreeshippingTableMap::ID => 0, SocolissimoFreeshippingTableMap::ACTIVE => 1, SocolissimoFreeshippingTableMap::CREATED_AT => 2, SocolissimoFreeshippingTableMap::UPDATED_AT => 3, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ACTIVE' => 1, 'CREATED_AT' => 2, 'UPDATED_AT' => 3, ),
self::TYPE_FIELDNAME => array('id' => 0, 'active' => 1, 'created_at' => 2, 'updated_at' => 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('socolissimo_freeshipping');
$this->setPhpName('SocolissimoFreeshipping');
$this->setClassName('\\SoColissimo\\Model\\SocolissimoFreeshipping');
$this->setPackage('SoColissimo.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('ACTIVE', 'Active', 'BOOLEAN', true, 1, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
);
} // getBehaviors()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*/
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
// If the PK cannot be derived from the row, return NULL.
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
return (int) $row[
$indexType == TableMap::TYPE_NUM
? 0 + $offset
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
];
}
/**
* The class that the tableMap will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is translated into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
*/
public static function getOMClass($withPrefix = true)
{
return $withPrefix ? SocolissimoFreeshippingTableMap::CLASS_DEFAULT : SocolissimoFreeshippingTableMap::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 (SocolissimoFreeshipping object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = SocolissimoFreeshippingTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = SocolissimoFreeshippingTableMap::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 + SocolissimoFreeshippingTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = SocolissimoFreeshippingTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
SocolissimoFreeshippingTableMap::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 = SocolissimoFreeshippingTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = SocolissimoFreeshippingTableMap::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;
SocolissimoFreeshippingTableMap::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(SocolissimoFreeshippingTableMap::ID);
$criteria->addSelectColumn(SocolissimoFreeshippingTableMap::ACTIVE);
$criteria->addSelectColumn(SocolissimoFreeshippingTableMap::CREATED_AT);
$criteria->addSelectColumn(SocolissimoFreeshippingTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.ACTIVE');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the TableMap related to this object.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getServiceContainer()->getDatabaseMap(SocolissimoFreeshippingTableMap::DATABASE_NAME)->getTable(SocolissimoFreeshippingTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(SocolissimoFreeshippingTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(SocolissimoFreeshippingTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new SocolissimoFreeshippingTableMap());
}
}
/**
* Performs a DELETE on the database, given a SocolissimoFreeshipping or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or SocolissimoFreeshipping 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(SocolissimoFreeshippingTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \SoColissimo\Model\SocolissimoFreeshipping) { // 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(SocolissimoFreeshippingTableMap::DATABASE_NAME);
$criteria->add(SocolissimoFreeshippingTableMap::ID, (array) $values, Criteria::IN);
}
$query = SocolissimoFreeshippingQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { SocolissimoFreeshippingTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { SocolissimoFreeshippingTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the socolissimo_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 SocolissimoFreeshippingQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a SocolissimoFreeshipping or Criteria object.
*
* @param mixed $criteria Criteria or SocolissimoFreeshipping 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(SocolissimoFreeshippingTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from SocolissimoFreeshipping object
}
if ($criteria->containsKey(SocolissimoFreeshippingTableMap::ID) && $criteria->keyContainsValue(SocolissimoFreeshippingTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.SocolissimoFreeshippingTableMap::ID.')');
}
// Set the correct dbName
$query = SocolissimoFreeshippingQuery::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;
}
} // SocolissimoFreeshippingTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
SocolissimoFreeshippingTableMap::buildTableMap();

View File

@@ -0,0 +1,452 @@
<?php
namespace SoColissimo\Model\Map;
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;
use SoColissimo\Model\SocolissimoPrice;
use SoColissimo\Model\SocolissimoPriceQuery;
/**
* This class defines the structure of the 'socolissimo_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 SocolissimoPriceTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'SoColissimo.Model.Map.SocolissimoPriceTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'socolissimo_price';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\SoColissimo\\Model\\SocolissimoPrice';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'SoColissimo.Model.SocolissimoPrice';
/**
* 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 = 'socolissimo_price.ID';
/**
* the column name for the AREA_ID field
*/
const AREA_ID = 'socolissimo_price.AREA_ID';
/**
* the column name for the DELIVERY_MODE_ID field
*/
const DELIVERY_MODE_ID = 'socolissimo_price.DELIVERY_MODE_ID';
/**
* the column name for the WEIGHT_MAX field
*/
const WEIGHT_MAX = 'socolissimo_price.WEIGHT_MAX';
/**
* the column name for the PRICE_MAX field
*/
const PRICE_MAX = 'socolissimo_price.PRICE_MAX';
/**
* the column name for the FRANCO_MIN_PRICE field
*/
const FRANCO_MIN_PRICE = 'socolissimo_price.FRANCO_MIN_PRICE';
/**
* the column name for the PRICE field
*/
const PRICE = 'socolissimo_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(SocolissimoPriceTableMap::ID, SocolissimoPriceTableMap::AREA_ID, SocolissimoPriceTableMap::DELIVERY_MODE_ID, SocolissimoPriceTableMap::WEIGHT_MAX, SocolissimoPriceTableMap::PRICE_MAX, SocolissimoPriceTableMap::FRANCO_MIN_PRICE, SocolissimoPriceTableMap::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(SocolissimoPriceTableMap::ID => 0, SocolissimoPriceTableMap::AREA_ID => 1, SocolissimoPriceTableMap::DELIVERY_MODE_ID => 2, SocolissimoPriceTableMap::WEIGHT_MAX => 3, SocolissimoPriceTableMap::PRICE_MAX => 4, SocolissimoPriceTableMap::FRANCO_MIN_PRICE => 5, SocolissimoPriceTableMap::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('socolissimo_price');
$this->setPhpName('SocolissimoPrice');
$this->setClassName('\\SoColissimo\\Model\\SocolissimoPrice');
$this->setPackage('SoColissimo.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', 'socolissimo_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', '\\SoColissimo\\Model\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('SocolissimoDeliveryMode', '\\SoColissimo\\Model\\SocolissimoDeliveryMode', 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 ? SocolissimoPriceTableMap::CLASS_DEFAULT : SocolissimoPriceTableMap::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 (SocolissimoPrice object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = SocolissimoPriceTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = SocolissimoPriceTableMap::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 + SocolissimoPriceTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = SocolissimoPriceTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
SocolissimoPriceTableMap::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 = SocolissimoPriceTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = SocolissimoPriceTableMap::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;
SocolissimoPriceTableMap::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(SocolissimoPriceTableMap::ID);
$criteria->addSelectColumn(SocolissimoPriceTableMap::AREA_ID);
$criteria->addSelectColumn(SocolissimoPriceTableMap::DELIVERY_MODE_ID);
$criteria->addSelectColumn(SocolissimoPriceTableMap::WEIGHT_MAX);
$criteria->addSelectColumn(SocolissimoPriceTableMap::PRICE_MAX);
$criteria->addSelectColumn(SocolissimoPriceTableMap::FRANCO_MIN_PRICE);
$criteria->addSelectColumn(SocolissimoPriceTableMap::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(SocolissimoPriceTableMap::DATABASE_NAME)->getTable(SocolissimoPriceTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(SocolissimoPriceTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(SocolissimoPriceTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new SocolissimoPriceTableMap());
}
}
/**
* Performs a DELETE on the database, given a SocolissimoPrice or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or SocolissimoPrice 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(SocolissimoPriceTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \SoColissimo\Model\SocolissimoPrice) { // 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(SocolissimoPriceTableMap::DATABASE_NAME);
$criteria->add(SocolissimoPriceTableMap::ID, (array) $values, Criteria::IN);
}
$query = SocolissimoPriceQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { SocolissimoPriceTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { SocolissimoPriceTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the socolissimo_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 SocolissimoPriceQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a SocolissimoPrice or Criteria object.
*
* @param mixed $criteria Criteria or SocolissimoPrice 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(SocolissimoPriceTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from SocolissimoPrice object
}
if ($criteria->containsKey(SocolissimoPriceTableMap::ID) && $criteria->keyContainsValue(SocolissimoPriceTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.SocolissimoPriceTableMap::ID.')');
}
// Set the correct dbName
$query = SocolissimoPriceQuery::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;
}
} // SocolissimoPriceTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
SocolissimoPriceTableMap::buildTableMap();

View File

@@ -0,0 +1,10 @@
<?php
namespace SoColissimo\Model;
use SoColissimo\Model\Base\OrderAddressSocolissimo as BaseOrderAddressSocolissimo;
class OrderAddressSocolissimo extends BaseOrderAddressSocolissimo
{
}

View File

@@ -0,0 +1,20 @@
<?php
namespace SoColissimo\Model;
use SoColissimo\Model\Base\OrderAddressSocolissimoQuery as BaseOrderAddressSocolissimoQuery;
/**
* Skeleton subclass for performing query and update operations on the 'order_address_socolissimo' 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 OrderAddressSocolissimoQuery extends BaseOrderAddressSocolissimoQuery
{
} // OrderAddressSocolissimoQuery

View File

@@ -0,0 +1,10 @@
<?php
namespace SoColissimo\Model;
use SoColissimo\Model\Base\SocolissimoAreaFreeshipping as BaseSocolissimoAreaFreeshipping;
class SocolissimoAreaFreeshipping extends BaseSocolissimoAreaFreeshipping
{
}

View File

@@ -0,0 +1,10 @@
<?php
namespace SoColissimo\Model;
use SoColissimo\Model\Base\SocolissimoAreaFreeshippingDom as BaseSocolissimoAreaFreeshippingDom;
class SocolissimoAreaFreeshippingDom extends BaseSocolissimoAreaFreeshippingDom
{
}

View File

@@ -0,0 +1,21 @@
<?php
namespace SoColissimo\Model;
use SoColissimo\Model\Base\SocolissimoAreaFreeshippingDomQuery as BaseSocolissimoAreaFreeshippingDomQuery;
/**
* Skeleton subclass for performing query and update operations on the 'socolissimo_area_freeshipping_dom' 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 SocolissimoAreaFreeshippingDomQuery extends BaseSocolissimoAreaFreeshippingDomQuery
{
} // SocolissimoAreaFreeshippingDomQuery

View File

@@ -0,0 +1,10 @@
<?php
namespace SoColissimo\Model;
use SoColissimo\Model\Base\SocolissimoAreaFreeshippingPr as BaseSocolissimoAreaFreeshippingPr;
class SocolissimoAreaFreeshippingPr extends BaseSocolissimoAreaFreeshippingPr
{
}

View File

@@ -0,0 +1,21 @@
<?php
namespace SoColissimo\Model;
use SoColissimo\Model\Base\SocolissimoAreaFreeshippingPrQuery as BaseSocolissimoAreaFreeshippingPrQuery;
/**
* Skeleton subclass for performing query and update operations on the 'socolissimo_area_freeshipping_pr' 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 SocolissimoAreaFreeshippingPrQuery extends BaseSocolissimoAreaFreeshippingPrQuery
{
} // SocolissimoAreaFreeshippingPrQuery

View File

@@ -0,0 +1,21 @@
<?php
namespace SoColissimo\Model;
use SoColissimo\Model\Base\SocolissimoAreaFreeshippingQuery as BaseSocolissimoAreaFreeshippingQuery;
/**
* Skeleton subclass for performing query and update operations on the 'socolissimo_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 SocolissimoAreaFreeshippingQuery extends BaseSocolissimoAreaFreeshippingQuery
{
} // SocolissimoAreaFreeshippingQuery

View File

@@ -0,0 +1,10 @@
<?php
namespace SoColissimo\Model;
use SoColissimo\Model\Base\SocolissimoDeliveryMode as BaseSocolissimoDeliveryMode;
class SocolissimoDeliveryMode extends BaseSocolissimoDeliveryMode
{
}

View File

@@ -0,0 +1,21 @@
<?php
namespace SoColissimo\Model;
use SoColissimo\Model\Base\SocolissimoDeliveryModeQuery as BaseSocolissimoDeliveryModeQuery;
/**
* Skeleton subclass for performing query and update operations on the 'socolissimo_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 SocolissimoDeliveryModeQuery extends BaseSocolissimoDeliveryModeQuery
{
} // SocolissimoDeliveryModeQuery

View File

@@ -0,0 +1,10 @@
<?php
namespace SoColissimo\Model;
use SoColissimo\Model\Base\SocolissimoFreeshipping as BaseSocolissimoFreeshipping;
class SocolissimoFreeshipping extends BaseSocolissimoFreeshipping
{
}

View File

@@ -0,0 +1,23 @@
<?php
namespace SoColissimo\Model;
use SoColissimo\Model\Base\SocolissimoFreeshippingQuery as BaseSocolissimoFreeshippingQuery;
/**
* Skeleton subclass for performing query and update operations on the 'socolissimo_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 SocolissimoFreeshippingQuery extends BaseSocolissimoFreeshippingQuery
{
public function getLast()
{
return $this->orderById('desc')->findOne()->getActive();
}
} // SocolissimoFreeshippingQuery

View File

@@ -0,0 +1,10 @@
<?php
namespace SoColissimo\Model;
use SoColissimo\Model\Base\SocolissimoPrice as BaseSocolissimoPrice;
class SocolissimoPrice extends BaseSocolissimoPrice
{
}

View File

@@ -0,0 +1,21 @@
<?php
namespace SoColissimo\Model;
use SoColissimo\Model\Base\SocolissimoPriceQuery as BaseSocolissimoPriceQuery;
/**
* Skeleton subclass for performing query and update operations on the 'socolissimo_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 SocolissimoPriceQuery extends BaseSocolissimoPriceQuery
{
} // SocolissimoPriceQuery

View File

@@ -0,0 +1,201 @@
So Colissimo Module v1.0
author: <info@thelia.net>
Summary
=======
### fr_FR
1. Installation
2. Utilisation
3. Boucles
4. Intégration
### en_US
1. Install notes
2. How to use
3. Loops
4. Integration
fr_FR
=====
Installation
------------
Pour installer le module So Colissimo, téléchargez l'archive et extrayez la dans le dossier dossierDeThelia/local/modules
Utilisation
-----------
Tout d'abord, allez dans votre back-office, onglet Modules, et activez le module So Colissimo.
Allez ensuite sur la page de configuration de ce dernier, onglet "Configurer So Colissimo", et entrez vos identifiants
pour le service So Colissimo.
Pour importer les fichiers générés via l'export avec Expeditor INET, vous avez besoin de THELIA_INET.FMT présent dans l'archive du module.
Boucles
-------
1. socolissimo.check.rights
- Arguments:
Aucun
- Sorties:
1. $ERRMES: message d'erreur
2. $ERRFILE: fichier où le problème a été detecté
- Utilisation:
```{loop name="yourloopname" type="socolissimo.check.rights"}<!-- your template -->{/loop}```
2. socolissimo
- Arguments:
1. area | obligatoire | id de l'area dont on veut savoir les prix
- Sorties:
1. $MAX_WEIGHT: poids maximal pour le prix
2. $PRICE: prix
- Utilisation:
```{loop name="yourloopname" type="socolissimo"}<!-- your template -->{/loop}```
3. socolissimoid
- Arguments:
Aucun
- Sorties:
1. $MODULE_ID: id du module So Colissimo
- Utilisation:
```{loop name="yourloopname" type="socolissimoid"}<!-- your template -->{/loop}```
4. socolissimo.around
- Arguments:
1. zipcode | optionnel | code postal de la ville recherchée
2. city | optionnel | nom de la ville recherchée
3. address | optionnel | id de l'addresse a utiliser pour la recherche.
address et zipcode + city ne peuvent pas être présents en même temps.
- Sorties:
1. $LONGITUDE: longitude du point relais
2. $LATITUDE : latitude du point relais
3. $CODE : code spécifique So Colissimo du point relais
4. $ADDRESS : adresse du point relais
5. $ZIPCODE : code postal du point relais
6. $CITY : ville du point relais
7. $DISTANCE : distance entre le point relais et l'adresse du client/l'adresse recherchée
- Utilisation:
```{loop name="yourloopname" type="socolissimo.around"}<!-- your template -->{/loop}```
5. address.socolissimo
- Arguments:
Les mêmes que la boucle address
- Sorties:
Les mêmes que la boucle address, mais avec l'adresse du point relais.
- Utilisation:
```{loop name="yourloopname" type="address.socolissimo"}<!-- your template -->{/loop}```
6. order.notsent.socolissimo
- Arguments:
Aucun
- Sorties:
Les même sorties que la boucle order, mais avec uniquement les commandes So Colissimo non envoyées.
- Utilisation:
```{loop name="yourloopname" type="order.notsent.socolissimo"}<!-- your template -->{/loop}```
7. socolissimo.order_address
- Argument :
1. id | obligatoire | ID de la OrderAddressSoColissimo que l'on veut retrouver grâce à la boucle.
- Sorties :
1. $ID : ID de la OrderAddressSoColissimo.
2. $CODE : code de la OrderAddressSoColissimo.
3. $TYPE : type de la OrderAddressSoColissimo.
- Utilisation:
```{loop name="yourloopname" type="socolissimo.order_address"}<!-- your template -->{/loop}```
Intégration
-----------
Un exemple d'intégration avec une google map vous est proposé avec le thème par default de Thelia.
Pour l'installer, veuillez copier les fichiers contenus dans dossierDeSoColissimo/templates/frontOffice/default,
dossierDeSoColissimo/templates/frontOffice/default/assets et dossierDeSoColissimo/templates/frontOffice/default/ajax respectivement dans le dossier
dossierDeThelia/templates/frontOffice/default, dossierDeThelia/templates/frontOffice/default/assets et dossierDeSoColissimo/templates/frontOffice/default/ajax
en_US
=====
Install notes
-----------
To install So Colissimo module, download the archive and extract it in pathToThelia/local/modules
How to use
-----------
First, go to your back office, tab Modules, and activate the module So Colissimo.
Then go to So Colissimo configure page, tab "Configure So Colissimo" and enter your So Colissimo id and password.
To import exported files in Expeditor INET, you need the file THELIA_INET.FMT, that is in the archive.
Loops
-----
1. socolissimo.check.rights
- Arguments:
None
- Output:
1. $ERRMES: error message
2. $ERRFILE: file where the error has been detected
- Usage:
```{loop name="yourloopname" type="socolissimo.check.rights"}<!-- your template -->{/loop}```
2. socolissimo
- Arguments:
1. area | mandatory | id de l'area dont on veut savoir les prix
- Output:
1. $MAX_WEIGHT: max weight for the price
2. $PRICE: price
- Usage:
```{loop name="yourloopname" type="socolissimo"}<!-- your template -->{/loop}```
3. socolissimoid
- Arguments:
None
- Output:
1. $MODULE_ID: id of the module So Colissimo
- Usage:
```{loop name="yourloopname" type="socolissimoid"}<!-- your template -->{/loop}```
4. socolissimo.around
- Arguments:
1. zipcode | optionnel | zipcode of the searched city
2. city | optionnel | name of the searched city
3. address | optionnel | id of the address to use for the search.
address and zipcode + city cannot be used at the same time.
- Output:
1. $LONGITUDE: longitude of the pickup & go store
2. $LATITUDE : latitude of the pickup & go store
3. $CODE : ID of the pickup & go store
4. $ADDRESS : address of the pickup & go store
5. $ZIPCODE : zipcode of the pickup & go store
6. $CITY : city of the pickup & go store
7. $DISTANCE : distance between the store and the customer's address/searched address
- Usage:
```{loop name="yourloopname" type="socolissimo.around"}<!-- your template -->{/loop}```
5. address.socolissimo
- Arguments:
The same as the loop address
- Output:
The same as the loop address, but with pickup & go store's address
- Usage:
```{loop name="yourloopname" type="address.socolissimo"}<!-- your template -->{/loop}```
6. order.notsent.socolissimo
- Arguments:
None
- Output:
The same as the loop order, but with not sent So Colissimo orders.
- Usage:
```{loop name="yourloopname" type="order.notsent.socolissimo"}<!-- your template -->{/loop}```
7. socolissimo.order_address
- Arguments:
1. id | obligatoire | ID of the OrderAddressSoColissimo that should be retrieved by the loop.
- Outputs:
1. $ID : OrderAddressSoColissimo ID.
2. $CODE : OrderAddressSoColissimo code.
3. $TYPE : OrderAddressSoColissimo type.
- Usage:
```{loop name="yourloopname" type="socolissimo.order_address"}<!-- your template -->{/loop}```
Integration
-----------
A integration example is available for the default theme of Thelia.
To install it, copy the files of pathToSoColissimo/templates/frontOffice/default and
pathToSoColissimo/templates/frontOffice/default/ajax respectively in pathToThelia/templates/frontOffice/default
and pathToThelia/templates/frontOffice/default/ajax

View File

@@ -0,0 +1,59 @@
<?php
namespace SoColissimo\Smarty\Plugins;
use SoColissimo\SoColissimo;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Model\CountryQuery;
use Thelia\Model\Country;
use Thelia\Module\Exception\DeliveryException;
use TheliaSmarty\Template\AbstractSmartyPlugin;
use TheliaSmarty\Template\SmartyPluginDescriptor;
class SocolissimoDeliveryPrice extends AbstractSmartyPlugin
{
protected $request;
protected $dispatcher;
public function __construct(
Request $request,
EventDispatcherInterface $dispatcher = null
) {
$this->request = $request;
$this->dispatcher = $dispatcher;
}
public function getPluginDescriptors()
{
return array(
new SmartyPluginDescriptor("function", "socolissimoDeliveryPrice", $this, "socolissimoDeliveryPrice")
);
}
public function socolissimoDeliveryPrice($params, $smarty)
{
$deliveryMode = $params["delivery-mode"];
$country = Country::getShopLocation();
if (isset($params["country"])) {
$country = CountryQuery::create()->findOneById($params["country"]);
}
$cartWeight = $this->request->getSession()->getSessionCart($this->dispatcher)->getWeight();
$cartAmount = $this->request->getSession()->getSessionCart($this->dispatcher)->getTaxedAmount($country);
try {
$price = SoColissimo::getPostageAmount(
$country->getAreaId(),
$cartWeight,
$cartAmount,
$deliveryMode
);
} catch (DeliveryException $ex) {
$smarty->assign('isValidMode', false);
}
$smarty->assign('deliveryModePrice', $price);
}
}

View File

@@ -0,0 +1,447 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace SoColissimo;
use PDO;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Propel;
use SoColissimo\Model\SocolissimoAreaFreeshippingDomQuery;
use SoColissimo\Model\SocolissimoAreaFreeshippingPrQuery;
use SoColissimo\Model\SocolissimoDeliveryMode;
use SoColissimo\Model\SocolissimoDeliveryModeQuery;
use SoColissimo\Model\SocolissimoPrice;
use SoColissimo\Model\SocolissimoPriceQuery;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\Finder\Finder;
use Thelia\Model\AreaQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Model\Country;
use Thelia\Model\ModuleImageQuery;
use Thelia\Model\ModuleQuery;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Install\Database;
use Thelia\Module\AbstractDeliveryModule;
use Thelia\Module\Exception\DeliveryException;
class SoColissimo extends AbstractDeliveryModule
{
protected $request;
protected $dispatcher;
private static $prices = null;
const DOMAIN = 'socolissimo';
const JSON_PRICE_RESOURCE = "/Config/prices.json";
const JSON_CONFIG_PATH = "/Config/config.json";
/**
* These constants refer to the imported CSV file.
* IMPORT_NB_COLS: file's number of columns (begin at 1)
* IMPORT_DELIVERY_REF_COL: file's column where delivery reference is set (begin at 0)
* IMPORT_ORDER_REF_COL: file's column where order reference is set (begin at 0)
*/
const IMPORT_NB_COLS = 2;
const IMPORT_DELIVERY_REF_COL = 0;
const IMPORT_ORDER_REF_COL = 1;
/**
* This method is called by the Delivery loop, to check if the current module has to be displayed to the customer.
* Override it to implements your delivery rules/
*
* If you return true, the delivery method will de displayed to the customer
* If you return false, the delivery method will not be displayed
*
* @param Country $country the country to deliver to.
*
* @return boolean
*/
public function isValidDelivery(Country $country)
{
$cartWeight = $this->getRequest()->getSession()->getSessionCart($this->getDispatcher())->getWeight();
$areaId = $country->getAreaId();
$prices = SocolissimoPriceQuery::create()
->filterByAreaId($areaId)
->findOne();
$freeShipping = SocolissimoDeliveryModeQuery::create()
->findOneByFreeshippingActive(1);
/* check if Colissimo delivers the asked area*/
if (null !== $prices || null !== $freeShipping) {
return true;
}
return false;
}
/**
* @param $areaId
* @param $weight
* @param $cartAmount
* @param $deliverModeCode
*
* @return mixed
* @throws DeliveryException
*/
public static function getPostageAmount($areaId, $weight, $cartAmount = 0, $deliverModeCode = null)
{
if (null === $deliverModeCode) {
$deliveryMode = SocolissimoDeliveryModeQuery::create()->find()->getFirst();
} else {
$deliveryMode = SocolissimoDeliveryModeQuery::create()->findOneByCode($deliverModeCode);
}
$freeshipping = $deliveryMode->getFreeshippingActive();
$freeshippingFrom = $deliveryMode->getFreeshippingFrom();
$deliveryModeQuery = $deliveryMode->getCode();
$postage = 0;
if (!$freeshipping) {
$areaPrices = SocolissimoPriceQuery::create()
->filterByDeliveryModeId($deliveryMode->getId())
->filterByAreaId($areaId)
->filterByWeightMax($weight, Criteria::GREATER_EQUAL)
->_or()
->filterByWeightMax(null)
->filterByPriceMax($cartAmount, Criteria::GREATER_EQUAL)
->_or()
->filterByPriceMax(null)
->orderByWeightMax()
->orderByPriceMax();
$firstPrice = $areaPrices->find()
->getFirst();
if (null === $firstPrice) {
throw new DeliveryException("Colissimo delivery unavailable for your cart weight or delivery country");
}
//If a min price for freeshipping is define and the amount of cart reach this montant return 0
if (null !== $freeshippingFrom && $freeshippingFrom <= $cartAmount) {
$postage = 0;
return $postage;
}
if ($deliveryModeQuery === 'dom') {
$cartAmountDom = SocolissimoAreaFreeshippingDomQuery::create()
->filterByAreaId($areaId)
->findOne();
if ($cartAmountDom) {
$cartAmountDom = $cartAmountDom->getCartAmount();
}
if (null !== $cartAmountDom && $cartAmountDom <= $cartAmount) {
$postage = 0;
return $postage;
}
} elseif ($deliveryModeQuery === 'pr') {
$cartAmountPr = SocolissimoAreaFreeshippingPrQuery::create()
->filterByAreaId($areaId)
->findOne();
if ($cartAmountPr) {
$cartAmountPr = $cartAmountPr->getCartAmount();
}
if (null !== $cartAmountPr && $cartAmountPr <= $cartAmount) {
$postage = 0;
return $postage;
}
}
$postage = $firstPrice->getPrice();
}
return $postage;
}
/**
*
* calculate and return delivery price
*
* @param Country $country
* @return mixed
* @throws DeliveryException
*/
public function getPostage(Country $country)
{
$request = $this->getRequest();
$cartWeight = $request->getSession()->getSessionCart($this->getDispatcher())->getWeight();
$cartAmount = $request->getSession()->getSessionCart($this->getDispatcher())->getTaxedAmount($country);
$dom = $request->get('socolissimo-home');
$pr_code = $request->get('socolissimo_code');
$deliveryModeCode = null;
if ($dom) {
$deliveryModeCode = "dom";
} elseif (!empty($pr_code)) {
$deliveryModeCode = "pr";
}
if (null == $deliveryModeCode) {
$session = $request->getSession();
$dom = $session->get('SoColissimoDomicile');
$pr_code = $session->get('SoColissimoDeliveryId');
if ($dom) {
$deliveryModeCode = "dom";
} elseif (!empty($pr_code)) {
$deliveryModeCode = "pr";
}
}
$areaIdArray = $this->getAllAreasForCountry($country);
if (empty($areaIdArray)) {
throw new DeliveryException("Your delivery country is not covered by Colissimo.");
}
$postage = null;
if (null === $postage = self::getMinPostage($areaIdArray, $cartWeight, $cartAmount, $deliveryModeCode)) {
$postage = self::getMinPostage($areaIdArray, $cartWeight, $cartAmount, 'dom');
if (null === $postage) {
throw new DeliveryException("Colissimo delivery unavailable for your cart weight or delivery country");
}
}
return $postage;
}
private function getMinPostage($areaIdArray, $cartWeight, $cartAmount, $deliveryModeCode)
{
$minPostage = null;
foreach ($areaIdArray as $areaId) {
try {
$postage = self::getPostageAmount($areaId, $cartWeight, $cartAmount, $deliveryModeCode);
if ($minPostage === null || $postage < $minPostage) {
$minPostage = $postage;
if ($minPostage == 0) {
break;
}
}
} catch (\Exception $ex) {
}
}
return $minPostage;
}
/**
* Returns ids of area containing this country and covers by this module
* @param Country $country
* @return array Area ids
*/
private 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 getCode()
{
return 'SoColissimo';
}
public static function getPrices(SocolissimoDeliveryMode $deliveryMode)
{
self::$prices = null;
$fileName = sprintf('%s%s', __DIR__, "/Config/prices_".$deliveryMode->getCode().".json");
// If delivery mode file doesn't exist take global price
if (!file_exists($fileName)) {
$fileName = sprintf('%s%s', __DIR__, self::JSON_PRICE_RESOURCE);
// If global price doesn't exist throw exception
if (!file_exists($fileName)) {
throw new Exception("Prices configuration not found.");
}
}
if (null === self::$prices) {
self::$prices = json_decode(file_get_contents($fileName), true);
}
return self::$prices;
}
public static function importJsonPrice(SocolissimoDeliveryMode $deliveryMode, ConnectionInterface $con)
{
$areaPrices = self::getPrices($deliveryMode);
$priceExist = SocolissimoPriceQuery::create()
->filterByDeliveryModeId($deliveryMode->getId())
->findOne();
//If at least one price exist doesn't import the xml (or it will erase the user price)
if (null !== $priceExist) {
return;
}
$con->beginTransaction();
try {
foreach ($areaPrices as $areaId => $area) {
// Check if the area exists
if (null !== AreaQuery::create()->findPk($areaId)) {
foreach ($area['slices'] as $weight => $price) {
$slice = (new SocolissimoPrice())
->setAreaId($areaId)
->setWeightMax($weight)
->setPrice($price)
->setDeliveryModeId($deliveryMode->getId());
$slice->save();
}
$con->commit();
}
}
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
public function postActivation(ConnectionInterface $con = null)
{
try {
// Security to not erase user config on reactivation
SocolissimoDeliveryModeQuery::create()->findOne();
SocolissimoAreaFreeshippingDomQuery::create()->findOne();
SocolissimoAreaFreeshippingPrQuery::create()->findOne();
} catch (\Exception $e) {
$database = new Database($con->getWrappedConnection());
$database->insertSql(null, [__DIR__ . '/Config/thelia.sql', __DIR__ . '/Config/insert.sql']);
}
try {
$deliveryModes = SocolissimoDeliveryModeQuery::create()
->find();
foreach ($deliveryModes as $deliveryMode) {
self::importJsonPrice($deliveryMode, $con);
}
} catch (\Exception $e) {
throw $e;
}
ConfigQuery::write(
'socolissimo_login',
ConfigQuery::read('socolissimo_login', null),
1,
1
);
ConfigQuery::write(
'socolissimo_pwd',
ConfigQuery::read('socolissimo_pwd', null),
1,
1
);
ConfigQuery::write(
'socolissimo_pwd',
ConfigQuery::read('socolissimo_pwd', null),
1,
1
);
ConfigQuery::write(
'socolissimo_google_map_key',
ConfigQuery::read('socolissimo_google_map_key', null),
1,
1
);
ConfigQuery::write(
'socolissimo_url_prod',
ConfigQuery::read('socolissimo_url_prod', 'https://ws.colissimo.fr/pointretrait-ws-cxf/PointRetraitServiceWS/2.0?wsdl'),
1,
1
);
ConfigQuery::write(
'socolissimo_url_test',
ConfigQuery::read('socolissimo_url_test', 'https://pfi.telintrans.fr/pointretrait-ws-cxf/PointRetraitServiceWS/2.0?wsdl'),
1,
1
);
/* insert the images from image folder if first module activation */
$module = $this->getModuleModel();
if (ModuleImageQuery::create()->filterByModule($module)->count() == 0) {
$this->deployImageFolder($module, sprintf('%s/images', __DIR__), $con);
}
}
public static function getModCode()
{
return ModuleQuery::create()->findOneByCode("SoColissimo")->getId();
}
/**
* @inheritDoc
*/
public function update($currentVersion, $newVersion, ConnectionInterface $con = null)
{
$finder = (new Finder)
->files()
->name('#.*?\.sql#')
->sortByName()
->in(__DIR__ . DS . 'Config' . DS . 'update' . DS . 'sql');
$database = new Database($con);
/** @var \Symfony\Component\Finder\SplFileInfo $updateSQLFile */
foreach ($finder as $updateSQLFile) {
if (version_compare($currentVersion, str_replace('.sql', '', $updateSQLFile->getFilename()), '<')) {
$database->insertSql(
null,
[
$updateSQLFile->getPathname()
]
);
}
}
}
}

View File

@@ -0,0 +1,25 @@
[GENERAL]
DELIMITE=O
SEPARATEUR=59
DELIMITEUR=34
FINDELIGNE=CRLF
Unité poids=KG
[CHAMPS]
Prenom=1
NomDestinataire=2
RaisonSociale=3
Adresse1=4
Adresse2=5
Adresse3=6
CodePostal=7
Commune=8
CodePays=9
Telephone=10
Portable=11
CodeProduit=12
Civilite=13
CodePointRetrait=14
Mail=15
Poids=16
NomCommercialChargeur=17
typeDePoint=18

View File

@@ -0,0 +1,172 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace SoColissimo\Tests\WebService;
/**
* Class BaseSoColissimoWebServiceTest
* @package SoColissimo\Tests\WebService
* @author Thelia <info@thelia.net>
*/
class BaseSoColissimoWebServiceTest extends \PHPUnit_Framework_TestCase
{
public function testCall()
{
$instance = new \SoColissimo\WebService\FindByAddress();
$this->assertInstanceOf("\\SoapClient",$instance->getSoap());
}
/**
* @expectedException \BadFunctionCallException
*/
public function testBadFunctionCallException()
{
$instance = new \SoColissimo\WebService\FindByAddress();
$instance->FooBar();
}
/**
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
*/
public function testGetInvalidArgumentException()
{
$instance = new \SoColissimo\WebService\FindByAddress();
$instance->getFoo("bar");
}
/**
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
*/
public function testSetInvalidArgumentException()
{
$instance = new \SoColissimo\WebService\FindByAddress();
$instance->setFoo();
}
/**
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
*/
public function testSetInvalidArgumentException2()
{
$instance = new \SoColissimo\WebService\FindByAddress();
$instance->setFoo("apple", "banana");
}
/**
* @expectedException \BadFunctionCallException
*/
public function testGetBadFunctionCallException()
{
$instance = new \SoColissimo\WebService\FindByAddress();
$instance->getFoo();
}
/**
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
*/
public function testExceptFindByAddressExec()
{
$instance = new \SoColissimo\WebService\FindByAddress();
$instance
->setAddress("17 rue des gras")
->setZipCode("63000")
->setCity("Clermont-Ferrand")
->setCountryCode("FR")
->setFilterRelay("1")
->setRequestId("1234")
->setLang("FR")
->setOptionInter("1")
->setShippingDate(date("d/m/Y"))
->setWeight("20")
->setAccountNumber("123456")
->setPassword(utf8_encode(base64_decode("VGEgbehyZSBlbiBzbGlwIDwz")))
;
$instance->exec();
}
public function testFindByAddressExec()
{
$instance = new \SoColissimo\WebService\FindByAddress();
$instance
->setAddress("17 rue des gras")
->setZipCode("63000")
->setCity("Clermont-Ferrand")
->setCountryCode("FR")
->setFilterRelay("1")
->setRequestId("1234")
->setLang("FR")
->setOptionInter("1")
->setShippingDate(date("d/m/Y"))
->setWeight("20")
->setAccountNumber("800734")
->setPassword("nass014")
;
$response = $instance->exec();
$this->assertTrue(is_array($response));
}
/**
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
*/
public function testExceptFindByIdExec()
{
$instance = new \SoColissimo\WebService\FindById();
$instance
->setId("002572")
->setLangue("FR")
->setDate(date("d/m/Y"))
->setWeight("20")
->setAccountNumber("123456")
->setPassword(utf8_encode(base64_decode("VGhpcyBpcyBvcGVuc3R1ZGlv")))
;
$instance->exec();
}
public function testFindByIdExec()
{
$instance = new \SoColissimo\WebService\FindById();
$instance
->setId("002572")
->setLangue("FR")
->setDate(date("d/m/Y"))
->setWeight("20")
->setAccountNumber("800734")
->setPassword("nass014")
;
$response = $instance->exec();
$this->assertInstanceOf("\\stdclass",$response);
}
}

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