D'autres fichiers en conf

This commit is contained in:
2021-01-25 18:44:19 +01:00
parent af1552b390
commit 154fff5134
74 changed files with 9151 additions and 0 deletions

0
local/modules/.gitkeep Normal file
View File

View File

@@ -0,0 +1,55 @@
<?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>
</loops>
<forms>
</forms>
<commands>
</commands>
<hooks>
<hook id="hooktest.hook.front" class="HookTest\Hook\FrontHook" scope="request">
<!-- test: hook tag -->
<tag name="hook.event_listener" event="main.head-top" />
<tag name="hook.event_listener" event="main.head-top" method="onMainHeadTopTest1" />
<tag name="hook.event_listener" event="main.head-top" method="onMainHeadTopTest2" type="front" />
<tag name="hook.event_listener" event="main.head-top" method="onMainHeadTopTest3" type="front" active="0" />
<!-- test: hook function -->
<tag name="hook.event_listener" event="main.body-top" />
<tag name="hook.event_listener" event="main.body-top" method="onMainBodyTop2" />
<!-- test: if hook -->
<tag name="hook.event_listener" event="main.navbar-secondary" />
<tag name="hook.event_listener" event="main.navbar-primary" />
<!-- test: hookblock / forhook -->
<tag name="hook.event_listener" event="main.footer-body" />
<!-- test: functionality -->
<tag name="hook.event_listener" event="main.content-top" />
<!-- render function-->
<tag name="hook.event_listener" event="main.content-top" method="onMainContentTopRender" />
<!-- dump function-->
<tag name="hook.event_listener" event="main.content-top" method="onMainContentTopDump" />
<!-- addCSS function-->
<tag name="hook.event_listener" event="main.content-top" method="onMainContentTopAddCSS" />
<!-- addJS function-->
<tag name="hook.event_listener" event="main.content-top" method="onMainContentTopAddJS" />
<!-- trans function-->
<tag name="hook.event_listener" event="main.content-top" method="onMainContentTopTrans" />
<!-- overriding -->
<tag name="hook.event_listener" event="main.content-top" method="onMainContentTopOverriding" />
</hook>
</hooks>
</config>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<module>
<fullnamespace>HookTest\HookTest</fullnamespace>
<descriptive locale="en_US">
<title>Hook module tester</title>
</descriptive>
<descriptive locale="fr_FR">
<title>Hook module tester</title>
</descriptive>
<version>0.1</version>
<author>
<name>Julien Chanséaume</name>
<email>jchanseaume@openstudio.fr</email>
</author>
<type>classic</type>
<thelia>2.0.0</thelia>
<stability>other</stability>
</module>

View File

@@ -0,0 +1,170 @@
<?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 HookTest\Hook;
use Thelia\Core\Event\Hook\HookRenderBlockEvent;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
use Thelia\Core\Hook\Fragment;
/**
* Class FrontHook
* @package HookCurrency\Hook
* @author Julien Chanséaume <jchanseaume@openstudio.fr>
*/
class FrontHook extends BaseHook {
protected $ldelim = "::";
protected $rdelim = "::";
public function onMainHeadTop(HookRenderEvent $event)
{
$event->add($this->mark("main.head-top test0"));
}
public function onMainHeadTopTest1(HookRenderEvent $event)
{
$event->add($this->mark("main.head-top test1"));
}
public function onMainHeadTopTest2(HookRenderEvent $event)
{
$event->add($this->mark("main.head-top test2"));
}
public function onMainHeadTopTest3(HookRenderEvent $event)
{
$event->add($this->mark("main.head-top test3"));
}
// == Hook Function =====================================================
public function onMainBodyTop(HookRenderEvent $event){
$event->add($this->mark("main.body-top 1-1"));
$event->add($this->mark("main.body-top 1-2"));
}
public function onMainBodyTop2(HookRenderEvent $event)
{
$event->add($this->mark("main.body-top 2"));
}
// == ifhook / elsehook ================================================
public function onMainNavbarSecondary(HookRenderEvent $event){
$event->add($this->mark("main.navbar-secondary 1"));
}
/**
* empty string should be considered as empty :) and should activate the elsehook
*
* @param HookRenderEvent $event
*/
public function onMainNavbarPrimary(HookRenderEvent $event)
{
$event->add("");
$event->add(" ");
}
public function onProductAdditional(HookRenderEvent $event)
{
// nothing added
}
// == hookblock / forhook ==============================================
public function onMainFooterBody(HookRenderBlockEvent $event)
{
$event->addFragment(new Fragment(array(
"id" => "id1",
"class" => "class1",
"content" => "content1"
)));
$event->add(array(
"id" => "id2",
"class" => "class2",
"content" => "content2"
));
}
// == global objects ===================================================
public function onMainContentTop(HookRenderEvent $event)
{
$event->add($this->mark("main.content-top"));
$event->add($this->mark("view : " . $this->getView()));
$event->add($this->mark("request : " . $this->getRequest()));
$event->add($this->mark("session : " . $this->getSession()->getId()));
$event->add($this->mark("cart : " . ($this->getCart() === null ? "null" : "not null")));
$event->add($this->mark("order : " . ($this->getOrder() === null ? "null" : "not null")));
$event->add($this->mark("currency : " . $this->getCurrency()->getId()));
$event->add($this->mark("customer : " . $this->getCustomer()));
$event->add($this->mark("lang : " . $this->getLang()->getId()));
}
public function onMainContentTopRender(HookRenderEvent $event)
{
$event->add($this->render("render.html"));
}
public function onMainContentTopDump(HookRenderEvent $event)
{
$event->add($this->dump("dump.txt"));
}
public function onMainContentTopAddCSS(HookRenderEvent $event)
{
$event->add($this->mark($this->addCSS("assets/css/styles.css")));
$event->add($this->mark($this->addCSS("assets/css/print.css", array("media" => "print"))));
}
public function onMainContentTopAddJS(HookRenderEvent $event)
{
$event->add($this->mark($this->addJS("assets/js/script.js")));
}
public function onMainContentTopTrans(HookRenderEvent $event)
{
$event->add($this->mark($this->trans("Hodor Hodor", array(), "hooktest")));
$event->add($this->mark($this->trans("Hello World", array(), "hooktest")));
$event->add($this->mark($this->trans("Hello %name%", array("%name%" => "Hodor"))));
$event->add($this->mark($this->trans("Hi %name%", array("%name%" => "Hodor"), "hooktest", 'fr_FR')));
}
// == template overriding ====================================================
public function onMainContentTopOverriding(HookRenderEvent $event)
{
$event->add($this->render("override1.html"));
// redefined in template hooktest in the module
$event->add($this->render("override2.html"));
// redefined in template hooktest
$event->add($this->render("override3.html"));
$event->add($this->render("override-assets.html"));
}
protected function mark($message, $endofline="\n")
{
return sprintf("%s %s %s%s", $this->ldelim, $message, $this->rdelim, $endofline);
}
}

View File

@@ -0,0 +1,21 @@
<?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 HookTest;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Module\BaseModule;
class HookTest extends BaseModule
{
}

View File

@@ -0,0 +1,8 @@
<?php
return array(
'Hodor Hodor' => 'Hodor en_US Hodor',
'Hello World' => 'Hello en_US World',
'Hello %name%' => 'Hello en_US %name%',
'Hi %name%' => 'Hi en_US %name%',
);

View File

@@ -0,0 +1,7 @@
<?php
return array(
'Hodor Hodor' => 'Hodor fr_FR Hodor',
'Hello World' => 'Bonjour fr_FR monde',
'Hello %name%' => 'Bonjour fr_FR %name%',
'Hi %name%' => 'Salut fr_FR %name%',
);

View File

@@ -0,0 +1,5 @@
<?php
return array(
);

View File

@@ -0,0 +1,4 @@
<?php
return array(
);

View File

@@ -0,0 +1,10 @@
{
"name": "thelia/hooktest-module",
"type": "thelia-module",
"require": {
"thelia/installer": "~1.1"
},
"extra": {
"installer-name": "HookTest"
}
}

View File

@@ -0,0 +1 @@
/* print.css */

View File

@@ -0,0 +1 @@
/* style1 in module/default */

View File

@@ -0,0 +1 @@
/* style2 in module/default */

View File

@@ -0,0 +1 @@
/* style3 in module/default */

View File

@@ -0,0 +1 @@
/* styles.css */

View File

@@ -0,0 +1 @@
/* script.js */

View File

@@ -0,0 +1,2 @@
:: function dump ::

View File

@@ -0,0 +1,71 @@
<ul class="nav navbar-nav navbar-cart navbar-right">
{ifloop rel="cartloop"}
<li class="dropdown pull-right cart-not-empty cart-container">
<a href="{url path="/cart"}" rel="nofollow" class="cart">
{intl l="Cart" d="hookcart.fo.default"} <span class="badge">{cart attr="count_item"}</span>
</a>
<div class="dropdown-menu cart-content">
<form id="form-cart-mini" action="{url path="/order/delivery"}" method="post">
<table class="table table-cart-mini">
<colgroup>
<col width="70">
<col>
<col width="100">
</colgroup>
<tbody>
{assign "total_price" 0}
{loop type="cart" name="cartloop"}
<tr>
<td class="image">
{loop type="image" name="product-image" product=$PRODUCT_ID limit="1" width="118" height="60"}
<img src="{$IMAGE_URL}" alt="{$TITLE}">
{/loop}
</td>
<td class="product">
<h3 class="name" style="margin:0">
{$TITLE}
</h3>
<a href="{url path="/cart/delete/{$ITEM_ID}"}" class="btn btn-remove" data-tip="tooltip" data-title="Delete" data-original-title=""><i class="icon-trash"></i> <span>{intl l="Remove" d="hookcart.fo.default"}</span></a>
</td>
<td class="unitprice text-center">
{if $IS_PROMO == 1}
{assign "real_price" $PROMO_TAXED_PRICE}
{else}
{assign "real_price" $TAXED_PRICE}
{/if}
<span class="qty">{$QUANTITY}</span> X <span class="price" style="font-size:1em;">{$real_price} {currency attr="symbol"}</span></div>
{assign "total_price" $total_price + ($QUANTITY * $real_price)}
</td>
</tr>
{/loop}
</tbody>
<tfoot>
<tr>
<td colspan="2" class="empty">
<a href="{url path="/cart"}" role="button" class="btn btn-default btn-sm"><span>{intl l="View Cart" d="hookcart.fo.default"}</span></a>
<a href="{url path="/order/delivery"}" role="button" class="btn btn-warning btn-sm"><span>{intl l="Checkout" d="hookcart.fo.default"}</span></a>
{*<button type="submit" name="checkout" class="btn btn-warning btn-sm"><span>{intl l="Checkout" d="hookcart.fo.default"}</span></button>*}
</td>
<td class="total">
<div class="total-price">
<span class="price">{$total_price} {currency attr="symbol"}</span>
</div>
</td>
</tr>
</tfoot>
</table>
</form>
</div>
</li>
{/ifloop}
{elseloop rel="cartloop"}
<li class="dropdown pull-right cart-container">
<a href="{url path="/cart"}" rel="nofollow" class="cart">
{intl l="Cart" d="hookcart.fo.default"} <span class="badge">0</span>
</a>
<div class="dropdown-menu cart-content">
<p>{intl l="You have no items in your shopping cart." d="hookcart.fo.default"}</p>
</div>
</li>
{/elseloop}
</ul>

View File

@@ -0,0 +1,13 @@
<!-- OVERRIDING ASSETS -->
{stylesheets file="assets/css/style1.css" source="HookTest"}
asset file 1 : {$asset_url}
{/stylesheets}
{stylesheets file="assets/css/style2.css" source="HookTest"}
asset file 2 : {$asset_url}
{/stylesheets}
{stylesheets file="assets/css/style3.css" source="HookTest"}
asset file 3 : {$asset_url}
{/stylesheets}
<!-- // OVERRIDING ASSETS -->

View File

@@ -0,0 +1 @@
:: file override1 from module/default ::

View File

@@ -0,0 +1 @@
:: file override2 from module/default ::

View File

@@ -0,0 +1 @@
:: file override3 from module/default ::

View File

@@ -0,0 +1,2 @@
:: function render ::

View File

@@ -0,0 +1 @@
/* style2 in module/hooktest */

View File

@@ -0,0 +1 @@
:: file override2 from module/hooktest ::

View File

@@ -0,0 +1,49 @@
<?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>
<!-- sample definition
<loop name="MySuperLoop" class="PaymentCondition\Loop\MySuperLoop" />
-->
</loops>
<forms>
<!--
<form name="MyFormName" class="PaymentCondition\Form\MySuperForm" />
-->
</forms>
<commands>
<!--
<command class="PaymentCondition\Command\MySuperCommand" />
-->
</commands>
<services>
<service id="payment_condition.payment.loop.extends" class="PaymentCondition\EventListeners\PaymentLoopExtend" scope="request">
<argument type="service" id="request_stack"/>
<tag name="kernel.event_subscriber" />
</service>
</services>
<hooks>
<hook id="payment_condition.customer.edit" class="PaymentCondition\Hook\CustomerEditHook">
<tag name="hook.event_listener" event="customer.edit" type="back" method="onCustomerEdit" />
</hook>
</hooks>
<!--
<exports>
</exports>
-->
<!--
<imports>
</imports>
-->
</config>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="http://thelia.net/schema/dic/module"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_2.xsd">
<fullnamespace>PaymentCondition\PaymentCondition</fullnamespace>
<descriptive locale="en_US">
<title>Allow to manage condition for display payment module</title>
<!--
<subtitle></subtitle>
<description></description>
<postscriptum></postscriptum>
-->
</descriptive>
<descriptive locale="fr_FR">
<title>Permet de génerer des conditions d'affichages pour les modules de paiements</title>
</descriptive>
<!-- <logo></logo> -->
<!--<images-folder>images</images-folder>-->
<languages>
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>1.0.0</version>
<authors>
<author>
<name>Vincent Lopes-Vicente</name>
<email>vlopes@openstudio.fr</email>
</author>
</authors>
<type>classic</type>
<!--
module dependencies
<required>
<module version="&gt;=0.1">Front</module>
<module version="~1.0">HookCart</module>
<module version="&gt;0.2">HookSearch</module>
</required>
-->
<thelia>2.3.0</thelia>
<stability>other</stability>
</module>

View File

@@ -0,0 +1,35 @@
<?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="payment_condition_configuration_view" path="/admin/module/PaymentCondition">
<default key="_controller">PaymentCondition\Controller\AdminController::viewAction</default>
</route>
<route id="payment_delivery_condition_view" path="/admin/module/paymentcondition/delivery" methods="get">
<default key="_controller">PaymentCondition\Controller\DeliveryConditionController::viewAction</default>
</route>
<route id="payment_delivery_condition_save" path="/admin/module/paymentcondition/delivery" methods="post">
<default key="_controller">PaymentCondition\Controller\DeliveryConditionController::saveAction</default>
</route>
<route id="payment_customer_family_condition_view" path="/admin/module/paymentcondition/customerfamily" methods="get">
<default key="_controller">PaymentCondition\Controller\CustomerFamilyConditionController::viewAction</default>
</route>
<route id="payment_customer_family_condition_save" path="/admin/module/paymentcondition/customerfamily" methods="post">
<default key="_controller">PaymentCondition\Controller\CustomerFamilyConditionController::saveAction</default>
</route>
<route id="payment_area_condition_view" path="/admin/module/paymentcondition/area" methods="get">
<default key="_controller">PaymentCondition\Controller\AreaConditionController::viewAction</default>
</route>
<route id="payment_area_condition_save" path="/admin/module/paymentcondition/area" methods="post">
<default key="_controller">PaymentCondition\Controller\AreaConditionController::saveAction</default>
</route>
</routes>

View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<database defaultIdMethod="native" name="thelia"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../vendor/propel/propel/resources/xsd/database.xsd" >
<table name="payment_delivery_condition" namespace="PaymentCondition\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="payment_module_id" type="INTEGER" required="true"/>
<column name="delivery_module_id" type="INTEGER" required="true"/>
<column name="is_valid" type="TINYINT"/>
<foreign-key foreignTable="module" name="fk_payment_delivery_condition_payment_module_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="payment_module_id" />
</foreign-key>
<foreign-key foreignTable="module" name="fk_payment_delivery_condition_delivery_module_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="delivery_module_id" />
</foreign-key>
</table>
<table name="payment_customer_family_condition" namespace="PaymentCondition\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="payment_module_id" type="INTEGER" required="true"/>
<column name="customer_family_id" type="INTEGER" required="true"/>
<column name="is_valid" type="TINYINT"/>
<foreign-key foreignTable="module" name="fk_payment_customer_family_condition_payment_module_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="payment_module_id" />
</foreign-key>
</table>
<table name="payment_area_condition" namespace="PaymentCondition\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="payment_module_id" type="INTEGER" required="true"/>
<column name="area_id" type="INTEGER" required="true"/>
<column name="is_valid" type="TINYINT"/>
<foreign-key foreignTable="module" name="fk_payment_area_condition_payment_module_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="payment_module_id" />
</foreign-key>
<foreign-key foreignTable="area" name="fk_payment_area_condition_area_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="area_id" />
</foreign-key>
</table>
<table name="payment_customer_condition" namespace="PaymentCondition\Model">
<column name="customer_id" primaryKey="true" type="INTEGER" required="true"/>
<column name="module_restriction_active" type="TINYINT"/>
<foreign-key foreignTable="customer" name="fk_payment_customer_condition_customer_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="customer_id" />
</foreign-key>
</table>
<table name="payment_customer_module_condition" namespace="PaymentCondition\Model">
<column name="payment_module_id" primaryKey="true" type="INTEGER" required="true"/>
<column name="customer_id" primaryKey="true" type="INTEGER" required="true"/>
<column name="is_valid" type="TINYINT"/>
<foreign-key foreignTable="customer" name="fk_payment_customer_module_condition_customer_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="customer_id" />
</foreign-key>
<foreign-key foreignTable="module" name="fk_payment_customer_module_condition_payment_module_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="payment_module_id" />
</foreign-key>
</table>
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
</database>

View File

@@ -0,0 +1,2 @@
# Sqlfile -> Database map
thelia.sql=thelia

View File

@@ -0,0 +1,125 @@
# 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;
-- ---------------------------------------------------------------------
-- payment_delivery_condition
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `payment_delivery_condition`;
CREATE TABLE `payment_delivery_condition`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`payment_module_id` INTEGER NOT NULL,
`delivery_module_id` INTEGER NOT NULL,
`is_valid` TINYINT,
PRIMARY KEY (`id`),
INDEX `fi_payment_delivery_condition_payment_module_id` (`payment_module_id`),
INDEX `fi_payment_delivery_condition_delivery_module_id` (`delivery_module_id`),
CONSTRAINT `fk_payment_delivery_condition_payment_module_id`
FOREIGN KEY (`payment_module_id`)
REFERENCES `module` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `fk_payment_delivery_condition_delivery_module_id`
FOREIGN KEY (`delivery_module_id`)
REFERENCES `module` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- payment_customer_family_condition
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `payment_customer_family_condition`;
CREATE TABLE `payment_customer_family_condition`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`payment_module_id` INTEGER NOT NULL,
`customer_family_id` INTEGER NOT NULL,
`is_valid` TINYINT,
PRIMARY KEY (`id`),
INDEX `fi_payment_customer_family_condition_payment_module_id` (`payment_module_id`),
CONSTRAINT `fk_payment_customer_family_condition_payment_module_id`
FOREIGN KEY (`payment_module_id`)
REFERENCES `module` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- payment_area_condition
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `payment_area_condition`;
CREATE TABLE `payment_area_condition`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`payment_module_id` INTEGER NOT NULL,
`area_id` INTEGER NOT NULL,
`is_valid` TINYINT,
PRIMARY KEY (`id`),
INDEX `fi_payment_area_condition_payment_module_id` (`payment_module_id`),
INDEX `fi_payment_area_condition_area_id` (`area_id`),
CONSTRAINT `fk_payment_area_condition_payment_module_id`
FOREIGN KEY (`payment_module_id`)
REFERENCES `module` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `fk_payment_area_condition_area_id`
FOREIGN KEY (`area_id`)
REFERENCES `area` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- payment_customer_condition
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `payment_customer_condition`;
CREATE TABLE `payment_customer_condition`
(
`customer_id` INTEGER NOT NULL,
`module_restriction_active` TINYINT,
PRIMARY KEY (`customer_id`),
CONSTRAINT `fk_payment_customer_condition_customer_id`
FOREIGN KEY (`customer_id`)
REFERENCES `customer` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- payment_customer_module_condition
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `payment_customer_module_condition`;
CREATE TABLE `payment_customer_module_condition`
(
`payment_module_id` INTEGER NOT NULL,
`customer_id` INTEGER NOT NULL,
`is_valid` TINYINT,
PRIMARY KEY (`payment_module_id`,`customer_id`),
INDEX `fi_payment_customer_module_condition_customer_id` (`customer_id`),
CONSTRAINT `fk_payment_customer_module_condition_customer_id`
FOREIGN KEY (`customer_id`)
REFERENCES `customer` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `fk_payment_customer_module_condition_payment_module_id`
FOREIGN KEY (`payment_module_id`)
REFERENCES `module` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,17 @@
<?php
namespace PaymentCondition\Controller;
use PaymentCondition\Model\PaymentDeliveryCondition;
use PaymentCondition\Model\PaymentDeliveryConditionQuery;
use Thelia\Controller\Admin\BaseAdminController;
use Thelia\Core\HttpFoundation\JsonResponse;
use Thelia\Model\ModuleQuery;
class AdminController extends BaseAdminController
{
public function viewAction()
{
return $this->render('payment-condition/configuration');
}
}

View File

@@ -0,0 +1,62 @@
<?php
namespace PaymentCondition\Controller;
use PaymentCondition\Model\PaymentAreaCondition;
use PaymentCondition\Model\PaymentAreaConditionQuery;
use Thelia\Controller\Admin\BaseAdminController;
use Thelia\Core\HttpFoundation\JsonResponse;
use Thelia\Model\AreaQuery;
use Thelia\Model\ModuleQuery;
class AreaConditionController extends BaseAdminController
{
public function viewAction()
{
$areaPaymentConditionArray = [];
$paymentModules = ModuleQuery::create()
->findByCategory('payment');
$shippingAreas = AreaQuery::create()->find();
$paymentAreaConditions = PaymentAreaConditionQuery::create()
->find();
if (null !== $paymentAreaConditions) {
/** @var PaymentAreaCondition $paymentAreaCondition */
foreach ($paymentAreaConditions as $paymentAreaCondition) {
$areaPaymentConditionArray[$paymentAreaCondition->getPaymentModuleId()][$paymentAreaCondition->getAreaId()] = $paymentAreaCondition->getIsValid();
}
}
return $this->render('payment-condition/shipping_area', [
'paymentModules' => $paymentModules,
'shippingAreas' => $shippingAreas,
"areaPaymentCondition" => $areaPaymentConditionArray
]);
}
public function saveAction()
{
$request = $this->getRequest();
try {
$paymentId = $request->request->get("paymentId");
$areaId = $request->request->get("areaId");
$isValid = $request->request->get("isValid") == "true" ? 1 : 0;
$paymentArea = PaymentAreaConditionQuery::create()
->filterByPaymentModuleId($paymentId)
->filterByAreaId($areaId)
->findOneOrCreate();
$paymentArea->setIsValid($isValid)
->save();
} catch (\Exception $e) {
return JsonResponse::create($e->getMessage(), 500);
}
return JsonResponse::create("Success");
}
}

View File

@@ -0,0 +1,78 @@
<?php
namespace PaymentCondition\Controller;
use CustomerFamily\Model\CustomerFamily;
use CustomerFamily\Model\CustomerFamilyQuery;
use PaymentCondition\Model\PaymentCustomerFamilyCondition;
use PaymentCondition\Model\PaymentCustomerFamilyConditionQuery;
use Thelia\Controller\Admin\BaseAdminController;
use Thelia\Core\HttpFoundation\JsonResponse;
use Thelia\Model\Module;
use Thelia\Model\ModuleQuery;
class CustomerFamilyConditionController extends BaseAdminController
{
public function viewAction()
{
$customerFamilyPaymentsModules = [];
$moduleCodes = [];
$familyCodes = [];
$paymentModules = ModuleQuery::create()
->findByCategory('payment');
$customerFamilies = CustomerFamilyQuery::create()
->find();
/** @var Module $paymentModule */
foreach ($paymentModules as $paymentModule) {
$moduleCodes[$paymentModule->getId()] = $paymentModule->getCode();
/** @var CustomerFamily $customerFamily */
foreach ($customerFamilies as $customerFamily) {
$customerFamilyPaymentsModules[$customerFamily->getId()][$paymentModule->getId()] = 0;
$familyCodes[$customerFamily->getId()] = $customerFamily->getCode();
}
}
$customerFamilyPayments = PaymentCustomerFamilyConditionQuery::create()
->find();
if (null !== $customerFamilyPayments) {
/** @var PaymentCustomerFamilyCondition $customerFamilyPayment */
foreach ($customerFamilyPayments as $customerFamilyPayment) {
$customerFamilyPaymentsModules[$customerFamilyPayment->getCustomerFamilyId()][$customerFamilyPayment->getPaymentModuleId()] = $customerFamilyPayment->getIsValid();
}
}
return $this->render('payment-condition/customer_family', [
"module_codes" => $moduleCodes,
"family_codes" => $familyCodes,
"paymentFamilyCondition" =>$customerFamilyPaymentsModules
]);
}
public function saveAction()
{
$request = $this->getRequest();
try {
$moduleId = $request->request->get("moduleId");
$customerFamilyId = $request->request->get("customerFamilyId");
$isValid = $request->request->get("isValid") == "true" ? 1 : 0;
$paymentCustomerFamily = PaymentCustomerFamilyConditionQuery::create()
->filterByPaymentModuleId($moduleId)
->filterByCustomerFamilyId($customerFamilyId)
->findOneOrCreate();
$paymentCustomerFamily->setIsValid($isValid)
->save();
} catch (\Exception $e) {
return JsonResponse::create($e->getMessage(), 500);
}
return JsonResponse::create("Success");
}
}

View File

@@ -0,0 +1,62 @@
<?php
namespace PaymentCondition\Controller;
use PaymentCondition\Model\PaymentDeliveryCondition;
use PaymentCondition\Model\PaymentDeliveryConditionQuery;
use Thelia\Controller\Admin\BaseAdminController;
use Thelia\Core\HttpFoundation\JsonResponse;
use Thelia\Model\ModuleQuery;
class DeliveryConditionController extends BaseAdminController
{
public function viewAction()
{
$paymentDeliveryConditionArray = [];
$paymentModules = ModuleQuery::create()
->findByCategory('payment');
$deliveryModules = ModuleQuery::create()
->findByCategory('delivery');
$paymentDeliveryConditions = PaymentDeliveryConditionQuery::create()
->find();
if (null !== $paymentDeliveryConditions) {
/** @var PaymentDeliveryCondition $paymentDeliveryCondition */
foreach ($paymentDeliveryConditions as $paymentDeliveryCondition) {
$paymentDeliveryConditionArray[$paymentDeliveryCondition->getPaymentModuleId()][$paymentDeliveryCondition->getDeliveryModuleId()] = $paymentDeliveryCondition->getIsValid();
}
}
return $this->render('payment-condition/delivery', [
'paymentModules' => $paymentModules,
'deliveryModules' => $deliveryModules,
"paymentDeliveryCondition" => $paymentDeliveryConditionArray
]);
}
public function saveAction()
{
$request = $this->getRequest();
try {
$paymentId = $request->request->get("paymentId");
$deliveryId = $request->request->get("deliveryId");
$isValid = $request->request->get("isValid") == "true" ? 1 : 0;
$paymentDelivery = PaymentDeliveryConditionQuery::create()
->filterByPaymentModuleId($paymentId)
->filterByDeliveryModuleId($deliveryId)
->findOneOrCreate();
$paymentDelivery->setIsValid($isValid)
->save();
} catch (\Exception $e) {
return JsonResponse::create($e->getMessage(), 500);
}
return JsonResponse::create("Success");
}
}

View File

@@ -0,0 +1,185 @@
<?php
namespace PaymentCondition\EventListeners;
use CustomerFamily\Model\CustomerCustomerFamilyQuery;
use PaymentCondition\Model\Map\PaymentAreaConditionTableMap;
use PaymentCondition\Model\Map\PaymentCustomerConditionTableMap;
use PaymentCondition\Model\Map\PaymentCustomerFamilyConditionTableMap;
use PaymentCondition\Model\Map\PaymentCustomerModuleConditionTableMap;
use PaymentCondition\Model\Map\PaymentDeliveryConditionTableMap;
use PaymentCondition\Model\PaymentCustomerConditionQuery;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\Join;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Thelia\Core\Event\Loop\LoopExtendsBuildModelCriteriaEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\HttpFoundation\Session\Session;
use Thelia\Model\AddressQuery;
use Thelia\Model\Map\CountryAreaTableMap;
use Thelia\Model\Map\CustomerTableMap;
use Thelia\Model\Map\ModuleTableMap;
use Thelia\Model\ModuleQuery;
use Thelia\Model\Order;
class PaymentLoopExtend implements EventSubscriberInterface
{
protected $request;
public function __construct(RequestStack $requestStack)
{
$this->request = $requestStack->getCurrentRequest();
}
public function paymentDeliveryCondition(LoopExtendsBuildModelCriteriaEvent $event)
{
/** @var Order $order */
$order = $this->request->getSession()->get('thelia.order');
if (null === $order) {
return;
}
$deliveryModuleId = $order->getDeliveryModuleId();
if (null === $deliveryModuleId) {
return;
}
$join = new Join();
$join->addExplicitCondition(
ModuleTableMap::TABLE_NAME,
'ID',
null,
PaymentDeliveryConditionTableMap::TABLE_NAME,
'PAYMENT_MODULE_ID',
null
);
$join->setJoinType(Criteria::JOIN);
$event->getModelCriteria()->addJoinObject($join, 'payment_delivery_condition_join')
->addJoinCondition('payment_delivery_condition_join', PaymentDeliveryConditionTableMap::DELIVERY_MODULE_ID . ' = ' . $deliveryModuleId)
->addJoinCondition('payment_delivery_condition_join', PaymentDeliveryConditionTableMap::IS_VALID . ' = 1');
}
public function paymentCustomerFamilyCondition(LoopExtendsBuildModelCriteriaEvent $event)
{
/** @var Session $session */
$session = $this->request->getSession();
$customer = $session->getCustomerUser();
if (null === $customer) {
return null;
}
$customerCustomerFamily = CustomerCustomerFamilyQuery::create()
->findOneByCustomerId($customer->getId());
if (null === $customerCustomerFamily) {
return null;
}
$join = new Join();
$join->addExplicitCondition(
ModuleTableMap::TABLE_NAME,
'ID',
null,
PaymentCustomerFamilyConditionTableMap::TABLE_NAME,
'PAYMENT_MODULE_ID',
null
);
$join->setJoinType(Criteria::JOIN);
$event->getModelCriteria()->addJoinObject($join, 'payment_customer_family_condition_join')
->addJoinCondition('payment_customer_family_condition_join', PaymentCustomerFamilyConditionTableMap::CUSTOMER_FAMILY_ID.' = '.$customerCustomerFamily->getCustomerFamilyId())
->addJoinCondition('payment_customer_family_condition_join', PaymentCustomerFamilyConditionTableMap::IS_VALID . ' = 1');
}
public function paymentAreaCondition(LoopExtendsBuildModelCriteriaEvent $event)
{
/** @var Order $order */
$order = $this->request->getSession()->get('thelia.order');
if (null === $order) {
return;
}
$chosenDeliveryAddressId = $order->getChoosenDeliveryAddress();
if (null === $chosenDeliveryAddressId) {
return;
}
$chosenDeliveryAddress = AddressQuery::create()->findOneById($chosenDeliveryAddressId);
if (null === $chosenDeliveryAddress) {
return;
}
$chosenCountryId = $chosenDeliveryAddress->getCountryId();
$query = ModuleTableMap::ID . ' IN (SELECT '.PaymentAreaConditionTableMap::PAYMENT_MODULE_ID.' FROM '.PaymentAreaConditionTableMap::TABLE_NAME
.' WHERE '.PaymentAreaConditionTableMap::IS_VALID.' = 1 AND area_id IN'
.' (SELECT '.CountryAreaTableMap::AREA_ID.' FROM '.CountryAreaTableMap::TABLE_NAME.' WHERE '.CountryAreaTableMap::COUNTRY_ID.' = '.$chosenCountryId.')'
.')';
$event->getModelCriteria()->add(ModuleTableMap::ID, $query, Criteria::CUSTOM);
}
public function paymentCustomerCondition(LoopExtendsBuildModelCriteriaEvent $event)
{
$criteria = $event->getModelCriteria();
$customer = $this->request->getSession()->getCustomerUser();
if (null === $customer) {
return;
}
$paymentCustomerCondition = PaymentCustomerConditionQuery::create()
->findOneByCustomerId($customer->getId());
if (null === $paymentCustomerCondition || false == $paymentCustomerCondition->getModuleRestrictionActive()) {
return;
}
// Join customer module condition to know if the payment module is valid
$paymentModuleConditionJoin = new Join();
$paymentModuleConditionJoin->addExplicitCondition(
ModuleTableMap::TABLE_NAME,
'ID',
null,
PaymentCustomerModuleConditionTableMap::TABLE_NAME,
'PAYMENT_MODULE_ID',
null
);
$paymentModuleConditionJoin->setJoinType(Criteria::JOIN);
$criteria->addJoinObject($paymentModuleConditionJoin, 'payment_customer_module_condition_join')
->addJoinCondition('payment_customer_module_condition_join', PaymentCustomerModuleConditionTableMap::COL_CUSTOMER_ID.' = '.$customer->getId())
->addJoinCondition('payment_customer_module_condition_join', PaymentCustomerModuleConditionTableMap::COL_IS_VALID.' = 1');
}
public static function getSubscribedEvents()
{
$events = [];
$events[TheliaEvents::getLoopExtendsEvent(TheliaEvents::LOOP_EXTENDS_BUILD_MODEL_CRITERIA, 'payment')][] = ['paymentDeliveryCondition', '64'];
$events[TheliaEvents::getLoopExtendsEvent(TheliaEvents::LOOP_EXTENDS_BUILD_MODEL_CRITERIA, 'payment')][] = ['paymentAreaCondition', '62'];
$customFamilyModuleIsActive = ModuleQuery::create()
->filterByCode('CustomerFamily')
->filterByActivate(1)
->findOne();
if (null !== $customFamilyModuleIsActive) {
$events[TheliaEvents::getLoopExtendsEvent(TheliaEvents::LOOP_EXTENDS_BUILD_MODEL_CRITERIA, 'payment')][] = ['paymentCustomerFamilyCondition', '63'];
}
$events[TheliaEvents::getLoopExtendsEvent(TheliaEvents::LOOP_EXTENDS_BUILD_MODEL_CRITERIA, 'payment')][] = ['paymentCustomerCondition', '60'];
return $events;
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace PaymentCondition\Hook;
use PaymentCondition\Model\PaymentCustomerConditionQuery;
use PaymentCondition\Model\PaymentCustomerModuleConditionQuery;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
class CustomerEditHook extends BaseHook
{
public function onCustomerEdit(HookRenderEvent $event)
{
$customerId = $event->getArgument('customer_id');
$paymentCustomerCondition = PaymentCustomerConditionQuery::create()
->findOneByCustomerId($customerId);
$paymentCustomerModuleConditions = PaymentCustomerModuleConditionQuery::create()
->findByCustomerId($customerId);
$allowedModules = [];
foreach ($paymentCustomerModuleConditions as $paymentCustomerModuleCondition) {
if ($paymentCustomerModuleCondition->getIsValid()) {
$allowedModules[] = $paymentCustomerModuleCondition->getModule();
}
}
$event->add($this->render('payment-condition/customer_edit_hook.html', compact('paymentCustomerCondition', 'allowedModules')));
}
}

View File

@@ -0,0 +1,12 @@
<?php
return array(
'Allowed payments :' => 'Paiements autorisés :',
'Condition by chosen delivery module' => 'Condition par module de livraison',
'Condition by chosen shipping area' => 'Condition par zone de livraison',
'Condition by customer family' => 'Condition par famille de client',
'Install and activate \'CustomerFamily\' module to get configuration options.' => 'Installez et activez le module \'CustomerFamily\' pour configurer cette partie',
'Payment condition module configuration' => 'Configuration des conditions de paiement',
'Payment conditions for this customer' => 'Conditions de paiement pour ce client',
'Payment restrictions is not activated for this customer' => 'Pas de restriction de paiement pour ce client',
);

View File

@@ -0,0 +1,4 @@
<?php
return array(
// 'an english string' => 'The displayed english string',
);

View File

@@ -0,0 +1,4 @@
<?php
return array(
// 'an english string' => 'La traduction française de la chaine',
);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,646 @@
<?php
namespace PaymentCondition\Model\Base;
use \Exception;
use \PDO;
use PaymentCondition\Model\PaymentAreaCondition as ChildPaymentAreaCondition;
use PaymentCondition\Model\PaymentAreaConditionQuery as ChildPaymentAreaConditionQuery;
use PaymentCondition\Model\Map\PaymentAreaConditionTableMap;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\Area;
use Thelia\Model\Module;
/**
* Base class that represents a query for the 'payment_area_condition' table.
*
*
*
* @method ChildPaymentAreaConditionQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildPaymentAreaConditionQuery orderByPaymentModuleId($order = Criteria::ASC) Order by the payment_module_id column
* @method ChildPaymentAreaConditionQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
* @method ChildPaymentAreaConditionQuery orderByIsValid($order = Criteria::ASC) Order by the is_valid column
*
* @method ChildPaymentAreaConditionQuery groupById() Group by the id column
* @method ChildPaymentAreaConditionQuery groupByPaymentModuleId() Group by the payment_module_id column
* @method ChildPaymentAreaConditionQuery groupByAreaId() Group by the area_id column
* @method ChildPaymentAreaConditionQuery groupByIsValid() Group by the is_valid column
*
* @method ChildPaymentAreaConditionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildPaymentAreaConditionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildPaymentAreaConditionQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildPaymentAreaConditionQuery leftJoinModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the Module relation
* @method ChildPaymentAreaConditionQuery rightJoinModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Module relation
* @method ChildPaymentAreaConditionQuery innerJoinModule($relationAlias = null) Adds a INNER JOIN clause to the query using the Module relation
*
* @method ChildPaymentAreaConditionQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
* @method ChildPaymentAreaConditionQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
* @method ChildPaymentAreaConditionQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
*
* @method ChildPaymentAreaCondition findOne(ConnectionInterface $con = null) Return the first ChildPaymentAreaCondition matching the query
* @method ChildPaymentAreaCondition findOneOrCreate(ConnectionInterface $con = null) Return the first ChildPaymentAreaCondition matching the query, or a new ChildPaymentAreaCondition object populated from the query conditions when no match is found
*
* @method ChildPaymentAreaCondition findOneById(int $id) Return the first ChildPaymentAreaCondition filtered by the id column
* @method ChildPaymentAreaCondition findOneByPaymentModuleId(int $payment_module_id) Return the first ChildPaymentAreaCondition filtered by the payment_module_id column
* @method ChildPaymentAreaCondition findOneByAreaId(int $area_id) Return the first ChildPaymentAreaCondition filtered by the area_id column
* @method ChildPaymentAreaCondition findOneByIsValid(int $is_valid) Return the first ChildPaymentAreaCondition filtered by the is_valid column
*
* @method array findById(int $id) Return ChildPaymentAreaCondition objects filtered by the id column
* @method array findByPaymentModuleId(int $payment_module_id) Return ChildPaymentAreaCondition objects filtered by the payment_module_id column
* @method array findByAreaId(int $area_id) Return ChildPaymentAreaCondition objects filtered by the area_id column
* @method array findByIsValid(int $is_valid) Return ChildPaymentAreaCondition objects filtered by the is_valid column
*
*/
abstract class PaymentAreaConditionQuery extends ModelCriteria
{
/**
* Initializes internal state of \PaymentCondition\Model\Base\PaymentAreaConditionQuery 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 = '\\PaymentCondition\\Model\\PaymentAreaCondition', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildPaymentAreaConditionQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildPaymentAreaConditionQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \PaymentCondition\Model\PaymentAreaConditionQuery) {
return $criteria;
}
$query = new \PaymentCondition\Model\PaymentAreaConditionQuery();
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 ChildPaymentAreaCondition|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = PaymentAreaConditionTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(PaymentAreaConditionTableMap::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 ChildPaymentAreaCondition A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, PAYMENT_MODULE_ID, AREA_ID, IS_VALID FROM payment_area_condition 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 ChildPaymentAreaCondition();
$obj->hydrate($row);
PaymentAreaConditionTableMap::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 ChildPaymentAreaCondition|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 ChildPaymentAreaConditionQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(PaymentAreaConditionTableMap::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 ChildPaymentAreaConditionQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(PaymentAreaConditionTableMap::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 ChildPaymentAreaConditionQuery 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(PaymentAreaConditionTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(PaymentAreaConditionTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(PaymentAreaConditionTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the payment_module_id column
*
* Example usage:
* <code>
* $query->filterByPaymentModuleId(1234); // WHERE payment_module_id = 1234
* $query->filterByPaymentModuleId(array(12, 34)); // WHERE payment_module_id IN (12, 34)
* $query->filterByPaymentModuleId(array('min' => 12)); // WHERE payment_module_id > 12
* </code>
*
* @see filterByModule()
*
* @param mixed $paymentModuleId 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 ChildPaymentAreaConditionQuery The current query, for fluid interface
*/
public function filterByPaymentModuleId($paymentModuleId = null, $comparison = null)
{
if (is_array($paymentModuleId)) {
$useMinMax = false;
if (isset($paymentModuleId['min'])) {
$this->addUsingAlias(PaymentAreaConditionTableMap::PAYMENT_MODULE_ID, $paymentModuleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($paymentModuleId['max'])) {
$this->addUsingAlias(PaymentAreaConditionTableMap::PAYMENT_MODULE_ID, $paymentModuleId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(PaymentAreaConditionTableMap::PAYMENT_MODULE_ID, $paymentModuleId, $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 ChildPaymentAreaConditionQuery 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(PaymentAreaConditionTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($areaId['max'])) {
$this->addUsingAlias(PaymentAreaConditionTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(PaymentAreaConditionTableMap::AREA_ID, $areaId, $comparison);
}
/**
* Filter the query on the is_valid column
*
* Example usage:
* <code>
* $query->filterByIsValid(1234); // WHERE is_valid = 1234
* $query->filterByIsValid(array(12, 34)); // WHERE is_valid IN (12, 34)
* $query->filterByIsValid(array('min' => 12)); // WHERE is_valid > 12
* </code>
*
* @param mixed $isValid 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 ChildPaymentAreaConditionQuery The current query, for fluid interface
*/
public function filterByIsValid($isValid = null, $comparison = null)
{
if (is_array($isValid)) {
$useMinMax = false;
if (isset($isValid['min'])) {
$this->addUsingAlias(PaymentAreaConditionTableMap::IS_VALID, $isValid['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($isValid['max'])) {
$this->addUsingAlias(PaymentAreaConditionTableMap::IS_VALID, $isValid['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(PaymentAreaConditionTableMap::IS_VALID, $isValid, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Module object
*
* @param \Thelia\Model\Module|ObjectCollection $module The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildPaymentAreaConditionQuery The current query, for fluid interface
*/
public function filterByModule($module, $comparison = null)
{
if ($module instanceof \Thelia\Model\Module) {
return $this
->addUsingAlias(PaymentAreaConditionTableMap::PAYMENT_MODULE_ID, $module->getId(), $comparison);
} elseif ($module instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(PaymentAreaConditionTableMap::PAYMENT_MODULE_ID, $module->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByModule() only accepts arguments of type \Thelia\Model\Module or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Module relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildPaymentAreaConditionQuery The current query, for fluid interface
*/
public function joinModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Module');
// 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, 'Module');
}
return $this;
}
/**
* Use the Module relation Module object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\ModuleQuery A secondary query class using the current class as primary query
*/
public function useModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinModule($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Module', '\Thelia\Model\ModuleQuery');
}
/**
* Filter the query by a related \Thelia\Model\Area object
*
* @param \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 ChildPaymentAreaConditionQuery The current query, for fluid interface
*/
public function filterByArea($area, $comparison = null)
{
if ($area instanceof \Thelia\Model\Area) {
return $this
->addUsingAlias(PaymentAreaConditionTableMap::AREA_ID, $area->getId(), $comparison);
} elseif ($area instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(PaymentAreaConditionTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByArea() only accepts arguments of type \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 ChildPaymentAreaConditionQuery 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 \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', '\Thelia\Model\AreaQuery');
}
/**
* Exclude object from result
*
* @param ChildPaymentAreaCondition $paymentAreaCondition Object to remove from the list of results
*
* @return ChildPaymentAreaConditionQuery The current query, for fluid interface
*/
public function prune($paymentAreaCondition = null)
{
if ($paymentAreaCondition) {
$this->addUsingAlias(PaymentAreaConditionTableMap::ID, $paymentAreaCondition->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the payment_area_condition 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(PaymentAreaConditionTableMap::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).
PaymentAreaConditionTableMap::clearInstancePool();
PaymentAreaConditionTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildPaymentAreaCondition or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildPaymentAreaCondition 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(PaymentAreaConditionTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(PaymentAreaConditionTableMap::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();
PaymentAreaConditionTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
PaymentAreaConditionTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // PaymentAreaConditionQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,564 @@
<?php
namespace PaymentCondition\Model\Base;
use \Exception;
use \PDO;
use PaymentCondition\Model\PaymentCustomerFamilyCondition as ChildPaymentCustomerFamilyCondition;
use PaymentCondition\Model\PaymentCustomerFamilyConditionQuery as ChildPaymentCustomerFamilyConditionQuery;
use PaymentCondition\Model\Map\PaymentCustomerFamilyConditionTableMap;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\Module;
/**
* Base class that represents a query for the 'payment_customer_family_condition' table.
*
*
*
* @method ChildPaymentCustomerFamilyConditionQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildPaymentCustomerFamilyConditionQuery orderByPaymentModuleId($order = Criteria::ASC) Order by the payment_module_id column
* @method ChildPaymentCustomerFamilyConditionQuery orderByCustomerFamilyId($order = Criteria::ASC) Order by the customer_family_id column
* @method ChildPaymentCustomerFamilyConditionQuery orderByIsValid($order = Criteria::ASC) Order by the is_valid column
*
* @method ChildPaymentCustomerFamilyConditionQuery groupById() Group by the id column
* @method ChildPaymentCustomerFamilyConditionQuery groupByPaymentModuleId() Group by the payment_module_id column
* @method ChildPaymentCustomerFamilyConditionQuery groupByCustomerFamilyId() Group by the customer_family_id column
* @method ChildPaymentCustomerFamilyConditionQuery groupByIsValid() Group by the is_valid column
*
* @method ChildPaymentCustomerFamilyConditionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildPaymentCustomerFamilyConditionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildPaymentCustomerFamilyConditionQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildPaymentCustomerFamilyConditionQuery leftJoinModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the Module relation
* @method ChildPaymentCustomerFamilyConditionQuery rightJoinModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Module relation
* @method ChildPaymentCustomerFamilyConditionQuery innerJoinModule($relationAlias = null) Adds a INNER JOIN clause to the query using the Module relation
*
* @method ChildPaymentCustomerFamilyCondition findOne(ConnectionInterface $con = null) Return the first ChildPaymentCustomerFamilyCondition matching the query
* @method ChildPaymentCustomerFamilyCondition findOneOrCreate(ConnectionInterface $con = null) Return the first ChildPaymentCustomerFamilyCondition matching the query, or a new ChildPaymentCustomerFamilyCondition object populated from the query conditions when no match is found
*
* @method ChildPaymentCustomerFamilyCondition findOneById(int $id) Return the first ChildPaymentCustomerFamilyCondition filtered by the id column
* @method ChildPaymentCustomerFamilyCondition findOneByPaymentModuleId(int $payment_module_id) Return the first ChildPaymentCustomerFamilyCondition filtered by the payment_module_id column
* @method ChildPaymentCustomerFamilyCondition findOneByCustomerFamilyId(int $customer_family_id) Return the first ChildPaymentCustomerFamilyCondition filtered by the customer_family_id column
* @method ChildPaymentCustomerFamilyCondition findOneByIsValid(int $is_valid) Return the first ChildPaymentCustomerFamilyCondition filtered by the is_valid column
*
* @method array findById(int $id) Return ChildPaymentCustomerFamilyCondition objects filtered by the id column
* @method array findByPaymentModuleId(int $payment_module_id) Return ChildPaymentCustomerFamilyCondition objects filtered by the payment_module_id column
* @method array findByCustomerFamilyId(int $customer_family_id) Return ChildPaymentCustomerFamilyCondition objects filtered by the customer_family_id column
* @method array findByIsValid(int $is_valid) Return ChildPaymentCustomerFamilyCondition objects filtered by the is_valid column
*
*/
abstract class PaymentCustomerFamilyConditionQuery extends ModelCriteria
{
/**
* Initializes internal state of \PaymentCondition\Model\Base\PaymentCustomerFamilyConditionQuery 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 = '\\PaymentCondition\\Model\\PaymentCustomerFamilyCondition', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildPaymentCustomerFamilyConditionQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildPaymentCustomerFamilyConditionQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \PaymentCondition\Model\PaymentCustomerFamilyConditionQuery) {
return $criteria;
}
$query = new \PaymentCondition\Model\PaymentCustomerFamilyConditionQuery();
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 ChildPaymentCustomerFamilyCondition|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = PaymentCustomerFamilyConditionTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(PaymentCustomerFamilyConditionTableMap::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 ChildPaymentCustomerFamilyCondition A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, PAYMENT_MODULE_ID, CUSTOMER_FAMILY_ID, IS_VALID FROM payment_customer_family_condition 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 ChildPaymentCustomerFamilyCondition();
$obj->hydrate($row);
PaymentCustomerFamilyConditionTableMap::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 ChildPaymentCustomerFamilyCondition|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 ChildPaymentCustomerFamilyConditionQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(PaymentCustomerFamilyConditionTableMap::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 ChildPaymentCustomerFamilyConditionQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(PaymentCustomerFamilyConditionTableMap::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 ChildPaymentCustomerFamilyConditionQuery 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(PaymentCustomerFamilyConditionTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(PaymentCustomerFamilyConditionTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(PaymentCustomerFamilyConditionTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the payment_module_id column
*
* Example usage:
* <code>
* $query->filterByPaymentModuleId(1234); // WHERE payment_module_id = 1234
* $query->filterByPaymentModuleId(array(12, 34)); // WHERE payment_module_id IN (12, 34)
* $query->filterByPaymentModuleId(array('min' => 12)); // WHERE payment_module_id > 12
* </code>
*
* @see filterByModule()
*
* @param mixed $paymentModuleId 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 ChildPaymentCustomerFamilyConditionQuery The current query, for fluid interface
*/
public function filterByPaymentModuleId($paymentModuleId = null, $comparison = null)
{
if (is_array($paymentModuleId)) {
$useMinMax = false;
if (isset($paymentModuleId['min'])) {
$this->addUsingAlias(PaymentCustomerFamilyConditionTableMap::PAYMENT_MODULE_ID, $paymentModuleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($paymentModuleId['max'])) {
$this->addUsingAlias(PaymentCustomerFamilyConditionTableMap::PAYMENT_MODULE_ID, $paymentModuleId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(PaymentCustomerFamilyConditionTableMap::PAYMENT_MODULE_ID, $paymentModuleId, $comparison);
}
/**
* Filter the query on the customer_family_id column
*
* Example usage:
* <code>
* $query->filterByCustomerFamilyId(1234); // WHERE customer_family_id = 1234
* $query->filterByCustomerFamilyId(array(12, 34)); // WHERE customer_family_id IN (12, 34)
* $query->filterByCustomerFamilyId(array('min' => 12)); // WHERE customer_family_id > 12
* </code>
*
* @param mixed $customerFamilyId 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 ChildPaymentCustomerFamilyConditionQuery The current query, for fluid interface
*/
public function filterByCustomerFamilyId($customerFamilyId = null, $comparison = null)
{
if (is_array($customerFamilyId)) {
$useMinMax = false;
if (isset($customerFamilyId['min'])) {
$this->addUsingAlias(PaymentCustomerFamilyConditionTableMap::CUSTOMER_FAMILY_ID, $customerFamilyId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($customerFamilyId['max'])) {
$this->addUsingAlias(PaymentCustomerFamilyConditionTableMap::CUSTOMER_FAMILY_ID, $customerFamilyId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(PaymentCustomerFamilyConditionTableMap::CUSTOMER_FAMILY_ID, $customerFamilyId, $comparison);
}
/**
* Filter the query on the is_valid column
*
* Example usage:
* <code>
* $query->filterByIsValid(1234); // WHERE is_valid = 1234
* $query->filterByIsValid(array(12, 34)); // WHERE is_valid IN (12, 34)
* $query->filterByIsValid(array('min' => 12)); // WHERE is_valid > 12
* </code>
*
* @param mixed $isValid 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 ChildPaymentCustomerFamilyConditionQuery The current query, for fluid interface
*/
public function filterByIsValid($isValid = null, $comparison = null)
{
if (is_array($isValid)) {
$useMinMax = false;
if (isset($isValid['min'])) {
$this->addUsingAlias(PaymentCustomerFamilyConditionTableMap::IS_VALID, $isValid['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($isValid['max'])) {
$this->addUsingAlias(PaymentCustomerFamilyConditionTableMap::IS_VALID, $isValid['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(PaymentCustomerFamilyConditionTableMap::IS_VALID, $isValid, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Module object
*
* @param \Thelia\Model\Module|ObjectCollection $module The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildPaymentCustomerFamilyConditionQuery The current query, for fluid interface
*/
public function filterByModule($module, $comparison = null)
{
if ($module instanceof \Thelia\Model\Module) {
return $this
->addUsingAlias(PaymentCustomerFamilyConditionTableMap::PAYMENT_MODULE_ID, $module->getId(), $comparison);
} elseif ($module instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(PaymentCustomerFamilyConditionTableMap::PAYMENT_MODULE_ID, $module->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByModule() only accepts arguments of type \Thelia\Model\Module or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Module relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildPaymentCustomerFamilyConditionQuery The current query, for fluid interface
*/
public function joinModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Module');
// 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, 'Module');
}
return $this;
}
/**
* Use the Module relation Module object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\ModuleQuery A secondary query class using the current class as primary query
*/
public function useModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinModule($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Module', '\Thelia\Model\ModuleQuery');
}
/**
* Exclude object from result
*
* @param ChildPaymentCustomerFamilyCondition $paymentCustomerFamilyCondition Object to remove from the list of results
*
* @return ChildPaymentCustomerFamilyConditionQuery The current query, for fluid interface
*/
public function prune($paymentCustomerFamilyCondition = null)
{
if ($paymentCustomerFamilyCondition) {
$this->addUsingAlias(PaymentCustomerFamilyConditionTableMap::ID, $paymentCustomerFamilyCondition->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the payment_customer_family_condition 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(PaymentCustomerFamilyConditionTableMap::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).
PaymentCustomerFamilyConditionTableMap::clearInstancePool();
PaymentCustomerFamilyConditionTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildPaymentCustomerFamilyCondition or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildPaymentCustomerFamilyCondition 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(PaymentCustomerFamilyConditionTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(PaymentCustomerFamilyConditionTableMap::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();
PaymentCustomerFamilyConditionTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
PaymentCustomerFamilyConditionTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // PaymentCustomerFamilyConditionQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,645 @@
<?php
namespace PaymentCondition\Model\Base;
use \Exception;
use \PDO;
use PaymentCondition\Model\PaymentDeliveryCondition as ChildPaymentDeliveryCondition;
use PaymentCondition\Model\PaymentDeliveryConditionQuery as ChildPaymentDeliveryConditionQuery;
use PaymentCondition\Model\Map\PaymentDeliveryConditionTableMap;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\Module;
/**
* Base class that represents a query for the 'payment_delivery_condition' table.
*
*
*
* @method ChildPaymentDeliveryConditionQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildPaymentDeliveryConditionQuery orderByPaymentModuleId($order = Criteria::ASC) Order by the payment_module_id column
* @method ChildPaymentDeliveryConditionQuery orderByDeliveryModuleId($order = Criteria::ASC) Order by the delivery_module_id column
* @method ChildPaymentDeliveryConditionQuery orderByIsValid($order = Criteria::ASC) Order by the is_valid column
*
* @method ChildPaymentDeliveryConditionQuery groupById() Group by the id column
* @method ChildPaymentDeliveryConditionQuery groupByPaymentModuleId() Group by the payment_module_id column
* @method ChildPaymentDeliveryConditionQuery groupByDeliveryModuleId() Group by the delivery_module_id column
* @method ChildPaymentDeliveryConditionQuery groupByIsValid() Group by the is_valid column
*
* @method ChildPaymentDeliveryConditionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildPaymentDeliveryConditionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildPaymentDeliveryConditionQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildPaymentDeliveryConditionQuery leftJoinModuleRelatedByPaymentModuleId($relationAlias = null) Adds a LEFT JOIN clause to the query using the ModuleRelatedByPaymentModuleId relation
* @method ChildPaymentDeliveryConditionQuery rightJoinModuleRelatedByPaymentModuleId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleRelatedByPaymentModuleId relation
* @method ChildPaymentDeliveryConditionQuery innerJoinModuleRelatedByPaymentModuleId($relationAlias = null) Adds a INNER JOIN clause to the query using the ModuleRelatedByPaymentModuleId relation
*
* @method ChildPaymentDeliveryConditionQuery leftJoinModuleRelatedByDeliveryModuleId($relationAlias = null) Adds a LEFT JOIN clause to the query using the ModuleRelatedByDeliveryModuleId relation
* @method ChildPaymentDeliveryConditionQuery rightJoinModuleRelatedByDeliveryModuleId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleRelatedByDeliveryModuleId relation
* @method ChildPaymentDeliveryConditionQuery innerJoinModuleRelatedByDeliveryModuleId($relationAlias = null) Adds a INNER JOIN clause to the query using the ModuleRelatedByDeliveryModuleId relation
*
* @method ChildPaymentDeliveryCondition findOne(ConnectionInterface $con = null) Return the first ChildPaymentDeliveryCondition matching the query
* @method ChildPaymentDeliveryCondition findOneOrCreate(ConnectionInterface $con = null) Return the first ChildPaymentDeliveryCondition matching the query, or a new ChildPaymentDeliveryCondition object populated from the query conditions when no match is found
*
* @method ChildPaymentDeliveryCondition findOneById(int $id) Return the first ChildPaymentDeliveryCondition filtered by the id column
* @method ChildPaymentDeliveryCondition findOneByPaymentModuleId(int $payment_module_id) Return the first ChildPaymentDeliveryCondition filtered by the payment_module_id column
* @method ChildPaymentDeliveryCondition findOneByDeliveryModuleId(int $delivery_module_id) Return the first ChildPaymentDeliveryCondition filtered by the delivery_module_id column
* @method ChildPaymentDeliveryCondition findOneByIsValid(int $is_valid) Return the first ChildPaymentDeliveryCondition filtered by the is_valid column
*
* @method array findById(int $id) Return ChildPaymentDeliveryCondition objects filtered by the id column
* @method array findByPaymentModuleId(int $payment_module_id) Return ChildPaymentDeliveryCondition objects filtered by the payment_module_id column
* @method array findByDeliveryModuleId(int $delivery_module_id) Return ChildPaymentDeliveryCondition objects filtered by the delivery_module_id column
* @method array findByIsValid(int $is_valid) Return ChildPaymentDeliveryCondition objects filtered by the is_valid column
*
*/
abstract class PaymentDeliveryConditionQuery extends ModelCriteria
{
/**
* Initializes internal state of \PaymentCondition\Model\Base\PaymentDeliveryConditionQuery 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 = '\\PaymentCondition\\Model\\PaymentDeliveryCondition', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildPaymentDeliveryConditionQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildPaymentDeliveryConditionQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \PaymentCondition\Model\PaymentDeliveryConditionQuery) {
return $criteria;
}
$query = new \PaymentCondition\Model\PaymentDeliveryConditionQuery();
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 ChildPaymentDeliveryCondition|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = PaymentDeliveryConditionTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(PaymentDeliveryConditionTableMap::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 ChildPaymentDeliveryCondition A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, PAYMENT_MODULE_ID, DELIVERY_MODULE_ID, IS_VALID FROM payment_delivery_condition 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 ChildPaymentDeliveryCondition();
$obj->hydrate($row);
PaymentDeliveryConditionTableMap::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 ChildPaymentDeliveryCondition|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 ChildPaymentDeliveryConditionQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(PaymentDeliveryConditionTableMap::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 ChildPaymentDeliveryConditionQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(PaymentDeliveryConditionTableMap::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 ChildPaymentDeliveryConditionQuery 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(PaymentDeliveryConditionTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(PaymentDeliveryConditionTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(PaymentDeliveryConditionTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the payment_module_id column
*
* Example usage:
* <code>
* $query->filterByPaymentModuleId(1234); // WHERE payment_module_id = 1234
* $query->filterByPaymentModuleId(array(12, 34)); // WHERE payment_module_id IN (12, 34)
* $query->filterByPaymentModuleId(array('min' => 12)); // WHERE payment_module_id > 12
* </code>
*
* @see filterByModuleRelatedByPaymentModuleId()
*
* @param mixed $paymentModuleId 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 ChildPaymentDeliveryConditionQuery The current query, for fluid interface
*/
public function filterByPaymentModuleId($paymentModuleId = null, $comparison = null)
{
if (is_array($paymentModuleId)) {
$useMinMax = false;
if (isset($paymentModuleId['min'])) {
$this->addUsingAlias(PaymentDeliveryConditionTableMap::PAYMENT_MODULE_ID, $paymentModuleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($paymentModuleId['max'])) {
$this->addUsingAlias(PaymentDeliveryConditionTableMap::PAYMENT_MODULE_ID, $paymentModuleId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(PaymentDeliveryConditionTableMap::PAYMENT_MODULE_ID, $paymentModuleId, $comparison);
}
/**
* Filter the query on the delivery_module_id column
*
* Example usage:
* <code>
* $query->filterByDeliveryModuleId(1234); // WHERE delivery_module_id = 1234
* $query->filterByDeliveryModuleId(array(12, 34)); // WHERE delivery_module_id IN (12, 34)
* $query->filterByDeliveryModuleId(array('min' => 12)); // WHERE delivery_module_id > 12
* </code>
*
* @see filterByModuleRelatedByDeliveryModuleId()
*
* @param mixed $deliveryModuleId 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 ChildPaymentDeliveryConditionQuery The current query, for fluid interface
*/
public function filterByDeliveryModuleId($deliveryModuleId = null, $comparison = null)
{
if (is_array($deliveryModuleId)) {
$useMinMax = false;
if (isset($deliveryModuleId['min'])) {
$this->addUsingAlias(PaymentDeliveryConditionTableMap::DELIVERY_MODULE_ID, $deliveryModuleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($deliveryModuleId['max'])) {
$this->addUsingAlias(PaymentDeliveryConditionTableMap::DELIVERY_MODULE_ID, $deliveryModuleId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(PaymentDeliveryConditionTableMap::DELIVERY_MODULE_ID, $deliveryModuleId, $comparison);
}
/**
* Filter the query on the is_valid column
*
* Example usage:
* <code>
* $query->filterByIsValid(1234); // WHERE is_valid = 1234
* $query->filterByIsValid(array(12, 34)); // WHERE is_valid IN (12, 34)
* $query->filterByIsValid(array('min' => 12)); // WHERE is_valid > 12
* </code>
*
* @param mixed $isValid 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 ChildPaymentDeliveryConditionQuery The current query, for fluid interface
*/
public function filterByIsValid($isValid = null, $comparison = null)
{
if (is_array($isValid)) {
$useMinMax = false;
if (isset($isValid['min'])) {
$this->addUsingAlias(PaymentDeliveryConditionTableMap::IS_VALID, $isValid['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($isValid['max'])) {
$this->addUsingAlias(PaymentDeliveryConditionTableMap::IS_VALID, $isValid['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(PaymentDeliveryConditionTableMap::IS_VALID, $isValid, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Module object
*
* @param \Thelia\Model\Module|ObjectCollection $module The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildPaymentDeliveryConditionQuery The current query, for fluid interface
*/
public function filterByModuleRelatedByPaymentModuleId($module, $comparison = null)
{
if ($module instanceof \Thelia\Model\Module) {
return $this
->addUsingAlias(PaymentDeliveryConditionTableMap::PAYMENT_MODULE_ID, $module->getId(), $comparison);
} elseif ($module instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(PaymentDeliveryConditionTableMap::PAYMENT_MODULE_ID, $module->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByModuleRelatedByPaymentModuleId() only accepts arguments of type \Thelia\Model\Module or Collection');
}
}
/**
* Adds a JOIN clause to the query using the ModuleRelatedByPaymentModuleId relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildPaymentDeliveryConditionQuery The current query, for fluid interface
*/
public function joinModuleRelatedByPaymentModuleId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ModuleRelatedByPaymentModuleId');
// 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, 'ModuleRelatedByPaymentModuleId');
}
return $this;
}
/**
* Use the ModuleRelatedByPaymentModuleId relation Module object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\ModuleQuery A secondary query class using the current class as primary query
*/
public function useModuleRelatedByPaymentModuleIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinModuleRelatedByPaymentModuleId($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ModuleRelatedByPaymentModuleId', '\Thelia\Model\ModuleQuery');
}
/**
* Filter the query by a related \Thelia\Model\Module object
*
* @param \Thelia\Model\Module|ObjectCollection $module The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildPaymentDeliveryConditionQuery The current query, for fluid interface
*/
public function filterByModuleRelatedByDeliveryModuleId($module, $comparison = null)
{
if ($module instanceof \Thelia\Model\Module) {
return $this
->addUsingAlias(PaymentDeliveryConditionTableMap::DELIVERY_MODULE_ID, $module->getId(), $comparison);
} elseif ($module instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(PaymentDeliveryConditionTableMap::DELIVERY_MODULE_ID, $module->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByModuleRelatedByDeliveryModuleId() only accepts arguments of type \Thelia\Model\Module or Collection');
}
}
/**
* Adds a JOIN clause to the query using the ModuleRelatedByDeliveryModuleId relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildPaymentDeliveryConditionQuery The current query, for fluid interface
*/
public function joinModuleRelatedByDeliveryModuleId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ModuleRelatedByDeliveryModuleId');
// 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, 'ModuleRelatedByDeliveryModuleId');
}
return $this;
}
/**
* Use the ModuleRelatedByDeliveryModuleId relation Module object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\ModuleQuery A secondary query class using the current class as primary query
*/
public function useModuleRelatedByDeliveryModuleIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinModuleRelatedByDeliveryModuleId($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ModuleRelatedByDeliveryModuleId', '\Thelia\Model\ModuleQuery');
}
/**
* Exclude object from result
*
* @param ChildPaymentDeliveryCondition $paymentDeliveryCondition Object to remove from the list of results
*
* @return ChildPaymentDeliveryConditionQuery The current query, for fluid interface
*/
public function prune($paymentDeliveryCondition = null)
{
if ($paymentDeliveryCondition) {
$this->addUsingAlias(PaymentDeliveryConditionTableMap::ID, $paymentDeliveryCondition->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the payment_delivery_condition 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(PaymentDeliveryConditionTableMap::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).
PaymentDeliveryConditionTableMap::clearInstancePool();
PaymentDeliveryConditionTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildPaymentDeliveryCondition or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildPaymentDeliveryCondition 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(PaymentDeliveryConditionTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(PaymentDeliveryConditionTableMap::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();
PaymentDeliveryConditionTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
PaymentDeliveryConditionTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // PaymentDeliveryConditionQuery

View File

@@ -0,0 +1,428 @@
<?php
namespace PaymentCondition\Model\Map;
use PaymentCondition\Model\PaymentAreaCondition;
use PaymentCondition\Model\PaymentAreaConditionQuery;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\DataFetcher\DataFetcherInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
/**
* This class defines the structure of the 'payment_area_condition' 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 PaymentAreaConditionTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'PaymentCondition.Model.Map.PaymentAreaConditionTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'payment_area_condition';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\PaymentCondition\\Model\\PaymentAreaCondition';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'PaymentCondition.Model.PaymentAreaCondition';
/**
* 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 = 'payment_area_condition.ID';
/**
* the column name for the PAYMENT_MODULE_ID field
*/
const PAYMENT_MODULE_ID = 'payment_area_condition.PAYMENT_MODULE_ID';
/**
* the column name for the AREA_ID field
*/
const AREA_ID = 'payment_area_condition.AREA_ID';
/**
* the column name for the IS_VALID field
*/
const IS_VALID = 'payment_area_condition.IS_VALID';
/**
* 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', 'PaymentModuleId', 'AreaId', 'IsValid', ),
self::TYPE_STUDLYPHPNAME => array('id', 'paymentModuleId', 'areaId', 'isValid', ),
self::TYPE_COLNAME => array(PaymentAreaConditionTableMap::ID, PaymentAreaConditionTableMap::PAYMENT_MODULE_ID, PaymentAreaConditionTableMap::AREA_ID, PaymentAreaConditionTableMap::IS_VALID, ),
self::TYPE_RAW_COLNAME => array('ID', 'PAYMENT_MODULE_ID', 'AREA_ID', 'IS_VALID', ),
self::TYPE_FIELDNAME => array('id', 'payment_module_id', 'area_id', 'is_valid', ),
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, 'PaymentModuleId' => 1, 'AreaId' => 2, 'IsValid' => 3, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'paymentModuleId' => 1, 'areaId' => 2, 'isValid' => 3, ),
self::TYPE_COLNAME => array(PaymentAreaConditionTableMap::ID => 0, PaymentAreaConditionTableMap::PAYMENT_MODULE_ID => 1, PaymentAreaConditionTableMap::AREA_ID => 2, PaymentAreaConditionTableMap::IS_VALID => 3, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PAYMENT_MODULE_ID' => 1, 'AREA_ID' => 2, 'IS_VALID' => 3, ),
self::TYPE_FIELDNAME => array('id' => 0, 'payment_module_id' => 1, 'area_id' => 2, 'is_valid' => 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('payment_area_condition');
$this->setPhpName('PaymentAreaCondition');
$this->setClassName('\\PaymentCondition\\Model\\PaymentAreaCondition');
$this->setPackage('PaymentCondition.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('PAYMENT_MODULE_ID', 'PaymentModuleId', 'INTEGER', 'module', 'ID', true, null, null);
$this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', true, null, null);
$this->addColumn('IS_VALID', 'IsValid', 'TINYINT', false, null, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('Module', '\\Thelia\\Model\\Module', RelationMap::MANY_TO_ONE, array('payment_module_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('Area', '\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'CASCADE', 'RESTRICT');
} // buildRelations()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*/
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
// If the PK cannot be derived from the row, return NULL.
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
return (int) $row[
$indexType == TableMap::TYPE_NUM
? 0 + $offset
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
];
}
/**
* The class that the tableMap will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is translated into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
*/
public static function getOMClass($withPrefix = true)
{
return $withPrefix ? PaymentAreaConditionTableMap::CLASS_DEFAULT : PaymentAreaConditionTableMap::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 (PaymentAreaCondition object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = PaymentAreaConditionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = PaymentAreaConditionTableMap::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 + PaymentAreaConditionTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = PaymentAreaConditionTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
PaymentAreaConditionTableMap::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 = PaymentAreaConditionTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = PaymentAreaConditionTableMap::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;
PaymentAreaConditionTableMap::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(PaymentAreaConditionTableMap::ID);
$criteria->addSelectColumn(PaymentAreaConditionTableMap::PAYMENT_MODULE_ID);
$criteria->addSelectColumn(PaymentAreaConditionTableMap::AREA_ID);
$criteria->addSelectColumn(PaymentAreaConditionTableMap::IS_VALID);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.PAYMENT_MODULE_ID');
$criteria->addSelectColumn($alias . '.AREA_ID');
$criteria->addSelectColumn($alias . '.IS_VALID');
}
}
/**
* 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(PaymentAreaConditionTableMap::DATABASE_NAME)->getTable(PaymentAreaConditionTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(PaymentAreaConditionTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(PaymentAreaConditionTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new PaymentAreaConditionTableMap());
}
}
/**
* Performs a DELETE on the database, given a PaymentAreaCondition or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or PaymentAreaCondition 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(PaymentAreaConditionTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \PaymentCondition\Model\PaymentAreaCondition) { // 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(PaymentAreaConditionTableMap::DATABASE_NAME);
$criteria->add(PaymentAreaConditionTableMap::ID, (array) $values, Criteria::IN);
}
$query = PaymentAreaConditionQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { PaymentAreaConditionTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { PaymentAreaConditionTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the payment_area_condition 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 PaymentAreaConditionQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a PaymentAreaCondition or Criteria object.
*
* @param mixed $criteria Criteria or PaymentAreaCondition 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(PaymentAreaConditionTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from PaymentAreaCondition object
}
if ($criteria->containsKey(PaymentAreaConditionTableMap::ID) && $criteria->keyContainsValue(PaymentAreaConditionTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.PaymentAreaConditionTableMap::ID.')');
}
// Set the correct dbName
$query = PaymentAreaConditionQuery::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;
}
} // PaymentAreaConditionTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
PaymentAreaConditionTableMap::buildTableMap();

View File

@@ -0,0 +1,427 @@
<?php
namespace PaymentCondition\Model\Map;
use PaymentCondition\Model\PaymentCustomerFamilyCondition;
use PaymentCondition\Model\PaymentCustomerFamilyConditionQuery;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\DataFetcher\DataFetcherInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
/**
* This class defines the structure of the 'payment_customer_family_condition' 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 PaymentCustomerFamilyConditionTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'PaymentCondition.Model.Map.PaymentCustomerFamilyConditionTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'payment_customer_family_condition';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\PaymentCondition\\Model\\PaymentCustomerFamilyCondition';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'PaymentCondition.Model.PaymentCustomerFamilyCondition';
/**
* 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 = 'payment_customer_family_condition.ID';
/**
* the column name for the PAYMENT_MODULE_ID field
*/
const PAYMENT_MODULE_ID = 'payment_customer_family_condition.PAYMENT_MODULE_ID';
/**
* the column name for the CUSTOMER_FAMILY_ID field
*/
const CUSTOMER_FAMILY_ID = 'payment_customer_family_condition.CUSTOMER_FAMILY_ID';
/**
* the column name for the IS_VALID field
*/
const IS_VALID = 'payment_customer_family_condition.IS_VALID';
/**
* 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', 'PaymentModuleId', 'CustomerFamilyId', 'IsValid', ),
self::TYPE_STUDLYPHPNAME => array('id', 'paymentModuleId', 'customerFamilyId', 'isValid', ),
self::TYPE_COLNAME => array(PaymentCustomerFamilyConditionTableMap::ID, PaymentCustomerFamilyConditionTableMap::PAYMENT_MODULE_ID, PaymentCustomerFamilyConditionTableMap::CUSTOMER_FAMILY_ID, PaymentCustomerFamilyConditionTableMap::IS_VALID, ),
self::TYPE_RAW_COLNAME => array('ID', 'PAYMENT_MODULE_ID', 'CUSTOMER_FAMILY_ID', 'IS_VALID', ),
self::TYPE_FIELDNAME => array('id', 'payment_module_id', 'customer_family_id', 'is_valid', ),
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, 'PaymentModuleId' => 1, 'CustomerFamilyId' => 2, 'IsValid' => 3, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'paymentModuleId' => 1, 'customerFamilyId' => 2, 'isValid' => 3, ),
self::TYPE_COLNAME => array(PaymentCustomerFamilyConditionTableMap::ID => 0, PaymentCustomerFamilyConditionTableMap::PAYMENT_MODULE_ID => 1, PaymentCustomerFamilyConditionTableMap::CUSTOMER_FAMILY_ID => 2, PaymentCustomerFamilyConditionTableMap::IS_VALID => 3, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PAYMENT_MODULE_ID' => 1, 'CUSTOMER_FAMILY_ID' => 2, 'IS_VALID' => 3, ),
self::TYPE_FIELDNAME => array('id' => 0, 'payment_module_id' => 1, 'customer_family_id' => 2, 'is_valid' => 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('payment_customer_family_condition');
$this->setPhpName('PaymentCustomerFamilyCondition');
$this->setClassName('\\PaymentCondition\\Model\\PaymentCustomerFamilyCondition');
$this->setPackage('PaymentCondition.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('PAYMENT_MODULE_ID', 'PaymentModuleId', 'INTEGER', 'module', 'ID', true, null, null);
$this->addColumn('CUSTOMER_FAMILY_ID', 'CustomerFamilyId', 'INTEGER', true, null, null);
$this->addColumn('IS_VALID', 'IsValid', 'TINYINT', false, null, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('Module', '\\Thelia\\Model\\Module', RelationMap::MANY_TO_ONE, array('payment_module_id' => 'id', ), 'CASCADE', 'RESTRICT');
} // buildRelations()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*/
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
// If the PK cannot be derived from the row, return NULL.
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
return (int) $row[
$indexType == TableMap::TYPE_NUM
? 0 + $offset
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
];
}
/**
* The class that the tableMap will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is translated into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
*/
public static function getOMClass($withPrefix = true)
{
return $withPrefix ? PaymentCustomerFamilyConditionTableMap::CLASS_DEFAULT : PaymentCustomerFamilyConditionTableMap::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 (PaymentCustomerFamilyCondition object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = PaymentCustomerFamilyConditionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = PaymentCustomerFamilyConditionTableMap::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 + PaymentCustomerFamilyConditionTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = PaymentCustomerFamilyConditionTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
PaymentCustomerFamilyConditionTableMap::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 = PaymentCustomerFamilyConditionTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = PaymentCustomerFamilyConditionTableMap::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;
PaymentCustomerFamilyConditionTableMap::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(PaymentCustomerFamilyConditionTableMap::ID);
$criteria->addSelectColumn(PaymentCustomerFamilyConditionTableMap::PAYMENT_MODULE_ID);
$criteria->addSelectColumn(PaymentCustomerFamilyConditionTableMap::CUSTOMER_FAMILY_ID);
$criteria->addSelectColumn(PaymentCustomerFamilyConditionTableMap::IS_VALID);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.PAYMENT_MODULE_ID');
$criteria->addSelectColumn($alias . '.CUSTOMER_FAMILY_ID');
$criteria->addSelectColumn($alias . '.IS_VALID');
}
}
/**
* 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(PaymentCustomerFamilyConditionTableMap::DATABASE_NAME)->getTable(PaymentCustomerFamilyConditionTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(PaymentCustomerFamilyConditionTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(PaymentCustomerFamilyConditionTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new PaymentCustomerFamilyConditionTableMap());
}
}
/**
* Performs a DELETE on the database, given a PaymentCustomerFamilyCondition or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or PaymentCustomerFamilyCondition 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(PaymentCustomerFamilyConditionTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \PaymentCondition\Model\PaymentCustomerFamilyCondition) { // 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(PaymentCustomerFamilyConditionTableMap::DATABASE_NAME);
$criteria->add(PaymentCustomerFamilyConditionTableMap::ID, (array) $values, Criteria::IN);
}
$query = PaymentCustomerFamilyConditionQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { PaymentCustomerFamilyConditionTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { PaymentCustomerFamilyConditionTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the payment_customer_family_condition 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 PaymentCustomerFamilyConditionQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a PaymentCustomerFamilyCondition or Criteria object.
*
* @param mixed $criteria Criteria or PaymentCustomerFamilyCondition 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(PaymentCustomerFamilyConditionTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from PaymentCustomerFamilyCondition object
}
if ($criteria->containsKey(PaymentCustomerFamilyConditionTableMap::ID) && $criteria->keyContainsValue(PaymentCustomerFamilyConditionTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.PaymentCustomerFamilyConditionTableMap::ID.')');
}
// Set the correct dbName
$query = PaymentCustomerFamilyConditionQuery::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;
}
} // PaymentCustomerFamilyConditionTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
PaymentCustomerFamilyConditionTableMap::buildTableMap();

View File

@@ -0,0 +1,428 @@
<?php
namespace PaymentCondition\Model\Map;
use PaymentCondition\Model\PaymentDeliveryCondition;
use PaymentCondition\Model\PaymentDeliveryConditionQuery;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\DataFetcher\DataFetcherInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
/**
* This class defines the structure of the 'payment_delivery_condition' 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 PaymentDeliveryConditionTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'PaymentCondition.Model.Map.PaymentDeliveryConditionTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'payment_delivery_condition';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\PaymentCondition\\Model\\PaymentDeliveryCondition';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'PaymentCondition.Model.PaymentDeliveryCondition';
/**
* 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 = 'payment_delivery_condition.ID';
/**
* the column name for the PAYMENT_MODULE_ID field
*/
const PAYMENT_MODULE_ID = 'payment_delivery_condition.PAYMENT_MODULE_ID';
/**
* the column name for the DELIVERY_MODULE_ID field
*/
const DELIVERY_MODULE_ID = 'payment_delivery_condition.DELIVERY_MODULE_ID';
/**
* the column name for the IS_VALID field
*/
const IS_VALID = 'payment_delivery_condition.IS_VALID';
/**
* 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', 'PaymentModuleId', 'DeliveryModuleId', 'IsValid', ),
self::TYPE_STUDLYPHPNAME => array('id', 'paymentModuleId', 'deliveryModuleId', 'isValid', ),
self::TYPE_COLNAME => array(PaymentDeliveryConditionTableMap::ID, PaymentDeliveryConditionTableMap::PAYMENT_MODULE_ID, PaymentDeliveryConditionTableMap::DELIVERY_MODULE_ID, PaymentDeliveryConditionTableMap::IS_VALID, ),
self::TYPE_RAW_COLNAME => array('ID', 'PAYMENT_MODULE_ID', 'DELIVERY_MODULE_ID', 'IS_VALID', ),
self::TYPE_FIELDNAME => array('id', 'payment_module_id', 'delivery_module_id', 'is_valid', ),
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, 'PaymentModuleId' => 1, 'DeliveryModuleId' => 2, 'IsValid' => 3, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'paymentModuleId' => 1, 'deliveryModuleId' => 2, 'isValid' => 3, ),
self::TYPE_COLNAME => array(PaymentDeliveryConditionTableMap::ID => 0, PaymentDeliveryConditionTableMap::PAYMENT_MODULE_ID => 1, PaymentDeliveryConditionTableMap::DELIVERY_MODULE_ID => 2, PaymentDeliveryConditionTableMap::IS_VALID => 3, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PAYMENT_MODULE_ID' => 1, 'DELIVERY_MODULE_ID' => 2, 'IS_VALID' => 3, ),
self::TYPE_FIELDNAME => array('id' => 0, 'payment_module_id' => 1, 'delivery_module_id' => 2, 'is_valid' => 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('payment_delivery_condition');
$this->setPhpName('PaymentDeliveryCondition');
$this->setClassName('\\PaymentCondition\\Model\\PaymentDeliveryCondition');
$this->setPackage('PaymentCondition.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('PAYMENT_MODULE_ID', 'PaymentModuleId', 'INTEGER', 'module', 'ID', true, null, null);
$this->addForeignKey('DELIVERY_MODULE_ID', 'DeliveryModuleId', 'INTEGER', 'module', 'ID', true, null, null);
$this->addColumn('IS_VALID', 'IsValid', 'TINYINT', false, null, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('ModuleRelatedByPaymentModuleId', '\\Thelia\\Model\\Module', RelationMap::MANY_TO_ONE, array('payment_module_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('ModuleRelatedByDeliveryModuleId', '\\Thelia\\Model\\Module', RelationMap::MANY_TO_ONE, array('delivery_module_id' => 'id', ), 'CASCADE', 'RESTRICT');
} // buildRelations()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*/
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
// If the PK cannot be derived from the row, return NULL.
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
return (int) $row[
$indexType == TableMap::TYPE_NUM
? 0 + $offset
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
];
}
/**
* The class that the tableMap will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is translated into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
*/
public static function getOMClass($withPrefix = true)
{
return $withPrefix ? PaymentDeliveryConditionTableMap::CLASS_DEFAULT : PaymentDeliveryConditionTableMap::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 (PaymentDeliveryCondition object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = PaymentDeliveryConditionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = PaymentDeliveryConditionTableMap::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 + PaymentDeliveryConditionTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = PaymentDeliveryConditionTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
PaymentDeliveryConditionTableMap::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 = PaymentDeliveryConditionTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = PaymentDeliveryConditionTableMap::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;
PaymentDeliveryConditionTableMap::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(PaymentDeliveryConditionTableMap::ID);
$criteria->addSelectColumn(PaymentDeliveryConditionTableMap::PAYMENT_MODULE_ID);
$criteria->addSelectColumn(PaymentDeliveryConditionTableMap::DELIVERY_MODULE_ID);
$criteria->addSelectColumn(PaymentDeliveryConditionTableMap::IS_VALID);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.PAYMENT_MODULE_ID');
$criteria->addSelectColumn($alias . '.DELIVERY_MODULE_ID');
$criteria->addSelectColumn($alias . '.IS_VALID');
}
}
/**
* 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(PaymentDeliveryConditionTableMap::DATABASE_NAME)->getTable(PaymentDeliveryConditionTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(PaymentDeliveryConditionTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(PaymentDeliveryConditionTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new PaymentDeliveryConditionTableMap());
}
}
/**
* Performs a DELETE on the database, given a PaymentDeliveryCondition or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or PaymentDeliveryCondition 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(PaymentDeliveryConditionTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \PaymentCondition\Model\PaymentDeliveryCondition) { // 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(PaymentDeliveryConditionTableMap::DATABASE_NAME);
$criteria->add(PaymentDeliveryConditionTableMap::ID, (array) $values, Criteria::IN);
}
$query = PaymentDeliveryConditionQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { PaymentDeliveryConditionTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { PaymentDeliveryConditionTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the payment_delivery_condition 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 PaymentDeliveryConditionQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a PaymentDeliveryCondition or Criteria object.
*
* @param mixed $criteria Criteria or PaymentDeliveryCondition 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(PaymentDeliveryConditionTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from PaymentDeliveryCondition object
}
if ($criteria->containsKey(PaymentDeliveryConditionTableMap::ID) && $criteria->keyContainsValue(PaymentDeliveryConditionTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.PaymentDeliveryConditionTableMap::ID.')');
}
// Set the correct dbName
$query = PaymentDeliveryConditionQuery::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;
}
} // PaymentDeliveryConditionTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
PaymentDeliveryConditionTableMap::buildTableMap();

View File

@@ -0,0 +1,10 @@
<?php
namespace PaymentCondition\Model;
use PaymentCondition\Model\Base\PaymentAreaCondition as BasePaymentAreaCondition;
class PaymentAreaCondition extends BasePaymentAreaCondition
{
}

View File

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

View File

@@ -0,0 +1,20 @@
<?php
namespace PaymentCondition\Model;
use PaymentCondition\Model\Base\PaymentCustomerCondition as BasePaymentCustomerCondition;
/**
* Skeleton subclass for representing a row from the 'payment_customer_condition' 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 PaymentCustomerCondition extends BasePaymentCustomerCondition
{
}

View File

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

View File

@@ -0,0 +1,10 @@
<?php
namespace PaymentCondition\Model;
use PaymentCondition\Model\Base\PaymentCustomerFamilyCondition as BasePaymentCustomerFamilyCondition;
class PaymentCustomerFamilyCondition extends BasePaymentCustomerFamilyCondition
{
}

View File

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

View File

@@ -0,0 +1,20 @@
<?php
namespace PaymentCondition\Model;
use PaymentCondition\Model\Base\PaymentCustomerModuleCondition as BasePaymentCustomerModuleCondition;
/**
* Skeleton subclass for representing a row from the 'payment_customer_module_condition' 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 PaymentCustomerModuleCondition extends BasePaymentCustomerModuleCondition
{
}

View File

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

View File

@@ -0,0 +1,10 @@
<?php
namespace PaymentCondition\Model;
use PaymentCondition\Model\Base\PaymentDeliveryCondition as BasePaymentDeliveryCondition;
class PaymentDeliveryCondition extends BasePaymentDeliveryCondition
{
}

View File

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

View File

@@ -0,0 +1,34 @@
<?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 PaymentCondition;
use PaymentCondition\Model\PaymentAreaConditionQuery;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Install\Database;
use Thelia\Module\BaseModule;
class PaymentCondition extends BaseModule
{
/** @var string */
const DOMAIN_NAME = 'paymentcondition';
public function postActivation(ConnectionInterface $con = null)
{
$database = new Database($con);
if (!self::getConfigValue('is_initialized', false)) {
$database->insertSql(null, [__DIR__ . "/Config/thelia.sql"]);
self::setConfigValue('is_initialized', true);
}
}
}

View File

@@ -0,0 +1,19 @@
# Payment Condition
Allow to restrict payment modules by customer, delivery module, customer family or shipping area
## Installation
### Composer
Add it in your main thelia composer.json file
```
composer require thelia/payment-condition-module:~1.0
```
## Usage
Go to module configuration where you can configure the payment restrictions.
This module change the payment loop result so if you use this loop to display your payment method you will have nothing else to do.

View File

@@ -0,0 +1,11 @@
{
"name": "thelia/payment-condition-module",
"license": "LGPL-3.0+",
"type": "thelia-module",
"require": {
"thelia/installer": "~1.1"
},
"extra": {
"installer-name": "PaymentCondition"
}
}

View File

@@ -0,0 +1,62 @@
{extends file="admin-layout.tpl"}
{block name="after-bootstrap-css"}
{/block}
{block name="no-return-functions"}
{$admin_current_location = 'module'}
{/block}
{block name="page-title"}{intl l='Payment condition module configuration' d='paymentcondition.bo.default'}{/block}
{block name="check-resource"}admin.module{/block}
{block name="check-access"}view{/block}
{block name="check-module"}paymentcondition{/block}
{block name="main-content"}
<div id="payment_condition_container">
<div id="payment_condition_delivery">
</div>
{loop name="customer_family_enabled" type="module" code="CustomerFamily" active="1"}
<div id="payment_condition_customer_family">
</div>
{/loop}
{elseloop rel="customer_family_enabled"}
<div class="alert alert-info">
{intl l="Install and activate 'CustomerFamily' module to get configuration options." d='paymentcondition.bo.default'}
</div>
{/elseloop}
<div id="payment_condition_area">
</div>
</div>
{/block}
{block name="javascript-initialization"}
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
<script src='{$asset_url}'></script>
{/javascripts}
<script>
$(function () {
$.get('{url path="/admin/module/paymentcondition/delivery"}').done(function (data) {
$('#payment_condition_delivery').append(data);
});
if ( $( "#payment_condition_customer_family" ).length ) {
$.get('{url path="/admin/module/paymentcondition/customerfamily"}').done(function (data) {
$('#payment_condition_customer_family').append(data);
});
}
$.get('{url path="/admin/module/paymentcondition/area"}').done(function (data) {
$('#payment_condition_area').append(data);
});
});
</script>
{/block}

View File

@@ -0,0 +1,25 @@
<div class="row">
<div class="col-md-12 general-block-decorator">
<div class="row">
<div class="col-md-12 title title-without-tabs">{intl l="Payment conditions for this customer" d="paymentcondition.bo.default"}</div>
<div class="col-md-12">
<div class="col-md-12">
{if null === $paymentCustomerCondition || 0 === $paymentCustomerCondition->getModuleRestrictionActive()}
<div class="alert alert-info">
{intl l="Payment restrictions is not activated for this customer" d="paymentcondition.bo.default"}
</div>
{else}
<h3>
{intl l="Allowed payments :" d="paymentcondition.bo.default"}
</h3>
<ul>
{foreach from=$allowedModules item=allowedModule}
<li>{$allowedModule->getTitle()} ({$allowedModule->getCode()})</li>
{/foreach}
</ul>
{/if}
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,59 @@
<div class="general-block-decorator">
<h4>{intl l="Condition by customer family"}</h4>
<div class="table-responsive">
<table class="table table-striped table-condensed table-left-aligned">
<thead>
<td colspan="3"></td>
{$i=0}
{foreach from=$module_codes item=code}
{$i = $i + 1}
<td>{$code}</td>
{/foreach}
</thead>
{foreach from=$paymentFamilyCondition key=family_id item=item}
<tr>
<td>{$family_codes[$family_id]}</td>
<td colspan="2"></td>
{foreach from=$item key=payment_id item=is_valid}
<td>
<div class="switch-small customer_family_condition_switch"
data-module="{$payment_id}"
data-family="{$family_id}"
data-category="payment" data-on="success" data-off="danger"
data-on-label="<i class='glyphicon glyphicon-ok'></i>"
data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input name="{$name}" type="checkbox" {if $is_valid}checked{/if}/>
</div>
</td>
{/foreach}
</tr>
{/foreach}
</table>
</div>
</div>
<script>
$(function () {
var customerFamilyConditionSwitch = $(".customer_family_condition_switch");
customerFamilyConditionSwitch.bootstrapSwitch();
customerFamilyConditionSwitch.on("switch-change", function(e, data) {
var checkbox = $(this);
var isChecked = data.value;
var customerFamilyId = $(this).data('family');
var moduleId = $(this).data('module');
var url = "{url path="/admin/module/paymentcondition/customerfamily"}";
{literal}
$.post(url, {
customerFamilyId : customerFamilyId,
moduleId : moduleId,
isValid : isChecked
}).fail(function(data) {
console.log(data.responseText);
checkbox.bootstrapSwitch('toggleState', true);
});
{/literal}
});
});
</script>

View File

@@ -0,0 +1,57 @@
<div class="general-block-decorator">
<h4>{intl l="Condition by chosen delivery module"}</h4>
<div class="table-responsive">
<table class="table table-striped table-condensed table-left-aligned">
<thead>
<td></td>
{foreach from=$paymentModules item=paymentModule}
<td>{$paymentModule->getCode()}</td>
{/foreach}
</thead>
{foreach from=$deliveryModules item=deliveryModule}
<tr>
<td>{$deliveryModule->getCode()}</td>
{foreach from=$paymentModules item=paymentModule}
<td>
<div class="switch-small delivery_condition_switch" data-delivery="{$deliveryModule->getId()}" data-payment="{$paymentModule->getId()}"
data-category="delivery" data-on="success" data-off="danger"
data-on-label="<i class='glyphicon glyphicon-ok'></i>"
data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input name="{$name}" type="checkbox" {if $paymentDeliveryCondition[$paymentModule->getId()][$deliveryModule->getId()]}checked{/if}/>
</div>
</td>
{/foreach}
</tr>
{/foreach}
</table>
</div>
</div>
<script>
$(function () {
var deliveryConditionSwitch = $(".delivery_condition_switch");
deliveryConditionSwitch.bootstrapSwitch();
deliveryConditionSwitch.on("switch-change", function(e, data) {
var checkbox = $(this);
var isChecked = data.value;
var deliveryId = $(this).data('delivery');
var paymentId = $(this).data('payment');
var url = "{url path="/admin/module/paymentcondition/delivery"}";
{literal}
$.post(url, {
deliveryId : deliveryId,
paymentId : paymentId,
isValid : isChecked
}).fail(function(data) {
console.log(data.responseText);
checkbox.bootstrapSwitch('toggleState', true);
});
{/literal}
});
});
</script>

View File

@@ -0,0 +1,57 @@
<div class="general-block-decorator">
<h4>{intl l="Condition by chosen shipping area"}</h4>
<div class="table-responsive">
<table class="table table-striped table-condensed table-left-aligned">
<thead>
<td></td>
{foreach from=$paymentModules item=paymentModule}
<td>{$paymentModule->getCode()}</td>
{/foreach}
</thead>
{foreach from=$shippingAreas item=shippingArea}
<tr>
<td>{$shippingArea->getName()}</td>
{foreach from=$paymentModules item=paymentModule}
<td>
<div class="switch-small area_condition_switch" data-area="{$shippingArea->getId()}" data-payment="{$paymentModule->getId()}"
data-category="area" data-on="success" data-off="danger"
data-on-label="<i class='glyphicon glyphicon-ok'></i>"
data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input name="{$name}" type="checkbox" {if $areaPaymentCondition[$paymentModule->getId()][$shippingArea->getId()]}checked{/if}/>
</div>
</td>
{/foreach}
</tr>
{/foreach}
</table>
</div>
</div>
<script>
$(function () {
var areaConditionSwitch = $(".area_condition_switch");
areaConditionSwitch.bootstrapSwitch();
areaConditionSwitch.on("switch-change", function(e, data) {
var checkbox = $(this);
var isChecked = data.value;
var areaId = $(this).data('area');
var paymentId = $(this).data('payment');
var url = "{url path="/admin/module/paymentcondition/area"}";
{literal}
$.post(url, {
areaId : areaId,
paymentId : paymentId,
isValid : isChecked
}).fail(function(data) {
console.log(data.responseText);
checkbox.bootstrapSwitch('toggleState', true);
});
{/literal}
});
});
</script>

0
templates/.gitkeep Normal file
View File

View File

@@ -0,0 +1,10 @@
{
"name": "thelia/hooktest-template",
"type": "thelia-frontoffice-template",
"require": {
"thelia/installer": "~1.1"
},
"extra": {
"installer-name": "hooktest"
}
}

View File

@@ -0,0 +1,110 @@
<li class="item">
{if $PSE_COUNT > 1}
{assign var="hasSubmit" value = false}
{else}
{assign var="hasSubmit" value = true}
{/if}
{assign var="productTitle" value="{$TITLE}"}
{if not $product_id}
{assign var="product_id" value=$ID}
{/if}
<article itemscope itemtype="http://schema.org/Product">
{hook name="singleproduct.top" product="{$product_id}"}
<a href="{$URL}" itemprop="url" tabindex="-1" class="product-image{if $hasQuickView == true} product-quickview{/if}">
{loop name="product_thumbnail" type="image" product=$product_id width="{$width}" height="{$height}" resize_mode="borders" limit="1"}
<img itemprop="image" src="{$IMAGE_URL}" alt="{$productTitle}">
{/loop}
{elseloop rel="product_thumbnail"}
{images file='../assets/img/218x146.png'}<img itemprop="image" src="{$asset_url}" alt="{$productTitle}">{/images}
{/elseloop}
<span class="mask"></span>
</a>
<div class="product-info">
<h2 class="name"><a href="{$URL}"><span itemprop="name">{$productTitle}</span></a></h2>
{if $hasDescription}
<div class="description" itemprop="description">
<p>{$DESCRIPTION nofilter}</p>
</div>
{/if}
</div>
{* Stock *}
{assign var="current_stock_content" value = "in_stock"}
{assign var="current_stock_href" value = "http://schema.org/InStock"}
{if {config key="check-available-stock"} != 0}
{if $QUANTITY == 0}
{assign var="current_stock_content" value = "out_stock"}
{assign var="current_stock_href" value = "http://schema.org/OutOfStock"}
{/if}
{/if}
<div class="product-price">
<div class="price-container" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<meta itemprop="category" content="{category attr="title"}">
{* List of condition : NewCondition, DamagedCondition, UsedCondition, RefurbishedCondition *}
<meta itemprop="itemCondition" itemscope itemtype="http://schema.org/NewCondition">
{* List of currency : The currency used to describe the product price, in three-letter ISO format. *}
<meta itemprop="priceCurrency" content="{currency attr="symbol"}">
<link itemprop="availability" href="{$current_stock_href}" content="{$current_stock_content}" />
{if $IS_PROMO }
<span class="special-price"><span itemprop="price" class="price-label">{intl l="Special Price:"} </span><span class="price">{format_number number=$TAXED_PROMO_PRICE} {currency attr="symbol"}</span></span>
<span class="old-price"><span class="price-label">{intl l="Regular Price:"} </span><span class="price">{format_number number=$TAXED_PRICE} {currency attr="symbol"}</span></span>
{else}
<span class="regular-price"><span itemprop="price" class="price">{format_number number=$BEST_TAXED_PRICE} {currency attr="symbol"}</span></span>
{/if}
</div>
{if $hasBtn == true}
{if $hasSubmit == true}
{form name="thelia.cart.add" }
<form id="form-product-details{$product_id}" action="{url path="/cart/add" }" method="post" class="form-product">
{form_hidden_fields form=$form}
<input type="hidden" name="view" value="product">
<input type="hidden" name="product_id" value="{$product_id}">
{if $form_error}<div class="alert alert-error">{$form_error_message}</div>{/if}
{form_field form=$form field='product_sale_elements_id'}
<input type="hidden" name="{$name}" value="{$PRODUCT_SALE_ELEMENT}" {$attr}>
{/form_field}
{form_field form=$form field="product"}
<input id="{$label_attr.for}" type="hidden" name="{$name}" value="{$product_id}" {$attr} >
{/form_field}
<fieldset class="product-cart form-inline">
{form_field form=$form field='quantity'}
<div class="form-group group-qty hide {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label for="{$label_attr.for}">{$label}</label>
<input type="number" name="{$name}" id="{$label_attr.for}" class="form-control" value="{$value|default:1}" min="0" required>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
{/form_field}
<div>
<div class="product-btn">
<button type="submit" class="btn btn-cart">{intl l="Add to cart"}</button>
</div>
</div>
</fieldset>
</form>
{/form}
{else}
<div>
<div class="product-btn">
<a href="{$URL}" class="btn btn-cart">{intl l="View product"}</a>
</div>
</div>
{/if}
{/if}
</div>
{hook name="singleproduct.bottom" product="{$product_id}"}
</article><!-- /product -->
</li>

View File

@@ -0,0 +1,24 @@
{extends file="layout.tpl"}
{block name="main-content"}
{ifhook rel="home.body"}
{hook name="home.body"}
{/ifhook}
{elsehook rel="home.body"}
::NO home.body::
{/elsehook}
{/block}
{block name="stylesheet"}
{hook name="home.stylesheet"}
{/block}
{block name="after-javascript-include"}
{hook name="home.after-javascript-include"}
{/block}
{block name="javascript-initialization"}
{hook name="home.javascript-initialization"}
{/block}

View File

@@ -0,0 +1,110 @@
<!--
______ __ __ ______ __ __ ______
/\__ _\ /\ \_\ \ /\ ___\ /\ \ /\ \ /\ __ \
\/_/\ \/ \ \ __ \ \ \ __\ \ \ \____ \ \ \ \ \ __ \
\ \_\ \ \_\ \_\ \ \_____\ \ \_____\ \ \_\ \ \_\ \_\
\/_/ \/_/\/_/ \/_____/ \/_____/ \/_/ \/_/\/_/
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
GNU General Public License : http://www.gnu.org/licenses/
-->
<!--
TEMPLATE-TEST-HOOK
-->
{* Declare assets directory, relative to template base directory *}
{declare_assets directory='assets'}
{* Set the default translation domain, that will be used by {intl} when the 'd' parameter is not set *}
{default_translation_domain domain='fo.default'}
{hook name="main.head-top"}
{hook name="main.stylesheet"}
{hook name="main.body-top"}
{hook name="main.header-top"}
{hook name="main.navbar-secondary"}
{ifhook rel="main.navbar-secondary"}
::main.navbar-secondary ifhook::
{/ifhook}
{elsehook rel="main.navbar-secondary"}
::main.navbar-secondary elsehook::
{/elsehook}
{hook name="main.navbar-primary"}
{ifhook rel="main.navbar-primary"}
::main.navbar-primary ifhook::
{/ifhook}
{elsehook rel="main.navbar-primary"}
::main.navbar-primary elsehook::
{/elsehook}
{hook name="main.header-bottom"}
{hook name="main.content-top"}
{block name="main-content"}{/block}
{hook name="main.content-bottom"}
{ifhook rel="main.footer-top"}
{hook name="main.footer-top"}
{/ifhook}
{elsehook rel="main.footer-top"}
::NO main.footer-top::
{/elsehook}
{ifhook rel="product.additional"}
{hookblock name="product.additional"}
{forhook rel="product.additional"}
::product.additional ifhook::
{/forhook}
{/hookblock}
{/ifhook}
{elsehook rel="product.additional"}
::product.additional elsehook::
{/elsehook}
{ifhook rel="main.footer-body"}
::main.footer-body ifhook::
{hookblock name="main.footer-body"}
{forhook rel="main.footer-body"}
::main.footer-body {$id} {$class} {$content}::
{/forhook}
{/hookblock}
{/ifhook}
{elsehook rel="main.footer-body"}
::main.footer-body elsehook::
{/elsehook}
{ifhook rel="main.footer-bottom"}
{hook name="main.footer-bottom"}
{/ifhook}
{elsehook rel="main.footer-bottom"}
::NO main.footer-bottom::
{/elsehook}
{hook name="main.after-javascript-include"}
{block name="after-javascript-include"}{/block}
{hook name="main.javascript-initialization"}
{block name="javascript-initialization"}{/block}
{hook name="main.body-bottom"}

View File

@@ -0,0 +1 @@
/* style3 in template/hooktest */

View File

@@ -0,0 +1 @@
:: file override3 from template/hooktest ::