diff --git a/local/modules/MondialRelay/Config/config-data.json b/local/modules/MondialRelay/Config/config-data.json
new file mode 100644
index 00000000..badcd50d
--- /dev/null
+++ b/local/modules/MondialRelay/Config/config-data.json
@@ -0,0 +1,269 @@
+{
+ "shippingZones": [
+ {
+ "name": "Mondial Relay - Relay delivery Zone 1",
+ "delivery_time_in_days": 3,
+ "delivery_type": 1,
+ "countries": [
+ "FRA",
+ "BEL",
+ "LUX",
+ "MCO"
+ ],
+ "prices": [
+ {
+ "up_to": 0.5,
+ "price_euro": 4.55
+ },
+ {
+ "up_to": 1,
+ "price_euro": 5.25
+ },
+ {
+ "up_to": 2,
+ "price_euro": 5.95
+ },
+ {
+ "up_to": 3,
+ "price_euro": 6.80
+ },
+ {
+ "up_to": 5,
+ "price_euro": 8
+ },
+ {
+ "up_to": 7,
+ "price_euro": 10.50
+ },
+ {
+ "up_to": 10,
+ "price_euro": 12.75
+ },
+ {
+ "up_to": 15,
+ "price_euro": 15.35
+ },
+ {
+ "up_to": 30,
+ "price_euro": 19.10
+ }
+ ]
+ },
+ {
+ "name": "Mondial Relay - Relay delivery Zone 2",
+ "delivery_time_in_days": 5,
+ "delivery_type": 1,
+ "countries": [
+ "ESP"
+ ],
+ "prices": [
+ {
+ "up_to": 0.5,
+ "price_euro": 8.40
+ },
+ {
+ "up_to": 1,
+ "price_euro": 9
+ },
+ {
+ "up_to": 2,
+ "price_euro": 9.80
+ },
+ {
+ "up_to": 3,
+ "price_euro": 10.50
+ },
+ {
+ "up_to": 5,
+ "price_euro": 12.80
+ },
+ {
+ "up_to": 7,
+ "price_euro": 15.20
+ },
+ {
+ "up_to": 10,
+ "price_euro": 17.40
+ },
+ {
+ "up_to": 15,
+ "price_euro": 22.80
+ },
+ {
+ "up_to": 30,
+ "price_euro": 27.50
+ }
+ ]
+ },
+ {
+ "name": "Mondial Relay - Home delivery Zone 1",
+ "delivery_time_in_days": 3,
+ "delivery_type": 2,
+ "countries": [
+ "DEU",
+ "BEL",
+ "LUX"
+ ],
+ "prices": [
+ {
+ "up_to": 0.5,
+ "price_euro": 9.50
+ },
+ {
+ "up_to": 1,
+ "price_euro": 9.50
+ },
+ {
+ "up_to": 2,
+ "price_euro": 10.20
+ },
+ {
+ "up_to": 3,
+ "price_euro": 10.90
+ },
+ {
+ "up_to": 5,
+ "price_euro": 12.30
+ },
+ {
+ "up_to": 7,
+ "price_euro": 13.70
+ },
+ {
+ "up_to": 10,
+ "price_euro": 15.80
+ },
+ {
+ "up_to": 15,
+ "price_euro": 19.30
+ },
+ {
+ "up_to": 30,
+ "price_euro": 29.80
+ }
+ ]
+ },
+ {
+ "name": "Mondial Relay - Home delivery Zone 2",
+ "delivery_time_in_days": 5,
+ "delivery_type": 2,
+ "countries": [
+ "GBR",
+ "ESP"
+ ],
+ "prices": [
+ {
+ "up_to": 0.5,
+ "price_euro": 10.20
+ },
+ {
+ "up_to": 1,
+ "price_euro": 10.20
+ },
+ {
+ "up_to": 2,
+ "price_euro": 11.30
+ },
+ {
+ "up_to": 3,
+ "price_euro": 12.40
+ },
+ {
+ "up_to": 5,
+ "price_euro": 14.60
+ },
+ {
+ "up_to": 7,
+ "price_euro": 16.80
+ },
+ {
+ "up_to": 10,
+ "price_euro": 20.10
+ },
+ {
+ "up_to": 15,
+ "price_euro": 25.60
+ },
+ {
+ "up_to": 30,
+ "price_euro": 36.60
+ }
+ ]
+ },
+ {
+ "name": "Mondial Relay - Home delivery Zone 3",
+ "delivery_time_in_days": 6,
+ "delivery_type": 2,
+ "countries": [
+ "ITA",
+ "PRT",
+ "AUT"
+ ],
+ "prices": [
+ {
+ "up_to": 0.5,
+ "price_euro": 11.20
+ },
+ {
+ "up_to": 1,
+ "price_euro": 11.20
+ },
+ {
+ "up_to": 2,
+ "price_euro": 12.30
+ },
+ {
+ "up_to": 3,
+ "price_euro": 13.40
+ },
+ {
+ "up_to": 5,
+ "price_euro": 15.60
+ },
+ {
+ "up_to": 7,
+ "price_euro": 17.80
+ },
+ {
+ "up_to": 10,
+ "price_euro": 21.10
+ },
+ {
+ "up_to": 15,
+ "price_euro": 26.60
+ },
+ {
+ "up_to": 30,
+ "price_euro": 37.60
+ }
+ ]
+ }
+ ],
+ "insurances": [
+ {
+ "level": 1,
+ "value": 50,
+ "price_with_tax_euro": 2
+ },
+ {
+ "level": 2,
+ "value": 125,
+ "price_with_tax_euro": 3.50
+ },
+ {
+ "level": 3,
+ "value": 250,
+ "price_with_tax_euro": 5
+ },
+ {
+ "level": 4,
+ "value": 375,
+ "price_with_tax_euro": 6.50
+ },
+ {
+ "level": 5,
+ "value": 500,
+ "price_with_tax_euro": 8
+ }
+ ]
+}
diff --git a/local/modules/MondialRelay/Config/config.xml b/local/modules/MondialRelay/Config/config.xml
new file mode 100644
index 00000000..da38c0d4
--- /dev/null
+++ b/local/modules/MondialRelay/Config/config.xml
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
' . $addresses[1];
+ }
+
+ $normalizedPoint["name"] = $nom;
+
+ $address = $addresses[2];
+ if (! empty($adresses[3])) {
+ $address .= '
' . $addresses[3];
+ }
+
+ $normalizedPoint["address"] = $address;
+
+
+ $horaires = [];
+
+ /** @var BussinessHours $horaire */
+ foreach ($point->business_hours() as $horaire) {
+ if ($horaire->openingTime1() != '0000' && $horaire->openingTime2() !== '0000') {
+ $data = [ 'day' => $days[$horaire->day()]];
+
+ $o1 = $horaire->openingTime1();
+ $o2 = $horaire->openingTime2();
+
+ if (! empty($o1) && $o1 != '0000') {
+ $data['opening_time_1'] = $this->makeHoraire($horaire->openingTime1());
+ $data['closing_time_1'] = $this->makeHoraire($horaire->closingTime1());
+ }
+
+ if (! empty($o2) && $o2 != '0000') {
+ $data['opening_time_2'] = $this->makeHoraire($horaire->openingTime2());
+ $data['closing_time_2'] = $this->makeHoraire($horaire->closingTime2());
+ }
+
+ $horaires[] = $data;
+ }
+ }
+
+ $normalizedPoint["openings"] = $horaires;
+
+ $normalizedPoints[] = $normalizedPoint;
+ }
+
+ $event->setPoints($normalizedPoints);
+ }
+
+ /**
+ * Update the order delivery address with MondialRelay point data
+ *
+ * @param OrderEvent $event
+ * @throws \Propel\Runtime\Exception\PropelException
+ */
+ public function updateOrderDeliveryAddress(OrderEvent $event)
+ {
+ /** @var Session $session */
+ $session = $this->requestStack->getCurrentRequest()->getSession();
+
+ if (null !== $mrAddressId = $session->get(MondialRelay::SESSION_SELECTED_PICKUP_RELAY_ID)) {
+ if (null !== $mrRelayPickup = MondialRelayPickupAddressQuery::create()->findPk($mrAddressId)) {
+ if (false !== $relayData = json_decode($mrRelayPickup->getJsonRelayData(), true)) {
+ if (null !== $orderAddress = OrderAddressQuery::create()->findPK($event->getOrder()->getDeliveryOrderAddressId())) {
+ $orderAddress
+ ->setCompany($relayData['name'])
+ ->setFirstname(
+ Translator::getInstance()->trans(
+ "Pickup relay #%number",
+ [ '%number' => $relayData['id']],
+ MondialRelay::DOMAIN_NAME
+ )
+ )
+ ->setLastname('')
+ ->setAddress1($relayData['address'])
+ ->setAddress2('')
+ ->setAddress3('')
+ ->setZipcode($relayData['zipcode'])
+ ->setCity($relayData['city'])
+ ->setCountry(CountryQuery::create()->findOneByIsoalpha2($relayData['country']))
+ ->save();
+
+ $mrRelayPickup
+ ->setOrderAddressId($orderAddress->getId())
+ ->save();
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @param OrderEvent $event
+ * @throws \Propel\Runtime\Exception\PropelException
+ */
+ public function updateCurrentDeliveryAddress(OrderEvent $event, $eventName, EventDispatcherInterface $dispatcher)
+ {
+ /** @var Request $request */
+ $request = $this->requestStack->getCurrentRequest();
+
+ /** @var Session $session */
+ $session = $request->getSession();
+
+ // Reset stored pickup address, if any
+ if (null !== $mrAddressId = $session->remove(MondialRelay::SESSION_SELECTED_PICKUP_RELAY_ID)) {
+ // Do not delete, as the customer may have do a back, and restart another order
+ // MondialRelayPickupAddressQuery::create()->filterById($mrAddressId)->delete();
+ }
+
+ if ($event->getDeliveryModule() == MondialRelay::getModuleId()) {
+ // Check selected MondialRlay mode
+ $mode = $request->get('mondial-relay-selected-delivery-mode');
+
+ if ($mode == 'pickup') {
+ // Get the selected pickup relay
+ if (null !== $relayId = $request->get('mondialrelay_relay', null)) {
+ $countryId = $request->get('mondial_relay_country_id', 0);
+
+ // Load pickup data for the selected point
+ $relayDataEvent = new FindRelayEvent($countryId, '', '', 0);
+ $relayDataEvent->setNumPointRelais($relayId);
+
+ $dispatcher->dispatch(MondialRelayEvents::FIND_RELAYS, $relayDataEvent);
+
+ // We're supposed to get only one point
+ $points = $relayDataEvent->getPoints();
+
+ if (isset($points[0])) {
+ // Create a new record to store the pickup data
+ $pickupAddress = new MondialRelayPickupAddress();
+ $pickupAddress
+ ->setJsonRelayData(json_encode($points[0]))
+ ->save();
+
+ $session->set(MondialRelay::SESSION_SELECTED_PICKUP_RELAY_ID, $pickupAddress->getId());
+ }
+ } else {
+ throw new TheliaProcessException("No Mondial Relay pickeup relay selected.");
+ }
+ } elseif ($mode !== 'home') {
+ throw new TheliaProcessException("Mondial Relay delivery mode was not selected.");
+ }
+ }
+ }
+
+ /**
+ * Clear stored information once the order has been processed.
+ *
+ * @param OrderEvent $event
+ * @param $eventName
+ * @param EventDispatcherInterface $dispatcher
+ */
+ public function clearDeliveryData(OrderEvent $event, $eventName, EventDispatcherInterface $dispatcher)
+ {
+ $session = $this->requestStack->getCurrentRequest()->getSession();
+
+ // Clear the session context
+ $session->remove(MondialRelay::SESSION_SELECTED_DELIVERY_TYPE);
+ $session->remove(MondialRelay::SESSION_SELECTED_PICKUP_RELAY_ID);
+ }
+
+ public static function getSubscribedEvents()
+ {
+ return [
+ TheliaEvents::getModuleEvent(
+ TheliaEvents::MODULE_DELIVERY_GET_POSTAGE,
+ MondialRelay::getModuleCode()
+ ) => [ "processDeliveryPostageEvent", 128 ],
+ TheliaEvents::ORDER_SET_DELIVERY_MODULE => ['updateCurrentDeliveryAddress', 64],
+ TheliaEvents::ORDER_BEFORE_PAYMENT => ['updateOrderDeliveryAddress', 256],
+ TheliaEvents::ORDER_CART_CLEAR => ['clearDeliveryData', 256],
+
+ MondialRelayEvents::FIND_RELAYS => [ "findRelays" , 128]
+ ];
+ }
+}
diff --git a/local/modules/MondialRelay/EventListeners/SendDeliveryEmail.php b/local/modules/MondialRelay/EventListeners/SendDeliveryEmail.php
new file mode 100644
index 00000000..165f9314
--- /dev/null
+++ b/local/modules/MondialRelay/EventListeners/SendDeliveryEmail.php
@@ -0,0 +1,68 @@
+mailer = $mailer;
+ }
+
+ /**
+ * @param OrderEvent $event
+ * @throws \Exception
+ * @throws \Propel\Runtime\Exception\PropelException
+ */
+ public function updateStatus(OrderEvent $event)
+ {
+ $order = $event->getOrder();
+
+ $deliveryRef = $order->getDeliveryRef();
+
+ if ($order->isSent()
+ &&
+ ! empty($deliveryRef)
+ &&
+ $order->getDeliveryModuleId() == MondialRelay::getModuleId()
+ ) {
+ if (null !== $contactEmail = ConfigQuery::read('store_email')) {
+ $this->mailer->sendEmailToCustomer(
+ MondialRelay::TRACKING_MESSAGE_NAME,
+ $order->getCustomer(),
+ [
+ 'order_id' => $order->getId(),
+ ]
+ );
+ }
+ }
+ }
+
+ public static function getSubscribedEvents()
+ {
+ return array(
+ TheliaEvents::ORDER_UPDATE_STATUS => array("updateStatus", 128)
+ );
+ }
+}
diff --git a/local/modules/MondialRelay/Form/InsuranceCreateForm.php b/local/modules/MondialRelay/Form/InsuranceCreateForm.php
new file mode 100644
index 00000000..9460cc94
--- /dev/null
+++ b/local/modules/MondialRelay/Form/InsuranceCreateForm.php
@@ -0,0 +1,42 @@
+
+ */
+class InsuranceCreateForm extends BaseForm
+{
+ protected function buildForm()
+ {
+ $this->formBuilder
+ ->add(
+ 'max_value',
+ 'number',
+ [
+ "constraints" => [new GreaterThanOrEqual([ 'value' => 0 ])],
+ 'label' => $this->translator->trans('Cart value', [], MondialRelay::DOMAIN_NAME),
+ ]
+ )->add(
+ 'price_with_tax',
+ 'number',
+ [
+ "constraints" => [new GreaterThanOrEqual([ 'value' => 0 ])],
+ 'label' => $this->translator->trans('Insurance price', [], MondialRelay::DOMAIN_NAME),
+ ]
+ )
+ ;
+ }
+}
diff --git a/local/modules/MondialRelay/Form/InsurancesUpdateForm.php b/local/modules/MondialRelay/Form/InsurancesUpdateForm.php
new file mode 100644
index 00000000..2f2c8d51
--- /dev/null
+++ b/local/modules/MondialRelay/Form/InsurancesUpdateForm.php
@@ -0,0 +1,50 @@
+
+ */
+class InsurancesUpdateForm extends BaseForm
+{
+ protected function buildForm()
+ {
+ $this->formBuilder
+ ->add(
+ 'max_value',
+ 'collection',
+ [
+ "type" => 'number',
+ "constraints" => [new GreaterThanOrEqual([ 'value' => 0 ])],
+ 'label' => $this->translator->trans('Cart value', [], MondialRelay::DOMAIN_NAME),
+ 'label_attr' => [ ],
+ 'allow_add' => true,
+ 'allow_delete' => true,
+ ]
+ )->add(
+ 'price_with_tax',
+ 'collection',
+ [
+ "type" => 'number',
+ "constraints" => [new GreaterThanOrEqual([ 'value' => 0 ])],
+ 'label' => $this->translator->trans('Insurance price', [], MondialRelay::DOMAIN_NAME),
+ 'label_attr' => [ ],
+ 'allow_add' => true,
+ 'allow_delete' => true,
+ ]
+ )
+ ;
+ }
+}
diff --git a/local/modules/MondialRelay/Form/PriceAttributesUpdateForm.php b/local/modules/MondialRelay/Form/PriceAttributesUpdateForm.php
new file mode 100644
index 00000000..21d85ded
--- /dev/null
+++ b/local/modules/MondialRelay/Form/PriceAttributesUpdateForm.php
@@ -0,0 +1,47 @@
+
+ */
+class PriceAttributesUpdateForm extends BaseForm
+{
+ protected function buildForm()
+ {
+ $this->formBuilder
+ ->add(
+ 'delivery_time',
+ 'integer',
+ [
+ "constraints" => [new GreaterThan([ 'value' => 0 ])],
+ 'label' => $this->translator->trans('Delivery delay', [], MondialRelay::DOMAIN_NAME),
+ ]
+ )->add(
+ 'delivery_type',
+ 'choice',
+ [
+ "choices" => [
+ MondialRelayZoneConfiguration::RELAY_DELIVERY_TYPE => $this->translator->trans('Relay delivery', [], MondialRelay::DOMAIN_NAME),
+ MondialRelayZoneConfiguration::HOME_DELIVERY_TYPE => $this->translator->trans('Home delivery', [], MondialRelay::DOMAIN_NAME),
+ MondialRelayZoneConfiguration::ALL_DELIVERY_TYPE => $this->translator->trans('Home and relay delivery', [], MondialRelay::DOMAIN_NAME)
+ ],
+ 'label' => $this->translator->trans('Delivery type', [], MondialRelay::DOMAIN_NAME),
+ ]
+ )
+ ;
+ }
+}
diff --git a/local/modules/MondialRelay/Form/PriceCreateForm.php b/local/modules/MondialRelay/Form/PriceCreateForm.php
new file mode 100644
index 00000000..cd9cd2d8
--- /dev/null
+++ b/local/modules/MondialRelay/Form/PriceCreateForm.php
@@ -0,0 +1,42 @@
+
+ */
+class PriceCreateForm extends BaseForm
+{
+ protected function buildForm()
+ {
+ $this->formBuilder
+ ->add(
+ 'max_weight',
+ 'number',
+ [
+ "constraints" => [new GreaterThan([ 'value' => 0 ])],
+ 'label' => $this->translator->trans('Weight up to...', [], MondialRelay::DOMAIN_NAME),
+ ]
+ )->add(
+ 'price',
+ 'number',
+ [
+ "constraints" => [new GreaterThan([ 'value' => 0 ])],
+ 'label' => $this->translator->trans('Price', [], MondialRelay::DOMAIN_NAME),
+ ]
+ )
+ ;
+ }
+}
diff --git a/local/modules/MondialRelay/Form/PricesUpdateForm.php b/local/modules/MondialRelay/Form/PricesUpdateForm.php
new file mode 100644
index 00000000..f92ede49
--- /dev/null
+++ b/local/modules/MondialRelay/Form/PricesUpdateForm.php
@@ -0,0 +1,48 @@
+
+ */
+class PricesUpdateForm extends BaseForm
+{
+ protected function buildForm()
+ {
+ $this->formBuilder
+ ->add(
+ 'max_weight',
+ 'collection',
+ [
+ "type" => "number",
+ "constraints" => [new GreaterThan([ 'value' => 0 ])],
+ 'label' => $this->translator->trans('Weight up to...', [], MondialRelay::DOMAIN_NAME),
+ 'allow_add' => true,
+ 'allow_delete' => true,
+ ]
+ )->add(
+ 'price',
+ 'collection',
+ [
+ "type" => "number",
+ "constraints" => [new GreaterThan([ 'value' => 0 ])],
+ 'label' => $this->translator->trans('Price', [], MondialRelay::DOMAIN_NAME),
+ 'allow_add' => true,
+ 'allow_delete' => true,
+ ]
+ )
+ ;
+ }
+}
diff --git a/local/modules/MondialRelay/Form/SettingsForm.php b/local/modules/MondialRelay/Form/SettingsForm.php
new file mode 100644
index 00000000..259aedca
--- /dev/null
+++ b/local/modules/MondialRelay/Form/SettingsForm.php
@@ -0,0 +1,105 @@
+
+ */
+class SettingsForm extends BaseForm
+{
+ protected function buildForm()
+ {
+ $this->formBuilder
+ ->add(
+ MondialRelay::CODE_ENSEIGNE,
+ 'text',
+ [
+ "constraints" => [new NotBlank()],
+ 'label' => $this->translator->trans('Mondial Relay store code', [], MondialRelay::DOMAIN_NAME),
+ 'label_attr' => [
+ 'help' => $this->translator->trans('This is the store code, as provided by Mondial Relay.', [], MondialRelay::DOMAIN_NAME)
+ ]
+
+ ]
+ )->add(
+ MondialRelay::PRIVATE_KEY,
+ 'text',
+ [
+ "constraints" => [new NotBlank()],
+ 'label' => $this->translator->trans('Private key', [], MondialRelay::DOMAIN_NAME),
+ 'label_attr' => [
+ 'help' => $this->translator->trans('Your private key, as provided by Mondial Relay.', [], MondialRelay::DOMAIN_NAME)
+ ]
+
+ ]
+ )->add(
+ MondialRelay::ALLOW_HOME_DELIVERY,
+ 'checkbox',
+ [
+ 'required' => false,
+ 'label' => $this->translator->trans('Allow home delivery', [], MondialRelay::DOMAIN_NAME),
+ 'label_attr' => [
+ 'help' => $this->translator->trans('Check this box to allow delivery at customer address in supported countries.', [], MondialRelay::DOMAIN_NAME)
+ ]
+
+ ]
+ )->add(
+ MondialRelay::ALLOW_RELAY_DELIVERY,
+ 'checkbox',
+ [
+ 'required' => false,
+ 'label' => $this->translator->trans('Allow relay delivery', [], MondialRelay::DOMAIN_NAME),
+ 'label_attr' => [
+ 'help' => $this->translator->trans('Check this box to allow delivery in relays in supported countries.', [], MondialRelay::DOMAIN_NAME)
+ ]
+
+ ]
+ )->add(
+ MondialRelay::ALLOW_INSURANCE,
+ 'checkbox',
+ [
+ 'required' => false,
+ 'label' => $this->translator->trans('Allow optional insurance', [], MondialRelay::DOMAIN_NAME),
+ 'label_attr' => [
+ 'help' => $this->translator->trans('Check this box to allow an optionnal insurance selection depending on cart value.', [], MondialRelay::DOMAIN_NAME)
+ ]
+
+ ]
+ )->add(
+ MondialRelay::WEBSERVICE_URL,
+ 'text',
+ [
+ 'label' => $this->translator->trans('Mondial Relay Web service WSDL URL', [], MondialRelay::DOMAIN_NAME),
+ 'label_attr' => [
+ 'help' => $this->translator->trans('This is the URL of the Mondial Relay web service WSDL.', [], MondialRelay::DOMAIN_NAME)
+ ]
+ ]
+ )->add(
+ MondialRelay::GOOGLE_MAPS_API_KEY,
+ 'text',
+ [
+ 'label' => $this->translator->trans('Google Map API Key', [], MondialRelay::DOMAIN_NAME),
+ 'label_attr' => [
+ 'help' => $this->translator->trans(
+ 'This key is required to display relays map. Click here to get one.',
+ [ "%get_key_url" => "https://developers.google.com/maps/documentation/javascript/get-api-key" ],
+ MondialRelay::DOMAIN_NAME
+ )
+ ]
+ ]
+ );
+ ;
+ }
+}
diff --git a/local/modules/MondialRelay/Hook/AdminHookManager.php b/local/modules/MondialRelay/Hook/AdminHookManager.php
new file mode 100644
index 00000000..788b9bcc
--- /dev/null
+++ b/local/modules/MondialRelay/Hook/AdminHookManager.php
@@ -0,0 +1,57 @@
+ MondialRelay::getConfigValue(MondialRelay::CODE_ENSEIGNE),
+ 'private_key' => MondialRelay::getConfigValue(MondialRelay::PRIVATE_KEY),
+ 'allow_relay_delivery' => MondialRelay::getConfigValue(MondialRelay::ALLOW_RELAY_DELIVERY),
+ 'allow_home_delivery' => MondialRelay::getConfigValue(MondialRelay::ALLOW_HOME_DELIVERY),
+ 'allow_insurance' => MondialRelay::getConfigValue(MondialRelay::ALLOW_INSURANCE),
+
+ 'module_id' => MondialRelay::getModuleId()
+ ];
+
+ $event->add(
+ $this->render('mondialrelay/module-configuration.html', $vars)
+ );
+ }
+
+ public function onMainTopMenuTools(HookRenderBlockEvent $event)
+ {
+ $event->add(
+ [
+ 'id' => 'tools_mondial_relay',
+ 'class' => '',
+ 'url' => URL::getInstance()->absoluteUrl('/admin/module/MondialRelay'),
+ 'title' => $this->trans('Mondial Relay', [], MondialRelay::DOMAIN_NAME)
+ ]
+ );
+ }
+
+ public function onModuleConfigureJs(HookRenderEvent $event)
+ {
+ $event
+ ->add($this->render("mondialrelay/assets/js/mondialrelay.js.html"))
+ ->add($this->addJS("mondialrelay/assets/js/bootstrap-notify.min.js"))
+ ;
+ }
+}
diff --git a/local/modules/MondialRelay/Hook/EmailHookManager.php b/local/modules/MondialRelay/Hook/EmailHookManager.php
new file mode 100644
index 00000000..f9f3a169
--- /dev/null
+++ b/local/modules/MondialRelay/Hook/EmailHookManager.php
@@ -0,0 +1,65 @@
+add(
+ $this->render(
+ 'mondialrelay/order-delivery-address.html',
+ [
+ 'module_id' => $event->getArgument('module'),
+ 'order_id' => $event->getArgument('order'),
+ 'html_mode' => $htmlMode ? '1' : '0'
+ ]
+ )
+ );
+ }
+
+ public function onDeliveryAddressText(HookRenderEvent $event)
+ {
+ $this->renderAddressTemplate($event, false);
+ }
+
+ public function onDeliveryAddressHtml(HookRenderEvent $event)
+ {
+ $this->renderAddressTemplate($event, true);
+ }
+
+ public function onAfterProductsText(HookRenderEvent $event)
+ {
+ $event->add(
+ $this->render(
+ 'mondialrelay/opening-hours-text.html',
+ [
+ 'order_id' => $event->getArgument('order'),
+ ]
+ )
+ );
+ }
+
+ public function onAfterProductsHtml(HookRenderEvent $event)
+ {
+ $event->add(
+ $this->render(
+ 'mondialrelay/opening-hours-html.html',
+ [
+ 'order_id' => $event->getArgument('order'),
+ ]
+ )
+ );
+ }
+}
diff --git a/local/modules/MondialRelay/Hook/FrontHookManager.php b/local/modules/MondialRelay/Hook/FrontHookManager.php
new file mode 100644
index 00000000..a034fbb1
--- /dev/null
+++ b/local/modules/MondialRelay/Hook/FrontHookManager.php
@@ -0,0 +1,53 @@
+getSession()->remove(MondialRelay::SESSION_SELECTED_DELIVERY_TYPE);
+ $this->getSession()->remove(MondialRelay::SESSION_SELECTED_PICKUP_RELAY_ID);
+
+ // Get the address id from the request, as the hook don(t give it to us.
+ $addressId = $this->getRequest()->get('address_id', 0);
+
+ $event->add(
+ $this->render(
+ 'mondialrelay/order-delivery-extra.html',
+ [
+ 'module_id' => MondialRelay::getModuleId(),
+ 'address_id' => $addressId
+ ]
+ )
+ );
+ }
+
+ public function onAccountOrderDeliveryAddress(HookRenderEvent $event)
+ {
+ $event->add(
+ $this->render(
+ 'mondialrelay/order-delivery-address.html',
+ [
+ 'order_id' => $event->getArgument('order'),
+ 'module_id' => $event->getArgument('module')
+ ]
+ )
+ );
+ }
+}
+
+
diff --git a/local/modules/MondialRelay/Hook/PdfHookManager.php b/local/modules/MondialRelay/Hook/PdfHookManager.php
new file mode 100644
index 00000000..6f368513
--- /dev/null
+++ b/local/modules/MondialRelay/Hook/PdfHookManager.php
@@ -0,0 +1,42 @@
+add(
+ $this->render(
+ 'mondialrelay/order-delivery-address.html',
+ [
+ 'module_id' => $event->getArgument('module'),
+ 'order_id' => $event->getArgument('order'),
+ ]
+ )
+ );
+ }
+ public function onAfterDeliveryModule(HookRenderEvent $event)
+ {
+ $event->add(
+ $this->render(
+ 'mondialrelay/opening-hours.html',
+ [
+ 'module_id' => $event->getArgument('module'),
+ 'order_id' => $event->getArgument('order'),
+ ]
+ )
+ );
+ }
+}
diff --git a/local/modules/MondialRelay/I18n/backOffice/default/en_US.php b/local/modules/MondialRelay/I18n/backOffice/default/en_US.php
new file mode 100644
index 00000000..7b00e1b8
--- /dev/null
+++ b/local/modules/MondialRelay/I18n/backOffice/default/en_US.php
@@ -0,0 +1,30 @@
+ 'Add a new insurance',
+ 'Add a new price' => 'Add a new price',
+ 'Add new insurance' => 'Add new insurance',
+ 'Add this price' => 'Add this price',
+ 'Area properties' => 'Area properties',
+ 'Cart value' => 'Cart value',
+ 'Cart weight up to...' => 'Cart weight up to...',
+ 'Configuration' => 'Configuration',
+ 'Delete this insurance' => 'Delete this insurance',
+ 'Delete this price' => 'Delete this price',
+ 'Delivery prices' => 'Delivery prices',
+ 'Development of this module is sponsored by you\'Nivers web and communication agency in Roanne.' => 'Development of this module is sponsored by you\'Nivers, web and communication agency in Roanne.',
+ 'Insurance price with tax' => 'Insurance price with tax',
+ 'Insurances' => 'Insurances',
+ 'Mondial Relay delivery configuration' => 'Mondial Relay delivery configuration',
+ 'Price with tax' => 'Price with tax',
+ 'Prices' => 'Prices',
+ 'Save' => 'Save',
+ 'Save changes' => 'Save changes',
+ 'Saving data, please wait...' => 'Saving data, please wait...',
+ 'Shipping zone "%name"' => 'Shipping zone "%name"',
+ 'Sorry, something goes wrong. Please try again.' => 'Sorry, something goes wrong. Please try again.',
+ 'There\'s no shipping zone defined for Mondial Relay. Please click here to configure module\'s shipping zones.' => 'There\'s no shipping zone defined for Mondial Relay. Please click here to configure module\'s shipping zones.',
+ 'Update finished.' => 'Update finished.',
+ 'days' => 'days',
+ 'kg' => 'kg',
+);
diff --git a/local/modules/MondialRelay/I18n/backOffice/default/fr_FR.php b/local/modules/MondialRelay/I18n/backOffice/default/fr_FR.php
new file mode 100644
index 00000000..c3d6f922
--- /dev/null
+++ b/local/modules/MondialRelay/I18n/backOffice/default/fr_FR.php
@@ -0,0 +1,30 @@
+ 'Ajouter une assurance',
+ 'Add a new price' => 'Ajouter un prix',
+ 'Add new insurance' => 'Ajouter une assurance',
+ 'Add this price' => 'Ajouter ce prix',
+ 'Area properties' => 'Propriétés de la zone',
+ 'Cart value' => 'Montant du panier',
+ 'Cart weight up to...' => 'Jusqu\'au poids...',
+ 'Configuration' => 'Configuration',
+ 'Delete this insurance' => 'Supprimer cette assurance',
+ 'Delete this price' => 'Supprimer ce prix',
+ 'Delivery prices' => 'Prix de livraison',
+ 'Development of this module is sponsored by you\'Nivers web and communication agency in Roanne.' => 'Le développement de ce module est financé par you\'Nivers, créateurs de site Internet à Roanne.',
+ 'Insurance price with tax' => 'Prix de l\'assurance TTC',
+ 'Insurances' => 'Assurances',
+ 'Mondial Relay delivery configuration' => 'Configuration des livraisons avec Mondial Relay',
+ 'Price with tax' => 'Prix TTC',
+ 'Prices' => 'Prix',
+ 'Save' => 'Enregistrer',
+ 'Save changes' => 'Enregistrer',
+ 'Saving data, please wait...' => 'Enregistrement en cours, merci de patienter...',
+ 'Shipping zone "%name"' => 'Zone de livraison "%name"',
+ 'Sorry, something goes wrong. Please try again.' => 'Quelque chose s\'est mal passé, merdi de ré-essayer.',
+ 'There\'s no shipping zone defined for Mondial Relay. Please click here to configure module\'s shipping zones.' => 'Il n\'y a pas de zone de livraison attaché à Mondial Relay. Cliquez ici pour configurer les zones de livraison du module',
+ 'Update finished.' => 'Enregistrement terminé.',
+ 'days' => 'jours',
+ 'kg' => 'kg',
+);
diff --git a/local/modules/MondialRelay/I18n/email/default/en_US.php b/local/modules/MondialRelay/I18n/email/default/en_US.php
new file mode 100644
index 00000000..21a492c1
--- /dev/null
+++ b/local/modules/MondialRelay/I18n/email/default/en_US.php
@@ -0,0 +1,15 @@
+ 'Dear %first %last',
+ 'Details about this order are available in your customer account.' => 'Details about this order are available in your customer account.',
+ 'Details about this order are available in your customer account: %account_url.' => 'Details about this order are available in your customer account: %account_url.',
+ 'Mondial Relay pickup location #%num' => 'Mondial Relay pickup location #%num',
+ 'Pickup relay opening hours:' => 'Pickup relay opening hours:',
+ 'See you soon at %store at the following address: %url' => 'See you soon at %store at the following address: %url',
+ 'See you soon at %store' => 'See you soon at %store',
+ 'The %store team.' => 'The %store team.',
+ 'Your %ref order has been shipped' => 'Your %ref order has been shipped',
+ 'Your order %order_ref has just been shipped from our store. The tracking number for this order is %tracking_ref. Please click here to track the delivery.' => 'Your order %order_ref has just been shipped from our store. The tracking number for this order is %tracking_ref. Please click here to track the delivery.',
+ 'Your order %order_ref has just been shipped from our store. The tracking number for this order is %tracking_ref. Tracking data is available at this address: https://www.mondialrelay.fr/suivi-de-colis' => 'Your order %order_ref has just been shipped from our store. The tracking number for this order is %tracking_ref. Tracking data is available at this address: https://www.mondialrelay.fr/suivi-de-colis',
+);
diff --git a/local/modules/MondialRelay/I18n/email/default/fr_FR.php b/local/modules/MondialRelay/I18n/email/default/fr_FR.php
new file mode 100644
index 00000000..c3955ff7
--- /dev/null
+++ b/local/modules/MondialRelay/I18n/email/default/fr_FR.php
@@ -0,0 +1,15 @@
+ 'Bonjour %first %last',
+ 'Details about this order are available in your customer account.' => 'Les détails de cette commande sont disponibles dans votre compte client.',
+ 'Details about this order are available in your customer account: %account_url.' => 'Les détails de cette commande sont disponibles dans votre compte client: %account_url.',
+ 'Mondial Relay pickup location #%num' => 'Point relais Mondial Relay No. %num',
+ 'Pickup relay opening hours:' => 'Horaires d\'ouverture du relais',
+ 'See you soon at %store at the following address: %url' => 'A bientôt sur %store en suivant ce lien: %url',
+ 'See you soon at %store' => 'A bientôt sur %store',
+ 'The %store team.' => 'L\'équipe %store.',
+ 'Your %ref order has been shipped' => 'Votre commande %ref a été expédiée.',
+ 'Your order %order_ref has just been shipped from our store. The tracking number for this order is %tracking_ref. Please click here to track the delivery.' => 'Votre commande %order_ref vient de quitter nos entrepôts. Le numéro de suivi est %tracking_ref. Merci de cliquer ici pour obtenir les informations de suivi.',
+ 'Your order %order_ref has just been shipped from our store. The tracking number for this order is %tracking_ref. Tracking data is available at this address: https://www.mondialrelay.fr/suivi-de-colis' => 'Votre commande %order_ref vient de quitter nos entrepôts. Le numéro de suivi est %tracking_ref. Pour obtenir des informations sur l\'avancement de votre commande, merci de suivre ce lien: https://www.mondialrelay.fr/suivi-de-colis',
+);
diff --git a/local/modules/MondialRelay/I18n/en_US.php b/local/modules/MondialRelay/I18n/en_US.php
new file mode 100644
index 00000000..074bad18
--- /dev/null
+++ b/local/modules/MondialRelay/I18n/en_US.php
@@ -0,0 +1,38 @@
+ 'Allow home delivery',
+ 'Allow optional insurance' => 'Allow optional insurance',
+ 'Allow relay delivery' => 'Allow relay delivery',
+ 'Cart value' => 'Cart value',
+ 'Check this box to allow an optionnal insurance selection depending on cart value.' => 'Check this box to allow an optionnal insurance selection depending on cart value.',
+ 'Check this box to allow delivery at customer address in supported countries.' => 'Check this box to allow delivery at customer address in supported countries.',
+ 'Check this box to allow delivery in relays in supported countries.' => 'Check this box to allow delivery in relays in supported countries.',
+ 'Delivery delay' => 'Delivery delay',
+ 'Delivery type' => 'Delivery type',
+ 'Friday' => 'Friday',
+ 'Google Map API Key' => 'Google Map API Key',
+ 'Home and relay delivery' => 'Home and relay delivery',
+ 'Home delivery' => 'Home delivery',
+ 'Insurance price' => 'Insurance price',
+ 'Monday' => 'Monday',
+ 'Mondial Relay' => 'Mondial Relay',
+ 'Mondial Relay Web service WSDL URL' => 'Mondial Relay Web service WSDL URL',
+ 'Mondial Relay store code' => 'Mondial Relay store code',
+ 'Mondial Relay tracking information' => 'Mondial Relay tracking information',
+ 'Pickup relay #%number' => 'Pickup relay #%number',
+ 'Price' => 'Price',
+ 'Private key' => 'Private key',
+ 'Relay delivery' => 'Relay delivery',
+ 'Saturday' => 'Saturday',
+ 'Sunday' => 'Sunday',
+ 'This is the URL of the Mondial Relay web service WSDL.' => 'This is the URL of the Mondial Relay web service WSDL.',
+ 'This is the store code, as provided by Mondial Relay.' => 'This is the store code, as provided by Mondial Relay.',
+ 'This key is required to display relays map. Click here to get one.' => 'This key is required to display relays map. Click here to get one.',
+ 'Thursday' => 'Thursday',
+ 'Tuesday' => 'Tuesday',
+ 'Wednesday' => 'Wednesday',
+ 'Weight up to...' => 'Weight up to...',
+ 'Your order has been shipped' => 'Your order has been shipped',
+ 'Your private key, as provided by Mondial Relay.' => 'Your private key, as provided by Mondial Relay.',
+);
diff --git a/local/modules/MondialRelay/I18n/fr_FR.php b/local/modules/MondialRelay/I18n/fr_FR.php
new file mode 100644
index 00000000..15b66128
--- /dev/null
+++ b/local/modules/MondialRelay/I18n/fr_FR.php
@@ -0,0 +1,38 @@
+ 'Autoriser la livraison à domicile',
+ 'Allow optional insurance' => 'Proposer une assurance optionnelle',
+ 'Allow relay delivery' => 'Autoriser la livraison en point relais',
+ 'Cart value' => 'Valeur du panier',
+ 'Check this box to allow an optionnal insurance selection depending on cart value.' => 'Cochez cette case pour proposer à vos client une assurance optionnelle, fonction du montant du panier',
+ 'Check this box to allow delivery at customer address in supported countries.' => 'Cochez cette case pour autoriser les livraison à domicile dans les pays ou Mondial Relay le propose',
+ 'Check this box to allow delivery in relays in supported countries.' => 'Cochez cette case pour autoriser les livraison en pojt relais dans les pays ou Mondial Relay le propose',
+ 'Delivery delay' => 'Délai de livraison',
+ 'Delivery type' => 'Type de livraison',
+ 'Friday' => 'Vendredi',
+ 'Google Map API Key' => 'Clef d\'API Google Maps',
+ 'Home and relay delivery' => 'Livraison en point relais ou à domicile',
+ 'Home delivery' => 'Livraison à mon domicile',
+ 'Insurance price' => 'Montant de l\'assurance',
+ 'Monday' => 'Lundi',
+ 'Mondial Relay' => 'Mondial Relay',
+ 'Mondial Relay Web service WSDL URL' => 'URL du WSDL du web service Mondial Relay',
+ 'Mondial Relay store code' => 'Code magasin Mondial Relay',
+ 'Mondial Relay tracking information' => 'Informations de suivi Mondial Relay',
+ 'Pickup relay #%number' => 'Point relais No. %number',
+ 'Price' => 'Prix',
+ 'Private key' => 'Clef privée',
+ 'Relay delivery' => 'Livraison en point relais',
+ 'Saturday' => 'Samedi',
+ 'Sunday' => 'Dimanche',
+ 'This is the URL of the Mondial Relay web service WSDL.' => 'Il s\'agit de l\'URL du descripteur du web service Mondial Relay, qui sera appelée par le module',
+ 'This is the store code, as provided by Mondial Relay.' => 'Il s\'agit du code magasin fourni par Mondial Relay',
+ 'This key is required to display relays map. Click here to get one.' => 'Cette clef est indispensable pour afficher la carte des points relais. Cliquez ici pour en obtenir une.',
+ 'Thursday' => 'Jeudi',
+ 'Tuesday' => 'Mardi',
+ 'Wednesday' => 'Mercredi',
+ 'Weight up to...' => 'Jusqu\'au poids...',
+ 'Your order has been shipped' => 'Votre commande a été expédiée',
+ 'Your private key, as provided by Mondial Relay.' => 'Votre clef privée, fournie par Mondial Relay',
+);
diff --git a/local/modules/MondialRelay/I18n/frontOffice/default/en_US.php b/local/modules/MondialRelay/I18n/frontOffice/default/en_US.php
new file mode 100644
index 00000000..2e19908b
--- /dev/null
+++ b/local/modules/MondialRelay/I18n/frontOffice/default/en_US.php
@@ -0,0 +1,23 @@
+ 'City',
+ 'Current address can\'t be geolocated' => 'Current address can\'t be geolocated',
+ 'Expected delivery date: %delivery_date' => 'Expected delivery date: %delivery_date',
+ 'Find' => 'Find',
+ 'Find a pickup location around you' => 'Find a pickup location around you',
+ 'Loading...' => 'Loading...',
+ 'Mondial Relay home delivery' => 'Mondial Relay home delivery',
+ 'Mondial Relay pickup location' => 'Mondial Relay pickup location',
+ 'Mondial Relay pickup location #%num' => 'Mondial Relay pickup #%num',
+ 'No pickup locations were found for this address.' => 'No pickup locations were found for this address.',
+ 'Oops, something goes wrong, please try again.' => 'Oops, something goes wrong, please try again.',
+ 'Pickup location #%number' => 'Pickup location #%number',
+ 'Pickup location address' => 'Pickup location address',
+ 'Pickup location opening hours' => 'Pickup location opening hours',
+ 'Please select a pickup location.' => 'Please select a pickup location.',
+ 'Search radius' => 'Search radius',
+ 'Sorry, we failed to get pickup locations. Error is : __ERR__.' => 'Sorry, we failed to get pickup locations. Error is : __ERR__.',
+ 'Zip code' => 'Zip code',
+ 'km' => 'km',
+);
diff --git a/local/modules/MondialRelay/I18n/frontOffice/default/fr_FR.php b/local/modules/MondialRelay/I18n/frontOffice/default/fr_FR.php
new file mode 100644
index 00000000..bea0ef5b
--- /dev/null
+++ b/local/modules/MondialRelay/I18n/frontOffice/default/fr_FR.php
@@ -0,0 +1,23 @@
+ 'Ville',
+ 'Current address can\'t be geolocated' => 'L\'adresse sélectionné ne peut être géolocalisée, merci de vérifier qu\'elle est correcte.',
+ 'Expected delivery date: %delivery_date' => 'Date de livraison estimée: %delivery_date',
+ 'Find' => 'Go',
+ 'Find a pickup location around you' => 'Trouver un point relais autour de vous',
+ 'Loading...' => 'Chargement...',
+ 'Mondial Relay home delivery' => 'Livraison Mondial Relay à mon domicile',
+ 'Mondial Relay pickup location' => 'Adresse du point relais Mondial Relay',
+ 'Mondial Relay pickup location #%num' => 'Point relais Mondial Relay No. %num',
+ 'No pickup locations were found for this address.' => 'Nous n\'avons pas trouvé de point relais autour de cette adresse.',
+ 'Oops, something goes wrong, please try again.' => 'Oups, quelque chose n\'a pas fonctionné correctement. Merci de recommencer.',
+ 'Pickup location #%number' => 'Point relais No. %number',
+ 'Pickup location address' => 'Adresse du point relais',
+ 'Pickup location opening hours' => 'Horaires d\'ouverture du relais',
+ 'Please select a pickup location.' => 'Merci de choisir un point relais.',
+ 'Search radius' => 'Rayon de recherche',
+ 'Sorry, we failed to get pickup locations. Error is : __ERR__.' => 'Impossible d\'obtenir les points relais. L\'erreur est : __ERR__.',
+ 'Zip code' => 'Code postal',
+ 'km' => 'km',
+);
diff --git a/local/modules/MondialRelay/I18n/pdf/default/en_US.php b/local/modules/MondialRelay/I18n/pdf/default/en_US.php
new file mode 100644
index 00000000..9285719e
--- /dev/null
+++ b/local/modules/MondialRelay/I18n/pdf/default/en_US.php
@@ -0,0 +1,6 @@
+ 'Mondial Relay pickup location #%num',
+ 'Pickup relay opening hours:' => 'Pickup relay opening hours:',
+);
diff --git a/local/modules/MondialRelay/I18n/pdf/default/fr_FR.php b/local/modules/MondialRelay/I18n/pdf/default/fr_FR.php
new file mode 100644
index 00000000..9f8033cd
--- /dev/null
+++ b/local/modules/MondialRelay/I18n/pdf/default/fr_FR.php
@@ -0,0 +1,6 @@
+ 'Point relais Mondial Relay No. %num',
+ 'Pickup relay opening hours:' => 'Horaires d\'ouverture du relais',
+);
diff --git a/local/modules/MondialRelay/LICENSE b/local/modules/MondialRelay/LICENSE
new file mode 100644
index 00000000..65c5ca88
--- /dev/null
+++ b/local/modules/MondialRelay/LICENSE
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. MondialRelayDeliveryInsurance instance. If
+ * obj is an instance of MondialRelayDeliveryInsurance, delegates to
+ * equals(MondialRelayDeliveryInsurance). Otherwise, returns false.
+ *
+ * @param mixed $obj The object to compare to.
+ * @return boolean Whether equal to the object specified.
+ */
+ public function equals($obj)
+ {
+ $thisclazz = get_class($this);
+ if (!is_object($obj) || !($obj instanceof $thisclazz)) {
+ return false;
+ }
+
+ if ($this === $obj) {
+ return true;
+ }
+
+ if (null === $this->getPrimaryKey()
+ || null === $obj->getPrimaryKey()) {
+ return false;
+ }
+
+ return $this->getPrimaryKey() === $obj->getPrimaryKey();
+ }
+
+ /**
+ * If the primary key is not null, return the hashcode of the
+ * primary key. Otherwise, return the hash code of the object.
+ *
+ * @return int Hashcode
+ */
+ public function hashCode()
+ {
+ if (null !== $this->getPrimaryKey()) {
+ return crc32(serialize($this->getPrimaryKey()));
+ }
+
+ return crc32(serialize(clone $this));
+ }
+
+ /**
+ * Get the associative array of the virtual columns in this object
+ *
+ * @return array
+ */
+ public function getVirtualColumns()
+ {
+ return $this->virtualColumns;
+ }
+
+ /**
+ * Checks the existence of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @return boolean
+ */
+ public function hasVirtualColumn($name)
+ {
+ return array_key_exists($name, $this->virtualColumns);
+ }
+
+ /**
+ * Get the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @return mixed
+ *
+ * @throws PropelException
+ */
+ public function getVirtualColumn($name)
+ {
+ if (!$this->hasVirtualColumn($name)) {
+ throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
+ }
+
+ return $this->virtualColumns[$name];
+ }
+
+ /**
+ * Set the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @param mixed $value The value to give to the virtual column
+ *
+ * @return MondialRelayDeliveryInsurance The current object, for fluid interface
+ */
+ public function setVirtualColumn($name, $value)
+ {
+ $this->virtualColumns[$name] = $value;
+
+ return $this;
+ }
+
+ /**
+ * Logs a message using Propel::log().
+ *
+ * @param string $msg
+ * @param int $priority One of the Propel::LOG_* logging levels
+ * @return boolean
+ */
+ protected function log($msg, $priority = Propel::LOG_INFO)
+ {
+ return Propel::log(get_class($this) . ': ' . $msg, $priority);
+ }
+
+ /**
+ * Populate the current object from a string, using a given parser format
+ *
+ * $book = new Book();
+ * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance,
+ * or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param string $data The source data to import from
+ *
+ * @return MondialRelayDeliveryInsurance The current object, for fluid interface
+ */
+ public function importFrom($parser, $data)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME);
+
+ return $this;
+ }
+
+ /**
+ * Export the current object properties to a string, using a given parser format
+ *
+ * $book = BookQuery::create()->findPk(9012);
+ * echo $book->exportTo('JSON');
+ * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
+ * @return string The exported data
+ */
+ public function exportTo($parser, $includeLazyLoadColumns = true)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
+ }
+
+ /**
+ * Clean up internal collections prior to serializing
+ * Avoids recursive loops that turn into segmentation faults when serializing
+ */
+ public function __sleep()
+ {
+ $this->clearAllReferences();
+
+ return array_keys(get_object_vars($this));
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [level] column value.
+ *
+ * @return int
+ */
+ public function getLevel()
+ {
+
+ return $this->level;
+ }
+
+ /**
+ * Get the [max_value] column value.
+ *
+ * @return string
+ */
+ public function getMaxValue()
+ {
+
+ return $this->max_value;
+ }
+
+ /**
+ * Get the [price_with_tax] column value.
+ *
+ * @return string
+ */
+ public function getPriceWithTax()
+ {
+
+ return $this->price_with_tax;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \MondialRelay\Model\MondialRelayDeliveryInsurance The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[MondialRelayDeliveryInsuranceTableMap::ID] = true;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [level] column.
+ *
+ * @param int $v new value
+ * @return \MondialRelay\Model\MondialRelayDeliveryInsurance The current object (for fluent API support)
+ */
+ public function setLevel($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->level !== $v) {
+ $this->level = $v;
+ $this->modifiedColumns[MondialRelayDeliveryInsuranceTableMap::LEVEL] = true;
+ }
+
+
+ return $this;
+ } // setLevel()
+
+ /**
+ * Set the value of [max_value] column.
+ *
+ * @param string $v new value
+ * @return \MondialRelay\Model\MondialRelayDeliveryInsurance The current object (for fluent API support)
+ */
+ public function setMaxValue($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->max_value !== $v) {
+ $this->max_value = $v;
+ $this->modifiedColumns[MondialRelayDeliveryInsuranceTableMap::MAX_VALUE] = true;
+ }
+
+
+ return $this;
+ } // setMaxValue()
+
+ /**
+ * Set the value of [price_with_tax] column.
+ *
+ * @param string $v new value
+ * @return \MondialRelay\Model\MondialRelayDeliveryInsurance The current object (for fluent API support)
+ */
+ public function setPriceWithTax($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->price_with_tax !== $v) {
+ $this->price_with_tax = $v;
+ $this->modifiedColumns[MondialRelayDeliveryInsuranceTableMap::PRICE_WITH_TAX] = true;
+ }
+
+
+ return $this;
+ } // setPriceWithTax()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->max_value !== '0.000000') {
+ return false;
+ }
+
+ if ($this->price_with_tax !== '0.000000') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by DataFetcher->fetch().
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @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.
+ *
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
+ {
+ try {
+
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : MondialRelayDeliveryInsuranceTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : MondialRelayDeliveryInsuranceTableMap::translateFieldName('Level', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->level = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : MondialRelayDeliveryInsuranceTableMap::translateFieldName('MaxValue', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->max_value = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MondialRelayDeliveryInsuranceTableMap::translateFieldName('PriceWithTax', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->price_with_tax = (null !== $col) ? (string) $col : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 4; // 4 = MondialRelayDeliveryInsuranceTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \MondialRelay\Model\MondialRelayDeliveryInsurance object", 0, $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(MondialRelayDeliveryInsuranceTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildMondialRelayDeliveryInsuranceQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
+ $row = $dataFetcher->fetch();
+ $dataFetcher->close();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see MondialRelayDeliveryInsurance::setDeleted()
+ * @see MondialRelayDeliveryInsurance::isDeleted()
+ */
+ public function delete(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(MondialRelayDeliveryInsuranceTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildMondialRelayDeliveryInsuranceQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(MondialRelayDeliveryInsuranceTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ MondialRelayDeliveryInsuranceTableMap::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(ConnectionInterface $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(ConnectionInterface $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[MondialRelayDeliveryInsuranceTableMap::ID] = true;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . MondialRelayDeliveryInsuranceTableMap::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(MondialRelayDeliveryInsuranceTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = 'ID';
+ }
+ if ($this->isColumnModified(MondialRelayDeliveryInsuranceTableMap::LEVEL)) {
+ $modifiedColumns[':p' . $index++] = 'LEVEL';
+ }
+ if ($this->isColumnModified(MondialRelayDeliveryInsuranceTableMap::MAX_VALUE)) {
+ $modifiedColumns[':p' . $index++] = 'MAX_VALUE';
+ }
+ if ($this->isColumnModified(MondialRelayDeliveryInsuranceTableMap::PRICE_WITH_TAX)) {
+ $modifiedColumns[':p' . $index++] = 'PRICE_WITH_TAX';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO mondial_relay_delivery_insurance (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case 'ID':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case 'LEVEL':
+ $stmt->bindValue($identifier, $this->level, PDO::PARAM_INT);
+ break;
+ case 'MAX_VALUE':
+ $stmt->bindValue($identifier, $this->max_value, PDO::PARAM_STR);
+ break;
+ case 'PRICE_WITH_TAX':
+ $stmt->bindValue($identifier, $this->price_with_tax, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
+ }
+
+ try {
+ $pk = $con->lastInsertId();
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get autoincrement id.', 0, $e);
+ }
+ $this->setId($pk);
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @return Integer Number of updated rows
+ * @see doSave()
+ */
+ protected function doUpdate(ConnectionInterface $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+
+ return $selectCriteria->doUpdate($valuesCriteria, $con);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = MondialRelayDeliveryInsuranceTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLevel();
+ break;
+ case 2:
+ return $this->getMaxValue();
+ break;
+ case 3:
+ return $this->getPriceWithTax();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
+ {
+ if (isset($alreadyDumpedObjects['MondialRelayDeliveryInsurance'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['MondialRelayDeliveryInsurance'][$this->getPrimaryKey()] = true;
+ $keys = MondialRelayDeliveryInsuranceTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLevel(),
+ $keys[2] => $this->getMaxValue(),
+ $keys[3] => $this->getPriceWithTax(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return void
+ */
+ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = MondialRelayDeliveryInsuranceTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLevel($value);
+ break;
+ case 2:
+ $this->setMaxValue($value);
+ break;
+ case 3:
+ $this->setPriceWithTax($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * The default key type is the column's TableMap::TYPE_PHPNAME.
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
+ {
+ $keys = MondialRelayDeliveryInsuranceTableMap::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLevel($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setMaxValue($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setPriceWithTax($arr[$keys[3]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(MondialRelayDeliveryInsuranceTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(MondialRelayDeliveryInsuranceTableMap::ID)) $criteria->add(MondialRelayDeliveryInsuranceTableMap::ID, $this->id);
+ if ($this->isColumnModified(MondialRelayDeliveryInsuranceTableMap::LEVEL)) $criteria->add(MondialRelayDeliveryInsuranceTableMap::LEVEL, $this->level);
+ if ($this->isColumnModified(MondialRelayDeliveryInsuranceTableMap::MAX_VALUE)) $criteria->add(MondialRelayDeliveryInsuranceTableMap::MAX_VALUE, $this->max_value);
+ if ($this->isColumnModified(MondialRelayDeliveryInsuranceTableMap::PRICE_WITH_TAX)) $criteria->add(MondialRelayDeliveryInsuranceTableMap::PRICE_WITH_TAX, $this->price_with_tax);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(MondialRelayDeliveryInsuranceTableMap::DATABASE_NAME);
+ $criteria->add(MondialRelayDeliveryInsuranceTableMap::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return null === $this->getId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of \MondialRelay\Model\MondialRelayDeliveryInsurance (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setLevel($this->getLevel());
+ $copyObj->setMaxValue($this->getMaxValue());
+ $copyObj->setPriceWithTax($this->getPriceWithTax());
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return \MondialRelay\Model\MondialRelayDeliveryInsurance Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->level = null;
+ $this->max_value = null;
+ $this->price_with_tax = null;
+ $this->alreadyInSave = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(MondialRelayDeliveryInsuranceTableMap::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * Code to be run before persisting the object
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preSave(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after persisting the object
+ * @param ConnectionInterface $con
+ */
+ public function postSave(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before inserting to database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preInsert(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after inserting to database
+ * @param ConnectionInterface $con
+ */
+ public function postInsert(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before updating the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preUpdate(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after updating the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postUpdate(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before deleting the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preDelete(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after deleting the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postDelete(ConnectionInterface $con = null)
+ {
+
+ }
+
+
+ /**
+ * Derived method to catches calls to undefined methods.
+ *
+ * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
+ * Allows to define default __call() behavior if you overwrite __call()
+ *
+ * @param string $name
+ * @param mixed $params
+ *
+ * @return array|string
+ */
+ public function __call($name, $params)
+ {
+ if (0 === strpos($name, 'get')) {
+ $virtualColumn = substr($name, 3);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+
+ $virtualColumn = lcfirst($virtualColumn);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+
+ if (0 === strpos($name, 'from')) {
+ $format = substr($name, 4);
+
+ return $this->importFrom($format, reset($params));
+ }
+
+ if (0 === strpos($name, 'to')) {
+ $format = substr($name, 2);
+ $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
+
+ return $this->exportTo($format, $includeLazyLoadColumns);
+ }
+
+ throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
+ }
+
+}
diff --git a/local/modules/MondialRelay/Model/Base/MondialRelayDeliveryInsuranceQuery.php b/local/modules/MondialRelay/Model/Base/MondialRelayDeliveryInsuranceQuery.php
new file mode 100644
index 00000000..192f7d36
--- /dev/null
+++ b/local/modules/MondialRelay/Model/Base/MondialRelayDeliveryInsuranceQuery.php
@@ -0,0 +1,479 @@
+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.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildMondialRelayDeliveryInsurance|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = MondialRelayDeliveryInsuranceTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(MondialRelayDeliveryInsuranceTableMap::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 ChildMondialRelayDeliveryInsurance A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT ID, LEVEL, MAX_VALUE, PRICE_WITH_TAX FROM mondial_relay_delivery_insurance 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 ChildMondialRelayDeliveryInsurance();
+ $obj->hydrate($row);
+ MondialRelayDeliveryInsuranceTableMap::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 ChildMondialRelayDeliveryInsurance|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
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @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 ChildMondialRelayDeliveryInsuranceQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::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 ChildMondialRelayDeliveryInsuranceQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @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 ChildMondialRelayDeliveryInsuranceQuery 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(MondialRelayDeliveryInsuranceTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the level column
+ *
+ * Example usage:
+ *
+ * $query->filterByLevel(1234); // WHERE level = 1234
+ * $query->filterByLevel(array(12, 34)); // WHERE level IN (12, 34)
+ * $query->filterByLevel(array('min' => 12)); // WHERE level > 12
+ *
+ *
+ * @param mixed $level 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 ChildMondialRelayDeliveryInsuranceQuery The current query, for fluid interface
+ */
+ public function filterByLevel($level = null, $comparison = null)
+ {
+ if (is_array($level)) {
+ $useMinMax = false;
+ if (isset($level['min'])) {
+ $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::LEVEL, $level['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($level['max'])) {
+ $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::LEVEL, $level['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::LEVEL, $level, $comparison);
+ }
+
+ /**
+ * Filter the query on the max_value column
+ *
+ * Example usage:
+ *
+ * $query->filterByMaxValue(1234); // WHERE max_value = 1234
+ * $query->filterByMaxValue(array(12, 34)); // WHERE max_value IN (12, 34)
+ * $query->filterByMaxValue(array('min' => 12)); // WHERE max_value > 12
+ *
+ *
+ * @param mixed $maxValue 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 ChildMondialRelayDeliveryInsuranceQuery The current query, for fluid interface
+ */
+ public function filterByMaxValue($maxValue = null, $comparison = null)
+ {
+ if (is_array($maxValue)) {
+ $useMinMax = false;
+ if (isset($maxValue['min'])) {
+ $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::MAX_VALUE, $maxValue['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($maxValue['max'])) {
+ $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::MAX_VALUE, $maxValue['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::MAX_VALUE, $maxValue, $comparison);
+ }
+
+ /**
+ * Filter the query on the price_with_tax column
+ *
+ * Example usage:
+ *
+ * $query->filterByPriceWithTax(1234); // WHERE price_with_tax = 1234
+ * $query->filterByPriceWithTax(array(12, 34)); // WHERE price_with_tax IN (12, 34)
+ * $query->filterByPriceWithTax(array('min' => 12)); // WHERE price_with_tax > 12
+ *
+ *
+ * @param mixed $priceWithTax 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 ChildMondialRelayDeliveryInsuranceQuery The current query, for fluid interface
+ */
+ public function filterByPriceWithTax($priceWithTax = null, $comparison = null)
+ {
+ if (is_array($priceWithTax)) {
+ $useMinMax = false;
+ if (isset($priceWithTax['min'])) {
+ $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::PRICE_WITH_TAX, $priceWithTax['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($priceWithTax['max'])) {
+ $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::PRICE_WITH_TAX, $priceWithTax['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::PRICE_WITH_TAX, $priceWithTax, $comparison);
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildMondialRelayDeliveryInsurance $mondialRelayDeliveryInsurance Object to remove from the list of results
+ *
+ * @return ChildMondialRelayDeliveryInsuranceQuery The current query, for fluid interface
+ */
+ public function prune($mondialRelayDeliveryInsurance = null)
+ {
+ if ($mondialRelayDeliveryInsurance) {
+ $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::ID, $mondialRelayDeliveryInsurance->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the mondial_relay_delivery_insurance 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(MondialRelayDeliveryInsuranceTableMap::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).
+ MondialRelayDeliveryInsuranceTableMap::clearInstancePool();
+ MondialRelayDeliveryInsuranceTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildMondialRelayDeliveryInsurance or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildMondialRelayDeliveryInsurance 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(MondialRelayDeliveryInsuranceTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(MondialRelayDeliveryInsuranceTableMap::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();
+
+
+ MondialRelayDeliveryInsuranceTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ MondialRelayDeliveryInsuranceTableMap::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+} // MondialRelayDeliveryInsuranceQuery
diff --git a/local/modules/MondialRelay/Model/Base/MondialRelayDeliveryPrice.php b/local/modules/MondialRelay/Model/Base/MondialRelayDeliveryPrice.php
new file mode 100644
index 00000000..3065dc16
--- /dev/null
+++ b/local/modules/MondialRelay/Model/Base/MondialRelayDeliveryPrice.php
@@ -0,0 +1,1336 @@
+max_weight = '0.000000';
+ $this->price_with_tax = '0.000000';
+ }
+
+ /**
+ * Initializes internal state of MondialRelay\Model\Base\MondialRelayDeliveryPrice object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Returns whether the object has been modified.
+ *
+ * @return boolean True if the object has been modified.
+ */
+ public function isModified()
+ {
+ return !!$this->modifiedColumns;
+ }
+
+ /**
+ * Has specified column been modified?
+ *
+ * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
+ * @return boolean True if $col has been modified.
+ */
+ public function isColumnModified($col)
+ {
+ return $this->modifiedColumns && isset($this->modifiedColumns[$col]);
+ }
+
+ /**
+ * Get the columns that have been modified in this object.
+ * @return array A unique list of the modified column names for this object.
+ */
+ public function getModifiedColumns()
+ {
+ return $this->modifiedColumns ? array_keys($this->modifiedColumns) : [];
+ }
+
+ /**
+ * Returns whether the object has ever been saved. This will
+ * be false, if the object was retrieved from storage or was created
+ * and then saved.
+ *
+ * @return boolean true, if the object has never been persisted.
+ */
+ public function isNew()
+ {
+ return $this->new;
+ }
+
+ /**
+ * Setter for the isNew attribute. This method will be called
+ * by Propel-generated children and objects.
+ *
+ * @param boolean $b the state of the object.
+ */
+ public function setNew($b)
+ {
+ $this->new = (Boolean) $b;
+ }
+
+ /**
+ * Whether this object has been deleted.
+ * @return boolean The deleted state of this object.
+ */
+ public function isDeleted()
+ {
+ return $this->deleted;
+ }
+
+ /**
+ * Specify whether this object has been deleted.
+ * @param boolean $b The deleted state of this object.
+ * @return void
+ */
+ public function setDeleted($b)
+ {
+ $this->deleted = (Boolean) $b;
+ }
+
+ /**
+ * Sets the modified state for the object to be false.
+ * @param string $col If supplied, only the specified column is reset.
+ * @return void
+ */
+ public function resetModified($col = null)
+ {
+ if (null !== $col) {
+ if (isset($this->modifiedColumns[$col])) {
+ unset($this->modifiedColumns[$col]);
+ }
+ } else {
+ $this->modifiedColumns = array();
+ }
+ }
+
+ /**
+ * Compares this with another MondialRelayDeliveryPrice instance. If
+ * obj is an instance of MondialRelayDeliveryPrice, delegates to
+ * equals(MondialRelayDeliveryPrice). Otherwise, returns false.
+ *
+ * @param mixed $obj The object to compare to.
+ * @return boolean Whether equal to the object specified.
+ */
+ public function equals($obj)
+ {
+ $thisclazz = get_class($this);
+ if (!is_object($obj) || !($obj instanceof $thisclazz)) {
+ return false;
+ }
+
+ if ($this === $obj) {
+ return true;
+ }
+
+ if (null === $this->getPrimaryKey()
+ || null === $obj->getPrimaryKey()) {
+ return false;
+ }
+
+ return $this->getPrimaryKey() === $obj->getPrimaryKey();
+ }
+
+ /**
+ * If the primary key is not null, return the hashcode of the
+ * primary key. Otherwise, return the hash code of the object.
+ *
+ * @return int Hashcode
+ */
+ public function hashCode()
+ {
+ if (null !== $this->getPrimaryKey()) {
+ return crc32(serialize($this->getPrimaryKey()));
+ }
+
+ return crc32(serialize(clone $this));
+ }
+
+ /**
+ * Get the associative array of the virtual columns in this object
+ *
+ * @return array
+ */
+ public function getVirtualColumns()
+ {
+ return $this->virtualColumns;
+ }
+
+ /**
+ * Checks the existence of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @return boolean
+ */
+ public function hasVirtualColumn($name)
+ {
+ return array_key_exists($name, $this->virtualColumns);
+ }
+
+ /**
+ * Get the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @return mixed
+ *
+ * @throws PropelException
+ */
+ public function getVirtualColumn($name)
+ {
+ if (!$this->hasVirtualColumn($name)) {
+ throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
+ }
+
+ return $this->virtualColumns[$name];
+ }
+
+ /**
+ * Set the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @param mixed $value The value to give to the virtual column
+ *
+ * @return MondialRelayDeliveryPrice The current object, for fluid interface
+ */
+ public function setVirtualColumn($name, $value)
+ {
+ $this->virtualColumns[$name] = $value;
+
+ return $this;
+ }
+
+ /**
+ * Logs a message using Propel::log().
+ *
+ * @param string $msg
+ * @param int $priority One of the Propel::LOG_* logging levels
+ * @return boolean
+ */
+ protected function log($msg, $priority = Propel::LOG_INFO)
+ {
+ return Propel::log(get_class($this) . ': ' . $msg, $priority);
+ }
+
+ /**
+ * Populate the current object from a string, using a given parser format
+ *
+ * $book = new Book();
+ * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance,
+ * or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param string $data The source data to import from
+ *
+ * @return MondialRelayDeliveryPrice The current object, for fluid interface
+ */
+ public function importFrom($parser, $data)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME);
+
+ return $this;
+ }
+
+ /**
+ * Export the current object properties to a string, using a given parser format
+ *
+ * $book = BookQuery::create()->findPk(9012);
+ * echo $book->exportTo('JSON');
+ * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
+ * @return string The exported data
+ */
+ public function exportTo($parser, $includeLazyLoadColumns = true)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
+ }
+
+ /**
+ * Clean up internal collections prior to serializing
+ * Avoids recursive loops that turn into segmentation faults when serializing
+ */
+ public function __sleep()
+ {
+ $this->clearAllReferences();
+
+ return array_keys(get_object_vars($this));
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [max_weight] column value.
+ *
+ * @return string
+ */
+ public function getMaxWeight()
+ {
+
+ return $this->max_weight;
+ }
+
+ /**
+ * Get the [price_with_tax] column value.
+ *
+ * @return string
+ */
+ public function getPriceWithTax()
+ {
+
+ return $this->price_with_tax;
+ }
+
+ /**
+ * Get the [area_id] column value.
+ *
+ * @return int
+ */
+ public function getAreaId()
+ {
+
+ return $this->area_id;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \MondialRelay\Model\MondialRelayDeliveryPrice The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[MondialRelayDeliveryPriceTableMap::ID] = true;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [max_weight] column.
+ *
+ * @param string $v new value
+ * @return \MondialRelay\Model\MondialRelayDeliveryPrice The current object (for fluent API support)
+ */
+ public function setMaxWeight($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->max_weight !== $v) {
+ $this->max_weight = $v;
+ $this->modifiedColumns[MondialRelayDeliveryPriceTableMap::MAX_WEIGHT] = true;
+ }
+
+
+ return $this;
+ } // setMaxWeight()
+
+ /**
+ * Set the value of [price_with_tax] column.
+ *
+ * @param string $v new value
+ * @return \MondialRelay\Model\MondialRelayDeliveryPrice The current object (for fluent API support)
+ */
+ public function setPriceWithTax($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->price_with_tax !== $v) {
+ $this->price_with_tax = $v;
+ $this->modifiedColumns[MondialRelayDeliveryPriceTableMap::PRICE_WITH_TAX] = true;
+ }
+
+
+ return $this;
+ } // setPriceWithTax()
+
+ /**
+ * Set the value of [area_id] column.
+ *
+ * @param int $v new value
+ * @return \MondialRelay\Model\MondialRelayDeliveryPrice The current object (for fluent API support)
+ */
+ public function setAreaId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->area_id !== $v) {
+ $this->area_id = $v;
+ $this->modifiedColumns[MondialRelayDeliveryPriceTableMap::AREA_ID] = true;
+ }
+
+ if ($this->aArea !== null && $this->aArea->getId() !== $v) {
+ $this->aArea = null;
+ }
+
+
+ return $this;
+ } // setAreaId()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->max_weight !== '0.000000') {
+ return false;
+ }
+
+ if ($this->price_with_tax !== '0.000000') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by DataFetcher->fetch().
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @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.
+ *
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
+ {
+ try {
+
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : MondialRelayDeliveryPriceTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : MondialRelayDeliveryPriceTableMap::translateFieldName('MaxWeight', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->max_weight = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : MondialRelayDeliveryPriceTableMap::translateFieldName('PriceWithTax', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->price_with_tax = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MondialRelayDeliveryPriceTableMap::translateFieldName('AreaId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->area_id = (null !== $col) ? (int) $col : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 4; // 4 = MondialRelayDeliveryPriceTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \MondialRelay\Model\MondialRelayDeliveryPrice object", 0, $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+ if ($this->aArea !== null && $this->area_id !== $this->aArea->getId()) {
+ $this->aArea = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(MondialRelayDeliveryPriceTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildMondialRelayDeliveryPriceQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
+ $row = $dataFetcher->fetch();
+ $dataFetcher->close();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aArea = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see MondialRelayDeliveryPrice::setDeleted()
+ * @see MondialRelayDeliveryPrice::isDeleted()
+ */
+ public function delete(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(MondialRelayDeliveryPriceTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildMondialRelayDeliveryPriceQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(MondialRelayDeliveryPriceTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ MondialRelayDeliveryPriceTableMap::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(ConnectionInterface $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aArea !== null) {
+ if ($this->aArea->isModified() || $this->aArea->isNew()) {
+ $affectedRows += $this->aArea->save($con);
+ }
+ $this->setArea($this->aArea);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(ConnectionInterface $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[MondialRelayDeliveryPriceTableMap::ID] = true;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . MondialRelayDeliveryPriceTableMap::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(MondialRelayDeliveryPriceTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = 'ID';
+ }
+ if ($this->isColumnModified(MondialRelayDeliveryPriceTableMap::MAX_WEIGHT)) {
+ $modifiedColumns[':p' . $index++] = 'MAX_WEIGHT';
+ }
+ if ($this->isColumnModified(MondialRelayDeliveryPriceTableMap::PRICE_WITH_TAX)) {
+ $modifiedColumns[':p' . $index++] = 'PRICE_WITH_TAX';
+ }
+ if ($this->isColumnModified(MondialRelayDeliveryPriceTableMap::AREA_ID)) {
+ $modifiedColumns[':p' . $index++] = 'AREA_ID';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO mondial_relay_delivery_price (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case 'ID':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case 'MAX_WEIGHT':
+ $stmt->bindValue($identifier, $this->max_weight, PDO::PARAM_STR);
+ break;
+ case 'PRICE_WITH_TAX':
+ $stmt->bindValue($identifier, $this->price_with_tax, PDO::PARAM_STR);
+ break;
+ case 'AREA_ID':
+ $stmt->bindValue($identifier, $this->area_id, PDO::PARAM_INT);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
+ }
+
+ try {
+ $pk = $con->lastInsertId();
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get autoincrement id.', 0, $e);
+ }
+ $this->setId($pk);
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @return Integer Number of updated rows
+ * @see doSave()
+ */
+ protected function doUpdate(ConnectionInterface $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+
+ return $selectCriteria->doUpdate($valuesCriteria, $con);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = MondialRelayDeliveryPriceTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getMaxWeight();
+ break;
+ case 2:
+ return $this->getPriceWithTax();
+ break;
+ case 3:
+ return $this->getAreaId();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['MondialRelayDeliveryPrice'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['MondialRelayDeliveryPrice'][$this->getPrimaryKey()] = true;
+ $keys = MondialRelayDeliveryPriceTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getMaxWeight(),
+ $keys[2] => $this->getPriceWithTax(),
+ $keys[3] => $this->getAreaId(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aArea) {
+ $result['Area'] = $this->aArea->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return void
+ */
+ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = MondialRelayDeliveryPriceTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setMaxWeight($value);
+ break;
+ case 2:
+ $this->setPriceWithTax($value);
+ break;
+ case 3:
+ $this->setAreaId($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * The default key type is the column's TableMap::TYPE_PHPNAME.
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
+ {
+ $keys = MondialRelayDeliveryPriceTableMap::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setMaxWeight($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setPriceWithTax($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setAreaId($arr[$keys[3]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(MondialRelayDeliveryPriceTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(MondialRelayDeliveryPriceTableMap::ID)) $criteria->add(MondialRelayDeliveryPriceTableMap::ID, $this->id);
+ if ($this->isColumnModified(MondialRelayDeliveryPriceTableMap::MAX_WEIGHT)) $criteria->add(MondialRelayDeliveryPriceTableMap::MAX_WEIGHT, $this->max_weight);
+ if ($this->isColumnModified(MondialRelayDeliveryPriceTableMap::PRICE_WITH_TAX)) $criteria->add(MondialRelayDeliveryPriceTableMap::PRICE_WITH_TAX, $this->price_with_tax);
+ if ($this->isColumnModified(MondialRelayDeliveryPriceTableMap::AREA_ID)) $criteria->add(MondialRelayDeliveryPriceTableMap::AREA_ID, $this->area_id);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(MondialRelayDeliveryPriceTableMap::DATABASE_NAME);
+ $criteria->add(MondialRelayDeliveryPriceTableMap::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return null === $this->getId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of \MondialRelay\Model\MondialRelayDeliveryPrice (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setMaxWeight($this->getMaxWeight());
+ $copyObj->setPriceWithTax($this->getPriceWithTax());
+ $copyObj->setAreaId($this->getAreaId());
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return \MondialRelay\Model\MondialRelayDeliveryPrice Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Declares an association between this object and a ChildArea object.
+ *
+ * @param ChildArea $v
+ * @return \MondialRelay\Model\MondialRelayDeliveryPrice The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setArea(ChildArea $v = null)
+ {
+ if ($v === null) {
+ $this->setAreaId(NULL);
+ } else {
+ $this->setAreaId($v->getId());
+ }
+
+ $this->aArea = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildArea object, it will not be re-added.
+ if ($v !== null) {
+ $v->addMondialRelayDeliveryPrice($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildArea object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildArea The associated ChildArea object.
+ * @throws PropelException
+ */
+ public function getArea(ConnectionInterface $con = null)
+ {
+ if ($this->aArea === null && ($this->area_id !== null)) {
+ $this->aArea = AreaQuery::create()->findPk($this->area_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aArea->addMondialRelayDeliveryPrices($this);
+ */
+ }
+
+ return $this->aArea;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->max_weight = null;
+ $this->price_with_tax = null;
+ $this->area_id = null;
+ $this->alreadyInSave = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aArea = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(MondialRelayDeliveryPriceTableMap::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * Code to be run before persisting the object
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preSave(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after persisting the object
+ * @param ConnectionInterface $con
+ */
+ public function postSave(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before inserting to database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preInsert(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after inserting to database
+ * @param ConnectionInterface $con
+ */
+ public function postInsert(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before updating the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preUpdate(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after updating the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postUpdate(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before deleting the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preDelete(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after deleting the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postDelete(ConnectionInterface $con = null)
+ {
+
+ }
+
+
+ /**
+ * Derived method to catches calls to undefined methods.
+ *
+ * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
+ * Allows to define default __call() behavior if you overwrite __call()
+ *
+ * @param string $name
+ * @param mixed $params
+ *
+ * @return array|string
+ */
+ public function __call($name, $params)
+ {
+ if (0 === strpos($name, 'get')) {
+ $virtualColumn = substr($name, 3);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+
+ $virtualColumn = lcfirst($virtualColumn);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+
+ if (0 === strpos($name, 'from')) {
+ $format = substr($name, 4);
+
+ return $this->importFrom($format, reset($params));
+ }
+
+ if (0 === strpos($name, 'to')) {
+ $format = substr($name, 2);
+ $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
+
+ return $this->exportTo($format, $includeLazyLoadColumns);
+ }
+
+ throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
+ }
+
+}
diff --git a/local/modules/MondialRelay/Model/Base/MondialRelayDeliveryPriceQuery.php b/local/modules/MondialRelay/Model/Base/MondialRelayDeliveryPriceQuery.php
new file mode 100644
index 00000000..48b6c3dc
--- /dev/null
+++ b/local/modules/MondialRelay/Model/Base/MondialRelayDeliveryPriceQuery.php
@@ -0,0 +1,564 @@
+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.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildMondialRelayDeliveryPrice|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = MondialRelayDeliveryPriceTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(MondialRelayDeliveryPriceTableMap::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 ChildMondialRelayDeliveryPrice A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT ID, MAX_WEIGHT, PRICE_WITH_TAX, AREA_ID FROM mondial_relay_delivery_price WHERE ID = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
+ $obj = new ChildMondialRelayDeliveryPrice();
+ $obj->hydrate($row);
+ MondialRelayDeliveryPriceTableMap::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 ChildMondialRelayDeliveryPrice|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
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @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 ChildMondialRelayDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::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 ChildMondialRelayDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @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 ChildMondialRelayDeliveryPriceQuery 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(MondialRelayDeliveryPriceTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the max_weight column
+ *
+ * Example usage:
+ *
+ * $query->filterByMaxWeight(1234); // WHERE max_weight = 1234
+ * $query->filterByMaxWeight(array(12, 34)); // WHERE max_weight IN (12, 34)
+ * $query->filterByMaxWeight(array('min' => 12)); // WHERE max_weight > 12
+ *
+ *
+ * @param mixed $maxWeight 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 ChildMondialRelayDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function filterByMaxWeight($maxWeight = null, $comparison = null)
+ {
+ if (is_array($maxWeight)) {
+ $useMinMax = false;
+ if (isset($maxWeight['min'])) {
+ $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::MAX_WEIGHT, $maxWeight['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($maxWeight['max'])) {
+ $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::MAX_WEIGHT, $maxWeight['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::MAX_WEIGHT, $maxWeight, $comparison);
+ }
+
+ /**
+ * Filter the query on the price_with_tax column
+ *
+ * Example usage:
+ *
+ * $query->filterByPriceWithTax(1234); // WHERE price_with_tax = 1234
+ * $query->filterByPriceWithTax(array(12, 34)); // WHERE price_with_tax IN (12, 34)
+ * $query->filterByPriceWithTax(array('min' => 12)); // WHERE price_with_tax > 12
+ *
+ *
+ * @param mixed $priceWithTax 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 ChildMondialRelayDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function filterByPriceWithTax($priceWithTax = null, $comparison = null)
+ {
+ if (is_array($priceWithTax)) {
+ $useMinMax = false;
+ if (isset($priceWithTax['min'])) {
+ $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::PRICE_WITH_TAX, $priceWithTax['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($priceWithTax['max'])) {
+ $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::PRICE_WITH_TAX, $priceWithTax['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::PRICE_WITH_TAX, $priceWithTax, $comparison);
+ }
+
+ /**
+ * Filter the query on the area_id column
+ *
+ * Example usage:
+ *
+ * $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
+ *
+ *
+ * @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 ChildMondialRelayDeliveryPriceQuery 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(MondialRelayDeliveryPriceTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($areaId['max'])) {
+ $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::AREA_ID, $areaId, $comparison);
+ }
+
+ /**
+ * 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 ChildMondialRelayDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function filterByArea($area, $comparison = null)
+ {
+ if ($area instanceof \Thelia\Model\Area) {
+ return $this
+ ->addUsingAlias(MondialRelayDeliveryPriceTableMap::AREA_ID, $area->getId(), $comparison);
+ } elseif ($area instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(MondialRelayDeliveryPriceTableMap::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 ChildMondialRelayDeliveryPriceQuery 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 ChildMondialRelayDeliveryPrice $mondialRelayDeliveryPrice Object to remove from the list of results
+ *
+ * @return ChildMondialRelayDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function prune($mondialRelayDeliveryPrice = null)
+ {
+ if ($mondialRelayDeliveryPrice) {
+ $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::ID, $mondialRelayDeliveryPrice->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the mondial_relay_delivery_price table.
+ *
+ * @param ConnectionInterface $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public function doDeleteAll(ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(MondialRelayDeliveryPriceTableMap::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).
+ MondialRelayDeliveryPriceTableMap::clearInstancePool();
+ MondialRelayDeliveryPriceTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildMondialRelayDeliveryPrice or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildMondialRelayDeliveryPrice 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(MondialRelayDeliveryPriceTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(MondialRelayDeliveryPriceTableMap::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();
+
+
+ MondialRelayDeliveryPriceTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ MondialRelayDeliveryPriceTableMap::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+} // MondialRelayDeliveryPriceQuery
diff --git a/local/modules/MondialRelay/Model/Base/MondialRelayPickupAddress.php b/local/modules/MondialRelay/Model/Base/MondialRelayPickupAddress.php
new file mode 100644
index 00000000..197cea4e
--- /dev/null
+++ b/local/modules/MondialRelay/Model/Base/MondialRelayPickupAddress.php
@@ -0,0 +1,1168 @@
+modifiedColumns;
+ }
+
+ /**
+ * Has specified column been modified?
+ *
+ * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
+ * @return boolean True if $col has been modified.
+ */
+ public function isColumnModified($col)
+ {
+ return $this->modifiedColumns && isset($this->modifiedColumns[$col]);
+ }
+
+ /**
+ * Get the columns that have been modified in this object.
+ * @return array A unique list of the modified column names for this object.
+ */
+ public function getModifiedColumns()
+ {
+ return $this->modifiedColumns ? array_keys($this->modifiedColumns) : [];
+ }
+
+ /**
+ * Returns whether the object has ever been saved. This will
+ * be false, if the object was retrieved from storage or was created
+ * and then saved.
+ *
+ * @return boolean true, if the object has never been persisted.
+ */
+ public function isNew()
+ {
+ return $this->new;
+ }
+
+ /**
+ * Setter for the isNew attribute. This method will be called
+ * by Propel-generated children and objects.
+ *
+ * @param boolean $b the state of the object.
+ */
+ public function setNew($b)
+ {
+ $this->new = (Boolean) $b;
+ }
+
+ /**
+ * Whether this object has been deleted.
+ * @return boolean The deleted state of this object.
+ */
+ public function isDeleted()
+ {
+ return $this->deleted;
+ }
+
+ /**
+ * Specify whether this object has been deleted.
+ * @param boolean $b The deleted state of this object.
+ * @return void
+ */
+ public function setDeleted($b)
+ {
+ $this->deleted = (Boolean) $b;
+ }
+
+ /**
+ * Sets the modified state for the object to be false.
+ * @param string $col If supplied, only the specified column is reset.
+ * @return void
+ */
+ public function resetModified($col = null)
+ {
+ if (null !== $col) {
+ if (isset($this->modifiedColumns[$col])) {
+ unset($this->modifiedColumns[$col]);
+ }
+ } else {
+ $this->modifiedColumns = array();
+ }
+ }
+
+ /**
+ * Compares this with another MondialRelayPickupAddress instance. If
+ * obj is an instance of MondialRelayPickupAddress, delegates to
+ * equals(MondialRelayPickupAddress). Otherwise, returns false.
+ *
+ * @param mixed $obj The object to compare to.
+ * @return boolean Whether equal to the object specified.
+ */
+ public function equals($obj)
+ {
+ $thisclazz = get_class($this);
+ if (!is_object($obj) || !($obj instanceof $thisclazz)) {
+ return false;
+ }
+
+ if ($this === $obj) {
+ return true;
+ }
+
+ if (null === $this->getPrimaryKey()
+ || null === $obj->getPrimaryKey()) {
+ return false;
+ }
+
+ return $this->getPrimaryKey() === $obj->getPrimaryKey();
+ }
+
+ /**
+ * If the primary key is not null, return the hashcode of the
+ * primary key. Otherwise, return the hash code of the object.
+ *
+ * @return int Hashcode
+ */
+ public function hashCode()
+ {
+ if (null !== $this->getPrimaryKey()) {
+ return crc32(serialize($this->getPrimaryKey()));
+ }
+
+ return crc32(serialize(clone $this));
+ }
+
+ /**
+ * Get the associative array of the virtual columns in this object
+ *
+ * @return array
+ */
+ public function getVirtualColumns()
+ {
+ return $this->virtualColumns;
+ }
+
+ /**
+ * Checks the existence of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @return boolean
+ */
+ public function hasVirtualColumn($name)
+ {
+ return array_key_exists($name, $this->virtualColumns);
+ }
+
+ /**
+ * Get the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @return mixed
+ *
+ * @throws PropelException
+ */
+ public function getVirtualColumn($name)
+ {
+ if (!$this->hasVirtualColumn($name)) {
+ throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
+ }
+
+ return $this->virtualColumns[$name];
+ }
+
+ /**
+ * Set the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @param mixed $value The value to give to the virtual column
+ *
+ * @return MondialRelayPickupAddress The current object, for fluid interface
+ */
+ public function setVirtualColumn($name, $value)
+ {
+ $this->virtualColumns[$name] = $value;
+
+ return $this;
+ }
+
+ /**
+ * Logs a message using Propel::log().
+ *
+ * @param string $msg
+ * @param int $priority One of the Propel::LOG_* logging levels
+ * @return boolean
+ */
+ protected function log($msg, $priority = Propel::LOG_INFO)
+ {
+ return Propel::log(get_class($this) . ': ' . $msg, $priority);
+ }
+
+ /**
+ * Populate the current object from a string, using a given parser format
+ *
+ * $book = new Book();
+ * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance,
+ * or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param string $data The source data to import from
+ *
+ * @return MondialRelayPickupAddress The current object, for fluid interface
+ */
+ public function importFrom($parser, $data)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME);
+
+ return $this;
+ }
+
+ /**
+ * Export the current object properties to a string, using a given parser format
+ *
+ * $book = BookQuery::create()->findPk(9012);
+ * echo $book->exportTo('JSON');
+ * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
+ * @return string The exported data
+ */
+ public function exportTo($parser, $includeLazyLoadColumns = true)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
+ }
+
+ /**
+ * Clean up internal collections prior to serializing
+ * Avoids recursive loops that turn into segmentation faults when serializing
+ */
+ public function __sleep()
+ {
+ $this->clearAllReferences();
+
+ return array_keys(get_object_vars($this));
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [json_relay_data] column value.
+ *
+ * @return string
+ */
+ public function getJsonRelayData()
+ {
+
+ return $this->json_relay_data;
+ }
+
+ /**
+ * Get the [order_address_id] column value.
+ *
+ * @return int
+ */
+ public function getOrderAddressId()
+ {
+
+ return $this->order_address_id;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \MondialRelay\Model\MondialRelayPickupAddress The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[MondialRelayPickupAddressTableMap::ID] = true;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [json_relay_data] column.
+ *
+ * @param string $v new value
+ * @return \MondialRelay\Model\MondialRelayPickupAddress The current object (for fluent API support)
+ */
+ public function setJsonRelayData($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->json_relay_data !== $v) {
+ $this->json_relay_data = $v;
+ $this->modifiedColumns[MondialRelayPickupAddressTableMap::JSON_RELAY_DATA] = true;
+ }
+
+
+ return $this;
+ } // setJsonRelayData()
+
+ /**
+ * Set the value of [order_address_id] column.
+ *
+ * @param int $v new value
+ * @return \MondialRelay\Model\MondialRelayPickupAddress The current object (for fluent API support)
+ */
+ public function setOrderAddressId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->order_address_id !== $v) {
+ $this->order_address_id = $v;
+ $this->modifiedColumns[MondialRelayPickupAddressTableMap::ORDER_ADDRESS_ID] = true;
+ }
+
+
+ return $this;
+ } // setOrderAddressId()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by DataFetcher->fetch().
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @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.
+ *
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
+ {
+ try {
+
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : MondialRelayPickupAddressTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : MondialRelayPickupAddressTableMap::translateFieldName('JsonRelayData', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->json_relay_data = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : MondialRelayPickupAddressTableMap::translateFieldName('OrderAddressId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->order_address_id = (null !== $col) ? (int) $col : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 3; // 3 = MondialRelayPickupAddressTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \MondialRelay\Model\MondialRelayPickupAddress object", 0, $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(MondialRelayPickupAddressTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildMondialRelayPickupAddressQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
+ $row = $dataFetcher->fetch();
+ $dataFetcher->close();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see MondialRelayPickupAddress::setDeleted()
+ * @see MondialRelayPickupAddress::isDeleted()
+ */
+ public function delete(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(MondialRelayPickupAddressTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildMondialRelayPickupAddressQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(MondialRelayPickupAddressTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ MondialRelayPickupAddressTableMap::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(ConnectionInterface $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(ConnectionInterface $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[MondialRelayPickupAddressTableMap::ID] = true;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . MondialRelayPickupAddressTableMap::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(MondialRelayPickupAddressTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = 'ID';
+ }
+ if ($this->isColumnModified(MondialRelayPickupAddressTableMap::JSON_RELAY_DATA)) {
+ $modifiedColumns[':p' . $index++] = 'JSON_RELAY_DATA';
+ }
+ if ($this->isColumnModified(MondialRelayPickupAddressTableMap::ORDER_ADDRESS_ID)) {
+ $modifiedColumns[':p' . $index++] = 'ORDER_ADDRESS_ID';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO mondial_relay_pickup_address (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case 'ID':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case 'JSON_RELAY_DATA':
+ $stmt->bindValue($identifier, $this->json_relay_data, PDO::PARAM_STR);
+ break;
+ case 'ORDER_ADDRESS_ID':
+ $stmt->bindValue($identifier, $this->order_address_id, PDO::PARAM_INT);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
+ }
+
+ try {
+ $pk = $con->lastInsertId();
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get autoincrement id.', 0, $e);
+ }
+ $this->setId($pk);
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @return Integer Number of updated rows
+ * @see doSave()
+ */
+ protected function doUpdate(ConnectionInterface $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+
+ return $selectCriteria->doUpdate($valuesCriteria, $con);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = MondialRelayPickupAddressTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getJsonRelayData();
+ break;
+ case 2:
+ return $this->getOrderAddressId();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
+ {
+ if (isset($alreadyDumpedObjects['MondialRelayPickupAddress'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['MondialRelayPickupAddress'][$this->getPrimaryKey()] = true;
+ $keys = MondialRelayPickupAddressTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getJsonRelayData(),
+ $keys[2] => $this->getOrderAddressId(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return void
+ */
+ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = MondialRelayPickupAddressTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setJsonRelayData($value);
+ break;
+ case 2:
+ $this->setOrderAddressId($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * The default key type is the column's TableMap::TYPE_PHPNAME.
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
+ {
+ $keys = MondialRelayPickupAddressTableMap::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setJsonRelayData($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setOrderAddressId($arr[$keys[2]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(MondialRelayPickupAddressTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(MondialRelayPickupAddressTableMap::ID)) $criteria->add(MondialRelayPickupAddressTableMap::ID, $this->id);
+ if ($this->isColumnModified(MondialRelayPickupAddressTableMap::JSON_RELAY_DATA)) $criteria->add(MondialRelayPickupAddressTableMap::JSON_RELAY_DATA, $this->json_relay_data);
+ if ($this->isColumnModified(MondialRelayPickupAddressTableMap::ORDER_ADDRESS_ID)) $criteria->add(MondialRelayPickupAddressTableMap::ORDER_ADDRESS_ID, $this->order_address_id);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(MondialRelayPickupAddressTableMap::DATABASE_NAME);
+ $criteria->add(MondialRelayPickupAddressTableMap::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return null === $this->getId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of \MondialRelay\Model\MondialRelayPickupAddress (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setJsonRelayData($this->getJsonRelayData());
+ $copyObj->setOrderAddressId($this->getOrderAddressId());
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return \MondialRelay\Model\MondialRelayPickupAddress Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->json_relay_data = null;
+ $this->order_address_id = null;
+ $this->alreadyInSave = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(MondialRelayPickupAddressTableMap::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * Code to be run before persisting the object
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preSave(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after persisting the object
+ * @param ConnectionInterface $con
+ */
+ public function postSave(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before inserting to database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preInsert(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after inserting to database
+ * @param ConnectionInterface $con
+ */
+ public function postInsert(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before updating the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preUpdate(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after updating the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postUpdate(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before deleting the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preDelete(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after deleting the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postDelete(ConnectionInterface $con = null)
+ {
+
+ }
+
+
+ /**
+ * Derived method to catches calls to undefined methods.
+ *
+ * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
+ * Allows to define default __call() behavior if you overwrite __call()
+ *
+ * @param string $name
+ * @param mixed $params
+ *
+ * @return array|string
+ */
+ public function __call($name, $params)
+ {
+ if (0 === strpos($name, 'get')) {
+ $virtualColumn = substr($name, 3);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+
+ $virtualColumn = lcfirst($virtualColumn);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+
+ if (0 === strpos($name, 'from')) {
+ $format = substr($name, 4);
+
+ return $this->importFrom($format, reset($params));
+ }
+
+ if (0 === strpos($name, 'to')) {
+ $format = substr($name, 2);
+ $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
+
+ return $this->exportTo($format, $includeLazyLoadColumns);
+ }
+
+ throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
+ }
+
+}
diff --git a/local/modules/MondialRelay/Model/Base/MondialRelayPickupAddressQuery.php b/local/modules/MondialRelay/Model/Base/MondialRelayPickupAddressQuery.php
new file mode 100644
index 00000000..7bbaff95
--- /dev/null
+++ b/local/modules/MondialRelay/Model/Base/MondialRelayPickupAddressQuery.php
@@ -0,0 +1,422 @@
+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.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildMondialRelayPickupAddress|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = MondialRelayPickupAddressTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(MondialRelayPickupAddressTableMap::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 ChildMondialRelayPickupAddress A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT ID, JSON_RELAY_DATA, ORDER_ADDRESS_ID FROM mondial_relay_pickup_address 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 ChildMondialRelayPickupAddress();
+ $obj->hydrate($row);
+ MondialRelayPickupAddressTableMap::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 ChildMondialRelayPickupAddress|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
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @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 ChildMondialRelayPickupAddressQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(MondialRelayPickupAddressTableMap::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 ChildMondialRelayPickupAddressQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(MondialRelayPickupAddressTableMap::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @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 ChildMondialRelayPickupAddressQuery 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(MondialRelayPickupAddressTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(MondialRelayPickupAddressTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(MondialRelayPickupAddressTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the json_relay_data column
+ *
+ * Example usage:
+ *
+ * $query->filterByJsonRelayData('fooValue'); // WHERE json_relay_data = 'fooValue'
+ * $query->filterByJsonRelayData('%fooValue%'); // WHERE json_relay_data LIKE '%fooValue%'
+ *
+ *
+ * @param string $jsonRelayData The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildMondialRelayPickupAddressQuery The current query, for fluid interface
+ */
+ public function filterByJsonRelayData($jsonRelayData = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($jsonRelayData)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $jsonRelayData)) {
+ $jsonRelayData = str_replace('*', '%', $jsonRelayData);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(MondialRelayPickupAddressTableMap::JSON_RELAY_DATA, $jsonRelayData, $comparison);
+ }
+
+ /**
+ * Filter the query on the order_address_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByOrderAddressId(1234); // WHERE order_address_id = 1234
+ * $query->filterByOrderAddressId(array(12, 34)); // WHERE order_address_id IN (12, 34)
+ * $query->filterByOrderAddressId(array('min' => 12)); // WHERE order_address_id > 12
+ *
+ *
+ * @param mixed $orderAddressId 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 ChildMondialRelayPickupAddressQuery The current query, for fluid interface
+ */
+ public function filterByOrderAddressId($orderAddressId = null, $comparison = null)
+ {
+ if (is_array($orderAddressId)) {
+ $useMinMax = false;
+ if (isset($orderAddressId['min'])) {
+ $this->addUsingAlias(MondialRelayPickupAddressTableMap::ORDER_ADDRESS_ID, $orderAddressId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($orderAddressId['max'])) {
+ $this->addUsingAlias(MondialRelayPickupAddressTableMap::ORDER_ADDRESS_ID, $orderAddressId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(MondialRelayPickupAddressTableMap::ORDER_ADDRESS_ID, $orderAddressId, $comparison);
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildMondialRelayPickupAddress $mondialRelayPickupAddress Object to remove from the list of results
+ *
+ * @return ChildMondialRelayPickupAddressQuery The current query, for fluid interface
+ */
+ public function prune($mondialRelayPickupAddress = null)
+ {
+ if ($mondialRelayPickupAddress) {
+ $this->addUsingAlias(MondialRelayPickupAddressTableMap::ID, $mondialRelayPickupAddress->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the mondial_relay_pickup_address 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(MondialRelayPickupAddressTableMap::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).
+ MondialRelayPickupAddressTableMap::clearInstancePool();
+ MondialRelayPickupAddressTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildMondialRelayPickupAddress or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildMondialRelayPickupAddress 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(MondialRelayPickupAddressTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(MondialRelayPickupAddressTableMap::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();
+
+
+ MondialRelayPickupAddressTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ MondialRelayPickupAddressTableMap::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+} // MondialRelayPickupAddressQuery
diff --git a/local/modules/MondialRelay/Model/Base/MondialRelayZoneConfiguration.php b/local/modules/MondialRelay/Model/Base/MondialRelayZoneConfiguration.php
new file mode 100644
index 00000000..b0e14075
--- /dev/null
+++ b/local/modules/MondialRelay/Model/Base/MondialRelayZoneConfiguration.php
@@ -0,0 +1,1311 @@
+modifiedColumns;
+ }
+
+ /**
+ * Has specified column been modified?
+ *
+ * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
+ * @return boolean True if $col has been modified.
+ */
+ public function isColumnModified($col)
+ {
+ return $this->modifiedColumns && isset($this->modifiedColumns[$col]);
+ }
+
+ /**
+ * Get the columns that have been modified in this object.
+ * @return array A unique list of the modified column names for this object.
+ */
+ public function getModifiedColumns()
+ {
+ return $this->modifiedColumns ? array_keys($this->modifiedColumns) : [];
+ }
+
+ /**
+ * Returns whether the object has ever been saved. This will
+ * be false, if the object was retrieved from storage or was created
+ * and then saved.
+ *
+ * @return boolean true, if the object has never been persisted.
+ */
+ public function isNew()
+ {
+ return $this->new;
+ }
+
+ /**
+ * Setter for the isNew attribute. This method will be called
+ * by Propel-generated children and objects.
+ *
+ * @param boolean $b the state of the object.
+ */
+ public function setNew($b)
+ {
+ $this->new = (Boolean) $b;
+ }
+
+ /**
+ * Whether this object has been deleted.
+ * @return boolean The deleted state of this object.
+ */
+ public function isDeleted()
+ {
+ return $this->deleted;
+ }
+
+ /**
+ * Specify whether this object has been deleted.
+ * @param boolean $b The deleted state of this object.
+ * @return void
+ */
+ public function setDeleted($b)
+ {
+ $this->deleted = (Boolean) $b;
+ }
+
+ /**
+ * Sets the modified state for the object to be false.
+ * @param string $col If supplied, only the specified column is reset.
+ * @return void
+ */
+ public function resetModified($col = null)
+ {
+ if (null !== $col) {
+ if (isset($this->modifiedColumns[$col])) {
+ unset($this->modifiedColumns[$col]);
+ }
+ } else {
+ $this->modifiedColumns = array();
+ }
+ }
+
+ /**
+ * Compares this with another MondialRelayZoneConfiguration instance. If
+ * obj is an instance of MondialRelayZoneConfiguration, delegates to
+ * equals(MondialRelayZoneConfiguration). Otherwise, returns false.
+ *
+ * @param mixed $obj The object to compare to.
+ * @return boolean Whether equal to the object specified.
+ */
+ public function equals($obj)
+ {
+ $thisclazz = get_class($this);
+ if (!is_object($obj) || !($obj instanceof $thisclazz)) {
+ return false;
+ }
+
+ if ($this === $obj) {
+ return true;
+ }
+
+ if (null === $this->getPrimaryKey()
+ || null === $obj->getPrimaryKey()) {
+ return false;
+ }
+
+ return $this->getPrimaryKey() === $obj->getPrimaryKey();
+ }
+
+ /**
+ * If the primary key is not null, return the hashcode of the
+ * primary key. Otherwise, return the hash code of the object.
+ *
+ * @return int Hashcode
+ */
+ public function hashCode()
+ {
+ if (null !== $this->getPrimaryKey()) {
+ return crc32(serialize($this->getPrimaryKey()));
+ }
+
+ return crc32(serialize(clone $this));
+ }
+
+ /**
+ * Get the associative array of the virtual columns in this object
+ *
+ * @return array
+ */
+ public function getVirtualColumns()
+ {
+ return $this->virtualColumns;
+ }
+
+ /**
+ * Checks the existence of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @return boolean
+ */
+ public function hasVirtualColumn($name)
+ {
+ return array_key_exists($name, $this->virtualColumns);
+ }
+
+ /**
+ * Get the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @return mixed
+ *
+ * @throws PropelException
+ */
+ public function getVirtualColumn($name)
+ {
+ if (!$this->hasVirtualColumn($name)) {
+ throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
+ }
+
+ return $this->virtualColumns[$name];
+ }
+
+ /**
+ * Set the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @param mixed $value The value to give to the virtual column
+ *
+ * @return MondialRelayZoneConfiguration The current object, for fluid interface
+ */
+ public function setVirtualColumn($name, $value)
+ {
+ $this->virtualColumns[$name] = $value;
+
+ return $this;
+ }
+
+ /**
+ * Logs a message using Propel::log().
+ *
+ * @param string $msg
+ * @param int $priority One of the Propel::LOG_* logging levels
+ * @return boolean
+ */
+ protected function log($msg, $priority = Propel::LOG_INFO)
+ {
+ return Propel::log(get_class($this) . ': ' . $msg, $priority);
+ }
+
+ /**
+ * Populate the current object from a string, using a given parser format
+ *
+ * $book = new Book();
+ * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance,
+ * or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param string $data The source data to import from
+ *
+ * @return MondialRelayZoneConfiguration The current object, for fluid interface
+ */
+ public function importFrom($parser, $data)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME);
+
+ return $this;
+ }
+
+ /**
+ * Export the current object properties to a string, using a given parser format
+ *
+ * $book = BookQuery::create()->findPk(9012);
+ * echo $book->exportTo('JSON');
+ * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
+ * @return string The exported data
+ */
+ public function exportTo($parser, $includeLazyLoadColumns = true)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
+ }
+
+ /**
+ * Clean up internal collections prior to serializing
+ * Avoids recursive loops that turn into segmentation faults when serializing
+ */
+ public function __sleep()
+ {
+ $this->clearAllReferences();
+
+ return array_keys(get_object_vars($this));
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [delivery_time] column value.
+ *
+ * @return int
+ */
+ public function getDeliveryTime()
+ {
+
+ return $this->delivery_time;
+ }
+
+ /**
+ * Get the [delivery_type] column value.
+ *
+ * @return int
+ */
+ public function getDeliveryType()
+ {
+
+ return $this->delivery_type;
+ }
+
+ /**
+ * Get the [area_id] column value.
+ *
+ * @return int
+ */
+ public function getAreaId()
+ {
+
+ return $this->area_id;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \MondialRelay\Model\MondialRelayZoneConfiguration The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[MondialRelayZoneConfigurationTableMap::ID] = true;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [delivery_time] column.
+ *
+ * @param int $v new value
+ * @return \MondialRelay\Model\MondialRelayZoneConfiguration The current object (for fluent API support)
+ */
+ public function setDeliveryTime($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->delivery_time !== $v) {
+ $this->delivery_time = $v;
+ $this->modifiedColumns[MondialRelayZoneConfigurationTableMap::DELIVERY_TIME] = true;
+ }
+
+
+ return $this;
+ } // setDeliveryTime()
+
+ /**
+ * Set the value of [delivery_type] column.
+ *
+ * @param int $v new value
+ * @return \MondialRelay\Model\MondialRelayZoneConfiguration The current object (for fluent API support)
+ */
+ public function setDeliveryType($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->delivery_type !== $v) {
+ $this->delivery_type = $v;
+ $this->modifiedColumns[MondialRelayZoneConfigurationTableMap::DELIVERY_TYPE] = true;
+ }
+
+
+ return $this;
+ } // setDeliveryType()
+
+ /**
+ * Set the value of [area_id] column.
+ *
+ * @param int $v new value
+ * @return \MondialRelay\Model\MondialRelayZoneConfiguration The current object (for fluent API support)
+ */
+ public function setAreaId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->area_id !== $v) {
+ $this->area_id = $v;
+ $this->modifiedColumns[MondialRelayZoneConfigurationTableMap::AREA_ID] = true;
+ }
+
+ if ($this->aArea !== null && $this->aArea->getId() !== $v) {
+ $this->aArea = null;
+ }
+
+
+ return $this;
+ } // setAreaId()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by DataFetcher->fetch().
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @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.
+ *
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
+ {
+ try {
+
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : MondialRelayZoneConfigurationTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : MondialRelayZoneConfigurationTableMap::translateFieldName('DeliveryTime', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->delivery_time = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : MondialRelayZoneConfigurationTableMap::translateFieldName('DeliveryType', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->delivery_type = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MondialRelayZoneConfigurationTableMap::translateFieldName('AreaId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->area_id = (null !== $col) ? (int) $col : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 4; // 4 = MondialRelayZoneConfigurationTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \MondialRelay\Model\MondialRelayZoneConfiguration object", 0, $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+ if ($this->aArea !== null && $this->area_id !== $this->aArea->getId()) {
+ $this->aArea = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(MondialRelayZoneConfigurationTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildMondialRelayZoneConfigurationQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
+ $row = $dataFetcher->fetch();
+ $dataFetcher->close();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aArea = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see MondialRelayZoneConfiguration::setDeleted()
+ * @see MondialRelayZoneConfiguration::isDeleted()
+ */
+ public function delete(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(MondialRelayZoneConfigurationTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildMondialRelayZoneConfigurationQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(MondialRelayZoneConfigurationTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ MondialRelayZoneConfigurationTableMap::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(ConnectionInterface $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aArea !== null) {
+ if ($this->aArea->isModified() || $this->aArea->isNew()) {
+ $affectedRows += $this->aArea->save($con);
+ }
+ $this->setArea($this->aArea);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(ConnectionInterface $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[MondialRelayZoneConfigurationTableMap::ID] = true;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . MondialRelayZoneConfigurationTableMap::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(MondialRelayZoneConfigurationTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = 'ID';
+ }
+ if ($this->isColumnModified(MondialRelayZoneConfigurationTableMap::DELIVERY_TIME)) {
+ $modifiedColumns[':p' . $index++] = 'DELIVERY_TIME';
+ }
+ if ($this->isColumnModified(MondialRelayZoneConfigurationTableMap::DELIVERY_TYPE)) {
+ $modifiedColumns[':p' . $index++] = 'DELIVERY_TYPE';
+ }
+ if ($this->isColumnModified(MondialRelayZoneConfigurationTableMap::AREA_ID)) {
+ $modifiedColumns[':p' . $index++] = 'AREA_ID';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO mondial_relay_zone_configuration (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case 'ID':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case 'DELIVERY_TIME':
+ $stmt->bindValue($identifier, $this->delivery_time, PDO::PARAM_INT);
+ break;
+ case 'DELIVERY_TYPE':
+ $stmt->bindValue($identifier, $this->delivery_type, PDO::PARAM_INT);
+ break;
+ case 'AREA_ID':
+ $stmt->bindValue($identifier, $this->area_id, PDO::PARAM_INT);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
+ }
+
+ try {
+ $pk = $con->lastInsertId();
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get autoincrement id.', 0, $e);
+ }
+ $this->setId($pk);
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @return Integer Number of updated rows
+ * @see doSave()
+ */
+ protected function doUpdate(ConnectionInterface $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+
+ return $selectCriteria->doUpdate($valuesCriteria, $con);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = MondialRelayZoneConfigurationTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getDeliveryTime();
+ break;
+ case 2:
+ return $this->getDeliveryType();
+ break;
+ case 3:
+ return $this->getAreaId();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['MondialRelayZoneConfiguration'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['MondialRelayZoneConfiguration'][$this->getPrimaryKey()] = true;
+ $keys = MondialRelayZoneConfigurationTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getDeliveryTime(),
+ $keys[2] => $this->getDeliveryType(),
+ $keys[3] => $this->getAreaId(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aArea) {
+ $result['Area'] = $this->aArea->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return void
+ */
+ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = MondialRelayZoneConfigurationTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setDeliveryTime($value);
+ break;
+ case 2:
+ $this->setDeliveryType($value);
+ break;
+ case 3:
+ $this->setAreaId($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * The default key type is the column's TableMap::TYPE_PHPNAME.
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
+ {
+ $keys = MondialRelayZoneConfigurationTableMap::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDeliveryTime($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDeliveryType($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setAreaId($arr[$keys[3]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(MondialRelayZoneConfigurationTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(MondialRelayZoneConfigurationTableMap::ID)) $criteria->add(MondialRelayZoneConfigurationTableMap::ID, $this->id);
+ if ($this->isColumnModified(MondialRelayZoneConfigurationTableMap::DELIVERY_TIME)) $criteria->add(MondialRelayZoneConfigurationTableMap::DELIVERY_TIME, $this->delivery_time);
+ if ($this->isColumnModified(MondialRelayZoneConfigurationTableMap::DELIVERY_TYPE)) $criteria->add(MondialRelayZoneConfigurationTableMap::DELIVERY_TYPE, $this->delivery_type);
+ if ($this->isColumnModified(MondialRelayZoneConfigurationTableMap::AREA_ID)) $criteria->add(MondialRelayZoneConfigurationTableMap::AREA_ID, $this->area_id);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(MondialRelayZoneConfigurationTableMap::DATABASE_NAME);
+ $criteria->add(MondialRelayZoneConfigurationTableMap::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return null === $this->getId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of \MondialRelay\Model\MondialRelayZoneConfiguration (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDeliveryTime($this->getDeliveryTime());
+ $copyObj->setDeliveryType($this->getDeliveryType());
+ $copyObj->setAreaId($this->getAreaId());
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return \MondialRelay\Model\MondialRelayZoneConfiguration Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Declares an association between this object and a ChildArea object.
+ *
+ * @param ChildArea $v
+ * @return \MondialRelay\Model\MondialRelayZoneConfiguration The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setArea(ChildArea $v = null)
+ {
+ if ($v === null) {
+ $this->setAreaId(NULL);
+ } else {
+ $this->setAreaId($v->getId());
+ }
+
+ $this->aArea = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildArea object, it will not be re-added.
+ if ($v !== null) {
+ $v->addMondialRelayZoneConfiguration($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildArea object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildArea The associated ChildArea object.
+ * @throws PropelException
+ */
+ public function getArea(ConnectionInterface $con = null)
+ {
+ if ($this->aArea === null && ($this->area_id !== null)) {
+ $this->aArea = AreaQuery::create()->findPk($this->area_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aArea->addMondialRelayZoneConfigurations($this);
+ */
+ }
+
+ return $this->aArea;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->delivery_time = null;
+ $this->delivery_type = null;
+ $this->area_id = null;
+ $this->alreadyInSave = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aArea = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(MondialRelayZoneConfigurationTableMap::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * Code to be run before persisting the object
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preSave(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after persisting the object
+ * @param ConnectionInterface $con
+ */
+ public function postSave(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before inserting to database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preInsert(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after inserting to database
+ * @param ConnectionInterface $con
+ */
+ public function postInsert(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before updating the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preUpdate(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after updating the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postUpdate(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before deleting the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preDelete(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after deleting the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postDelete(ConnectionInterface $con = null)
+ {
+
+ }
+
+
+ /**
+ * Derived method to catches calls to undefined methods.
+ *
+ * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
+ * Allows to define default __call() behavior if you overwrite __call()
+ *
+ * @param string $name
+ * @param mixed $params
+ *
+ * @return array|string
+ */
+ public function __call($name, $params)
+ {
+ if (0 === strpos($name, 'get')) {
+ $virtualColumn = substr($name, 3);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+
+ $virtualColumn = lcfirst($virtualColumn);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+
+ if (0 === strpos($name, 'from')) {
+ $format = substr($name, 4);
+
+ return $this->importFrom($format, reset($params));
+ }
+
+ if (0 === strpos($name, 'to')) {
+ $format = substr($name, 2);
+ $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
+
+ return $this->exportTo($format, $includeLazyLoadColumns);
+ }
+
+ throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
+ }
+
+}
diff --git a/local/modules/MondialRelay/Model/Base/MondialRelayZoneConfigurationQuery.php b/local/modules/MondialRelay/Model/Base/MondialRelayZoneConfigurationQuery.php
new file mode 100644
index 00000000..982569d6
--- /dev/null
+++ b/local/modules/MondialRelay/Model/Base/MondialRelayZoneConfigurationQuery.php
@@ -0,0 +1,564 @@
+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.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildMondialRelayZoneConfiguration|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = MondialRelayZoneConfigurationTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(MondialRelayZoneConfigurationTableMap::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 ChildMondialRelayZoneConfiguration A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT ID, DELIVERY_TIME, DELIVERY_TYPE, AREA_ID FROM mondial_relay_zone_configuration 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 ChildMondialRelayZoneConfiguration();
+ $obj->hydrate($row);
+ MondialRelayZoneConfigurationTableMap::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 ChildMondialRelayZoneConfiguration|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
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @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 ChildMondialRelayZoneConfigurationQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::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 ChildMondialRelayZoneConfigurationQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @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 ChildMondialRelayZoneConfigurationQuery 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(MondialRelayZoneConfigurationTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the delivery_time column
+ *
+ * Example usage:
+ *
+ * $query->filterByDeliveryTime(1234); // WHERE delivery_time = 1234
+ * $query->filterByDeliveryTime(array(12, 34)); // WHERE delivery_time IN (12, 34)
+ * $query->filterByDeliveryTime(array('min' => 12)); // WHERE delivery_time > 12
+ *
+ *
+ * @param mixed $deliveryTime 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 ChildMondialRelayZoneConfigurationQuery The current query, for fluid interface
+ */
+ public function filterByDeliveryTime($deliveryTime = null, $comparison = null)
+ {
+ if (is_array($deliveryTime)) {
+ $useMinMax = false;
+ if (isset($deliveryTime['min'])) {
+ $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::DELIVERY_TIME, $deliveryTime['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($deliveryTime['max'])) {
+ $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::DELIVERY_TIME, $deliveryTime['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::DELIVERY_TIME, $deliveryTime, $comparison);
+ }
+
+ /**
+ * Filter the query on the delivery_type column
+ *
+ * Example usage:
+ *
+ * $query->filterByDeliveryType(1234); // WHERE delivery_type = 1234
+ * $query->filterByDeliveryType(array(12, 34)); // WHERE delivery_type IN (12, 34)
+ * $query->filterByDeliveryType(array('min' => 12)); // WHERE delivery_type > 12
+ *
+ *
+ * @param mixed $deliveryType 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 ChildMondialRelayZoneConfigurationQuery The current query, for fluid interface
+ */
+ public function filterByDeliveryType($deliveryType = null, $comparison = null)
+ {
+ if (is_array($deliveryType)) {
+ $useMinMax = false;
+ if (isset($deliveryType['min'])) {
+ $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::DELIVERY_TYPE, $deliveryType['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($deliveryType['max'])) {
+ $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::DELIVERY_TYPE, $deliveryType['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::DELIVERY_TYPE, $deliveryType, $comparison);
+ }
+
+ /**
+ * Filter the query on the area_id column
+ *
+ * Example usage:
+ *
+ * $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
+ *
+ *
+ * @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 ChildMondialRelayZoneConfigurationQuery 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(MondialRelayZoneConfigurationTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($areaId['max'])) {
+ $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::AREA_ID, $areaId, $comparison);
+ }
+
+ /**
+ * 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 ChildMondialRelayZoneConfigurationQuery The current query, for fluid interface
+ */
+ public function filterByArea($area, $comparison = null)
+ {
+ if ($area instanceof \Thelia\Model\Area) {
+ return $this
+ ->addUsingAlias(MondialRelayZoneConfigurationTableMap::AREA_ID, $area->getId(), $comparison);
+ } elseif ($area instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(MondialRelayZoneConfigurationTableMap::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 ChildMondialRelayZoneConfigurationQuery 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 ChildMondialRelayZoneConfiguration $mondialRelayZoneConfiguration Object to remove from the list of results
+ *
+ * @return ChildMondialRelayZoneConfigurationQuery The current query, for fluid interface
+ */
+ public function prune($mondialRelayZoneConfiguration = null)
+ {
+ if ($mondialRelayZoneConfiguration) {
+ $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::ID, $mondialRelayZoneConfiguration->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the mondial_relay_zone_configuration 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(MondialRelayZoneConfigurationTableMap::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).
+ MondialRelayZoneConfigurationTableMap::clearInstancePool();
+ MondialRelayZoneConfigurationTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildMondialRelayZoneConfiguration or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildMondialRelayZoneConfiguration 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(MondialRelayZoneConfigurationTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(MondialRelayZoneConfigurationTableMap::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();
+
+
+ MondialRelayZoneConfigurationTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ MondialRelayZoneConfigurationTableMap::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+} // MondialRelayZoneConfigurationQuery
diff --git a/local/modules/MondialRelay/Model/Map/MondialRelayDeliveryInsuranceTableMap.php b/local/modules/MondialRelay/Model/Map/MondialRelayDeliveryInsuranceTableMap.php
new file mode 100644
index 00000000..8271f1c8
--- /dev/null
+++ b/local/modules/MondialRelay/Model/Map/MondialRelayDeliveryInsuranceTableMap.php
@@ -0,0 +1,426 @@
+ array('Id', 'Level', 'MaxValue', 'PriceWithTax', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'level', 'maxValue', 'priceWithTax', ),
+ self::TYPE_COLNAME => array(MondialRelayDeliveryInsuranceTableMap::ID, MondialRelayDeliveryInsuranceTableMap::LEVEL, MondialRelayDeliveryInsuranceTableMap::MAX_VALUE, MondialRelayDeliveryInsuranceTableMap::PRICE_WITH_TAX, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'LEVEL', 'MAX_VALUE', 'PRICE_WITH_TAX', ),
+ self::TYPE_FIELDNAME => array('id', 'level', 'max_value', 'price_with_tax', ),
+ 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, 'Level' => 1, 'MaxValue' => 2, 'PriceWithTax' => 3, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'level' => 1, 'maxValue' => 2, 'priceWithTax' => 3, ),
+ self::TYPE_COLNAME => array(MondialRelayDeliveryInsuranceTableMap::ID => 0, MondialRelayDeliveryInsuranceTableMap::LEVEL => 1, MondialRelayDeliveryInsuranceTableMap::MAX_VALUE => 2, MondialRelayDeliveryInsuranceTableMap::PRICE_WITH_TAX => 3, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'LEVEL' => 1, 'MAX_VALUE' => 2, 'PRICE_WITH_TAX' => 3, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'level' => 1, 'max_value' => 2, 'price_with_tax' => 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('mondial_relay_delivery_insurance');
+ $this->setPhpName('MondialRelayDeliveryInsurance');
+ $this->setClassName('\\MondialRelay\\Model\\MondialRelayDeliveryInsurance');
+ $this->setPackage('MondialRelay.Model');
+ $this->setUseIdGenerator(true);
+ // columns
+ $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
+ $this->addColumn('LEVEL', 'Level', 'INTEGER', true, null, null);
+ $this->addColumn('MAX_VALUE', 'MaxValue', 'DECIMAL', true, 16, 0);
+ $this->addColumn('PRICE_WITH_TAX', 'PriceWithTax', 'DECIMAL', true, 16, 0);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ } // 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 ? MondialRelayDeliveryInsuranceTableMap::CLASS_DEFAULT : MondialRelayDeliveryInsuranceTableMap::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 (MondialRelayDeliveryInsurance object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = MondialRelayDeliveryInsuranceTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = MondialRelayDeliveryInsuranceTableMap::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 + MondialRelayDeliveryInsuranceTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = MondialRelayDeliveryInsuranceTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ MondialRelayDeliveryInsuranceTableMap::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 = MondialRelayDeliveryInsuranceTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = MondialRelayDeliveryInsuranceTableMap::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;
+ MondialRelayDeliveryInsuranceTableMap::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(MondialRelayDeliveryInsuranceTableMap::ID);
+ $criteria->addSelectColumn(MondialRelayDeliveryInsuranceTableMap::LEVEL);
+ $criteria->addSelectColumn(MondialRelayDeliveryInsuranceTableMap::MAX_VALUE);
+ $criteria->addSelectColumn(MondialRelayDeliveryInsuranceTableMap::PRICE_WITH_TAX);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LEVEL');
+ $criteria->addSelectColumn($alias . '.MAX_VALUE');
+ $criteria->addSelectColumn($alias . '.PRICE_WITH_TAX');
+ }
+ }
+
+ /**
+ * 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(MondialRelayDeliveryInsuranceTableMap::DATABASE_NAME)->getTable(MondialRelayDeliveryInsuranceTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(MondialRelayDeliveryInsuranceTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(MondialRelayDeliveryInsuranceTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new MondialRelayDeliveryInsuranceTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a MondialRelayDeliveryInsurance or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or MondialRelayDeliveryInsurance 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(MondialRelayDeliveryInsuranceTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \MondialRelay\Model\MondialRelayDeliveryInsurance) { // 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(MondialRelayDeliveryInsuranceTableMap::DATABASE_NAME);
+ $criteria->add(MondialRelayDeliveryInsuranceTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = MondialRelayDeliveryInsuranceQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { MondialRelayDeliveryInsuranceTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { MondialRelayDeliveryInsuranceTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the mondial_relay_delivery_insurance 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 MondialRelayDeliveryInsuranceQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a MondialRelayDeliveryInsurance or Criteria object.
+ *
+ * @param mixed $criteria Criteria or MondialRelayDeliveryInsurance 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(MondialRelayDeliveryInsuranceTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from MondialRelayDeliveryInsurance object
+ }
+
+ if ($criteria->containsKey(MondialRelayDeliveryInsuranceTableMap::ID) && $criteria->keyContainsValue(MondialRelayDeliveryInsuranceTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.MondialRelayDeliveryInsuranceTableMap::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $query = MondialRelayDeliveryInsuranceQuery::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;
+ }
+
+} // MondialRelayDeliveryInsuranceTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+MondialRelayDeliveryInsuranceTableMap::buildTableMap();
diff --git a/local/modules/MondialRelay/Model/Map/MondialRelayDeliveryPriceTableMap.php b/local/modules/MondialRelay/Model/Map/MondialRelayDeliveryPriceTableMap.php
new file mode 100644
index 00000000..d2b4cb26
--- /dev/null
+++ b/local/modules/MondialRelay/Model/Map/MondialRelayDeliveryPriceTableMap.php
@@ -0,0 +1,427 @@
+ array('Id', 'MaxWeight', 'PriceWithTax', 'AreaId', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'maxWeight', 'priceWithTax', 'areaId', ),
+ self::TYPE_COLNAME => array(MondialRelayDeliveryPriceTableMap::ID, MondialRelayDeliveryPriceTableMap::MAX_WEIGHT, MondialRelayDeliveryPriceTableMap::PRICE_WITH_TAX, MondialRelayDeliveryPriceTableMap::AREA_ID, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'MAX_WEIGHT', 'PRICE_WITH_TAX', 'AREA_ID', ),
+ self::TYPE_FIELDNAME => array('id', 'max_weight', 'price_with_tax', 'area_id', ),
+ 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, 'MaxWeight' => 1, 'PriceWithTax' => 2, 'AreaId' => 3, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'maxWeight' => 1, 'priceWithTax' => 2, 'areaId' => 3, ),
+ self::TYPE_COLNAME => array(MondialRelayDeliveryPriceTableMap::ID => 0, MondialRelayDeliveryPriceTableMap::MAX_WEIGHT => 1, MondialRelayDeliveryPriceTableMap::PRICE_WITH_TAX => 2, MondialRelayDeliveryPriceTableMap::AREA_ID => 3, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'MAX_WEIGHT' => 1, 'PRICE_WITH_TAX' => 2, 'AREA_ID' => 3, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'max_weight' => 1, 'price_with_tax' => 2, 'area_id' => 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('mondial_relay_delivery_price');
+ $this->setPhpName('MondialRelayDeliveryPrice');
+ $this->setClassName('\\MondialRelay\\Model\\MondialRelayDeliveryPrice');
+ $this->setPackage('MondialRelay.Model');
+ $this->setUseIdGenerator(true);
+ // columns
+ $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
+ $this->addColumn('MAX_WEIGHT', 'MaxWeight', 'DECIMAL', true, 16, 0);
+ $this->addColumn('PRICE_WITH_TAX', 'PriceWithTax', 'DECIMAL', true, 16, 0);
+ $this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', true, null, null);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $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 ? MondialRelayDeliveryPriceTableMap::CLASS_DEFAULT : MondialRelayDeliveryPriceTableMap::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 (MondialRelayDeliveryPrice object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = MondialRelayDeliveryPriceTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = MondialRelayDeliveryPriceTableMap::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 + MondialRelayDeliveryPriceTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = MondialRelayDeliveryPriceTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ MondialRelayDeliveryPriceTableMap::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 = MondialRelayDeliveryPriceTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = MondialRelayDeliveryPriceTableMap::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;
+ MondialRelayDeliveryPriceTableMap::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(MondialRelayDeliveryPriceTableMap::ID);
+ $criteria->addSelectColumn(MondialRelayDeliveryPriceTableMap::MAX_WEIGHT);
+ $criteria->addSelectColumn(MondialRelayDeliveryPriceTableMap::PRICE_WITH_TAX);
+ $criteria->addSelectColumn(MondialRelayDeliveryPriceTableMap::AREA_ID);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.MAX_WEIGHT');
+ $criteria->addSelectColumn($alias . '.PRICE_WITH_TAX');
+ $criteria->addSelectColumn($alias . '.AREA_ID');
+ }
+ }
+
+ /**
+ * 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(MondialRelayDeliveryPriceTableMap::DATABASE_NAME)->getTable(MondialRelayDeliveryPriceTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(MondialRelayDeliveryPriceTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(MondialRelayDeliveryPriceTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new MondialRelayDeliveryPriceTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a MondialRelayDeliveryPrice or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or MondialRelayDeliveryPrice 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(MondialRelayDeliveryPriceTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \MondialRelay\Model\MondialRelayDeliveryPrice) { // 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(MondialRelayDeliveryPriceTableMap::DATABASE_NAME);
+ $criteria->add(MondialRelayDeliveryPriceTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = MondialRelayDeliveryPriceQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { MondialRelayDeliveryPriceTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { MondialRelayDeliveryPriceTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the mondial_relay_delivery_price table.
+ *
+ * @param ConnectionInterface $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public static function doDeleteAll(ConnectionInterface $con = null)
+ {
+ return MondialRelayDeliveryPriceQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a MondialRelayDeliveryPrice or Criteria object.
+ *
+ * @param mixed $criteria Criteria or MondialRelayDeliveryPrice 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(MondialRelayDeliveryPriceTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from MondialRelayDeliveryPrice object
+ }
+
+ if ($criteria->containsKey(MondialRelayDeliveryPriceTableMap::ID) && $criteria->keyContainsValue(MondialRelayDeliveryPriceTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.MondialRelayDeliveryPriceTableMap::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $query = MondialRelayDeliveryPriceQuery::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;
+ }
+
+} // MondialRelayDeliveryPriceTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+MondialRelayDeliveryPriceTableMap::buildTableMap();
diff --git a/local/modules/MondialRelay/Model/Map/MondialRelayPickupAddressTableMap.php b/local/modules/MondialRelay/Model/Map/MondialRelayPickupAddressTableMap.php
new file mode 100644
index 00000000..9fce2b25
--- /dev/null
+++ b/local/modules/MondialRelay/Model/Map/MondialRelayPickupAddressTableMap.php
@@ -0,0 +1,418 @@
+ array('Id', 'JsonRelayData', 'OrderAddressId', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'jsonRelayData', 'orderAddressId', ),
+ self::TYPE_COLNAME => array(MondialRelayPickupAddressTableMap::ID, MondialRelayPickupAddressTableMap::JSON_RELAY_DATA, MondialRelayPickupAddressTableMap::ORDER_ADDRESS_ID, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'JSON_RELAY_DATA', 'ORDER_ADDRESS_ID', ),
+ self::TYPE_FIELDNAME => array('id', 'json_relay_data', 'order_address_id', ),
+ self::TYPE_NUM => array(0, 1, 2, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ self::TYPE_PHPNAME => array('Id' => 0, 'JsonRelayData' => 1, 'OrderAddressId' => 2, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'jsonRelayData' => 1, 'orderAddressId' => 2, ),
+ self::TYPE_COLNAME => array(MondialRelayPickupAddressTableMap::ID => 0, MondialRelayPickupAddressTableMap::JSON_RELAY_DATA => 1, MondialRelayPickupAddressTableMap::ORDER_ADDRESS_ID => 2, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'JSON_RELAY_DATA' => 1, 'ORDER_ADDRESS_ID' => 2, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'json_relay_data' => 1, 'order_address_id' => 2, ),
+ self::TYPE_NUM => array(0, 1, 2, )
+ );
+
+ /**
+ * Initialize the table attributes and columns
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('mondial_relay_pickup_address');
+ $this->setPhpName('MondialRelayPickupAddress');
+ $this->setClassName('\\MondialRelay\\Model\\MondialRelayPickupAddress');
+ $this->setPackage('MondialRelay.Model');
+ $this->setUseIdGenerator(true);
+ // columns
+ $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
+ $this->addColumn('JSON_RELAY_DATA', 'JsonRelayData', 'CLOB', true, null, null);
+ $this->addColumn('ORDER_ADDRESS_ID', 'OrderAddressId', 'INTEGER', true, null, null);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ } // 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 ? MondialRelayPickupAddressTableMap::CLASS_DEFAULT : MondialRelayPickupAddressTableMap::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 (MondialRelayPickupAddress object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = MondialRelayPickupAddressTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = MondialRelayPickupAddressTableMap::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 + MondialRelayPickupAddressTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = MondialRelayPickupAddressTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ MondialRelayPickupAddressTableMap::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 = MondialRelayPickupAddressTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = MondialRelayPickupAddressTableMap::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;
+ MondialRelayPickupAddressTableMap::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(MondialRelayPickupAddressTableMap::ID);
+ $criteria->addSelectColumn(MondialRelayPickupAddressTableMap::JSON_RELAY_DATA);
+ $criteria->addSelectColumn(MondialRelayPickupAddressTableMap::ORDER_ADDRESS_ID);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.JSON_RELAY_DATA');
+ $criteria->addSelectColumn($alias . '.ORDER_ADDRESS_ID');
+ }
+ }
+
+ /**
+ * 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(MondialRelayPickupAddressTableMap::DATABASE_NAME)->getTable(MondialRelayPickupAddressTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(MondialRelayPickupAddressTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(MondialRelayPickupAddressTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new MondialRelayPickupAddressTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a MondialRelayPickupAddress or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or MondialRelayPickupAddress 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(MondialRelayPickupAddressTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \MondialRelay\Model\MondialRelayPickupAddress) { // 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(MondialRelayPickupAddressTableMap::DATABASE_NAME);
+ $criteria->add(MondialRelayPickupAddressTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = MondialRelayPickupAddressQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { MondialRelayPickupAddressTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { MondialRelayPickupAddressTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the mondial_relay_pickup_address 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 MondialRelayPickupAddressQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a MondialRelayPickupAddress or Criteria object.
+ *
+ * @param mixed $criteria Criteria or MondialRelayPickupAddress 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(MondialRelayPickupAddressTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from MondialRelayPickupAddress object
+ }
+
+ if ($criteria->containsKey(MondialRelayPickupAddressTableMap::ID) && $criteria->keyContainsValue(MondialRelayPickupAddressTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.MondialRelayPickupAddressTableMap::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $query = MondialRelayPickupAddressQuery::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;
+ }
+
+} // MondialRelayPickupAddressTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+MondialRelayPickupAddressTableMap::buildTableMap();
diff --git a/local/modules/MondialRelay/Model/Map/MondialRelayZoneConfigurationTableMap.php b/local/modules/MondialRelay/Model/Map/MondialRelayZoneConfigurationTableMap.php
new file mode 100644
index 00000000..45374e38
--- /dev/null
+++ b/local/modules/MondialRelay/Model/Map/MondialRelayZoneConfigurationTableMap.php
@@ -0,0 +1,427 @@
+ array('Id', 'DeliveryTime', 'DeliveryType', 'AreaId', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'deliveryTime', 'deliveryType', 'areaId', ),
+ self::TYPE_COLNAME => array(MondialRelayZoneConfigurationTableMap::ID, MondialRelayZoneConfigurationTableMap::DELIVERY_TIME, MondialRelayZoneConfigurationTableMap::DELIVERY_TYPE, MondialRelayZoneConfigurationTableMap::AREA_ID, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'DELIVERY_TIME', 'DELIVERY_TYPE', 'AREA_ID', ),
+ self::TYPE_FIELDNAME => array('id', 'delivery_time', 'delivery_type', 'area_id', ),
+ 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, 'DeliveryTime' => 1, 'DeliveryType' => 2, 'AreaId' => 3, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'deliveryTime' => 1, 'deliveryType' => 2, 'areaId' => 3, ),
+ self::TYPE_COLNAME => array(MondialRelayZoneConfigurationTableMap::ID => 0, MondialRelayZoneConfigurationTableMap::DELIVERY_TIME => 1, MondialRelayZoneConfigurationTableMap::DELIVERY_TYPE => 2, MondialRelayZoneConfigurationTableMap::AREA_ID => 3, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'DELIVERY_TIME' => 1, 'DELIVERY_TYPE' => 2, 'AREA_ID' => 3, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'delivery_time' => 1, 'delivery_type' => 2, 'area_id' => 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('mondial_relay_zone_configuration');
+ $this->setPhpName('MondialRelayZoneConfiguration');
+ $this->setClassName('\\MondialRelay\\Model\\MondialRelayZoneConfiguration');
+ $this->setPackage('MondialRelay.Model');
+ $this->setUseIdGenerator(true);
+ // columns
+ $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
+ $this->addColumn('DELIVERY_TIME', 'DeliveryTime', 'INTEGER', true, null, null);
+ $this->addColumn('DELIVERY_TYPE', 'DeliveryType', 'INTEGER', true, 1, null);
+ $this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', true, null, null);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $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 ? MondialRelayZoneConfigurationTableMap::CLASS_DEFAULT : MondialRelayZoneConfigurationTableMap::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 (MondialRelayZoneConfiguration object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = MondialRelayZoneConfigurationTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = MondialRelayZoneConfigurationTableMap::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 + MondialRelayZoneConfigurationTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = MondialRelayZoneConfigurationTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ MondialRelayZoneConfigurationTableMap::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 = MondialRelayZoneConfigurationTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = MondialRelayZoneConfigurationTableMap::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;
+ MondialRelayZoneConfigurationTableMap::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(MondialRelayZoneConfigurationTableMap::ID);
+ $criteria->addSelectColumn(MondialRelayZoneConfigurationTableMap::DELIVERY_TIME);
+ $criteria->addSelectColumn(MondialRelayZoneConfigurationTableMap::DELIVERY_TYPE);
+ $criteria->addSelectColumn(MondialRelayZoneConfigurationTableMap::AREA_ID);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.DELIVERY_TIME');
+ $criteria->addSelectColumn($alias . '.DELIVERY_TYPE');
+ $criteria->addSelectColumn($alias . '.AREA_ID');
+ }
+ }
+
+ /**
+ * 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(MondialRelayZoneConfigurationTableMap::DATABASE_NAME)->getTable(MondialRelayZoneConfigurationTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(MondialRelayZoneConfigurationTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(MondialRelayZoneConfigurationTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new MondialRelayZoneConfigurationTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a MondialRelayZoneConfiguration or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or MondialRelayZoneConfiguration 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(MondialRelayZoneConfigurationTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \MondialRelay\Model\MondialRelayZoneConfiguration) { // 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(MondialRelayZoneConfigurationTableMap::DATABASE_NAME);
+ $criteria->add(MondialRelayZoneConfigurationTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = MondialRelayZoneConfigurationQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { MondialRelayZoneConfigurationTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { MondialRelayZoneConfigurationTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the mondial_relay_zone_configuration 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 MondialRelayZoneConfigurationQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a MondialRelayZoneConfiguration or Criteria object.
+ *
+ * @param mixed $criteria Criteria or MondialRelayZoneConfiguration 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(MondialRelayZoneConfigurationTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from MondialRelayZoneConfiguration object
+ }
+
+ if ($criteria->containsKey(MondialRelayZoneConfigurationTableMap::ID) && $criteria->keyContainsValue(MondialRelayZoneConfigurationTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.MondialRelayZoneConfigurationTableMap::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $query = MondialRelayZoneConfigurationQuery::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;
+ }
+
+} // MondialRelayZoneConfigurationTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+MondialRelayZoneConfigurationTableMap::buildTableMap();
diff --git a/local/modules/MondialRelay/Model/MondialRelayDeliveryInsurance.php b/local/modules/MondialRelay/Model/MondialRelayDeliveryInsurance.php
new file mode 100644
index 00000000..25d3f39a
--- /dev/null
+++ b/local/modules/MondialRelay/Model/MondialRelayDeliveryInsurance.php
@@ -0,0 +1,10 @@
+findOne();
+ } catch (\Exception $e) {
+ $database = new Database($con);
+ $database->insertSql(null, [ __DIR__ . '/Config/thelia.sql' ]);
+
+ // Test Enseigne and private key
+ self::setConfigValue(self::CODE_ENSEIGNE, "BDTEST13");
+ self::setConfigValue(self::PRIVATE_KEY, "PrivateK");
+ self::setConfigValue(self::WEBSERVICE_URL, "https://api.mondialrelay.com/Web_Services.asmx?WSDL");
+ self::setConfigValue(self::GOOGLE_MAPS_API_KEY, "get_your_own_api_key");
+ self::setConfigValue(self::ALLOW_HOME_DELIVERY, true);
+ self::setConfigValue(self::ALLOW_RELAY_DELIVERY, true);
+ self::setConfigValue(self::ALLOW_INSURANCE, true);
+
+ // Create mondial relay shipping zones for relay and home delivery
+
+ $moduleId = self::getModuleId();
+
+ $rateFromEuro = Currency::getDefaultCurrency()->getRate();
+
+ $moduleConfiguration = json_decode(file_get_contents(__DIR__. '/Config/config-data.json'));
+
+ if (false === $moduleConfiguration) {
+ throw new TheliaProcessException("Invalid JSON configuration for Mondial Relay module");
+ }
+
+ // Create all shipping zones, and associate Mondial relay module with them.
+ foreach ($moduleConfiguration->shippingZones as $shippingZone) {
+ AreaQuery::create()->filterByName($shippingZone->name)->delete();
+
+ $area = new Area();
+
+ $area
+ ->setName($shippingZone->name)
+ ->save();
+
+ foreach ($shippingZone->countries as $countryIsoCode) {
+ if (null !== $country = CountryQuery::create()->findOneByIsoalpha3($countryIsoCode)) {
+ (new CountryArea())
+ ->setAreaId($area->getId())
+ ->setCountryId($country->getId())
+ ->save();
+ }
+ }
+
+ // Define zone attributes
+ (new MondialRelayZoneConfiguration())
+ ->setAreaId($area->getId())
+ ->setDeliveryType($shippingZone->delivery_type)
+ ->setDeliveryTime($shippingZone->delivery_time_in_days)
+ ->save();
+
+ // Attach this zone to our module
+ (new AreaDeliveryModule())
+ ->setArea($area)
+ ->setDeliveryModuleId($moduleId)
+ ->save();
+
+ // Create base prices
+ foreach ($shippingZone->prices as $price) {
+ (new MondialRelayDeliveryPrice())
+ ->setAreaId($area->getId())
+ ->setMaxWeight($price->up_to)
+ ->setPriceWithTax($price->price_euro * $rateFromEuro)
+ ->save();
+ }
+ }
+
+ // Insurances
+ foreach ($moduleConfiguration->insurances as $insurance) {
+ (new MondialRelayDeliveryInsurance())
+ ->setMaxValue($insurance->value)
+ ->setPriceWithTax($insurance->price_with_tax_euro)
+ ->setLevel($insurance->level)
+ ->save();
+ }
+
+ if (null === MessageQuery::create()->findOneByName(self::TRACKING_MESSAGE_NAME)) {
+ $message = new Message();
+ $message
+ ->setName(self::TRACKING_MESSAGE_NAME)
+ ->setHtmlLayoutFileName('')
+ ->setHtmlTemplateFileName(self::TRACKING_MESSAGE_NAME.'.html')
+ ->setTextLayoutFileName('')
+ ->setTextTemplateFileName(self::TRACKING_MESSAGE_NAME.'.txt')
+ ;
+
+ $languages = LangQuery::create()->find();
+
+ /** @var Lang $language */
+ foreach ($languages as $language) {
+ $locale = $language->getLocale();
+ $message->setLocale($locale);
+
+ $message->setTitle(
+ Translator::getInstance()->trans('Mondial Relay tracking information', [], self::DOMAIN_NAME, $locale)
+ );
+
+ $message->setSubject(
+ Translator::getInstance()->trans('Your order has been shipped', [], self::DOMAIN_NAME, $locale)
+ );
+ }
+
+ $message->save();
+ }
+
+ /* Deploy the module's image */
+ $module = $this->getModuleModel();
+ if (ModuleImageQuery::create()->filterByModule($module)->count() == 0) {
+ $this->deployImageFolder($module, sprintf('%s/images', __DIR__), $con);
+ }
+ }
+ }
+
+ /**
+ * @param ConnectionInterface|null $con
+ * @param bool $deleteModuleData
+ * @throws \Propel\Runtime\Exception\PropelException
+ */
+ public function destroy(ConnectionInterface $con = null, $deleteModuleData = false)
+ {
+ if ($deleteModuleData) {
+ // Delete message
+ MessageQuery::create()->filterByName(self::TRACKING_MESSAGE_NAME)->delete($con);
+
+ // Delete module config data
+ ModuleConfigQuery::create()->filterByModuleId(self::getModuleId())->delete($con);
+
+ // Delete module tables.
+ if (null !== $con) {
+ $database = new Database($con);
+ $database->insertSql(null, [__DIR__ . '/Config/drop.sql']);
+ }
+ }
+
+ parent::destroy($con, $deleteModuleData);
+ }
+}
diff --git a/local/modules/MondialRelay/Readme.md b/local/modules/MondialRelay/Readme.md
new file mode 100644
index 00000000..8d25067b
--- /dev/null
+++ b/local/modules/MondialRelay/Readme.md
@@ -0,0 +1,39 @@
+# Module de livraison Mondial Relay
+
+Ce module vous permet de proposer à vos clients une livraison avec le transporteur Mondial Relay,
+en point relais ou directement à domicile, en fonction des options disponibles
+dans le pays de destination.
+
+## Installation
+
+Ajoutez le module depuis la page Modules de votre back-office, ou directement sur votre serveur si vous préférez. Vous
+pouvez aussi utiliser composer :
+
+ composer require thelia/mondialrelay:~1.0
+
+## Configuration
+
+Par défaut, le module utilise des identifiants de test. Rendez-vous dans la configuration du module pour indiquer vos
+propres identifiants Mondial Relay, et configurer les divers aspects du module.
+
+Lors de son installation, le module crée cinq zones de livraison, qui correspondent aux zones proposées par
+Mondial Relay [sur la page des tarifs](http://www.mondialrelay.fr/envoi-de-colis/premiere-visite/#Tarifs "sur cette page").
+
+Chacun de ces zones de livraison peut proposer la livraison en point relais, la livraison à domicile, ou les deux.
+Vous pouvez régler ceci dans l'onglet "Prix" de la configuration du module.
+
+Pour chaque zone, vous pouvez définir des prix par tranche de poids. Ces prix sont initialisés l'installation du module
+avec les prix de mars 2018.
+
+## Intégration
+
+Le module utilise les hooks de Thelia, aucun travail d'intégration n'est nécessaire.
+
+Pour une livraison en point relais, les caractéristiques du relais (numéro, coordonnées, horaires d'ouverture) sont
+communiquées à vos clients dans les e-mails, documents PDF et historique de commande.
+
+## Notifications par email
+
+Si vous avez saisi un numéro de suivi, une notification d'envoi est expédiée à vos clients lorsque la commande passe Ã
+ l'état "envoyé". Vous pouvez modifier le contenu de ce mail dans les fichiers
+ `templates/email/default/mondial-relay-tracking-message.html` et `templates/email/default/mondial-relay-tracking-message.txt`
diff --git a/local/modules/MondialRelay/Solution-Web-Service-V5.4.pdf b/local/modules/MondialRelay/Solution-Web-Service-V5.4.pdf
new file mode 100644
index 00000000..4c4ed390
Binary files /dev/null and b/local/modules/MondialRelay/Solution-Web-Service-V5.4.pdf differ
diff --git a/local/modules/MondialRelay/composer.json b/local/modules/MondialRelay/composer.json
new file mode 100644
index 00000000..aeac3166
--- /dev/null
+++ b/local/modules/MondialRelay/composer.json
@@ -0,0 +1,11 @@
+{
+ "name": "thelia/mondial-relay-module",
+ "license": "LGPL-3.0-or-later",
+ "type": "thelia-module",
+ "require": {
+ "xaviborja/php-mondialrelay-api": "dev-master"
+ },
+ "extra": {
+ "installer-name": "MondialRelay"
+ }
+}
diff --git a/local/modules/MondialRelay/composer.lock b/local/modules/MondialRelay/composer.lock
new file mode 100644
index 00000000..f35aeffa
--- /dev/null
+++ b/local/modules/MondialRelay/composer.lock
@@ -0,0 +1,59 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "9dba6910bb06325dfa941ec161c6c334",
+ "packages": [
+ {
+ "name": "xaviborja/php-mondialrelay-api",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/xaviborja/php-mondialrelay-api.git",
+ "reference": "b57f7da5f3f2ce983c8bea3d8239b7fdbe7ebcbf"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/xaviborja/php-mondialrelay-api/zipball/b57f7da5f3f2ce983c8bea3d8239b7fdbe7ebcbf",
+ "reference": "b57f7da5f3f2ce983c8bea3d8239b7fdbe7ebcbf",
+ "shasum": ""
+ },
+ "require": {
+ "xaviborja/php-mondialrelay-api": "dev-master"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^5.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "MondialRelay\\": "src/MondialRelay/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Xavier Borja",
+ "email": "xavibm86@gmail.com"
+ }
+ ],
+ "description": "A PHP library for dealing with Mondial Relay API (http://api.mondialrelay.com)",
+ "time": "2017-06-21T12:22:06+00:00"
+ }
+ ],
+ "packages-dev": [],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": {
+ "xaviborja/php-mondialrelay-api": 20
+ },
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": [],
+ "platform-dev": []
+}
diff --git a/local/modules/MondialRelay/images/logo-mr.png b/local/modules/MondialRelay/images/logo-mr.png
new file mode 100644
index 00000000..0b887e90
Binary files /dev/null and b/local/modules/MondialRelay/images/logo-mr.png differ
diff --git a/local/modules/MondialRelay/templates/backOffice/default/mondialrelay/ajax/general.html b/local/modules/MondialRelay/templates/backOffice/default/mondialrelay/ajax/general.html
new file mode 100644
index 00000000..6e83d898
--- /dev/null
+++ b/local/modules/MondialRelay/templates/backOffice/default/mondialrelay/ajax/general.html
@@ -0,0 +1,37 @@
+{form name="mondialrelay.settings_form"}
+
+ + {loop type="area" name="module-areas" module_id=$module_id order='id'} +
{intl l="Dear %first %last" last=$LASTNAME first=$FIRSTNAME},
+ {/loop} + +{intl l="Your order %order_ref has just been shipped from our store. The tracking number for this order is %tracking_ref. Please click here to track the delivery." order_ref=$REF tracking_ref=$DELIVERY_REF}
+{intl l="Details about this order are available in your customer account." account_url={url path="/account"}}
+{intl l="See you soon at %store" url={navigate to='index'} store={config key="store_name"}}
+{intl l="The %store team." store={config key="store_name"}}
+{/loop} +{/block} diff --git a/local/modules/MondialRelay/templates/email/default/mondial-relay-tracking-message.txt b/local/modules/MondialRelay/templates/email/default/mondial-relay-tracking-message.txt new file mode 100644 index 00000000..2ae098dc --- /dev/null +++ b/local/modules/MondialRelay/templates/email/default/mondial-relay-tracking-message.txt @@ -0,0 +1,11 @@ +{default_translation_domain domain='mondialrelay.email.default'} +{default_locale locale={$locale}} +{loop type="order" name="order" id=$order_id} +{loop type="customer" name="customer.order" current=false id=$CUSTOMER backend_context="1"} +{intl l="Dear %first %last" last=$LASTNAME first=$FIRSTNAME},{intl l="Pickup relay opening hours:" d="mondialrelay.email.default"}
+| {$opening.day} | + {if $opening.opening_time_1} +{$opening.opening_time_1} - {$opening.closing_time_1} | + {else} ++ {/if} + {if $opening.opening_time_2} + | {$opening.opening_time_2} - {$opening.closing_time_2} | + {else} ++ {/if} + |
| {$opening.day} | +{if $opening.opening_time_1}{$opening.opening_time_1} - {$opening.closing_time_1}{else} {/if} | +{if $opening.opening_time_2}{$opening.opening_time_2} - {$opening.closing_time_2}{else} {/if} | +
{intl l="Pickup relay opening hours:" d="mondialrelay.pdf.default"}
+| {$opening.day} | + {if $opening.opening_time_1} +{$opening.opening_time_1} - {$opening.closing_time_1} | + {else} ++ {/if} + {if $opening.opening_time_2} + | {$opening.opening_time_2} - {$opening.closing_time_2} | + {else} ++ {/if} + |