Merge branches 'coupon' and 'master' of https://github.com/thelia/thelia into coupon

* 'coupon' of https://github.com/thelia/thelia:

# By Etienne Roudeix (17) and others
# Via Etienne Roudeix (9) and others
* 'master' of https://github.com/thelia/thelia: (52 commits)
  fix content faker
  fix typo and remove url generation in postInsert model
  add covers annotation in ProductRewriteTest
  create test for UrlRewritingTrait
  payment loop
  fix postage display
  postage + invoice step
  template is not mandatory in product table.
  refactor rewrriten method name
  Changed getDefaultCategory in getDefaultCategoryId
  remove old model classes:
  Working : Content : fix loop giving no elements
  Working : Content : fix loop giving no elements
  Added missing files...
  Started product management
  Working : Content : fix loop giving no elements
  Working : Product : fix loop giving no elements
  cart billing integration
  empty cart or delivery exception
  remove isntall routing and template
  ...
This commit is contained in:
gmorel
2013-09-17 22:55:29 +02:00
178 changed files with 20645 additions and 2315 deletions

3
.gitignore vendored
View File

@@ -19,10 +19,9 @@ local/media/documents/*
local/media/images/* local/media/images/*
web/assets/* web/assets/*
web/cache/* web/cache/*
web/.htaccess
phpdoc*.log phpdoc*.log
php-cs php-cs
xhprof/ xhprof/
phpunit.phar phpunit.phar
.DS_Store .DS_Store
phpmyadmin phpmyadmin

View File

@@ -0,0 +1,178 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\CachedFileEvent;
use Thelia\Model\ConfigQuery;
use Thelia\Tools\URL;
/**
*
* Cached file management actions. This class handles file caching in the web space
*
* Basically, files are stored outside the web space (by default in local/media/<dirname>),
* and cached in the web space (by default in web/local/<dirname>).
*
* In the file cache directory, a subdirectory for files categories (eg. product, category, folder, etc.) is
* automatically created, and the cached file is created here. Plugin may use their own subdirectory as required.
*
* A copy (or symbolic link, by default) of the original file is created in the cache.
*
* @package Thelia\Action
* @author Franck Allimant <franck@cqfdev.fr>
*
*/
abstract class BaseCachedFile extends BaseAction
{
/**
* @return string root of the file cache directory in web space
*/
protected abstract function getCacheDirFromWebRoot();
/**
* Clear the file cache. Is a subdirectory is specified, only this directory is cleared.
* If no directory is specified, the whole cache is cleared.
* Only files are deleted, directories will remain.
*
* @param CachedFileEvent $event
*/
public function clearCache(CachedFileEvent $event)
{
$path = $this->getCachePath($event->getCacheSubdirectory(), false);
$this->clearDirectory($path);
}
/**
* Recursively clears the specified directory.
*
* @param string $path the directory path
*/
protected function clearDirectory($path)
{
$iterator = new \DirectoryIterator($path);
foreach ($iterator as $fileinfo) {
if ($fileinfo->isDot()) continue;
if ($fileinfo->isFile() || $fileinfo->isLink()) {
@unlink($fileinfo->getPathname());
} elseif ($fileinfo->isDir()) {
$this->clearDirectory($fileinfo->getPathname());
}
}
}
/**
* Return the absolute URL to the cached file
*
* @param string $subdir the subdirectory related to cache base
* @param string $filename the safe filename, as returned by getCacheFilePath()
* @return string the absolute URL to the cached file
*/
protected function getCacheFileURL($subdir, $safe_filename)
{
$path = $this->getCachePathFromWebRoot($subdir);
return URL::getInstance()->absoluteUrl(sprintf("%s/%s", $path, $safe_filename), null, URL::PATH_TO_FILE);
}
/**
* Return the full path of the cached file
*
* @param string $subdir the subdirectory related to cache base
* @param string $filename the filename
* @param string $hashed_options a hash of transformation options, or null if no transformations have been applied
* @param boolean $forceOriginalDocument if true, the original file path in the cache dir is returned.
* @return string the cache directory path relative to Web Root
*/
protected function getCacheFilePath($subdir, $filename, $forceOriginalFile = false, $hashed_options = null)
{
$path = $this->getCachePath($subdir);
$safe_filename = preg_replace("[^:alnum:\-\._]", "-", strtolower(basename($filename)));
// Keep original safe name if no tranformations are applied
if ($forceOriginalFile || $hashed_options == null)
return sprintf("%s/%s", $path, $safe_filename);
else
return sprintf("%s/%s-%s", $path, $hashed_options, $safe_filename);
}
/**
* Return the cache directory path relative to Web Root
*
* @param string $subdir the subdirectory related to cache base, or null to get the cache directory only.
* @return string the cache directory path relative to Web Root
*/
protected function getCachePathFromWebRoot($subdir = null)
{
$cache_dir_from_web_root = $this->getCacheDirFromWebRoot();
if ($subdir != null) {
$safe_subdir = basename($subdir);
$path = sprintf("%s/%s", $cache_dir_from_web_root, $safe_subdir);
} else
$path = $cache_dir_from_web_root;
// Check if path is valid, e.g. in the cache dir
return $path;
}
/**
* Return the absolute cache directory path
*
* @param string $subdir the subdirectory related to cache base, or null to get the cache base directory.
* @throws \RuntimeException if cache directory cannot be created
* @return string the absolute cache directory path
*/
protected function getCachePath($subdir = null, $create_if_not_exists = true)
{
$cache_base = $this->getCachePathFromWebRoot($subdir);
$web_root = rtrim(THELIA_WEB_DIR, '/');
$path = sprintf("%s/%s", $web_root, $cache_base);
// Create directory (recursively) if it does not exists.
if ($create_if_not_exists && !is_dir($path)) {
if (!@mkdir($path, 0777, true)) {
throw new \RuntimeException(sprintf("Failed to create %s/%s file in cache directory", $cache_base));
}
}
// Check if path is valid, e.g. in the cache dir
$cache_base = realpath(sprintf("%s/%s", $web_root, $this->getCachePathFromWebRoot()));
if (strpos(realpath($path), $cache_base) !== 0) {
throw new \InvalidArgumentException(sprintf("Invalid cache path %s, with subdirectory %s", $path, $subdir));
}
return $path;
}
}

View File

@@ -36,6 +36,10 @@ use Thelia\Core\Event\CategoryDeleteEvent;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\Event\CategoryToggleVisibilityEvent; use Thelia\Core\Event\CategoryToggleVisibilityEvent;
use Thelia\Core\Event\CategoryAddContentEvent;
use Thelia\Core\Event\CategoryDeleteContentEvent;
use Thelia\Model\CategoryAssociatedContent;
use Thelia\Model\CategoryAssociatedContentQuery;
class Category extends BaseAction implements EventSubscriberInterface class Category extends BaseAction implements EventSubscriberInterface
{ {
@@ -147,6 +151,33 @@ class Category extends BaseAction implements EventSubscriberInterface
} }
} }
public function addContent(CategoryAddContentEvent $event) {
if (CategoryAssociatedContentQuery::create()
->filterByContentId($event->getContentId())
->filterByCategory($event->getCategory())->count() <= 0) {
$content = new CategoryAssociatedContent();
$content
->setCategory($event->getCategory())
->setContentId($event->getContentId())
->save()
;
}
}
public function removeContent(CategoryDeleteContentEvent $event) {
$content = CategoryAssociatedContentQuery::create()
->filterByContentId($event->getContentId())
->filterByCategory($event->getCategory())->findOne()
;
if ($content !== null) $content->delete();
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@@ -157,7 +188,12 @@ class Category extends BaseAction implements EventSubscriberInterface
TheliaEvents::CATEGORY_UPDATE => array("update", 128), TheliaEvents::CATEGORY_UPDATE => array("update", 128),
TheliaEvents::CATEGORY_DELETE => array("delete", 128), TheliaEvents::CATEGORY_DELETE => array("delete", 128),
TheliaEvents::CATEGORY_TOGGLE_VISIBILITY => array("toggleVisibility", 128), TheliaEvents::CATEGORY_TOGGLE_VISIBILITY => array("toggleVisibility", 128),
TheliaEvents::CATEGORY_UPDATE_POSITION => array("updatePosition", 128)
TheliaEvents::CATEGORY_UPDATE_POSITION => array("updatePosition", 128),
TheliaEvents::CATEGORY_ADD_CONTENT => array("addContent", 128),
TheliaEvents::CATEGORY_REMOVE_CONTENT => array("removeContent", 128),
); );
} }
} }

View File

@@ -0,0 +1,139 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\DocumentEvent;
use Thelia\Model\ConfigQuery;
use Thelia\Tools\URL;
use Imagine\Document\ImagineInterface;
use Imagine\Document\DocumentInterface;
use Imagine\Document\Box;
use Imagine\Document\Color;
use Imagine\Document\Point;
use Thelia\Exception\DocumentException;
use Thelia\Core\Event\TheliaEvents;
/**
*
* Document management actions. This class handles document processing an caching.
*
* Basically, documents are stored outside the web space (by default in local/media/documents),
* and cached in the web space (by default in web/local/documents).
*
* In the documents caches directory, a subdirectory for documents categories (eg. product, category, folder, etc.) is
* automatically created, and the cached document is created here. Plugin may use their own subdirectory as required.
*
* The cached document name contains a hash of the processing options, and the original (normalized) name of the document.
*
* A copy (or symbolic link, by default) of the original document is always created in the cache, so that the full
* resolution document is always available.
*
* Various document processing options are available :
*
* - resizing, with border, crop, or by keeping document aspect ratio
* - rotation, in degrees, positive or negative
* - background color, applyed to empty background when creating borders or rotating
* - effects. The effects are applied in the specified order. The following effects are available:
* - gamma:value : change the document Gamma to the specified value. Example: gamma:0.7
* - grayscale or greyscale: switch document to grayscale
* - colorize:color : apply a color mask to the document. Exemple: colorize:#ff2244
* - negative : transform the document in its negative equivalent
* - vflip or vertical_flip : vertical flip
* - hflip or horizontal_flip : horizontal flip
*
* If a problem occurs, an DocumentException may be thrown.
*
* @package Thelia\Action
* @author Franck Allimant <franck@cqfdev.fr>
*
*/
class Document extends BaseCachedFile implements EventSubscriberInterface
{
/**
* @return string root of the document cache directory in web space
*/
protected function getCacheDirFromWebRoot() {
return ConfigQuery::read('document_cache_dir_from_web_root', 'cache');
}
/**
* Process document and write the result in the document cache.
*
* When the original document is required, create either a symbolic link with the
* original document in the cache dir, or copy it in the cache dir if it's not already done.
*
* This method updates the cache_file_path and file_url attributes of the event
*
* @param DocumentEvent $event
* @throws \InvalidArgumentException, DocumentException
*/
public function processDocument(DocumentEvent $event)
{
$subdir = $event->getCacheSubdirectory();
$source_file = $event->getSourceFilepath();
if (null == $subdir || null == $source_file) {
throw new \InvalidArgumentException("Cache sub-directory and source file path cannot be null");
}
$originalDocumentPathInCache = $this->getCacheFilePath($subdir, $source_file, true);
if (! file_exists($originalDocumentPathInCache)) {
if (! file_exists($source_file)) {
throw new DocumentException(sprintf("Source document file %s does not exists.", $source_file));
}
$mode = ConfigQuery::read('original_document_delivery_mode', 'symlink');
if ($mode == 'symlink') {
if (false == symlink($source_file, $originalDocumentPathInCache)) {
throw new DocumentException(sprintf("Failed to create symbolic link for %s in %s document cache directory", basename($source_file), $subdir));
}
} else {// mode = 'copy'
if (false == @copy($source_file, $originalDocumentPathInCache)) {
throw new DocumentException(sprintf("Failed to copy %s in %s document cache directory", basename($source_file), $subdir));
}
}
}
// Compute the document URL
$document_url = $this->getCacheFileURL($subdir, basename($originalDocumentPathInCache));
// Update the event with file path and file URL
$event->setDocumentPath($originalDocumentPathInCache);
$event->setDocumentUrl(URL::getInstance()->absoluteUrl($document_url, null, URL::PATH_TO_FILE));
}
public static function getSubscribedEvents()
{
return array(
TheliaEvents::DOCUMENT_PROCESS => array("processDocument", 128),
TheliaEvents::DOCUMENT_CLEAR_CACHE => array("clearCache", 128),
);
}
}

View File

@@ -71,7 +71,7 @@ use Thelia\Core\Event\TheliaEvents;
* @author Franck Allimant <franck@cqfdev.fr> * @author Franck Allimant <franck@cqfdev.fr>
* *
*/ */
class Image extends BaseAction implements EventSubscriberInterface class Image extends BaseCachedFile implements EventSubscriberInterface
{ {
// Resize mode constants // Resize mode constants
const EXACT_RATIO_WITH_BORDERS = 1; const EXACT_RATIO_WITH_BORDERS = 1;
@@ -79,38 +79,10 @@ class Image extends BaseAction implements EventSubscriberInterface
const KEEP_IMAGE_RATIO = 3; const KEEP_IMAGE_RATIO = 3;
/** /**
* Clear the image cache. Is a subdirectory is specified, only this directory is cleared. * @return string root of the image cache directory in web space
* If no directory is specified, the whole cache is cleared.
* Only files are deleted, directories will remain.
*
* @param ImageEvent $event
*/ */
public function clearCache(ImageEvent $event) protected function getCacheDirFromWebRoot() {
{ return ConfigQuery::read('image_cache_dir_from_web_root', 'cache');
$path = $this->getCachePath($event->getCacheSubdirectory(), false);
$this->clearDirectory($path);
}
/**
* Recursively clears the specified directory.
*
* @param string $path the directory path
*/
protected function clearDirectory($path)
{
$iterator = new \DirectoryIterator($path);
foreach ($iterator as $fileinfo) {
if ($fileinfo->isDot()) continue;
if ($fileinfo->isFile() || $fileinfo->isLink()) {
@unlink($fileinfo->getPathname());
} elseif ($fileinfo->isDir()) {
$this->clearDirectory($fileinfo->getPathname());
}
}
} }
/** /**
@@ -138,9 +110,9 @@ class Image extends BaseAction implements EventSubscriberInterface
// echo basename($source_file).": "; // echo basename($source_file).": ";
// Find cached file path // Find cached file path
$cacheFilePath = $this->getCacheFilePath($subdir, $source_file, $event); $cacheFilePath = $this->getCacheFilePath($subdir, $source_file, $event->isOriginalImage(), $event->getOptionsHash());
$originalImagePathInCache = $this->getCacheFilePath($subdir, $source_file, $event, true); $originalImagePathInCache = $this->getCacheFilePath($subdir, $source_file, true);
if (! file_exists($cacheFilePath)) { if (! file_exists($cacheFilePath)) {
@@ -359,94 +331,6 @@ class Image extends BaseAction implements EventSubscriberInterface
return $image; return $image;
} }
/**
* Return the absolute URL to the cached image
*
* @param string $subdir the subdirectory related to cache base
* @param string $filename the safe filename, as returned by getCacheFilePath()
* @return string the absolute URL to the cached image
*/
protected function getCacheFileURL($subdir, $safe_filename)
{
$path = $this->getCachePathFromWebRoot($subdir);
return URL::getInstance()->absoluteUrl(sprintf("%s/%s", $path, $safe_filename), null, URL::PATH_TO_FILE);
}
/**
* Return the full path of the cached file
*
* @param string $subdir the subdirectory related to cache base
* @param string $filename the filename
* @param boolean $forceOriginalImage if true, the origiunal image path in the cache dir is returned.
* @return string the cache directory path relative to Web Root
*/
protected function getCacheFilePath($subdir, $filename, ImageEvent $event, $forceOriginalImage = false)
{
$path = $this->getCachePath($subdir);
$safe_filename = preg_replace("[^:alnum:\-\._]", "-", strtolower(basename($filename)));
// Keep original safe name if no tranformations are applied
if ($forceOriginalImage || $event->isOriginalImage())
return sprintf("%s/%s", $path, $safe_filename);
else
return sprintf("%s/%s-%s", $path, $event->getOptionsHash(), $safe_filename);
}
/**
* Return the cache directory path relative to Web Root
*
* @param string $subdir the subdirectory related to cache base, or null to get the cache directory only.
* @return string the cache directory path relative to Web Root
*/
protected function getCachePathFromWebRoot($subdir = null)
{
$cache_dir_from_web_root = ConfigQuery::read('image_cache_dir_from_web_root', 'cache');
if ($subdir != null) {
$safe_subdir = basename($subdir);
$path = sprintf("%s/%s", $cache_dir_from_web_root, $safe_subdir);
} else
$path = $cache_dir_from_web_root;
// Check if path is valid, e.g. in the cache dir
return $path;
}
/**
* Return the absolute cache directory path
*
* @param string $subdir the subdirectory related to cache base, or null to get the cache base directory.
* @throws \RuntimeException if cache directory cannot be created
* @return string the absolute cache directory path
*/
protected function getCachePath($subdir = null, $create_if_not_exists = true)
{
$cache_base = $this->getCachePathFromWebRoot($subdir);
$web_root = rtrim(THELIA_WEB_DIR, '/');
$path = sprintf("%s/%s", $web_root, $cache_base);
// Create directory (recursively) if it does not exists.
if ($create_if_not_exists && !is_dir($path)) {
if (!@mkdir($path, 0777, true)) {
throw new ImageException(sprintf("Failed to create %s/%s image cache directory", $cache_base));
}
}
// Check if path is valid, e.g. in the cache dir
$cache_base = realpath(sprintf("%s/%s", $web_root, $this->getCachePathFromWebRoot()));
if (strpos(realpath($path), $cache_base) !== 0) {
throw new \InvalidArgumentException(sprintf("Invalid cache path %s, with subdirectory %s", $path, $subdir));
}
return $path;
}
/** /**
* Create a new Imagine object using current driver configuration * Create a new Imagine object using current driver configuration
* *

View File

@@ -0,0 +1,97 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Action;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\CartEvent;
use Thelia\Core\Event\OrderEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\ProductPrice;
use Thelia\Model\ProductPriceQuery;
use Thelia\Model\CartItem;
use Thelia\Model\CartItemQuery;
use Thelia\Model\ConfigQuery;
/**
*
* Class Order
* @package Thelia\Action
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*/
class Order extends BaseAction implements EventSubscriberInterface
{
/**
* @param \Thelia\Core\Event\OrderEvent $event
*/
public function setDeliveryAddress(OrderEvent $event)
{
$order = $event->getOrder();
$order->chosenDeliveryAddress = $event->getDeliveryAddress();
$event->setOrder($order);
}
/**
* @param \Thelia\Core\Event\OrderEvent $event
*/
public function setDeliveryModule(OrderEvent $event)
{
$order = $event->getOrder();
$order->setDeliveryModuleId($event->getDeliveryModule());
$order->setPostage($event->getPostage());
$event->setOrder($order);
}
/**
* Returns an array of event names this subscriber wants to listen to.
*
* The array keys are event names and the value can be:
*
* * The method name to call (priority defaults to 0)
* * An array composed of the method name to call and the priority
* * An array of arrays composed of the method names to call and respective
* priorities, or 0 if unset
*
* For instance:
*
* * array('eventName' => 'methodName')
* * array('eventName' => array('methodName', $priority))
* * array('eventName' => array(array('methodName1', $priority), array('methodName2'))
*
* @return array The event names to listen to
*
* @api
*/
public static function getSubscribedEvents()
{
return array(
TheliaEvents::ORDER_SET_DELIVERY_ADDRESS => array("setDeliveryAddress", 128),
TheliaEvents::ORDER_SET_DELIVERY_MODULE => array("setDeliveryModule", 128),
);
}
}

View File

@@ -0,0 +1,199 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Model\ProductQuery;
use Thelia\Model\Product as ProductModel;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\ProductUpdateEvent;
use Thelia\Core\Event\ProductCreateEvent;
use Thelia\Core\Event\ProductDeleteEvent;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\Event\ProductToggleVisibilityEvent;
use Thelia\Core\Event\ProductAddContentEvent;
use Thelia\Core\Event\ProductDeleteContentEvent;
use Thelia\Model\ProductAssociatedContent;
use Thelia\Model\ProductAssociatedContentQuery;
class Product extends BaseAction implements EventSubscriberInterface
{
/**
* Create a new product entry
*
* @param ProductCreateEvent $event
*/
public function create(ProductCreateEvent $event)
{
$product = new ProductModel();
$product
->setDispatcher($this->getDispatcher())
->setLocale($event->getLocale())
->setTitle($event->getTitle())
->setParent($event->getParent())
->setVisible($event->getVisible())
->save()
;
$event->setProduct($product);
}
/**
* Change a product
*
* @param ProductUpdateEvent $event
*/
public function update(ProductUpdateEvent $event)
{
$search = ProductQuery::create();
if (null !== $product = ProductQuery::create()->findPk($event->getProductId())) {
$product
->setDispatcher($this->getDispatcher())
->setLocale($event->getLocale())
->setTitle($event->getTitle())
->setDescription($event->getDescription())
->setChapo($event->getChapo())
->setPostscriptum($event->getPostscriptum())
->setParent($event->getParent())
->setVisible($event->getVisible())
->save();
$event->setProduct($product);
}
}
/**
* Delete a product entry
*
* @param ProductDeleteEvent $event
*/
public function delete(ProductDeleteEvent $event)
{
if (null !== $product = ProductQuery::create()->findPk($event->getProductId())) {
$product
->setDispatcher($this->getDispatcher())
->delete()
;
$event->setProduct($product);
}
}
/**
* Toggle product visibility. No form used here
*
* @param ActionEvent $event
*/
public function toggleVisibility(ProductToggleVisibilityEvent $event)
{
$product = $event->getProduct();
$product
->setDispatcher($this->getDispatcher())
->setVisible($product->getVisible() ? false : true)
->save()
;
}
/**
* Changes position, selecting absolute ou relative change.
*
* @param ProductChangePositionEvent $event
*/
public function updatePosition(UpdatePositionEvent $event)
{
if (null !== $product = ProductQuery::create()->findPk($event->getObjectId())) {
$product->setDispatcher($this->getDispatcher());
$mode = $event->getMode();
if ($mode == UpdatePositionEvent::POSITION_ABSOLUTE)
return $product->changeAbsolutePosition($event->getPosition());
else if ($mode == UpdatePositionEvent::POSITION_UP)
return $product->movePositionUp();
else if ($mode == UpdatePositionEvent::POSITION_DOWN)
return $product->movePositionDown();
}
}
public function addContent(ProductAddContentEvent $event) {
if (ProductAssociatedContentQuery::create()
->filterByContentId($event->getContentId())
->filterByProduct($event->getProduct())->count() <= 0) {
$content = new ProductAssociatedContent();
$content
->setProduct($event->getProduct())
->setContentId($event->getContentId())
->save()
;
}
}
public function removeContent(ProductDeleteContentEvent $event) {
$content = ProductAssociatedContentQuery::create()
->filterByContentId($event->getContentId())
->filterByProduct($event->getProduct())->findOne()
;
if ($content !== null) $content->delete();
}
/**
* {@inheritDoc}
*/
public static function getSubscribedEvents()
{
return array(
TheliaEvents::PRODUCT_CREATE => array("create", 128),
TheliaEvents::PRODUCT_UPDATE => array("update", 128),
TheliaEvents::PRODUCT_DELETE => array("delete", 128),
TheliaEvents::PRODUCT_TOGGLE_VISIBILITY => array("toggleVisibility", 128),
TheliaEvents::PRODUCT_UPDATE_POSITION => array("updatePosition", 128),
TheliaEvents::PRODUCT_ADD_CONTENT => array("addContent", 128),
TheliaEvents::PRODUCT_REMOVE_CONTENT => array("removeContent", 128),
);
}
}

View File

@@ -17,6 +17,11 @@
<tag name="kernel.event_subscriber"/> <tag name="kernel.event_subscriber"/>
</service> </service>
<service id="thelia.action.order" class="Thelia\Action\Order">
<argument type="service" id="service_container"/>
<tag name="kernel.event_subscriber"/>
</service>
<service id="thelia.action.customer" class="Thelia\Action\Customer"> <service id="thelia.action.customer" class="Thelia\Action\Customer">
<argument type="service" id="service_container"/> <argument type="service" id="service_container"/>
<tag name="kernel.event_subscriber"/> <tag name="kernel.event_subscriber"/>
@@ -37,6 +42,11 @@
<tag name="kernel.event_subscriber"/> <tag name="kernel.event_subscriber"/>
</service> </service>
<service id="thelia.action.product" class="Thelia\Action\Product">
<argument type="service" id="service_container"/>
<tag name="kernel.event_subscriber"/>
</service>
<service id="thelia.action.config" class="Thelia\Action\Config"> <service id="thelia.action.config" class="Thelia\Action\Config">
<argument type="service" id="service_container"/> <argument type="service" id="service_container"/>
<tag name="kernel.event_subscriber"/> <tag name="kernel.event_subscriber"/>

View File

@@ -24,6 +24,7 @@
<loop class="Thelia\Core\Template\Loop\Order" name="order"/> <loop class="Thelia\Core\Template\Loop\Order" name="order"/>
<loop class="Thelia\Core\Template\Loop\OrderStatus" name="order-status"/> <loop class="Thelia\Core\Template\Loop\OrderStatus" name="order-status"/>
<loop class="Thelia\Core\Template\Loop\CategoryPath" name="category-path"/> <loop class="Thelia\Core\Template\Loop\CategoryPath" name="category-path"/>
<loop class="Thelia\Core\Template\Loop\Payment" name="payment"/>
<loop class="Thelia\Core\Template\Loop\Product" name="product"/> <loop class="Thelia\Core\Template\Loop\Product" name="product"/>
<loop class="Thelia\Core\Template\Loop\ProductSaleElements" name="product_sale_elements"/> <loop class="Thelia\Core\Template\Loop\ProductSaleElements" name="product_sale_elements"/>
<loop class="Thelia\Core\Template\Loop\Feed" name="feed"/> <loop class="Thelia\Core\Template\Loop\Feed" name="feed"/>
@@ -40,6 +41,8 @@
</loops> </loops>
<forms> <forms>
<form name="thelia.install.step3" class="Thelia\Form\InstallStep3Form"/>
<form name="thelia.customer.creation" class="Thelia\Form\CustomerCreation"/> <form name="thelia.customer.creation" class="Thelia\Form\CustomerCreation"/>
<form name="thelia.customer.modification" class="Thelia\Form\CustomerModification"/> <form name="thelia.customer.modification" class="Thelia\Form\CustomerModification"/>
<form name="thelia.customer.lostpassword" class="Thelia\Form\CustomerLostPasswordForm"/> <form name="thelia.customer.lostpassword" class="Thelia\Form\CustomerLostPasswordForm"/>
@@ -53,11 +56,17 @@
<form name="thelia.admin.category.creation" class="Thelia\Form\CategoryCreationForm"/> <form name="thelia.admin.category.creation" class="Thelia\Form\CategoryCreationForm"/>
<form name="thelia.admin.category.modification" class="Thelia\Form\CategoryModificationForm"/> <form name="thelia.admin.category.modification" class="Thelia\Form\CategoryModificationForm"/>
<form name="thelia.admin.product.creation" class="Thelia\Form\ProductCreationForm"/>
<form name="thelia.admin.product.modification" class="Thelia\Form\ProductModificationForm"/>
<form name="thelia.admin.product.creation" class="Thelia\Form\ProductCreationForm"/> <form name="thelia.admin.product.creation" class="Thelia\Form\ProductCreationForm"/>
<form name="thelia.admin.product.deletion" class="Thelia\Form\ProductModificationForm"/> <form name="thelia.admin.product.deletion" class="Thelia\Form\ProductModificationForm"/>
<form name="thelia.cart.add" class="Thelia\Form\CartAdd"/> <form name="thelia.cart.add" class="Thelia\Form\CartAdd"/>
<form name="thelia.order.delivery" class="Thelia\Form\OrderDelivery"/>
<form name="thelia.order.payment" class="Thelia\Form\OrderPayment"/>
<form name="thelia.admin.config.creation" class="Thelia\Form\ConfigCreationForm"/> <form name="thelia.admin.config.creation" class="Thelia\Form\ConfigCreationForm"/>
<form name="thelia.admin.config.modification" class="Thelia\Form\ConfigModificationForm"/> <form name="thelia.admin.config.modification" class="Thelia\Form\ConfigModificationForm"/>
@@ -201,6 +210,7 @@
<service id="smarty.plugin.security" class="Thelia\Core\Template\Smarty\Plugins\Security" scope="request"> <service id="smarty.plugin.security" class="Thelia\Core\Template\Smarty\Plugins\Security" scope="request">
<tag name="thelia.parser.register_plugin"/> <tag name="thelia.parser.register_plugin"/>
<argument type="service" id="request" />
<argument type="service" id="thelia.securityContext" /> <argument type="service" id="thelia.securityContext" />
</service> </service>

View File

@@ -56,17 +56,6 @@
<tag name="router.register" priority="0"/> <tag name="router.register" priority="0"/>
</service> </service>
<service id="router.install" class="%router.class%">
<argument type="service" id="router.xmlLoader"/>
<argument>install.xml</argument>
<argument type="collection">
<argument key="cache_dir">%kernel.cache_dir%</argument>
<argument key="debug">%kernel.debug%</argument>
</argument>
<argument type="service" id="request.context"/>
<tag name="router.register" priority="-1"/>
</service>
<service id="router.front" class="%router.class%"> <service id="router.front" class="%router.class%">
<argument type="service" id="router.xmlLoader"/> <argument type="service" id="router.xmlLoader"/>
<argument>front.xml</argument> <argument>front.xml</argument>

View File

@@ -95,11 +95,68 @@
<route id="admin.categories.update-position" path="/admin/categories/update-position"> <route id="admin.categories.update-position" path="/admin/categories/update-position">
<default key="_controller">Thelia\Controller\Admin\CategoryController::updatePositionAction</default> <default key="_controller">Thelia\Controller\Admin\CategoryController::updatePositionAction</default>
</route> </route>
<route id="admin.categories.related-content.add" path="/admin/categories/related-content/add">
<default key="_controller">Thelia\Controller\Admin\CategoryController::addRelatedContentAction</default>
</route>
<route id="admin.categories.related-content.delete" path="/admin/categories/related-content/delete">
<default key="_controller">Thelia\Controller\Admin\CategoryController::deleteRelatedContentAction</default>
</route>
<route id="admin.category.available-related-content" path="/admin/category/{categoryId}/available-related-content/{folderId}.{_format}" methods="GET">
<default key="_controller">Thelia\Controller\Admin\CategoryController::getAvailableRelatedContentAction</default>
<requirement key="_format">xml|json</requirement>
</route>
<route id="admin.category.ajax" path="/admin/catalog/category/parent/{parentId}.{_format}" methods="GET"> <route id="admin.category.ajax" path="/admin/catalog/category/parent/{parentId}.{_format}" methods="GET">
<default key="_controller">Thelia\Controller\Admin\CategoryController::getByParentIdAction</default> <default key="_controller">Thelia\Controller\Admin\CategoryController::getByParentIdAction</default>
<requirement key="_format">xml|json</requirement> <requirement key="_format">xml|json</requirement>
</route> </route>
<!-- Product Management -->
<route id="admin.products.default" path="/admin/products">
<default key="_controller">Thelia\Controller\Admin\ProductController::defaultAction</default>
</route>
<route id="admin.products.create" path="/admin/products/create">
<default key="_controller">Thelia\Controller\Admin\ProductController::createAction</default>
</route>
<route id="admin.products.update" path="/admin/products/update">
<default key="_controller">Thelia\Controller\Admin\ProductController::updateAction</default>
</route>
<route id="admin.products.save" path="/admin/products/save">
<default key="_controller">Thelia\Controller\Admin\ProductController::processUpdateAction</default>
</route>
<route id="admin.products.set-default" path="/admin/products/toggle-online">
<default key="_controller">Thelia\Controller\Admin\ProductController::setToggleVisibilityAction</default>
</route>
<route id="admin.products.delete" path="/admin/products/delete">
<default key="_controller">Thelia\Controller\Admin\ProductController::deleteAction</default>
</route>
<route id="admin.products.update-position" path="/admin/products/update-position">
<default key="_controller">Thelia\Controller\Admin\ProductController::updatePositionAction</default>
</route>
<route id="admin.products.related-content.add" path="/admin/products/related-content/add">
<default key="_controller">Thelia\Controller\Admin\ProductController::addRelatedContentAction</default>
</route>
<route id="admin.products.related-content.delete" path="/admin/products/related-content/delete">
<default key="_controller">Thelia\Controller\Admin\ProductController::deleteRelatedContentAction</default>
</route>
<route id="admin.product.available-related-content" path="/admin/product/{productId}/available-related-content/{folderId}.{_format}" methods="GET">
<default key="_controller">Thelia\Controller\Admin\ProductController::getAvailableRelatedContentAction</default>
<requirement key="_format">xml|json</requirement>
</route>
<!-- Route to the Coupon controller (process Coupon browsing) --> <!-- Route to the Coupon controller (process Coupon browsing) -->

View File

@@ -97,6 +97,7 @@
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default> <default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">cart</default> <default key="_view">cart</default>
</route> </route>
<route id="cart.add.process" path="/cart/add"> <route id="cart.add.process" path="/cart/add">
<default key="_controller">Thelia\Controller\Front\CartController::addItem</default> <default key="_controller">Thelia\Controller\Front\CartController::addItem</default>
</route> </route>
@@ -111,6 +112,26 @@
<default key="_view">cart</default> <default key="_view">cart</default>
</route> </route>
<route id="order.delivery.process" path="/order/delivery" methods="post">
<default key="_controller">Thelia\Controller\Front\OrderController::deliver</default>
<default key="_view">order_delivery</default>
</route>
<route id="order.delivery" path="/order/delivery">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">order_delivery</default>
</route>
<route id="order.invoice.process" path="/order/invoice" methods="post">
<default key="_controller">Thelia\Controller\Front\OrderController::pay</default>
<default key="_view">order_invoice</default>
</route>
<route id="order.invoice" path="/order/invoice">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">order_invoice</default>
</route>
<!-- end cart routes --> <!-- end cart routes -->
<!-- order management process --> <!-- order management process -->

View File

@@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<route id="install.step1" path="/install" >
<default key="_controller">Thelia\Controller\Install\InstallController::index</default>
</route>
<route id="install.step2" path="/install/step/2" >
<default key="_controller">Thelia\Controller\Install\InstallController::checkPermission</default>
</route>
<route id="install.step3" path="/install/step/3" >
<default key="_controller">Thelia\Controller\Install\InstallController::databaseConnection</default>
</route>
<route id="install.step4" path="/install/step/4" >
<default key="_controller">Thelia\Controller\Install\InstallController::databaseSelection</default>
</route>
<route id="install.step5" path="/install/step/5" >
<default key="_controller">Thelia\Controller\Install\InstallController::generalInformation</default>
</route>
<route id="install.step6" path="/install/thanks" >
<default key="_controller">Thelia\Controller\Install\InstallController::thanks</default>
</route>
</routes>

View File

@@ -224,7 +224,7 @@ abstract class AbstractCrudController extends BaseAdminController
* @param unknown $updateEvent the update event * @param unknown $updateEvent the update event
* @return Response a response, or null to continue normal processing * @return Response a response, or null to continue normal processing
*/ */
protected function performAdditionalUpdateAction($updateeEvent) protected function performAdditionalUpdateAction($updateEvent)
{ {
return null; return null;
} }

View File

@@ -32,6 +32,13 @@ use Thelia\Form\CategoryModificationForm;
use Thelia\Form\CategoryCreationForm; use Thelia\Form\CategoryCreationForm;
use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\Event\CategoryToggleVisibilityEvent; use Thelia\Core\Event\CategoryToggleVisibilityEvent;
use Thelia\Core\Event\CategoryDeleteContentEvent;
use Thelia\Core\Event\CategoryAddContentEvent;
use Thelia\Model\CategoryAssociatedContent;
use Thelia\Model\FolderQuery;
use Thelia\Model\ContentQuery;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Model\CategoryAssociatedContentQuery;
/** /**
* Manages categories * Manages categories
@@ -126,7 +133,7 @@ class CategoryController extends AbstractCrudController
'description' => $object->getDescription(), 'description' => $object->getDescription(),
'postscriptum' => $object->getPostscriptum(), 'postscriptum' => $object->getPostscriptum(),
'visible' => $object->getVisible(), 'visible' => $object->getVisible(),
'url' => $object->getRewritenUrl($this->getCurrentEditionLocale()), 'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
'parent' => $object->getParent() 'parent' => $object->getParent()
); );
@@ -152,31 +159,42 @@ class CategoryController extends AbstractCrudController
return $object->getId(); return $object->getId();
} }
protected function getEditionArguments()
{
return array(
'category_id' => $this->getRequest()->get('category_id', 0),
'folder_id' => $this->getRequest()->get('folder_id', 0),
'current_tab' => $this->getRequest()->get('current_tab', 'general')
);
}
protected function renderListTemplate($currentOrder) { protected function renderListTemplate($currentOrder) {
// Get product order
$product_order = $this->getListOrderFromSession('product', 'product_order', 'manual');
return $this->render('categories', return $this->render('categories',
array( array(
'category_order' => $currentOrder, 'category_order' => $currentOrder,
'product_order' => $product_order,
'category_id' => $this->getRequest()->get('category_id', 0) 'category_id' => $this->getRequest()->get('category_id', 0)
) ));
);
}
protected function renderEditionTemplate() {
return $this->render('category-edit', array('category_id' => $this->getRequest()->get('category_id', 0)));
}
protected function redirectToEditionTemplate() {
$this->redirectToRoute(
"admin.categories.update",
array('category_id' => $this->getRequest()->get('category_id', 0))
);
} }
protected function redirectToListTemplate() { protected function redirectToListTemplate() {
$this->redirectToRoute( $this->redirectToRoute(
'admin.categories.default', 'admin.categories.default',
array('category_id' => $this->getRequest()->get('category_id', 0)) array('category_id' => $this->getRequest()->get('category_id', 0))
); );
}
protected function renderEditionTemplate() {
return $this->render('category-edit', $this->getEditionArguments());
}
protected function redirectToEditionTemplate() {
$this->redirectToRoute("admin.categories.update", $this->getEditionArguments());
} }
/** /**
@@ -209,6 +227,18 @@ class CategoryController extends AbstractCrudController
); );
} }
protected function performAdditionalUpdateAction($updateEvent)
{
if ($this->getRequest()->get('save_mode') != 'stay') {
// Redirect to parent category list
$this->redirectToRoute(
'admin.categories.default',
array('category_id' => $updateEvent->getCategory()->getParent())
);
}
}
protected function performAdditionalUpdatePositionAction($event) protected function performAdditionalUpdatePositionAction($event)
{ {
@@ -224,4 +254,81 @@ class CategoryController extends AbstractCrudController
return null; return null;
} }
public function getAvailableRelatedContentAction($categoryId, $folderId) {
$result = array();
$folders = FolderQuery::create()->filterById($folderId)->find();
if ($folders !== null) {
$list = ContentQuery::create()
->joinWithI18n($this->getCurrentEditionLocale())
->filterByFolder($folders, Criteria::IN)
->filterById(CategoryAssociatedContentQuery::create()->select('content_id')->findByCategoryId($categoryId), Criteria::NOT_IN)
->find();
;
if ($list !== null) {
foreach($list as $item) {
$result[] = array('id' => $item->getId(), 'title' => $item->getTitle());
}
}
}
return $this->jsonResponse(json_encode($result));
}
public function addRelatedContentAction() {
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
$content_id = intval($this->getRequest()->get('content_id'));
if ($content_id > 0) {
$event = new CategoryAddContentEvent(
$this->getExistingObject(),
$content_id
);
try {
$this->dispatch(TheliaEvents::CATEGORY_ADD_CONTENT, $event);
}
catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
}
$this->redirectToEditionTemplate();
}
public function deleteRelatedContentAction() {
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
$content_id = intval($this->getRequest()->get('content_id'));
if ($content_id > 0) {
$event = new CategoryDeleteContentEvent(
$this->getExistingObject(),
$content_id
);
try {
$this->dispatch(TheliaEvents::CATEGORY_REMOVE_CONTENT, $event);
}
catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
}
$this->redirectToEditionTemplate();
}
} }

View File

@@ -0,0 +1,350 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
use Thelia\Core\Event\ProductDeleteEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\ProductUpdateEvent;
use Thelia\Core\Event\ProductCreateEvent;
use Thelia\Model\ProductQuery;
use Thelia\Form\ProductModificationForm;
use Thelia\Form\ProductCreationForm;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\Event\ProductToggleVisibilityEvent;
use Thelia\Core\Event\ProductDeleteContentEvent;
use Thelia\Core\Event\ProductAddContentEvent;
use Thelia\Model\ProductAssociatedContent;
use Thelia\Model\FolderQuery;
use Thelia\Model\ContentQuery;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Model\ProductAssociatedContentQuery;
/**
* Manages products
*
* @author Franck Allimant <franck@cqfdev.fr>
*/
class ProductController extends AbstractCrudController
{
public function __construct()
{
parent::__construct(
'product',
'manual',
'product_order',
'admin.products.default',
'admin.products.create',
'admin.products.update',
'admin.products.delete',
TheliaEvents::PRODUCT_CREATE,
TheliaEvents::PRODUCT_UPDATE,
TheliaEvents::PRODUCT_DELETE,
TheliaEvents::PRODUCT_TOGGLE_VISIBILITY,
TheliaEvents::PRODUCT_UPDATE_POSITION
);
}
protected function getCreationForm()
{
return new ProductCreationForm($this->getRequest());
}
protected function getUpdateForm()
{
return new ProductModificationForm($this->getRequest());
}
protected function getCreationEvent($formData)
{
$createEvent = new ProductCreateEvent();
$createEvent
->setTitle($formData['title'])
->setLocale($formData["locale"])
->setParent($formData['parent'])
->setVisible($formData['visible'])
;
return $createEvent;
}
protected function getUpdateEvent($formData)
{
$changeEvent = new ProductUpdateEvent($formData['id']);
// Create and dispatch the change event
$changeEvent
->setLocale($formData['locale'])
->setTitle($formData['title'])
->setChapo($formData['chapo'])
->setDescription($formData['description'])
->setPostscriptum($formData['postscriptum'])
->setVisible($formData['visible'])
->setUrl($formData['url'])
->setParent($formData['parent'])
;
return $changeEvent;
}
protected function createUpdatePositionEvent($positionChangeMode, $positionValue)
{
return new UpdatePositionEvent(
$this->getRequest()->get('product_id', null),
$positionChangeMode,
$positionValue
);
}
protected function getDeleteEvent()
{
return new ProductDeleteEvent($this->getRequest()->get('product_id', 0));
}
protected function eventContainsObject($event)
{
return $event->hasProduct();
}
protected function hydrateObjectForm($object)
{
// Prepare the data that will hydrate the form
$data = array(
'id' => $object->getId(),
'locale' => $object->getLocale(),
'title' => $object->getTitle(),
'chapo' => $object->getChapo(),
'description' => $object->getDescription(),
'postscriptum' => $object->getPostscriptum(),
'visible' => $object->getVisible(),
'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
'parent' => $object->getParent()
);
// Setup the object form
return new ProductModificationForm($this->getRequest(), "form", $data);
}
protected function getObjectFromEvent($event)
{
return $event->hasProduct() ? $event->getProduct() : null;
}
protected function getExistingObject()
{
return ProductQuery::create()
->joinWithI18n($this->getCurrentEditionLocale())
->findOneById($this->getRequest()->get('product_id', 0));
}
protected function getObjectLabel($object)
{
return $object->getTitle();
}
protected function getObjectId($object)
{
return $object->getId();
}
protected function getEditionArguments()
{
return array(
'product_id' => $this->getRequest()->get('product_id', 0),
'folder_id' => $this->getRequest()->get('folder_id', 0),
'current_tab' => $this->getRequest()->get('current_tab', 'general')
);
}
protected function renderListTemplate($currentOrder)
{
$this->getListOrderFromSession('product', 'product_order', 'manual');
return $this->render('categories',
array(
'product_order' => $currentOrder,
'product_id' => $this->getRequest()->get('product_id', 0)
));
}
protected function redirectToListTemplate()
{
// Redirect to the product default category list
$product = $this->getExistingObject();
$this->redirectToRoute(
'admin.products.default',
array('category_id' => $product != null ? $product->getDefaultCategory() : 0)
);
}
protected function renderEditionTemplate()
{
return $this->render('product-edit', $this->getEditionArguments());
}
protected function redirectToEditionTemplate()
{
$this->redirectToRoute("admin.products.update", $this->getEditionArguments());
}
/**
* Online status toggle product
*/
public function setToggleVisibilityAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
$event = new ProductToggleVisibilityEvent($this->getExistingObject());
try {
$this->dispatch(TheliaEvents::PRODUCT_TOGGLE_VISIBILITY, $event);
} catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
// Ajax response -> no action
return $this->nullResponse();
}
protected function performAdditionalDeleteAction($deleteEvent)
{
// Redirect to parent product list
$this->redirectToRoute(
'admin.products.default',
array('category_id' => $deleteEvent->getProduct()->getDefaultCategory())
);
}
protected function performAdditionalUpdateAction($updateEvent)
{
if ($this->getRequest()->get('save_mode') != 'stay') {
// Redirect to parent product list
$this->redirectToRoute(
'admin.categories.default',
array('category_id' => $product->getDefaultCategory())
);
}
}
protected function performAdditionalUpdatePositionAction($event)
{
$product = ProductQuery::create()->findPk($event->getObjectId());
if ($product != null) {
// Redirect to parent product list
$this->redirectToRoute(
'admin.categories.default',
array('category_id' => $product->getDefaultCategory())
);
}
return null;
}
public function getAvailableRelatedContentAction($productId, $folderId)
{
$result = array();
$folders = FolderQuery::create()->filterById($folderId)->find();
if ($folders !== null) {
$list = ContentQuery::create()
->joinWithI18n($this->getCurrentEditionLocale())
->filterByFolder($folders, Criteria::IN)
->filterById(ProductAssociatedContentQuery::create()->select('content_id')->findByProductId($productId), Criteria::NOT_IN)
->find();
;
if ($list !== null) {
foreach($list as $item) {
$result[] = array('id' => $item->getId(), 'title' => $item->getTitle());
}
}
}
return $this->jsonResponse(json_encode($result));
}
public function addRelatedContentAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
$content_id = intval($this->getRequest()->get('content_id'));
if ($content_id > 0) {
$event = new ProductAddContentEvent(
$this->getExistingObject(),
$content_id
);
try {
$this->dispatch(TheliaEvents::PRODUCT_ADD_CONTENT, $event);
}
catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
}
$this->redirectToEditionTemplate();
}
public function deleteRelatedContentAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
$content_id = intval($this->getRequest()->get('content_id'));
if ($content_id > 0) {
$event = new ProductDeleteContentEvent(
$this->getExistingObject(),
$content_id
);
try {
$this->dispatch(TheliaEvents::PRODUCT_REMOVE_CONTENT, $event);
}
catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
}
$this->redirectToEditionTemplate();
}
}

View File

@@ -31,6 +31,7 @@ use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
use Symfony\Component\Routing\Exception\RouteNotFoundException; use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\Routing\Router; use Symfony\Component\Routing\Router;
use Thelia\Core\Security\SecurityContext; use Thelia\Core\Security\SecurityContext;
use Thelia\Core\Translation\Translator;
use Thelia\Tools\URL; use Thelia\Tools\URL;
use Thelia\Tools\Redirect; use Thelia\Tools\Redirect;
use Thelia\Core\Template\ParserContext; use Thelia\Core\Template\ParserContext;
@@ -62,6 +63,14 @@ class BaseController extends ContainerAware
return new Response(); return new Response();
} }
/**
* Return a JSON response
*/
protected function jsonResponse($json_data)
{
return new Response($json_data, 200, array('content-type' => 'application/json'));
}
/** /**
* Dispatch a Thelia event * Dispatch a Thelia event
* *
@@ -89,7 +98,7 @@ class BaseController extends ContainerAware
* *
* return the Translator * return the Translator
* *
* @return mixed \Thelia\Core\Translation\Translator * @return Translator
*/ */
public function getTranslator() public function getTranslator()
{ {

View File

@@ -57,4 +57,22 @@ class BaseFrontController extends BaseController
$this->redirectToRoute("customer.login.view"); $this->redirectToRoute("customer.login.view");
} }
} }
protected function checkCartNotEmpty()
{
$cart = $this->getSession()->getCart();
if($cart===null || $cart->countCartItems() == 0) {
$this->redirectToRoute("cart.view");
}
}
protected function checkValidDelivery()
{
$order = $this->getSession()->getOrder();
if(null === $order || null === $order->chosenDeliveryAddress || null === $order->getDeliveryModuleId()) {
$this->redirectToRoute("order.delivery");
}
}
} }

View File

@@ -0,0 +1,197 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Controller\Front;
use Propel\Runtime\Exception\PropelException;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Core\Event\OrderEvent;
use Thelia\Core\Event\TheliaEvents;
use Symfony\Component\HttpFoundation\Request;
use Thelia\Form\OrderDelivery;
use Thelia\Form\OrderPayment;
use Thelia\Log\Tlog;
use Thelia\Model\AddressQuery;
use Thelia\Model\AreaDeliveryModuleQuery;
use Thelia\Model\CountryQuery;
use Thelia\Model\ModuleQuery;
use Thelia\Model\Order;
/**
* Class OrderController
* @package Thelia\Controller\Front
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*/
class OrderController extends BaseFrontController
{
/**
* set delivery address
* set delivery module
*/
public function deliver()
{
$this->checkAuth();
$this->checkCartNotEmpty();
$message = false;
$orderDelivery = new OrderDelivery($this->getRequest());
try {
$form = $this->validateForm($orderDelivery, "post");
$deliveryAddressId = $form->get("delivery-address")->getData();
$deliveryModuleId = $form->get("delivery-module")->getData();
$deliveryAddress = AddressQuery::create()->findPk($deliveryAddressId);
$deliveryModule = ModuleQuery::create()->findPk($deliveryModuleId);
/* check that the delivery address belongs to the current customer */
$deliveryAddress = AddressQuery::create()->findPk($deliveryAddressId);
if($deliveryAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) {
throw new \Exception("Delivery address does not belong to the current customer");
}
/* check that the delivery module fetches the delivery address area */
if(AreaDeliveryModuleQuery::create()
->filterByAreaId($deliveryAddress->getCountry()->getAreaId())
->filterByDeliveryModuleId($deliveryModuleId)
->count() == 0) {
throw new \Exception("Delivery module cannot be use with selected delivery address");
}
/* try to get postage amount */
$moduleReflection = new \ReflectionClass($deliveryModule->getFullNamespace());
if ($moduleReflection->isSubclassOf("Thelia\Module\DeliveryModuleInterface") === false) {
throw new \RuntimeException(sprintf("delivery module %s is not a Thelia\Module\DeliveryModuleInterface", $deliveryModule->getCode()));
}
$moduleInstance = $moduleReflection->newInstance();
$postage = $moduleInstance->getPostage($deliveryAddress->getCountry());
$orderEvent = $this->getOrderEvent();
$orderEvent->setDeliveryAddress($deliveryAddressId);
$orderEvent->setDeliveryModule($deliveryModuleId);
$orderEvent->setPostage($postage);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_ADDRESS, $orderEvent);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_MODULE, $orderEvent);
$this->redirectToRoute("order.invoice");
} catch (FormValidationException $e) {
$message = sprintf("Please check your input: %s", $e->getMessage());
} catch (PropelException $e) {
$this->getParserContext()->setGeneralError($e->getMessage());
} catch (\Exception $e) {
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
}
if ($message !== false) {
Tlog::getInstance()->error(sprintf("Error during order delivery process : %s. Exception was %s", $message, $e->getMessage()));
$orderDelivery->setErrorMessage($message);
$this->getParserContext()
->addForm($orderDelivery)
->setGeneralError($message)
;
}
}
/**
* set invoice address
* set payment module
*/
public function pay()
{
$this->checkAuth();
$this->checkCartNotEmpty();
$this->checkValidDelivery();
$message = false;
$orderPayment = new OrderPayment($this->getRequest());
try {
$form = $this->validateForm($orderPayment, "post");
$deliveryAddressId = $form->get("delivery-address")->getData();
$deliveryModuleId = $form->get("delivery-module")->getData();
/* check that the invoice address belongs to the current customer */
$deliveryAddress = AddressQuery::create()->findPk($deliveryAddressId);
if($deliveryAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) {
throw new \Exception("Invoice address does not belong to the current customer");
}
$orderEvent = $this->getOrderEvent();
$orderEvent->setInvoiceAddress($deliveryAddressId);
$orderEvent->setPaymentModule($deliveryModuleId);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_ADDRESS, $orderEvent);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_MODULE, $orderEvent);
$this->redirectToRoute("order.invoice");
} catch (FormValidationException $e) {
$message = sprintf("Please check your input: %s", $e->getMessage());
} catch (PropelException $e) {
$this->getParserContext()->setGeneralError($e->getMessage());
} catch (\Exception $e) {
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
}
if ($message !== false) {
Tlog::getInstance()->error(sprintf("Error during order delivery process : %s. Exception was %s", $message, $e->getMessage()));
$orderPayment->setErrorMessage($message);
$this->getParserContext()
->addForm($orderPayment)
->setGeneralError($message)
;
}
}
protected function getOrderEvent()
{
$order = $this->getOrder($this->getRequest());
return new OrderEvent($order);
}
public function getOrder(Request $request)
{
$session = $request->getSession();
if (null !== $order = $session->getOrder()) {
return $order;
}
$order = new Order();
$session->setOrder($order);
return $order;
}
}

View File

@@ -0,0 +1,94 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
class CachedFileEvent extends ActionEvent
{
/**
* @var string The complete file name (with path) of the source file
*/
protected $source_filepath = null;
/**
* @var string The target subdirectory in the cache
*/
protected $cache_subdirectory = null;
/**
* @var string The absolute URL of the cached file (in the web space)
*/
protected $file_url = null;
/**
* @var string The absolute path of the cached file
*/
protected $cache_filepath = null;
public function getFileUrl()
{
return $this->file_url;
}
public function setFileUrl($file_url)
{
$this->file_url = $file_url;
return $this;
}
public function getCacheFilepath()
{
return $this->cache_filepath;
}
public function setCacheFilepath($cache_filepath)
{
$this->cache_filepath = $cache_filepath;
return $this;
}
public function getSourceFilepath()
{
return $this->source_filepath;
}
public function setSourceFilepath($source_filepath)
{
$this->source_filepath = $source_filepath;
return $this;
}
public function getCacheSubdirectory()
{
return $this->cache_subdirectory;
}
public function setCacheSubdirectory($cache_subdirectory)
{
$this->cache_subdirectory = $cache_subdirectory;
return $this;
}
}

View File

@@ -0,0 +1,48 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
use Thelia\Model\Category;
class CategoryAddContentEvent extends CategoryEvent
{
protected $content_id;
public function __construct(Category $category, $content_id)
{
parent::__construct($category);
$this->content_id = $content_id;
}
public function getContentId()
{
return $this->content_id;
}
public function setContentId($content_id)
{
$this->content_id = $content_id;
}
}

View File

@@ -0,0 +1,48 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
use Thelia\Model\Category;
class CategoryDeleteContentEvent extends CategoryEvent
{
protected $content_id;
public function __construct(Category $category, $content_id)
{
parent::__construct($category);
$this->content_id = $content_id;
}
public function getContentId()
{
return $this->content_id;
}
public function setContentId($content_id)
{
$this->content_id = $content_id;
}
}

View File

@@ -21,39 +21,47 @@
/* */ /* */
/*************************************************************************************/ /*************************************************************************************/
namespace Thelia\Controller\Install; namespace Thelia\Core\Event;
use Symfony\Component\HttpFoundation\Response;
use Thelia\Controller\BaseController;
/** class DocumentEvent extends CachedFileEvent
* Class BaseInstallController
* @package Thelia\Controller\Install
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class BaseInstallController extends BaseController
{ {
protected $document_path;
protected $document_url;
/** /**
* @return a ParserInterface instance parser * @return the document file path
*/ */
protected function getParser() public function getDocumentPath()
{ {
$parser = $this->container->get("thelia.parser"); return $this->document_path;
// Define the template that shoud be used
$parser->setTemplate("install");
return $parser;
} }
public function render($templateName, $args = array()) /**
* @param string $document_path the document file path
*/
public function setDocumentPath($document_path)
{ {
return new Response($this->renderRaw($templateName, $args)); $this->document_path = $document_path;
return $this;
} }
public function renderRaw($templateName, $args = array()) /**
* @return the document URL
*/
public function getDocumentUrl()
{ {
$data = $this->getParser()->render($templateName, $args); return $this->document_url;
return $data;
} }
/**
* @param string $document_url the document URL
*/
public function setDocumentUrl($document_url)
{
$this->document_url = $document_url;
return $this;
}
} }

View File

@@ -23,22 +23,8 @@
namespace Thelia\Core\Event; namespace Thelia\Core\Event;
class ImageEvent extends ActionEvent class ImageEvent extends CachedFileEvent
{ {
/**
* @var string The complete file name (with path) of the source image
*/
protected $source_filepath = null;
/**
* @var string The target subdirectory in the image cache
*/
protected $cache_subdirectory = null;
/**
* @var string The absolute URL of the cached image (in the web space)
*/
protected $file_url = null;
/** /**
* @var string The absolute path of the cached image file * @var string The absolute path of the cached image file
*/ */
@@ -121,6 +107,8 @@ class ImageEvent extends ActionEvent
public function setCategory($category) public function setCategory($category)
{ {
$this->category = $category; $this->category = $category;
return $this;
} }
public function getWidth() public function getWidth()
@@ -131,6 +119,8 @@ class ImageEvent extends ActionEvent
public function setWidth($width) public function setWidth($width)
{ {
$this->width = $width; $this->width = $width;
return $this;
} }
public function getHeight() public function getHeight()
@@ -141,6 +131,8 @@ class ImageEvent extends ActionEvent
public function setHeight($height) public function setHeight($height)
{ {
$this->height = $height; $this->height = $height;
return $this;
} }
public function getResizeMode() public function getResizeMode()
@@ -151,6 +143,8 @@ class ImageEvent extends ActionEvent
public function setResizeMode($resize_mode) public function setResizeMode($resize_mode)
{ {
$this->resize_mode = $resize_mode; $this->resize_mode = $resize_mode;
return $this;
} }
public function getBackgroundColor() public function getBackgroundColor()
@@ -161,6 +155,8 @@ class ImageEvent extends ActionEvent
public function setBackgroundColor($background_color) public function setBackgroundColor($background_color)
{ {
$this->background_color = $background_color; $this->background_color = $background_color;
return $this;
} }
public function getEffects() public function getEffects()
@@ -171,6 +167,8 @@ class ImageEvent extends ActionEvent
public function setEffects(array $effects) public function setEffects(array $effects)
{ {
$this->effects = $effects; $this->effects = $effects;
return $this;
} }
public function getRotation() public function getRotation()
@@ -181,46 +179,8 @@ class ImageEvent extends ActionEvent
public function setRotation($rotation) public function setRotation($rotation)
{ {
$this->rotation = $rotation; $this->rotation = $rotation;
}
public function getFileUrl() return $this;
{
return $this->file_url;
}
public function setFileUrl($file_url)
{
$this->file_url = $file_url;
}
public function getCacheFilepath()
{
return $this->cache_filepath;
}
public function setCacheFilepath($cache_filepath)
{
$this->cache_filepath = $cache_filepath;
}
public function getSourceFilepath()
{
return $this->source_filepath;
}
public function setSourceFilepath($source_filepath)
{
$this->source_filepath = $source_filepath;
}
public function getCacheSubdirectory()
{
return $this->cache_subdirectory;
}
public function setCacheSubdirectory($cache_subdirectory)
{
$this->cache_subdirectory = $cache_subdirectory;
} }
public function getQuality() public function getQuality()
@@ -231,6 +191,8 @@ class ImageEvent extends ActionEvent
public function setQuality($quality) public function setQuality($quality)
{ {
$this->quality = $quality; $this->quality = $quality;
return $this;
} }
public function getOriginalFileUrl() public function getOriginalFileUrl()
@@ -241,6 +203,8 @@ class ImageEvent extends ActionEvent
public function setOriginalFileUrl($original_file_url) public function setOriginalFileUrl($original_file_url)
{ {
$this->original_file_url = $original_file_url; $this->original_file_url = $original_file_url;
return $this;
} }
public function getCacheOriginalFilepath() public function getCacheOriginalFilepath()
@@ -251,5 +215,7 @@ class ImageEvent extends ActionEvent
public function setCacheOriginalFilepath($cache_original_filepath) public function setCacheOriginalFilepath($cache_original_filepath)
{ {
$this->cache_original_filepath = $cache_original_filepath; $this->cache_original_filepath = $cache_original_filepath;
return $this;
} }
} }

View File

@@ -0,0 +1,140 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
use Thelia\Model\Order;
class OrderEvent extends ActionEvent
{
protected $order = null;
protected $invoiceAddress = null;
protected $deliveryAddress = null;
protected $deliveryModule = null;
protected $paymentModule = null;
protected $postage = null;
/**
* @param Order $order
*/
public function __construct(Order $order)
{
$this->setOrder($order);
}
/**
* @param Order $order
*/
public function setOrder(Order $order)
{
$this->order = $order;
}
/**
* @param $address
*/
public function setInvoiceAddress($address)
{
$this->deliveryAddress = $address;
}
/**
* @param $address
*/
public function setDeliveryAddress($address)
{
$this->deliveryAddress = $address;
}
/**
* @param $module
*/
public function setDeliveryModule($module)
{
$this->deliveryModule = $module;
}
/**
* @param $module
*/
public function setPaymentModule($module)
{
$this->paymentModule = $module;
}
/**
* @param $postage
*/
public function setPostage($postage)
{
$this->postage = $postage;
}
/**
* @return null|Order
*/
public function getOrder()
{
return $this->order;
}
/**
* @return null|int
*/
public function getInvoiceAddress()
{
return $this->invoiceAddress;
}
/**
* @return null|int
*/
public function getDeliveryAddress()
{
return $this->deliveryAddress;
}
/**
* @return null|int
*/
public function getDeliveryModule()
{
return $this->deliveryModule;
}
/**
* @return null|int
*/
public function getPaymentModule()
{
return $this->paymentModule;
}
/**
* @return null|int
*/
public function getPostage()
{
return $this->postage;
}
}

View File

@@ -0,0 +1,48 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
use Thelia\Model\Product;
class ProductAddContentEvent extends ProductEvent
{
protected $content_id;
public function __construct(Product $product, $content_id)
{
parent::__construct($product);
$this->content_id = $content_id;
}
public function getContentId()
{
return $this->content_id;
}
public function setContentId($content_id)
{
$this->content_id = $content_id;
}
}

View File

@@ -0,0 +1,80 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
class ProductCreateEvent extends ProductEvent
{
protected $title;
protected $parent;
protected $locale;
protected $visible;
public function getTitle()
{
return $this->title;
}
public function setTitle($title)
{
$this->title = $title;
return $this;
}
public function getParent()
{
return $this->parent;
}
public function setParent($parent)
{
$this->parent = $parent;
return $this;
}
public function getLocale()
{
return $this->locale;
}
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
public function getVisible()
{
return $this->visible;
}
public function setVisible($visible)
{
$this->visible = $visible;
return $this;
}
}

View File

@@ -0,0 +1,48 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
use Thelia\Model\Product;
class ProductDeleteContentEvent extends ProductEvent
{
protected $content_id;
public function __construct(Product $product, $content_id)
{
parent::__construct($product);
$this->content_id = $content_id;
}
public function getContentId()
{
return $this->content_id;
}
public function setContentId($content_id)
{
$this->content_id = $content_id;
}
}

View File

@@ -0,0 +1,44 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
class ProductDeleteEvent extends ProductEvent
{
public function __construct($product_id)
{
$this->product_id = $product_id;
}
public function getProductId()
{
return $this->product_id;
}
public function setProductId($product_id)
{
$this->product_id = $product_id;
return $this;
}
}

View File

@@ -0,0 +1,54 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
use Thelia\Model\Product;
use Thelia\Core\Event\ActionEvent;
class ProductEvent extends ActionEvent
{
public $product = null;
public function __construct(Product $product = null)
{
$this->product = $product;
}
public function hasProduct()
{
return ! is_null($this->product);
}
public function getProduct()
{
return $this->product;
}
public function setProduct(Product $product)
{
$this->product = $product;
return $this;
}
}

View File

@@ -0,0 +1,28 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
class ProductToggleVisibilityEvent extends ProductEvent
{
}

View File

@@ -0,0 +1,113 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
class ProductUpdateEvent extends ProductCreateEvent
{
protected $product_id;
protected $chapo;
protected $description;
protected $postscriptum;
protected $url;
protected $parent;
public function __construct($product_id)
{
$this->product_id = $product_id;
}
public function getProductId()
{
return $this->product_id;
}
public function setProductId($product_id)
{
$this->product_id = $product_id;
return $this;
}
public function getChapo()
{
return $this->chapo;
}
public function setChapo($chapo)
{
$this->chapo = $chapo;
return $this;
}
public function getDescription()
{
return $this->description;
}
public function setDescription($description)
{
$this->description = $description;
return $this;
}
public function getPostscriptum()
{
return $this->postscriptum;
}
public function setPostscriptum($postscriptum)
{
$this->postscriptum = $postscriptum;
return $this;
}
public function getUrl()
{
return $this->url;
}
public function setUrl($url)
{
$this->url = $url;
return $this;
}
public function getParent()
{
return $this->parent;
}
public function setParent($parent)
{
$this->parent = $parent;
return $this;
}
}

View File

@@ -153,6 +153,9 @@ final class TheliaEvents
const CATEGORY_TOGGLE_VISIBILITY = "action.toggleCategoryVisibility"; const CATEGORY_TOGGLE_VISIBILITY = "action.toggleCategoryVisibility";
const CATEGORY_UPDATE_POSITION = "action.updateCategoryPosition"; const CATEGORY_UPDATE_POSITION = "action.updateCategoryPosition";
const CATEGORY_ADD_CONTENT = "action.categoryAddContent";
const CATEGORY_REMOVE_CONTENT = "action.categoryRemoveContent";
const BEFORE_CREATECATEGORY = "action.before_createcategory"; const BEFORE_CREATECATEGORY = "action.before_createcategory";
const AFTER_CREATECATEGORY = "action.after_createcategory"; const AFTER_CREATECATEGORY = "action.after_createcategory";
@@ -162,6 +165,26 @@ final class TheliaEvents
const BEFORE_UPDATECATEGORY = "action.before_updateCategory"; const BEFORE_UPDATECATEGORY = "action.before_updateCategory";
const AFTER_UPDATECATEGORY = "action.after_updateCategory"; const AFTER_UPDATECATEGORY = "action.after_updateCategory";
// -- Product management -----------------------------------------------
const PRODUCT_CREATE = "action.createProduct";
const PRODUCT_UPDATE = "action.updateProduct";
const PRODUCT_DELETE = "action.deleteProduct";
const PRODUCT_TOGGLE_VISIBILITY = "action.toggleProductVisibility";
const PRODUCT_UPDATE_POSITION = "action.updateProductPosition";
const PRODUCT_ADD_CONTENT = "action.productAddContent";
const PRODUCT_REMOVE_CONTENT = "action.productRemoveContent";
const BEFORE_CREATEPRODUCT = "action.before_createproduct";
const AFTER_CREATEPRODUCT = "action.after_createproduct";
const BEFORE_DELETEPRODUCT = "action.before_deleteproduct";
const AFTER_DELETEPRODUCT = "action.after_deleteproduct";
const BEFORE_UPDATEPRODUCT = "action.before_updateProduct";
const AFTER_UPDATEPRODUCT = "action.after_updateProduct";
/** /**
* sent when a new existing cat id duplicated. This append when current customer is different from current cart * sent when a new existing cat id duplicated. This append when current customer is different from current cart
*/ */
@@ -189,13 +212,25 @@ final class TheliaEvents
const CART_DELETEITEM = "action.deleteArticle"; const CART_DELETEITEM = "action.deleteArticle";
/**
* Order linked event
*/
const ORDER_SET_BILLING_ADDRESS = "action.order.setBillingAddress";
const ORDER_SET_DELIVERY_ADDRESS = "action.order.setDeliveryAddress";
const ORDER_SET_DELIVERY_MODULE = "action.order.setDeliveryModule";
/** /**
* Sent on image processing * Sent on image processing
*/ */
const IMAGE_PROCESS = "action.processImage"; const IMAGE_PROCESS = "action.processImage";
/** /**
* Sent on cimage cache clear request * Sent on document processing
*/
const DOCUMENT_PROCESS = "action.processDocument";
/**
* Sent on image cache clear request
*/ */
const IMAGE_CLEAR_CACHE = "action.clearImageCache"; const IMAGE_CLEAR_CACHE = "action.clearImageCache";

View File

@@ -28,8 +28,10 @@ use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Router;
use Thelia\Core\Template\Exception\ResourceNotFoundException; use Thelia\Core\Template\Exception\ResourceNotFoundException;
use Thelia\Core\Template\ParserInterface; use Thelia\Core\Template\ParserInterface;
use Thelia\Exception\OrderException;
use Thelia\Tools\Redirect; use Thelia\Tools\Redirect;
use Thelia\Tools\URL; use Thelia\Tools\URL;
use Thelia\Core\Security\Exception\AuthenticationException; use Thelia\Core\Security\Exception\AuthenticationException;
@@ -87,6 +89,19 @@ class ViewListener implements EventSubscriberInterface
// Redirect to the login template // Redirect to the login template
Redirect::exec($this->container->get('thelia.url.manager')->viewUrl($ex->getLoginTemplate())); Redirect::exec($this->container->get('thelia.url.manager')->viewUrl($ex->getLoginTemplate()));
} catch (OrderException $e) {
switch($e->getCode()) {
case OrderException::CART_EMPTY:
// Redirect to the cart template
Redirect::exec($this->container->get('router.chainRequest')->generate($e->cartRoute, $e->arguments, Router::ABSOLUTE_URL));
break;
case OrderException::UNDEFINED_DELIVERY:
// Redirect to the delivery choice template
Redirect::exec($this->container->get('router.chainRequest')->generate($e->orderDeliveryRoute, $e->arguments, Router::ABSOLUTE_URL));
break;
}
throw $e;
} }
} }

View File

@@ -29,6 +29,7 @@ use Thelia\Exception\InvalidCartException;
use Thelia\Model\CartQuery; use Thelia\Model\CartQuery;
use Thelia\Model\Cart; use Thelia\Model\Cart;
use Thelia\Model\Currency; use Thelia\Model\Currency;
use Thelia\Model\Order;
use Thelia\Tools\URL; use Thelia\Tools\URL;
use Thelia\Model\Lang; use Thelia\Model\Lang;
@@ -43,6 +44,8 @@ use Thelia\Model\Lang;
class Session extends BaseSession class Session extends BaseSession
{ {
/** /**
* @param bool $forceDefault
*
* @return \Thelia\Model\Lang|null * @return \Thelia\Model\Lang|null
*/ */
public function getLang($forceDefault = true) public function getLang($forceDefault = true)
@@ -205,22 +208,22 @@ class Session extends BaseSession
return $this; return $this;
} }
/** // -- Order ------------------------------------------------------------------
* assign delivery id in session
*
* @param $delivery_id public function setOrder(Order $order)
* @return $this
*/
public function setDelivery($delivery_id)
{ {
$this->set("thelia.delivery_id", $delivery_id); $this->set("thelia.order", $order);
return $this; return $this;
} }
public function getDelivery() /**
* @return Order
*/
public function getOrder()
{ {
return $this->get("thelia.delivery_id"); return $this->get("thelia.order");
} }

View File

@@ -128,7 +128,7 @@ class RewritingRouter implements RouterInterface, RequestMatcherInterface
*/ */
public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
{ {
// TODO: Implement generate() method. throw new RouteNotFoundException();
} }
/** /**

View File

@@ -54,7 +54,13 @@ class Address extends BaseLoop
protected function getArgDefinitions() protected function getArgDefinitions()
{ {
return new ArgumentCollection( return new ArgumentCollection(
Argument::createIntListTypeArgument('id'), new Argument(
'id',
new TypeCollection(
new Type\IntListType(),
new Type\EnumType(array('*', 'any'))
)
),
new Argument( new Argument(
'customer', 'customer',
new TypeCollection( new TypeCollection(
@@ -63,8 +69,14 @@ class Address extends BaseLoop
), ),
'current' 'current'
), ),
Argument::createBooleanTypeArgument('default'), Argument::createBooleanOrBothTypeArgument('default'),
Argument::createIntListTypeArgument('exclude') new Argument(
'exclude',
new TypeCollection(
new Type\IntListType(),
new Type\EnumType(array('none'))
)
)
); );
} }
@@ -79,7 +91,7 @@ class Address extends BaseLoop
$id = $this->getId(); $id = $this->getId();
if (null !== $id) { if (null !== $id && !in_array($id, array('*', 'any'))) {
$search->filterById($id, Criteria::IN); $search->filterById($id, Criteria::IN);
} }
@@ -106,7 +118,7 @@ class Address extends BaseLoop
$exclude = $this->getExclude(); $exclude = $this->getExclude();
if (!is_null($exclude)) { if (null !== $exclude && 'none' !== $exclude) {
$search->filterById($exclude, Criteria::NOT_IN); $search->filterById($exclude, Criteria::NOT_IN);
} }

View File

@@ -53,8 +53,12 @@ class AssociatedContent extends Content
{ {
$argumentCollection = parent::getArgDefinitions(); $argumentCollection = parent::getArgDefinitions();
$argumentCollection->addArgument(Argument::createIntTypeArgument('product')) $argumentCollection
->addArgument(Argument::createIntTypeArgument('category')); ->addArgument(Argument::createIntTypeArgument('product'))
->addArgument(Argument::createIntTypeArgument('category'))
->addArgument(Argument::createIntTypeArgument('exclude_product'))
->addArgument(Argument::createIntTypeArgument('exclude_category'))
;
$argumentCollection->get('order')->default = "associated_content"; $argumentCollection->get('order')->default = "associated_content";
@@ -91,6 +95,28 @@ class AssociatedContent extends Content
$search->filterByCategoryId($category, Criteria::EQUAL); $search->filterByCategoryId($category, Criteria::EQUAL);
} }
$exclude_product = $this->getExcludeProduct();
// If we have to filter by template, find all attributes assigned to this template, and filter by found IDs
if (null !== $exclude_product) {
// Exclure tous les attribut qui sont attachés aux templates indiqués
$search->filterById(
ProductAssociatedContentQuery::create()->filterByProductId($exclude_product)->select('product_id')->find(),
Criteria::NOT_IN
);
}
$exclude_category = $this->getExcludeCategory();
// If we have to filter by template, find all attributes assigned to this template, and filter by found IDs
if (null !== $exclude_category) {
// Exclure tous les attribut qui sont attachés aux templates indiqués
$search->filterById(
CategoryAssociatedContentQuery::create()->filterByProductId($exclude_category)->select('category_id')->find(),
Criteria::NOT_IN
);
}
$order = $this->getOrder(); $order = $this->getOrder();
$orderByAssociatedContent = array_search('associated_content', $order); $orderByAssociatedContent = array_search('associated_content', $order);
$orderByAssociatedContentReverse = array_search('associated_content_reverse', $order); $orderByAssociatedContentReverse = array_search('associated_content_reverse', $order);

View File

@@ -29,7 +29,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\ModuleQuery; use Thelia\Model\ModuleQuery;
/** /**
* Class Delivery
* @package Thelia\Core\Template\Loop * @package Thelia\Core\Template\Loop
* @author Manuel Raynaud <mraynaud@openstudio.fr> * @author Manuel Raynaud <mraynaud@openstudio.fr>
*/ */
@@ -93,6 +92,8 @@ class BaseSpecificModule extends BaseI18nLoop
{ {
$search = ModuleQuery::create(); $search = ModuleQuery::create();
$search->filterByActivate(1);
if (null !== $id = $this->getId()) { if (null !== $id = $this->getId()) {
$search->filterById($id); $search->filterById($id);
} }

View File

@@ -13,6 +13,7 @@ use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\CountryQuery;
class Cart extends BaseLoop class Cart extends BaseLoop
{ {
@@ -82,7 +83,7 @@ class Cart extends BaseLoop
foreach ($cartItems as $cartItem) { foreach ($cartItems as $cartItem) {
$product = $cartItem->getProduct(); $product = $cartItem->getProduct();
//$product->setLocale($this->request->getSession()->getLocale()); $productSaleElement = $cartItem->getProductSaleElements();
$loopResultRow = new LoopResultRow($result, $cartItem, $this->versionable, $this->timestampable, $this->countable); $loopResultRow = new LoopResultRow($result, $cartItem, $this->versionable, $this->timestampable, $this->countable);
@@ -92,6 +93,17 @@ class Cart extends BaseLoop
$loopResultRow->set("QUANTITY", $cartItem->getQuantity()); $loopResultRow->set("QUANTITY", $cartItem->getQuantity());
$loopResultRow->set("PRICE", $cartItem->getPrice()); $loopResultRow->set("PRICE", $cartItem->getPrice());
$loopResultRow->set("PRODUCT_ID", $product->getId()); $loopResultRow->set("PRODUCT_ID", $product->getId());
$loopResultRow->set("PRODUCT_URL", $product->getUrl($this->request->getSession()->getLang()->getLocale()))
->set("STOCK", $productSaleElement->getQuantity())
->set("PRICE", $cartItem->getPrice())
->set("PROMO_PRICE", $cartItem->getPromoPrice())
->set("TAXED_PRICE", $cartItem->getTaxedPrice(
CountryQuery::create()->findOneById(64) // @TODO : make it magic
))
->set("PROMO_TAXED_PRICE", $cartItem->getTaxedPromoPrice(
CountryQuery::create()->findOneById(64) // @TODO : make it magic
))
->set("IS_PROMO", $cartItem->getPromo() === 1 ? 1 : 0);
$result->addRow($loopResultRow); $result->addRow($loopResultRow);
} }

View File

@@ -61,6 +61,7 @@ class Content extends BaseI18nLoop
return new ArgumentCollection( return new ArgumentCollection(
Argument::createIntListTypeArgument('id'), Argument::createIntListTypeArgument('id'),
Argument::createIntListTypeArgument('folder'), Argument::createIntListTypeArgument('folder'),
Argument::createIntListTypeArgument('folder_default'),
Argument::createBooleanTypeArgument('current'), Argument::createBooleanTypeArgument('current'),
Argument::createBooleanTypeArgument('current_folder'), Argument::createBooleanTypeArgument('current_folder'),
Argument::createIntTypeArgument('depth', 1), Argument::createIntTypeArgument('depth', 1),
@@ -97,9 +98,20 @@ class Content extends BaseI18nLoop
} }
$folder = $this->getFolder(); $folder = $this->getFolder();
$folderDefault = $this->getFolderDefault();
if (!is_null($folder)) { if (!is_null($folder) || !is_null($folderDefault)) {
$folders = FolderQuery::create()->filterById($folder, Criteria::IN)->find();
$foldersIds = array();
if (!is_array($folder)) {
$folder = array();
}
if (!is_array($folderDefault)) {
$folderDefault = array();
}
$foldersIds = array_merge($foldersIds, $folder, $folderDefault);
$folders =FolderQuery::create()->filterById($foldersIds, Criteria::IN)->find();
$depth = $this->getDepth(); $depth = $this->getDepth();
@@ -164,12 +176,12 @@ class Content extends BaseI18nLoop
$search->addDescendingOrderByColumn('i18n_TITLE'); $search->addDescendingOrderByColumn('i18n_TITLE');
break; break;
case "manual": case "manual":
if(null === $folder || count($folder) != 1) if(null === $foldersIds || count($foldersIds) != 1)
throw new \InvalidArgumentException('Manual order cannot be set without single folder argument'); throw new \InvalidArgumentException('Manual order cannot be set without single folder argument');
$search->orderByPosition(Criteria::ASC); $search->orderByPosition(Criteria::ASC);
break; break;
case "manual_reverse": case "manual_reverse":
if(null === $folder || count($folder) != 1) if(null === $foldersIds || count($foldersIds) != 1)
throw new \InvalidArgumentException('Manual order cannot be set without single folder argument'); throw new \InvalidArgumentException('Manual order cannot be set without single folder argument');
$search->orderByPosition(Criteria::DESC); $search->orderByPosition(Criteria::DESC);
break; break;

View File

@@ -87,7 +87,7 @@ class Country extends BaseI18nLoop
if (true === $withArea) { if (true === $withArea) {
$search->filterByAreaId(null, Criteria::ISNOTNULL); $search->filterByAreaId(null, Criteria::ISNOTNULL);
} elseif (false == $withArea) { } elseif (false === $withArea) {
$search->filterByAreaId(null, Criteria::ISNULL); $search->filterByAreaId(null, Criteria::ISNULL);
} }

View File

@@ -22,9 +22,12 @@
/*************************************************************************************/ /*************************************************************************************/
namespace Thelia\Core\Template\Loop; namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\CountryQuery;
use Thelia\Module\BaseModule;
/** /**
* Class Delivery * Class Delivery
@@ -50,6 +53,19 @@ class Delivery extends BaseSpecificModule
$search = parent::exec($pagination); $search = parent::exec($pagination);
/* manage translations */ /* manage translations */
$locale = $this->configureI18nProcessing($search); $locale = $this->configureI18nProcessing($search);
$search->filterByType(BaseModule::DELIVERY_MODULE_TYPE, Criteria::EQUAL);
$countryId = $this->getCountry();
if(null !== $countryId) {
$country = CountryQuery::create()->findPk($countryId);
if(null === $country) {
throw new \InvalidArgumentException('Cannot found country id: `' . $countryId . '` in delivery loop');
}
} else {
$country = CountryQuery::create()->findOneByByDefault(1);
}
/* perform search */ /* perform search */
$deliveryModules = $this->search($search, $pagination); $deliveryModules = $this->search($search, $pagination);
@@ -73,7 +89,7 @@ class Delivery extends BaseSpecificModule
->set('CHAPO', $deliveryModule->getVirtualColumn('i18n_CHAPO')) ->set('CHAPO', $deliveryModule->getVirtualColumn('i18n_CHAPO'))
->set('DESCRIPTION', $deliveryModule->getVirtualColumn('i18n_DESCRIPTION')) ->set('DESCRIPTION', $deliveryModule->getVirtualColumn('i18n_DESCRIPTION'))
->set('POSTSCRIPTUM', $deliveryModule->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set('POSTSCRIPTUM', $deliveryModule->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set('PRICE', $moduleInstance->calculate($this->getCountry())) ->set('POSTAGE', $moduleInstance->getPostage($country))
; ;
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);

View File

@@ -0,0 +1,277 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Event\DocumentEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Type\TypeCollection;
use Thelia\Type\EnumListType;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Type\EnumType;
use Thelia\Log\Tlog;
/**
* The document loop
*
* @author Franck Allimant <franck@cqfdev.fr>
*/
class Document extends BaseI18nLoop
{
public $timestampable = true;
/**
* @var array Possible document sources
*/
protected $possible_sources = array('category', 'product', 'folder', 'content');
/**
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
*/
protected function getArgDefinitions()
{
$collection = new ArgumentCollection(
Argument::createIntListTypeArgument('id'),
Argument::createIntListTypeArgument('exclude'),
new Argument(
'order',
new TypeCollection(
new EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual-reverse', 'random'))
),
'manual'
),
Argument::createIntTypeArgument('lang'),
Argument::createIntTypeArgument('category'),
Argument::createIntTypeArgument('product'),
Argument::createIntTypeArgument('folder'),
Argument::createIntTypeArgument('content'),
new Argument(
'source',
new TypeCollection(
new EnumType($this->possible_sources)
)
),
Argument::createIntTypeArgument('source_id')
);
// Add possible document sources
foreach ($this->possible_sources as $source) {
$collection->addArgument(Argument::createIntTypeArgument($source));
}
return $collection;
}
/**
* Dynamically create the search query, and set the proper filter and order
*
* @param string $source a valid source identifier (@see $possible_sources)
* @param int $object_id the source object ID
* @return ModelCriteria the propel Query object
*/
protected function createSearchQuery($source, $object_id)
{
$object = ucfirst($source);
$queryClass = sprintf("\Thelia\Model\%sDocumentQuery", $object);
$filterMethod = sprintf("filterBy%sId", $object);
// xxxDocumentQuery::create()
$method = new \ReflectionMethod($queryClass, 'create');
$search = $method->invoke(null); // Static !
// $query->filterByXXX(id)
if (! is_null($object_id)) {
$method = new \ReflectionMethod($queryClass, $filterMethod);
$method->invoke($search, $object_id);
}
$orders = $this->getOrder();
// Results ordering
foreach ($orders as $order) {
switch ($order) {
case "alpha":
$search->addAscendingOrderByColumn('i18n_TITLE');
break;
case "alpha-reverse":
$search->addDescendingOrderByColumn('i18n_TITLE');
break;
case "manual-reverse":
$search->orderByPosition(Criteria::DESC);
break;
case "manual":
$search->orderByPosition(Criteria::ASC);
break;
case "random":
$search->clearOrderByColumns();
$search->addAscendingOrderByColumn('RAND()');
break(2);
break;
}
}
return $search;
}
/**
* Dynamically create the search query, and set the proper filter and order
*
* @param string $object_type (returned) the a valid source identifier (@see $possible_sources)
* @param string $object_id (returned) the ID of the source object
* @return ModelCriteria the propel Query object
*/
protected function getSearchQuery(&$object_type, &$object_id)
{
$search = null;
// Check form source="product" source_id="123" style arguments
$source = $this->getSource();
if (! is_null($source)) {
$source_id = $this->getSourceId();
$id = $this->getId();
// echo "source = ".$this->getSource().", id=".$source_id." - ".$this->getArg('source_id')->getValue()."<br />";
if (is_null($source_id) && is_null($id)) {
throw new \InvalidArgumentException("If 'source' argument is specified, 'id' or 'source_id' argument should be specified");
}
$search = $this->createSearchQuery($source, $source_id);
$object_type = $source;
$object_id = $source_id;
} else {
// Check for product="id" folder="id", etc. style arguments
foreach ($this->possible_sources as $source) {
$argValue = intval($this->getArgValue($source));
if ($argValue > 0) {
$search = $this->createSearchQuery($source, $argValue);
$object_type = $source;
$object_id = $argValue;
break;
}
}
}
if ($search == null)
throw new \InvalidArgumentException(sprintf("Unable to find document source. Valid sources are %s", implode(',', $this->possible_sources)));
return $search;
}
/**
* @param unknown $pagination
*/
public function exec(&$pagination)
{
// Select the proper query to use, and get the object type
$object_type = $object_id = null;
$search = $this->getSearchQuery($object_type, $object_id);
/* manage translations */
$locale = $this->configureI18nProcessing($search);
$id = $this->getId();
if (! is_null($id)) {
$search->filterById($id, Criteria::IN);
}
$exclude = $this->getExclude();
if (!is_null($exclude))
$search->filterById($exclude, Criteria::NOT_IN);
// Create document processing event
$event = new DocumentEvent($this->request);
// echo "sql=".$search->toString();
$results = $this->search($search, $pagination);
$loopResult = new LoopResult($results);
foreach ($results as $result) {
// Create document processing event
$event = new DocumentEvent($this->request);
// Put source document file path
$source_filepath = sprintf("%s%s/%s/%s",
THELIA_ROOT,
ConfigQuery::read('documents_library_path', 'local/media/documents'),
$object_type,
$result->getFile()
);
$event->setSourceFilepath($source_filepath);
$event->setCacheSubdirectory($object_type);
try {
// Dispatch document processing event
$this->dispatcher->dispatch(TheliaEvents::DOCUMENT_PROCESS, $event);
$loopResultRow = new LoopResultRow($loopResult, $result, $this->versionable, $this->timestampable, $this->countable);
$loopResultRow
->set("ID" , $result->getId())
->set("LOCALE" ,$locale)
->set("DOCUMENT_URL" , $event->getFileUrl())
->set("DOCUMENT_PATH" , $event->getCacheFilepath())
->set("ORIGINAL_DOCUMENT_PATH", $source_filepath)
->set("TITLE" , $result->getVirtualColumn('i18n_TITLE'))
->set("CHAPO" , $result->getVirtualColumn('i18n_CHAPO'))
->set("DESCRIPTION" , $result->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM" , $result->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("POSITION" , $result->getPosition())
->set("OBJECT_TYPE" , $object_type)
->set("OBJECT_ID" , $object_id)
;
$loopResult->addRow($loopResultRow);
}
catch (\Exception $ex) {
// Ignore the result and log an error
Tlog::getInstance()->addError("Failed to process document in document loop: ", $this->args);
}
}
return $loopResult;
}
}

View File

@@ -123,8 +123,10 @@ class Image extends BaseI18nLoop
$search = $method->invoke(null); // Static ! $search = $method->invoke(null); // Static !
// $query->filterByXXX(id) // $query->filterByXXX(id)
$method = new \ReflectionMethod($queryClass, $filterMethod); if (! is_null($object_id)) {
$method->invoke($search, $object_id); $method = new \ReflectionMethod($queryClass, $filterMethod);
$method->invoke($search, $object_id);
}
$orders = $this->getOrder(); $orders = $this->getOrder();
@@ -171,11 +173,12 @@ class Image extends BaseI18nLoop
if (! is_null($source)) { if (! is_null($source)) {
$source_id = $this->getSourceId(); $source_id = $this->getSourceId();
$id = $this->getId();
// echo "source = ".$this->getSource().", id=".$source_id." - ".$this->getArg('source_id')->getValue()."<br />"; //echo "source = ".$this->getSource()."source_id=$source_id, id=$id<br />";
if (is_null($source_id)) { if (is_null($source_id) && is_null($id)) {
throw new \InvalidArgumentException("'source_id' argument cannot be null if 'source' argument is specified."); throw new \InvalidArgumentException("If 'source' argument is specified, 'id' or 'source_id' argument should be specified");
} }
$search = $this->createSearchQuery($source, $source_id); $search = $this->createSearchQuery($source, $source_id);
@@ -259,14 +262,13 @@ class Image extends BaseI18nLoop
} }
// echo "sql=".$search->toString(); //echo "sql=".$search->toString();
$results = $this->search($search, $pagination); $results = $this->search($search, $pagination);
$loopResult = new LoopResult($results); $loopResult = new LoopResult($results);
foreach ($results as $result) { foreach ($results as $result) {
// Create image processing event // Create image processing event
$event = new ImageEvent($this->request); $event = new ImageEvent($this->request);
@@ -282,7 +284,7 @@ class Image extends BaseI18nLoop
// Put source image file path // Put source image file path
$source_filepath = sprintf("%s%s/%s/%s", $source_filepath = sprintf("%s%s/%s/%s",
THELIA_ROOT, THELIA_ROOT,
ConfigQuery::read('documents_library_path', 'local/media/images'), ConfigQuery::read('images_library_path', 'local/media/images'),
$object_type, $object_type,
$result->getFile() $result->getFile()
); );

View File

@@ -0,0 +1,84 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Module\BaseModule;
/**
* Class Payment
* @package Thelia\Core\Template\Loop
* @author Etienne Roudeix <eroudeix@gmail.com>
*/
class Payment extends BaseSpecificModule
{
public function getArgDefinitions()
{
$collection = parent::getArgDefinitions();
return $collection;
}
public function exec(&$pagination)
{
$search = parent::exec($pagination);
/* manage translations */
$locale = $this->configureI18nProcessing($search);
$search->filterByType(BaseModule::PAYMENT_MODULE_TYPE, Criteria::EQUAL);
/* perform search */
$paymentModules = $this->search($search, $pagination);
$loopResult = new LoopResult($paymentModules);
foreach ($paymentModules as $paymentModule) {
$loopResultRow = new LoopResultRow($loopResult, $paymentModule, $this->versionable, $this->timestampable, $this->countable);
$moduleReflection = new \ReflectionClass($paymentModule->getFullNamespace());
if ($moduleReflection->isSubclassOf("Thelia\Module\PaymentModuleInterface") === false) {
throw new \RuntimeException(sprintf("payment module %s is not a Thelia\Module\PaymentModuleInterface", $paymentModule->getCode()));
}
$moduleInstance = $moduleReflection->newInstance();
$moduleInstance->setRequest($this->request);
$moduleInstance->setDispatcher($this->dispatcher);
$loopResultRow
->set('ID', $paymentModule->getId())
->set('TITLE', $paymentModule->getVirtualColumn('i18n_TITLE'))
->set('CHAPO', $paymentModule->getVirtualColumn('i18n_CHAPO'))
->set('DESCRIPTION', $paymentModule->getVirtualColumn('i18n_DESCRIPTION'))
->set('POSTSCRIPTUM', $paymentModule->getVirtualColumn('i18n_POSTSCRIPTUM'))
;
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

View File

@@ -73,6 +73,7 @@ class Product extends BaseI18nLoop
) )
), ),
Argument::createIntListTypeArgument('category'), Argument::createIntListTypeArgument('category'),
Argument::createIntListTypeArgument('category_default'),
Argument::createBooleanTypeArgument('new'), Argument::createBooleanTypeArgument('new'),
Argument::createBooleanTypeArgument('promo'), Argument::createBooleanTypeArgument('promo'),
Argument::createFloatTypeArgument('min_price'), Argument::createFloatTypeArgument('min_price'),
@@ -88,7 +89,7 @@ class Product extends BaseI18nLoop
new Argument( new Argument(
'order', 'order',
new TypeCollection( new TypeCollection(
new Type\EnumListType(array('alpha', 'alpha_reverse', 'min_price', 'max_price', 'manual', 'manual_reverse', 'ref', 'promo', 'new', 'random', 'given_id')) new Type\EnumListType(array('id', 'id_reverse', 'alpha', 'alpha_reverse', 'min_price', 'max_price', 'manual', 'manual_reverse', 'ref', 'promo', 'new', 'random', 'given_id'))
), ),
'alpha' 'alpha'
), ),
@@ -170,9 +171,20 @@ class Product extends BaseI18nLoop
} }
$category = $this->getCategory(); $category = $this->getCategory();
$categoryDefault = $this->getCategoryDefault();
if (!is_null($category)) { if (!is_null($category) ||!is_null($categoryDefault)) {
$categories = CategoryQuery::create()->filterById($category, Criteria::IN)->find();
$categoryIds = array();
if (!is_array($category)) {
$category = array();
}
if (!is_array($categoryDefault)) {
$categoryDefault = array();
}
$categoryIds = array_merge($categoryIds, $category, $categoryDefault);
$categories =CategoryQuery::create()->filterById($categoryIds, Criteria::IN)->find();
$depth = $this->getDepth(); $depth = $this->getDepth();
@@ -527,6 +539,12 @@ class Product extends BaseI18nLoop
foreach ($orders as $order) { foreach ($orders as $order) {
switch ($order) { switch ($order) {
case "id":
$search->orderById(Criteria::ASC);
break;
case "id_reverse":
$search->orderById(Criteria::DESC);
break;
case "alpha": case "alpha":
$search->addAscendingOrderByColumn('i18n_TITLE'); $search->addAscendingOrderByColumn('i18n_TITLE');
break; break;
@@ -540,12 +558,12 @@ class Product extends BaseI18nLoop
$search->addDescendingOrderByColumn('real_lowest_price'); $search->addDescendingOrderByColumn('real_lowest_price');
break; break;
case "manual": case "manual":
if(null === $category || count($category) != 1) if(null === $categoryIds || count($categoryIds) != 1)
throw new \InvalidArgumentException('Manual order cannot be set without single category argument'); throw new \InvalidArgumentException('Manual order cannot be set without single category argument');
$search->orderByPosition(Criteria::ASC); $search->orderByPosition(Criteria::ASC);
break; break;
case "manual_reverse": case "manual_reverse":
if(null === $category || count($category) != 1) if(null === $categoryIds || count($categoryIds) != 1)
throw new \InvalidArgumentException('Manual order cannot be set without single category argument'); throw new \InvalidArgumentException('Manual order cannot be set without single category argument');
$search->orderByPosition(Criteria::DESC); $search->orderByPosition(Criteria::DESC);
break; break;

View File

@@ -115,7 +115,7 @@ class ProductSaleElements extends BaseLoop
$currencyId = $this->getCurrency(); $currencyId = $this->getCurrency();
if (null !== $currencyId) { if (null !== $currencyId) {
$currency = CurrencyQuery::create()->findOneById($currencyId); $currency = CurrencyQuery::create()->findPk($currencyId);
if (null === $currency) { if (null === $currency) {
throw new \InvalidArgumentException('Cannot found currency id: `' . $currency . '` in product_sale_elements loop'); throw new \InvalidArgumentException('Cannot found currency id: `' . $currency . '` in product_sale_elements loop');
} }

View File

@@ -31,6 +31,7 @@ use Thelia\Core\Template\ParserContext;
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor; use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
use Thelia\Model\CategoryQuery; use Thelia\Model\CategoryQuery;
use Thelia\Model\ContentQuery; use Thelia\Model\ContentQuery;
use Thelia\Model\CountryQuery;
use Thelia\Model\CurrencyQuery; use Thelia\Model\CurrencyQuery;
use Thelia\Model\FolderQuery; use Thelia\Model\FolderQuery;
use Thelia\Model\Product; use Thelia\Model\Product;
@@ -154,25 +155,58 @@ class DataAccessFunctions extends AbstractSmartyPlugin
} }
} }
public function countryDataAccess($params, $smarty)
{
$defaultCountry = CountryQuery::create()->findOneByByDefault(1);
switch($params["attr"]) {
case "default":
return $defaultCountry->getId();
}
}
public function cartDataAccess($params, $smarty) public function cartDataAccess($params, $smarty)
{ {
$cart = $this->getCart($this->request); $cart = $this->getCart($this->request);
$result = ""; $result = "";
switch($params["attr"]) { switch($params["attr"]) {
case "count_item": case "count_item":
$result = $cart->getCartItems()->count(); $result = $cart->getCartItems()->count();
break; break;
case "total_price":
$result = $cart->getTotalAmount();
break;
case "total_taxed_price":
$result = $cart->getTaxedAmount(
CountryQuery::create()->findOneById(64) // @TODO : make it magic
);
break;
} }
return $result; return $result;
} }
public function orderDataAccess($params, &$smarty)
{
$order = $this->request->getSession()->getOrder();
$attribute = $this->getNormalizedParam($params, array('attribute', 'attrib', 'attr'));
switch($attribute) {
case 'postage':
return $order->getPostage();
case 'delivery_address':
return $order->chosenDeliveryAddress;
}
throw new \InvalidArgumentException(sprintf("%s has no '%s' attribute", 'Order', $attribute));
}
/** /**
* Lang global data * Lang global data
* *
* @param $params * @param $params
* @param $smarty * @param $smarty
*
* @return string
*/ */
public function langDataAccess($params, $smarty) public function langDataAccess($params, $smarty)
{ {
@@ -271,6 +305,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
*/ */
public function getPluginDescriptors() public function getPluginDescriptors()
{ {
return array( return array(
new SmartyPluginDescriptor('function', 'admin', $this, 'adminDataAccess'), new SmartyPluginDescriptor('function', 'admin', $this, 'adminDataAccess'),
new SmartyPluginDescriptor('function', 'customer', $this, 'customerDataAccess'), new SmartyPluginDescriptor('function', 'customer', $this, 'customerDataAccess'),
@@ -279,8 +314,10 @@ class DataAccessFunctions extends AbstractSmartyPlugin
new SmartyPluginDescriptor('function', 'content', $this, 'contentDataAccess'), new SmartyPluginDescriptor('function', 'content', $this, 'contentDataAccess'),
new SmartyPluginDescriptor('function', 'folder', $this, 'folderDataAccess'), new SmartyPluginDescriptor('function', 'folder', $this, 'folderDataAccess'),
new SmartyPluginDescriptor('function', 'currency', $this, 'currencyDataAccess'), new SmartyPluginDescriptor('function', 'currency', $this, 'currencyDataAccess'),
new SmartyPluginDescriptor('function', 'country', $this, 'countryDataAccess'),
new SmartyPluginDescriptor('function', 'lang', $this, 'langDataAccess'), new SmartyPluginDescriptor('function', 'lang', $this, 'langDataAccess'),
new SmartyPluginDescriptor('function', 'cart', $this, 'cartDataAccess'), new SmartyPluginDescriptor('function', 'cart', $this, 'cartDataAccess'),
new SmartyPluginDescriptor('function', 'order', $this, 'orderDataAccess'),
); );
} }
} }

View File

@@ -23,18 +23,22 @@
namespace Thelia\Core\Template\Smarty\Plugins; namespace Thelia\Core\Template\Smarty\Plugins;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor; use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Core\Security\SecurityContext; use Thelia\Core\Security\SecurityContext;
use Thelia\Core\Security\Exception\AuthenticationException; use Thelia\Core\Security\Exception\AuthenticationException;
use Thelia\Exception\OrderException;
class Security extends AbstractSmartyPlugin class Security extends AbstractSmartyPlugin
{ {
protected $request;
private $securityContext; private $securityContext;
public function __construct(SecurityContext $securityContext) public function __construct(Request $request, SecurityContext $securityContext)
{ {
$this->securityContext = $securityContext; $this->securityContext = $securityContext;
$this->request = $request;
} }
/** /**
@@ -43,32 +47,53 @@ class Security extends AbstractSmartyPlugin
* @param array $params * @param array $params
* @param unknown $smarty * @param unknown $smarty
* @return string no text is returned. * @return string no text is returned.
* @throws \Thelia\Core\Security\Exception\AuthenticationException
*/ */
public function checkAuthFunction($params, &$smarty) public function checkAuthFunction($params, &$smarty)
{ {
$roles = $this->_explode($this->getParam($params, 'roles')); $roles = $this->_explode($this->getParam($params, 'roles'));
$permissions = $this->_explode($this->getParam($params, 'permissions')); $permissions = $this->_explode($this->getParam($params, 'permissions'));
if (! $this->securityContext->isGranted($roles, $permissions)) { if (! $this->securityContext->isGranted($roles, $permissions)) {
$ex = new AuthenticationException( $ex = new AuthenticationException(
sprintf("User not granted for roles '%s', permissions '%s' in context '%s'.", sprintf("User not granted for roles '%s', permissions '%s' in context '%s'.",
implode(',', $roles), implode(',', $permissions), $context implode(',', $roles), implode(',', $permissions), $context
) )
); );
$loginTpl = $this->getParam($params, 'login_tpl'); $loginTpl = $this->getParam($params, 'login_tpl');
if (null != $loginTpl) { if (null != $loginTpl) {
$ex->setLoginTemplate($loginTpl); $ex->setLoginTemplate($loginTpl);
} }
throw $ex; throw $ex;
} }
return ''; return '';
} }
public function checkCartNotEmptyFunction($params, &$smarty)
{
$cart = $this->request->getSession()->getCart();
if($cart===null || $cart->countCartItems() == 0) {
throw new OrderException('Cart must not be empty', OrderException::CART_EMPTY, array('empty' => 1));
}
return "";
}
public function checkValidDeliveryFunction($params, &$smarty)
{
$order = $this->request->getSession()->getOrder();
if(null === $order || null === $order->chosenDeliveryAddress || null === $order->getDeliveryModuleId()) {
throw new OrderException('Delivery must be defined', OrderException::UNDEFINED_DELIVERY, array('missing' => 1));
}
return "";
}
/** /**
* Define the various smarty plugins handled by this class * Define the various smarty plugins handled by this class
* *
@@ -77,7 +102,9 @@ class Security extends AbstractSmartyPlugin
public function getPluginDescriptors() public function getPluginDescriptors()
{ {
return array( return array(
new SmartyPluginDescriptor('function', 'check_auth', $this, 'checkAuthFunction') new SmartyPluginDescriptor('function', 'check_auth', $this, 'checkAuthFunction'),
new SmartyPluginDescriptor('function', 'check_cart_not_empty', $this, 'checkCartNotEmptyFunction'),
new SmartyPluginDescriptor('function', 'check_valid_delivery', $this, 'checkValidDeliveryFunction'),
); );
} }
} }

View File

@@ -86,6 +86,8 @@ class Thelia extends Kernel
$serviceContainer->setLogger('defaultLogger', \Thelia\Log\Tlog::getInstance()); $serviceContainer->setLogger('defaultLogger', \Thelia\Log\Tlog::getInstance());
$con->useDebug(true); $con->useDebug(true);
} }
} }
/** /**

View File

@@ -0,0 +1,36 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Exception;
use Thelia\Log\Tlog;
class DocumentException extends \RuntimeException
{
public function __construct($message, $code = null, $previous = null)
{
Tlog::getInstance()->addError($message);
parent::__construct($message, $code, $previous);
}
}

View File

@@ -0,0 +1,52 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Exception;
class OrderException extends \RuntimeException
{
/**
* @var string The cart template name
*/
public $cartRoute = "cart.view";
public $orderDeliveryRoute = "order.delivery";
public $arguments = array();
const UNKNOWN_EXCEPTION = 0;
const CART_EMPTY = 100;
const UNDEFINED_DELIVERY = 200;
public function __construct($message, $code = null, $arguments = array(), $previous = null)
{
if(is_array($arguments)) {
$this->arguments = $arguments;
}
if ($code === null) {
$code = self::UNKNOWN_EXCEPTION;
}
parent::__construct($message, $code, $previous);
}
}

View File

@@ -43,15 +43,18 @@ class CategoryCreationForm extends BaseForm
"label" => Translator::getInstance()->trans("Parent category *"), "label" => Translator::getInstance()->trans("Parent category *"),
"constraints" => array( "constraints" => array(
new NotBlank() new NotBlank()
) ),
"label_attr" => array("for" => "parent_create")
)) ))
->add("locale", "text", array( ->add("locale", "text", array(
"constraints" => array( "constraints" => array(
new NotBlank() new NotBlank()
) ),
"label_attr" => array("for" => "locale_create")
)) ))
->add("visible", "integer", array( ->add("visible", "integer", array(
"label" => Translator::getInstance()->trans("This category is online on the front office.") "label" => Translator::getInstance()->trans("This category is online."),
"label_attr" => array("for" => "visible_create")
)) ))
; ;
} }

View File

@@ -39,7 +39,8 @@ class CategoryModificationForm extends CategoryCreationForm
->add("url", "text", array( ->add("url", "text", array(
"label" => Translator::getInstance()->trans("Rewriten URL *"), "label" => Translator::getInstance()->trans("Rewriten URL *"),
"constraints" => array(new NotBlank()) "constraints" => array(new NotBlank()),
"label_attr" => array("for" => "rewriten_url")
)) ))
; ;

View File

@@ -0,0 +1,111 @@
<?php
/**********************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/**********************************************************************************/
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Symfony\Component\Validator\Constraints\NotBlank;
/**
* Created by JetBrains PhpStorm.
* Date: 8/29/13
* Time: 3:45 PM
*
* Allow to build a form Install Step 3 Database connection
*
* @package Coupon
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class InstallStep3Form extends BaseForm
{
/**
* Build Coupon form
*
* @return void
*/
protected function buildForm()
{
$this->formBuilder
->add(
'host',
'text',
array(
'constraints' => array(
new NotBlank()
)
)
)
->add(
'user',
'text',
array(
'constraints' => array(
new NotBlank()
)
)
)
->add(
'password',
'text',
array(
'constraints' => array(
new NotBlank()
)
)
)
->add(
'port',
'text',
array(
'constraints' => array(
new NotBlank(),
new GreaterThan(
array(
'value' => 0
)
)
)
)
)
->add(
'locale',
'hidden',
array(
'constraints' => array(
new NotBlank()
)
)
);
}
/**
* Get form name
*
* @return string
*/
public function getName()
{
return 'thelia_install_step3';
}
}

View File

@@ -0,0 +1,94 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Model\AddressQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Translation\Translator;
use Thelia\Model\ModuleQuery;
use Thelia\Module\BaseModule;
/**
* Class OrderDelivery
* @package Thelia\Form
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*/
class OrderDelivery extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add("delivery-address", "integer", array(
"required" => true,
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Callback(array(
"methods" => array(
array($this, "verifyDeliveryAddress")
)
))
)
))
->add("delivery-module", "integer", array(
"required" => true,
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Callback(array(
"methods" => array(
array($this, "verifyDeliveryModule")
)
))
)
));
}
public function verifyDeliveryAddress($value, ExecutionContextInterface $context)
{
$address = AddressQuery::create()
->findPk($value);
if(null === $address) {
$context->addViolation("Address ID not found");
}
}
public function verifyDeliveryModule($value, ExecutionContextInterface $context)
{
$module = ModuleQuery::create()
->filterByType(BaseModule::DELIVERY_MODULE_TYPE)
->filterByActivate(1)
->filterById($value)
->find();
if(null === $module) {
$context->addViolation("Delivery module ID not found");
}
}
public function getName()
{
return "thelia_order_delivery";
}
}

View File

@@ -0,0 +1,94 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Model\AddressQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Translation\Translator;
use Thelia\Model\ModuleQuery;
use Thelia\Module\BaseModule;
/**
* Class OrderPayment
* @package Thelia\Form
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*/
class OrderPayment extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add("invoice-address", "integer", array(
"required" => true,
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Callback(array(
"methods" => array(
array($this, "verifyInvoiceAddress")
)
))
)
))
->add("payment-module", "integer", array(
"required" => true,
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Callback(array(
"methods" => array(
array($this, "verifyPaymentModule")
)
))
)
));
}
public function verifyInvoiceAddress($value, ExecutionContextInterface $context)
{
$address = AddressQuery::create()
->findPk($value);
if(null === $address) {
$context->addViolation("Address ID not found");
}
}
public function verifyPaymentModule($value, ExecutionContextInterface $context)
{
$module = ModuleQuery::create()
->filterByType(BaseModule::PAYMENT_MODULE_TYPE)
->filterByActivate(1)
->filterById($value)
->find();
if(null === $module) {
$context->addViolation("Payment module ID not found");
}
}
public function getName()
{
return "thelia_order_payment";
}
}

View File

@@ -47,7 +47,7 @@ class ProductCreationForm extends BaseForm
"for" => "title" "for" => "title"
) )
)) ))
->add("parent", "integer", array( ->add("default_category", "integer", array(
"constraints" => array( "constraints" => array(
new NotBlank() new NotBlank()
) )
@@ -57,7 +57,11 @@ class ProductCreationForm extends BaseForm
new NotBlank() new NotBlank()
) )
)) ))
; ->add("visible", "integer", array(
"label" => Translator::getInstance()->trans("This product is online."),
"label_attr" => array("for" => "visible_create")
))
;
} }
public function getName() public function getName()

View File

@@ -0,0 +1,64 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Thelia\Core\Translation\Translator;
use Symfony\Component\Validator\Constraints\NotBlank;
class ProductModificationForm extends ProductCreationForm
{
use StandardDescriptionFieldsTrait;
protected function buildForm()
{
parent::buildForm(true);
$this->formBuilder
->add("id", "integer", array(
"label" => Translator::getInstance()->trans("Prodcut ID *"),
"label_attr" => array("for" => "product_id_field"),
"constraints" => array(new GreaterThan(array('value' => 0)))
))
->add("template_id", "integer", array(
"label" => Translator::getInstance()->trans("Product template"),
"label_attr" => array("for" => "product_template_field")
))
->add("url", "text", array(
"label" => Translator::getInstance()->trans("Rewriten URL *"),
"constraints" => array(new NotBlank()),
"label_attr" => array("for" => "rewriten_url_field")
))
;
// Add standard description fields, excluding title and locale, which a re defined in parent class
$this->addStandardDescFields(array('title', 'locale'));
}
public function getName()
{
return "thelia_product_modification";
}
}

View File

@@ -58,7 +58,8 @@ trait StandardDescriptionFieldsTrait
"label" => Translator::getInstance()->trans("Title"), "label" => Translator::getInstance()->trans("Title"),
"label_attr" => array( "label_attr" => array(
"for" => "title" "for" => "title"
) ),
"label_attr" => array("for" => "title_field")
) )
); );
@@ -67,7 +68,7 @@ trait StandardDescriptionFieldsTrait
->add("chapo", "text", array( ->add("chapo", "text", array(
"label" => Translator::getInstance()->trans("Summary"), "label" => Translator::getInstance()->trans("Summary"),
"label_attr" => array( "label_attr" => array(
"for" => "summary" "for" => "summary_field"
) )
)); ));
@@ -76,7 +77,7 @@ trait StandardDescriptionFieldsTrait
->add("description", "text", array( ->add("description", "text", array(
"label" => Translator::getInstance()->trans("Detailed description"), "label" => Translator::getInstance()->trans("Detailed description"),
"label_attr" => array( "label_attr" => array(
"for" => "detailed_description" "for" => "detailed_description_field"
) )
)); ));
@@ -85,7 +86,7 @@ trait StandardDescriptionFieldsTrait
->add("postscriptum", "text", array( ->add("postscriptum", "text", array(
"label" => Translator::getInstance()->trans("Conclusion"), "label" => Translator::getInstance()->trans("Conclusion"),
"label_attr" => array( "label_attr" => array(
"for" => "conclusion" "for" => "conclusion_field"
) )
)); ));
} }

View File

@@ -25,19 +25,33 @@ use Thelia\Install\Exception\AlreadyInstallException;
/** /**
* Class BaseInstall * Class BaseInstall
*
* @author Manuel Raynaud <mraynaud@openstudio.fr> * @author Manuel Raynaud <mraynaud@openstudio.fr>
*/ */
abstract class BaseInstall abstract class BaseInstall
{ {
/** @var bool If Installation wizard is launched by CLI */
protected $isConsoleMode = true;
/** /**
* Verify if an installation already exists * Constructor
*
* @param bool $verifyInstall Verify if an installation already exists
*
* @throws Exception\AlreadyInstallException
*/ */
public function __construct($verifyInstall = true) public function __construct($verifyInstall = true)
{ {
/* TODO : activate this part
// Check if install wizard is launched via CLI
if (php_sapi_name() == 'cli') {
$this->isConsoleMode = true;
} else {
$this->isConsoleMode = false;
}
if (file_exists(THELIA_ROOT . '/local/config/database.yml') && $verifyInstall) { if (file_exists(THELIA_ROOT . '/local/config/database.yml') && $verifyInstall) {
throw new AlreadyInstallException("Thelia is already installed"); throw new AlreadyInstallException("Thelia is already installed");
}*/ }
$this->exec(); $this->exec();

View File

@@ -0,0 +1,122 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Install;
use PDO;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use Symfony\Component\Translation\TranslatorInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Install\Exception\InstallException;
/**
* Class CheckDatabaseConnection
*
* Take care of integration tests (database connection)
*
* @package Thelia\Install
* @author Manuel Raynaud <mraynaud@openstudio.fr>
* @author Guillaume MOREL <gmorel@openstudio.fr>
*/
class CheckDatabaseConnection extends BaseInstall
{
protected $validationMessages = array();
/** @var bool If permissions are OK */
protected $isValid = true;
/** @var TranslatorInterface Translator Service */
protected $translator = null;
/** @var string Database host information */
protected $host = null;
/** @var string Database user information */
protected $user = null;
/** @var string Database password information */
protected $password = null;
/** @var int Database port information */
protected $port = null;
/**
* @var \PDO instance
*/
protected $connection = null;
/**
* Constructor
*
* @param string $host Database host information
* @param string $user Database user information
* @param string $password Database password information
* @param int $port Database port information
* @param bool $verifyInstall If verify install
* @param Translator $translator Translator Service
* necessary for install wizard
*/
public function __construct($host, $user, $password, $port, $verifyInstall = true, Translator $translator = null)
{
$this->host = $host;
$this->user = $user;
$this->password = $password;
$this->port = $port;
parent::__construct($verifyInstall);
}
/**
* Perform database connection check
*
* @return bool
*/
public function exec()
{
$dsn = "mysql:host=%s;port=%s";
try {
$this->connection = new \PDO(
sprintf($dsn, $this->host, $this->port),
$this->user,
$this->password
);
} catch (\PDOException $e) {
$this->validationMessages = 'Wrong connection information';
$this->isValid = false;
}
return $this->isValid;
}
public function getConnection()
{
return $this->connection;
}
}

View File

@@ -23,56 +23,364 @@
namespace Thelia\Install; namespace Thelia\Install;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use Symfony\Component\Translation\TranslatorInterface;
use Thelia\Core\Translation\Translator;
/** /**
* Class CheckPermission * Class CheckPermission
*
* Take care of integration tests (files permissions)
*
* @package Thelia\Install * @package Thelia\Install
* @author Manuel Raynaud <mraynaud@openstudio.fr> * @author Manuel Raynaud <mraynaud@openstudio.fr>
* @author Guillaume MOREL <gmorel@openstudio.fr>
*/ */
class CheckPermission extends BaseInstall class CheckPermission extends BaseInstall
{ {
const CONF = "const";
const LOG = "log";
const CACHE = "cache";
private $directories = array(); const DIR_CONF = 'local/config';
private $validation = array(); const DIR_LOG = 'log';
private $valid = true; const DIR_CACHE = 'cache';
public function __construct($verifyInstall = true) /** @var array Directory needed to be writable */
protected $directoriesToBeWritable = array(
self::DIR_CONF,
self::DIR_LOG,
self::DIR_CACHE,
);
/** @var array Minimum server configuration necessary */
protected $minServerConfigurationNecessary = array(
'memory_limit' => 134217728,
'post_max_size' => 20971520,
'upload_max_filesize' => 2097152
);
protected $validationMessages = array();
/** @var bool If permissions are OK */
protected $isValid = true;
/** @var TranslatorInterface Translator Service */
protected $translator = null;
/**
* Constructor
*
* @param bool $verifyInstall If verify install
* @param Translator $translator Translator Service
* necessary for install wizard
*/
public function __construct($verifyInstall = true, Translator $translator = null)
{ {
$this->translator = $translator;
$this->validationMessages['php_version'] = array(
$this->directories = array( 'text' => $this->getI18nPhpVersionText('5.4', phpversion(), true),
self::CONF => THELIA_ROOT . "local/config", 'hint' => $this->getI18nPhpVersionHint(),
self::LOG => THELIA_ROOT . "log", 'status' => true
self::CACHE => THELIA_ROOT . "cache"
); );
$this->validation = array( foreach ($this->directoriesToBeWritable as $directory) {
self::CONF => array( $this->validationMessages[$directory] = array(
"text" => sprintf("config directory(%s)...", $this->directories[self::CONF]), 'text' => '',
"status" => true 'hint' => '',
), 'status' => true
self::LOG => array( );
"text" => sprintf("cache directory(%s)...", $this->directories[self::LOG]), }
"status" => true foreach ($this->minServerConfigurationNecessary as $key => $value) {
), $this->validationMessages[$key] = array(
self::CACHE => array( 'text' => '',
"text" => sprintf("log directory(%s)...", $this->directories[self::CACHE]), 'hint' => $this->getI18nConfigHint(),
"status" => true 'status' => true
) );
); }
parent::__construct($verifyInstall); parent::__construct($verifyInstall);
} }
/**
* Perform file permission check
*
* @return bool
*/
public function exec() public function exec()
{ {
foreach ($this->directories as $key => $directory) { if (version_compare(phpversion(), '5.4', '<')) {
if(is_writable($directory) === false) { $this->validationMessages['php_version'] = $this->getI18nPhpVersionText('5.4', phpversion(), false);
$this->valid = false; }
$this->validation[$key]["status"] = false;
foreach ($this->directoriesToBeWritable as $directory) {
$fullDirectory = THELIA_ROOT . $directory;
$this->validationMessages[$directory]['text'] = $this->getI18nDirectoryText($fullDirectory, true);
if (is_writable($fullDirectory) === false) {
if (!$this->makeDirectoryWritable($fullDirectory)) {
$this->isValid = false;
$this->validationMessages[$directory]['status'] = false;
$this->validationMessages[$directory]['text'] = $this->getI18nDirectoryText($fullDirectory, false);
$this->validationMessages[$directory]['hint'] = $this->getI18nDirectoryHint($fullDirectory);
}
} }
} }
foreach ($this->minServerConfigurationNecessary as $key => $value) {
$this->validationMessages[$key]['text'] = $this->getI18nConfigText($key, $this->formatBytes($value), ini_get($key), true);
if (!$this->verifyServerMemoryValues($key, $value)) {
$this->isValid = false;
$this->validationMessages[$key]['status'] = false;
$this->validationMessages[$key]['text'] = $this->getI18nConfigText($key, $this->formatBytes($value), ini_get($key), false);;
}
}
return $this->isValid;
} }
}
/**
* Get validation messages
*
* @return array
*/
public function getValidationMessages()
{
return $this->validationMessages;
}
/**
* Make a directory writable (recursively)
*
* @param string $directory path to directory
*
* @return bool
*/
protected function makeDirectoryWritable($directory)
{
chmod($directory, 0777);
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($directory)
);
foreach ($iterator as $item) {
chmod($item, 0777);
}
return (is_writable(THELIA_ROOT . $directory) === true);
}
/**
* Get Translated text about the directory state
*
* @param string $directory Directory being checked
* @param bool $isValid If directory permission is valid
*
* @return string
*/
protected function getI18nDirectoryText($directory, $isValid)
{
if ($this->translator !== null) {
if ($isValid) {
$sentence = 'Your directory <strong>%directory%</strong> is writable';
} else {
$sentence = 'Your directory <strong>%directory%</strong> is not writable';
}
$translatedText = $this->translator->trans(
$sentence,
array(
'%directory%' => $directory
),
'install-wizard'
);
} else {
$translatedText = sprintf('Your directory %s needs to be writable', $directory);
}
return $translatedText;
}
/**
* Get Translated hint about the directory state
*
* @param string $directory Directory being checked
*
* @return string
*/
protected function getI18nDirectoryHint($directory)
{
if ($this->translator !== null) {
$sentence = '<span class="label label-primary">chmod 777 %directory%</span> on your server with admin rights could help';
$translatedText = $this->translator->trans(
$sentence,
array(
'%directory%' => $directory
),
'install-wizard'
);
} else {
$translatedText = sprintf('chmod 777 %s on your server with admin rights could help', $directory);
}
return $translatedText;
}
/**
* Get Translated text about the directory state
* Not usable with CLI
*
* @param string $key .ini file key
* @param string $expectedValue Expected server value
* @param string $currentValue Actual server value
* @param bool $isValid If server configuration is valid
*
* @return string
*/
protected function getI18nConfigText($key, $expectedValue, $currentValue, $isValid)
{
if ($isValid) {
$sentence = 'Your <span class="label label-primary">%key%</span> server configuration (currently %currentValue%) is well enough to run Thelia2 (%expectedValue% needed)';
} else {
$sentence = 'Your <span class="label label-primary">%key%</span> server configuration (currently %currentValue%) is not sufficient enough in order to run Thelia2 (%expectedValue% needed)';
}
$translatedText = $this->translator->trans(
$sentence,
array(
'%key%' => $key,
'%expectedValue%' => $expectedValue,
'%currentValue%' => $currentValue,
),
'install-wizard'
);
return $translatedText;
}
/**
* Get Translated hint about the config requirement issue
*
* @return string
*/
protected function getI18nConfigHint()
{
$sentence = 'Modifying this value on your server <span class="label label-primary">php.ini</span> file with admin rights could help';
$translatedText = $this->translator->trans(
$sentence,
array(),
'install-wizard'
);
return $translatedText;
}
/**
* Get Translated hint about the PHP version requirement issue
*
* @param string $expectedValue
* @param string $currentValue
* @param bool $isValid
*
* @return string
*/
protected function getI18nPhpVersionText($expectedValue, $currentValue, $isValid)
{
if ($this->translator !== null) {
if ($isValid) {
$sentence = 'Your PHP version <span class="label label-primary">%currentValue%</span> is well enough to run Thelia2 (%expectedValue% needed)';
} else {
$sentence = 'Your PHP version <span class="label label-primary">%currentValue%</span> is not sufficient enough to run Thelia2 (%expectedValue% needed)';
}
$translatedText = $this->translator->trans(
$sentence,
array(
'%expectedValue%' => $expectedValue,
'%currentValue%' => $currentValue,
),
'install-wizard'
);
} else {
$translatedText = sprintf('Thelia needs at least PHP %s (%s currently)', $expectedValue, $currentValue);
}
return $translatedText;
}
/**
* Get Translated hint about the config requirement issue
*
* @return string
*/
protected function getI18nPhpVersionHint()
{
$sentence = 'Upgrading your version of PHP with admin rights could help';
$translatedText = $this->translator->trans(
$sentence,
array(),
'install-wizard'
);
return $translatedText;
}
/**
* Check if a server memory value is met or not
*
* @param string $key .ini file key
* @param int $necessaryValueInBytes Expected value in bytes
*
* @return bool
*/
protected function verifyServerMemoryValues($key, $necessaryValueInBytes)
{
$serverValueInBytes = $this->returnBytes(ini_get($key));
return ($serverValueInBytes >= $necessaryValueInBytes);
}
/**
* Return bytes from memory .ini value
*
* @param string $val .ini value
*
* @return int
*/
protected function returnBytes($val)
{
$val = trim($val);
$last = strtolower($val[strlen($val)-1]);
switch($last) {
// The 'G' modifier is available since PHP 5.1.0
case 'g':
$val *= 1024;
case 'm':
$val *= 1024;
case 'k':
$val *= 1024;
}
return $val;
}
/**
* Convert bytes to readable string
*
* @param int $bytes bytes
* @param int $precision conversion precision
*
* @return string
*/
protected function formatBytes($bytes, $precision = 2)
{
$base = log($bytes) / log(1024);
$suffixes = array('', 'k', 'M', 'G', 'T');
return round(pow(1024, $base - floor($base)), $precision) . $suffixes[floor($base)];
}
}

View File

@@ -93,7 +93,7 @@ class Database
*/ */
public function createDatabase($dbName) public function createDatabase($dbName)
{ {
$this->connection->query( $this->connection->exec(
sprintf( sprintf(
"CREATE DATABASE IF NOT EXISTS %s CHARACTER SET utf8", "CREATE DATABASE IF NOT EXISTS %s CHARACTER SET utf8",
$dbName $dbName

View File

@@ -34,8 +34,6 @@ class Admin extends BaseAdmin implements UserInterface
public function setPassword($password) public function setPassword($password)
{ {
\Thelia\Log\Tlog::getInstance()->debug($password);
if ($this->isNew() && ($password === null || trim($password) == "")) { if ($this->isNew() && ($password === null || trim($password) == "")) {
throw new \InvalidArgumentException("customer password is mandatory on creation"); throw new \InvalidArgumentException("customer password is mandatory on creation");
} }

View File

@@ -0,0 +1,10 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\AreaDeliveryModule as BaseAreaDeliveryModule;
class AreaDeliveryModule extends BaseAreaDeliveryModule
{
}

View File

@@ -2,11 +2,11 @@
namespace Thelia\Model; namespace Thelia\Model;
use Thelia\Model\Base\DelivzoneQuery as BaseDelivzoneQuery; use Thelia\Model\Base\AreaDeliveryModuleQuery as BaseAreaDeliveryModuleQuery;
/** /**
* Skeleton subclass for performing query and update operations on the 'delivzone' table. * Skeleton subclass for performing query and update operations on the 'area_delivery_module' table.
* *
* *
* *
@@ -15,6 +15,7 @@ use Thelia\Model\Base\DelivzoneQuery as BaseDelivzoneQuery;
* long as it does not already exist in the output directory. * long as it does not already exist in the output directory.
* *
*/ */
class DelivzoneQuery extends BaseDelivzoneQuery { class AreaDeliveryModuleQuery extends BaseAreaDeliveryModuleQuery
{
} // DelivzoneQuery } // AreaDeliveryModuleQuery

View File

@@ -18,11 +18,11 @@ use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime; use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\Area as ChildArea; use Thelia\Model\Area as ChildArea;
use Thelia\Model\AreaDeliveryModule as ChildAreaDeliveryModule;
use Thelia\Model\AreaDeliveryModuleQuery as ChildAreaDeliveryModuleQuery;
use Thelia\Model\AreaQuery as ChildAreaQuery; use Thelia\Model\AreaQuery as ChildAreaQuery;
use Thelia\Model\Country as ChildCountry; use Thelia\Model\Country as ChildCountry;
use Thelia\Model\CountryQuery as ChildCountryQuery; use Thelia\Model\CountryQuery as ChildCountryQuery;
use Thelia\Model\Delivzone as ChildDelivzone;
use Thelia\Model\DelivzoneQuery as ChildDelivzoneQuery;
use Thelia\Model\Map\AreaTableMap; use Thelia\Model\Map\AreaTableMap;
abstract class Area implements ActiveRecordInterface abstract class Area implements ActiveRecordInterface
@@ -72,10 +72,10 @@ abstract class Area implements ActiveRecordInterface
protected $name; protected $name;
/** /**
* The value for the unit field. * The value for the postage field.
* @var double * @var double
*/ */
protected $unit; protected $postage;
/** /**
* The value for the created_at field. * The value for the created_at field.
@@ -96,10 +96,10 @@ abstract class Area implements ActiveRecordInterface
protected $collCountriesPartial; protected $collCountriesPartial;
/** /**
* @var ObjectCollection|ChildDelivzone[] Collection to store aggregation of ChildDelivzone objects. * @var ObjectCollection|ChildAreaDeliveryModule[] Collection to store aggregation of ChildAreaDeliveryModule objects.
*/ */
protected $collDelivzones; protected $collAreaDeliveryModules;
protected $collDelivzonesPartial; protected $collAreaDeliveryModulesPartial;
/** /**
* Flag to prevent endless save loop, if this object is referenced * Flag to prevent endless save loop, if this object is referenced
@@ -119,7 +119,7 @@ abstract class Area implements ActiveRecordInterface
* An array of objects scheduled for deletion. * An array of objects scheduled for deletion.
* @var ObjectCollection * @var ObjectCollection
*/ */
protected $delivzonesScheduledForDeletion = null; protected $areaDeliveryModulesScheduledForDeletion = null;
/** /**
* Initializes internal state of Thelia\Model\Base\Area object. * Initializes internal state of Thelia\Model\Base\Area object.
@@ -398,14 +398,14 @@ abstract class Area implements ActiveRecordInterface
} }
/** /**
* Get the [unit] column value. * Get the [postage] column value.
* *
* @return double * @return double
*/ */
public function getUnit() public function getPostage()
{ {
return $this->unit; return $this->postage;
} }
/** /**
@@ -491,25 +491,25 @@ abstract class Area implements ActiveRecordInterface
} // setName() } // setName()
/** /**
* Set the value of [unit] column. * Set the value of [postage] column.
* *
* @param double $v new value * @param double $v new value
* @return \Thelia\Model\Area The current object (for fluent API support) * @return \Thelia\Model\Area The current object (for fluent API support)
*/ */
public function setUnit($v) public function setPostage($v)
{ {
if ($v !== null) { if ($v !== null) {
$v = (double) $v; $v = (double) $v;
} }
if ($this->unit !== $v) { if ($this->postage !== $v) {
$this->unit = $v; $this->postage = $v;
$this->modifiedColumns[] = AreaTableMap::UNIT; $this->modifiedColumns[] = AreaTableMap::POSTAGE;
} }
return $this; return $this;
} // setUnit() } // setPostage()
/** /**
* Sets the value of [created_at] column to a normalized version of the date/time value specified. * Sets the value of [created_at] column to a normalized version of the date/time value specified.
@@ -596,8 +596,8 @@ abstract class Area implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AreaTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AreaTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)];
$this->name = (null !== $col) ? (string) $col : null; $this->name = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AreaTableMap::translateFieldName('Unit', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AreaTableMap::translateFieldName('Postage', TableMap::TYPE_PHPNAME, $indexType)];
$this->unit = (null !== $col) ? (double) $col : null; $this->postage = (null !== $col) ? (double) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AreaTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AreaTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
@@ -681,7 +681,7 @@ abstract class Area implements ActiveRecordInterface
$this->collCountries = null; $this->collCountries = null;
$this->collDelivzones = null; $this->collAreaDeliveryModules = null;
} // if (deep) } // if (deep)
} }
@@ -834,18 +834,17 @@ abstract class Area implements ActiveRecordInterface
} }
} }
if ($this->delivzonesScheduledForDeletion !== null) { if ($this->areaDeliveryModulesScheduledForDeletion !== null) {
if (!$this->delivzonesScheduledForDeletion->isEmpty()) { if (!$this->areaDeliveryModulesScheduledForDeletion->isEmpty()) {
foreach ($this->delivzonesScheduledForDeletion as $delivzone) { \Thelia\Model\AreaDeliveryModuleQuery::create()
// need to save related object because we set the relation to null ->filterByPrimaryKeys($this->areaDeliveryModulesScheduledForDeletion->getPrimaryKeys(false))
$delivzone->save($con); ->delete($con);
} $this->areaDeliveryModulesScheduledForDeletion = null;
$this->delivzonesScheduledForDeletion = null;
} }
} }
if ($this->collDelivzones !== null) { if ($this->collAreaDeliveryModules !== null) {
foreach ($this->collDelivzones as $referrerFK) { foreach ($this->collAreaDeliveryModules as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con); $affectedRows += $referrerFK->save($con);
} }
@@ -884,8 +883,8 @@ abstract class Area implements ActiveRecordInterface
if ($this->isColumnModified(AreaTableMap::NAME)) { if ($this->isColumnModified(AreaTableMap::NAME)) {
$modifiedColumns[':p' . $index++] = 'NAME'; $modifiedColumns[':p' . $index++] = 'NAME';
} }
if ($this->isColumnModified(AreaTableMap::UNIT)) { if ($this->isColumnModified(AreaTableMap::POSTAGE)) {
$modifiedColumns[':p' . $index++] = 'UNIT'; $modifiedColumns[':p' . $index++] = 'POSTAGE';
} }
if ($this->isColumnModified(AreaTableMap::CREATED_AT)) { if ($this->isColumnModified(AreaTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT'; $modifiedColumns[':p' . $index++] = 'CREATED_AT';
@@ -910,8 +909,8 @@ abstract class Area implements ActiveRecordInterface
case 'NAME': case 'NAME':
$stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
break; break;
case 'UNIT': case 'POSTAGE':
$stmt->bindValue($identifier, $this->unit, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->postage, PDO::PARAM_STR);
break; break;
case 'CREATED_AT': case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
@@ -988,7 +987,7 @@ abstract class Area implements ActiveRecordInterface
return $this->getName(); return $this->getName();
break; break;
case 2: case 2:
return $this->getUnit(); return $this->getPostage();
break; break;
case 3: case 3:
return $this->getCreatedAt(); return $this->getCreatedAt();
@@ -1027,7 +1026,7 @@ abstract class Area implements ActiveRecordInterface
$result = array( $result = array(
$keys[0] => $this->getId(), $keys[0] => $this->getId(),
$keys[1] => $this->getName(), $keys[1] => $this->getName(),
$keys[2] => $this->getUnit(), $keys[2] => $this->getPostage(),
$keys[3] => $this->getCreatedAt(), $keys[3] => $this->getCreatedAt(),
$keys[4] => $this->getUpdatedAt(), $keys[4] => $this->getUpdatedAt(),
); );
@@ -1041,8 +1040,8 @@ abstract class Area implements ActiveRecordInterface
if (null !== $this->collCountries) { if (null !== $this->collCountries) {
$result['Countries'] = $this->collCountries->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); $result['Countries'] = $this->collCountries->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
} }
if (null !== $this->collDelivzones) { if (null !== $this->collAreaDeliveryModules) {
$result['Delivzones'] = $this->collDelivzones->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); $result['AreaDeliveryModules'] = $this->collAreaDeliveryModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
} }
} }
@@ -1085,7 +1084,7 @@ abstract class Area implements ActiveRecordInterface
$this->setName($value); $this->setName($value);
break; break;
case 2: case 2:
$this->setUnit($value); $this->setPostage($value);
break; break;
case 3: case 3:
$this->setCreatedAt($value); $this->setCreatedAt($value);
@@ -1119,7 +1118,7 @@ abstract class Area implements ActiveRecordInterface
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setUnit($arr[$keys[2]]); if (array_key_exists($keys[2], $arr)) $this->setPostage($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
} }
@@ -1135,7 +1134,7 @@ abstract class Area implements ActiveRecordInterface
if ($this->isColumnModified(AreaTableMap::ID)) $criteria->add(AreaTableMap::ID, $this->id); if ($this->isColumnModified(AreaTableMap::ID)) $criteria->add(AreaTableMap::ID, $this->id);
if ($this->isColumnModified(AreaTableMap::NAME)) $criteria->add(AreaTableMap::NAME, $this->name); if ($this->isColumnModified(AreaTableMap::NAME)) $criteria->add(AreaTableMap::NAME, $this->name);
if ($this->isColumnModified(AreaTableMap::UNIT)) $criteria->add(AreaTableMap::UNIT, $this->unit); if ($this->isColumnModified(AreaTableMap::POSTAGE)) $criteria->add(AreaTableMap::POSTAGE, $this->postage);
if ($this->isColumnModified(AreaTableMap::CREATED_AT)) $criteria->add(AreaTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(AreaTableMap::CREATED_AT)) $criteria->add(AreaTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(AreaTableMap::UPDATED_AT)) $criteria->add(AreaTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(AreaTableMap::UPDATED_AT)) $criteria->add(AreaTableMap::UPDATED_AT, $this->updated_at);
@@ -1202,7 +1201,7 @@ abstract class Area implements ActiveRecordInterface
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{ {
$copyObj->setName($this->getName()); $copyObj->setName($this->getName());
$copyObj->setUnit($this->getUnit()); $copyObj->setPostage($this->getPostage());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
@@ -1217,9 +1216,9 @@ abstract class Area implements ActiveRecordInterface
} }
} }
foreach ($this->getDelivzones() as $relObj) { foreach ($this->getAreaDeliveryModules() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addDelivzone($relObj->copy($deepCopy)); $copyObj->addAreaDeliveryModule($relObj->copy($deepCopy));
} }
} }
@@ -1267,8 +1266,8 @@ abstract class Area implements ActiveRecordInterface
if ('Country' == $relationName) { if ('Country' == $relationName) {
return $this->initCountries(); return $this->initCountries();
} }
if ('Delivzone' == $relationName) { if ('AreaDeliveryModule' == $relationName) {
return $this->initDelivzones(); return $this->initAreaDeliveryModules();
} }
} }
@@ -1491,31 +1490,31 @@ abstract class Area implements ActiveRecordInterface
} }
/** /**
* Clears out the collDelivzones collection * Clears out the collAreaDeliveryModules collection
* *
* This does not modify the database; however, it will remove any associated objects, causing * This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method. * them to be refetched by subsequent calls to accessor method.
* *
* @return void * @return void
* @see addDelivzones() * @see addAreaDeliveryModules()
*/ */
public function clearDelivzones() public function clearAreaDeliveryModules()
{ {
$this->collDelivzones = null; // important to set this to NULL since that means it is uninitialized $this->collAreaDeliveryModules = null; // important to set this to NULL since that means it is uninitialized
} }
/** /**
* Reset is the collDelivzones collection loaded partially. * Reset is the collAreaDeliveryModules collection loaded partially.
*/ */
public function resetPartialDelivzones($v = true) public function resetPartialAreaDeliveryModules($v = true)
{ {
$this->collDelivzonesPartial = $v; $this->collAreaDeliveryModulesPartial = $v;
} }
/** /**
* Initializes the collDelivzones collection. * Initializes the collAreaDeliveryModules collection.
* *
* By default this just sets the collDelivzones collection to an empty array (like clearcollDelivzones()); * By default this just sets the collAreaDeliveryModules collection to an empty array (like clearcollAreaDeliveryModules());
* however, you may wish to override this method in your stub class to provide setting appropriate * however, you may wish to override this method in your stub class to provide setting appropriate
* to your application -- for example, setting the initial array to the values stored in database. * to your application -- for example, setting the initial array to the values stored in database.
* *
@@ -1524,17 +1523,17 @@ abstract class Area implements ActiveRecordInterface
* *
* @return void * @return void
*/ */
public function initDelivzones($overrideExisting = true) public function initAreaDeliveryModules($overrideExisting = true)
{ {
if (null !== $this->collDelivzones && !$overrideExisting) { if (null !== $this->collAreaDeliveryModules && !$overrideExisting) {
return; return;
} }
$this->collDelivzones = new ObjectCollection(); $this->collAreaDeliveryModules = new ObjectCollection();
$this->collDelivzones->setModel('\Thelia\Model\Delivzone'); $this->collAreaDeliveryModules->setModel('\Thelia\Model\AreaDeliveryModule');
} }
/** /**
* Gets an array of ChildDelivzone objects which contain a foreign key that references this object. * Gets an array of ChildAreaDeliveryModule objects which contain a foreign key that references this object.
* *
* If the $criteria is not null, it is used to always fetch the results from the database. * If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached. * Otherwise the results are fetched from the database the first time, then cached.
@@ -1544,109 +1543,109 @@ abstract class Area implements ActiveRecordInterface
* *
* @param Criteria $criteria optional Criteria object to narrow the query * @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object * @param ConnectionInterface $con optional connection object
* @return Collection|ChildDelivzone[] List of ChildDelivzone objects * @return Collection|ChildAreaDeliveryModule[] List of ChildAreaDeliveryModule objects
* @throws PropelException * @throws PropelException
*/ */
public function getDelivzones($criteria = null, ConnectionInterface $con = null) public function getAreaDeliveryModules($criteria = null, ConnectionInterface $con = null)
{ {
$partial = $this->collDelivzonesPartial && !$this->isNew(); $partial = $this->collAreaDeliveryModulesPartial && !$this->isNew();
if (null === $this->collDelivzones || null !== $criteria || $partial) { if (null === $this->collAreaDeliveryModules || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collDelivzones) { if ($this->isNew() && null === $this->collAreaDeliveryModules) {
// return empty collection // return empty collection
$this->initDelivzones(); $this->initAreaDeliveryModules();
} else { } else {
$collDelivzones = ChildDelivzoneQuery::create(null, $criteria) $collAreaDeliveryModules = ChildAreaDeliveryModuleQuery::create(null, $criteria)
->filterByArea($this) ->filterByArea($this)
->find($con); ->find($con);
if (null !== $criteria) { if (null !== $criteria) {
if (false !== $this->collDelivzonesPartial && count($collDelivzones)) { if (false !== $this->collAreaDeliveryModulesPartial && count($collAreaDeliveryModules)) {
$this->initDelivzones(false); $this->initAreaDeliveryModules(false);
foreach ($collDelivzones as $obj) { foreach ($collAreaDeliveryModules as $obj) {
if (false == $this->collDelivzones->contains($obj)) { if (false == $this->collAreaDeliveryModules->contains($obj)) {
$this->collDelivzones->append($obj); $this->collAreaDeliveryModules->append($obj);
} }
} }
$this->collDelivzonesPartial = true; $this->collAreaDeliveryModulesPartial = true;
} }
$collDelivzones->getInternalIterator()->rewind(); $collAreaDeliveryModules->getInternalIterator()->rewind();
return $collDelivzones; return $collAreaDeliveryModules;
} }
if ($partial && $this->collDelivzones) { if ($partial && $this->collAreaDeliveryModules) {
foreach ($this->collDelivzones as $obj) { foreach ($this->collAreaDeliveryModules as $obj) {
if ($obj->isNew()) { if ($obj->isNew()) {
$collDelivzones[] = $obj; $collAreaDeliveryModules[] = $obj;
} }
} }
} }
$this->collDelivzones = $collDelivzones; $this->collAreaDeliveryModules = $collAreaDeliveryModules;
$this->collDelivzonesPartial = false; $this->collAreaDeliveryModulesPartial = false;
} }
} }
return $this->collDelivzones; return $this->collAreaDeliveryModules;
} }
/** /**
* Sets a collection of Delivzone objects related by a one-to-many relationship * Sets a collection of AreaDeliveryModule objects related by a one-to-many relationship
* to the current object. * to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted) * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection. * and new objects from the given Propel collection.
* *
* @param Collection $delivzones A Propel collection. * @param Collection $areaDeliveryModules A Propel collection.
* @param ConnectionInterface $con Optional connection object * @param ConnectionInterface $con Optional connection object
* @return ChildArea The current object (for fluent API support) * @return ChildArea The current object (for fluent API support)
*/ */
public function setDelivzones(Collection $delivzones, ConnectionInterface $con = null) public function setAreaDeliveryModules(Collection $areaDeliveryModules, ConnectionInterface $con = null)
{ {
$delivzonesToDelete = $this->getDelivzones(new Criteria(), $con)->diff($delivzones); $areaDeliveryModulesToDelete = $this->getAreaDeliveryModules(new Criteria(), $con)->diff($areaDeliveryModules);
$this->delivzonesScheduledForDeletion = $delivzonesToDelete; $this->areaDeliveryModulesScheduledForDeletion = $areaDeliveryModulesToDelete;
foreach ($delivzonesToDelete as $delivzoneRemoved) { foreach ($areaDeliveryModulesToDelete as $areaDeliveryModuleRemoved) {
$delivzoneRemoved->setArea(null); $areaDeliveryModuleRemoved->setArea(null);
} }
$this->collDelivzones = null; $this->collAreaDeliveryModules = null;
foreach ($delivzones as $delivzone) { foreach ($areaDeliveryModules as $areaDeliveryModule) {
$this->addDelivzone($delivzone); $this->addAreaDeliveryModule($areaDeliveryModule);
} }
$this->collDelivzones = $delivzones; $this->collAreaDeliveryModules = $areaDeliveryModules;
$this->collDelivzonesPartial = false; $this->collAreaDeliveryModulesPartial = false;
return $this; return $this;
} }
/** /**
* Returns the number of related Delivzone objects. * Returns the number of related AreaDeliveryModule objects.
* *
* @param Criteria $criteria * @param Criteria $criteria
* @param boolean $distinct * @param boolean $distinct
* @param ConnectionInterface $con * @param ConnectionInterface $con
* @return int Count of related Delivzone objects. * @return int Count of related AreaDeliveryModule objects.
* @throws PropelException * @throws PropelException
*/ */
public function countDelivzones(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) public function countAreaDeliveryModules(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{ {
$partial = $this->collDelivzonesPartial && !$this->isNew(); $partial = $this->collAreaDeliveryModulesPartial && !$this->isNew();
if (null === $this->collDelivzones || null !== $criteria || $partial) { if (null === $this->collAreaDeliveryModules || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collDelivzones) { if ($this->isNew() && null === $this->collAreaDeliveryModules) {
return 0; return 0;
} }
if ($partial && !$criteria) { if ($partial && !$criteria) {
return count($this->getDelivzones()); return count($this->getAreaDeliveryModules());
} }
$query = ChildDelivzoneQuery::create(null, $criteria); $query = ChildAreaDeliveryModuleQuery::create(null, $criteria);
if ($distinct) { if ($distinct) {
$query->distinct(); $query->distinct();
} }
@@ -1656,58 +1655,83 @@ abstract class Area implements ActiveRecordInterface
->count($con); ->count($con);
} }
return count($this->collDelivzones); return count($this->collAreaDeliveryModules);
} }
/** /**
* Method called to associate a ChildDelivzone object to this object * Method called to associate a ChildAreaDeliveryModule object to this object
* through the ChildDelivzone foreign key attribute. * through the ChildAreaDeliveryModule foreign key attribute.
* *
* @param ChildDelivzone $l ChildDelivzone * @param ChildAreaDeliveryModule $l ChildAreaDeliveryModule
* @return \Thelia\Model\Area The current object (for fluent API support) * @return \Thelia\Model\Area The current object (for fluent API support)
*/ */
public function addDelivzone(ChildDelivzone $l) public function addAreaDeliveryModule(ChildAreaDeliveryModule $l)
{ {
if ($this->collDelivzones === null) { if ($this->collAreaDeliveryModules === null) {
$this->initDelivzones(); $this->initAreaDeliveryModules();
$this->collDelivzonesPartial = true; $this->collAreaDeliveryModulesPartial = true;
} }
if (!in_array($l, $this->collDelivzones->getArrayCopy(), true)) { // only add it if the **same** object is not already associated if (!in_array($l, $this->collAreaDeliveryModules->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddDelivzone($l); $this->doAddAreaDeliveryModule($l);
} }
return $this; return $this;
} }
/** /**
* @param Delivzone $delivzone The delivzone object to add. * @param AreaDeliveryModule $areaDeliveryModule The areaDeliveryModule object to add.
*/ */
protected function doAddDelivzone($delivzone) protected function doAddAreaDeliveryModule($areaDeliveryModule)
{ {
$this->collDelivzones[]= $delivzone; $this->collAreaDeliveryModules[]= $areaDeliveryModule;
$delivzone->setArea($this); $areaDeliveryModule->setArea($this);
} }
/** /**
* @param Delivzone $delivzone The delivzone object to remove. * @param AreaDeliveryModule $areaDeliveryModule The areaDeliveryModule object to remove.
* @return ChildArea The current object (for fluent API support) * @return ChildArea The current object (for fluent API support)
*/ */
public function removeDelivzone($delivzone) public function removeAreaDeliveryModule($areaDeliveryModule)
{ {
if ($this->getDelivzones()->contains($delivzone)) { if ($this->getAreaDeliveryModules()->contains($areaDeliveryModule)) {
$this->collDelivzones->remove($this->collDelivzones->search($delivzone)); $this->collAreaDeliveryModules->remove($this->collAreaDeliveryModules->search($areaDeliveryModule));
if (null === $this->delivzonesScheduledForDeletion) { if (null === $this->areaDeliveryModulesScheduledForDeletion) {
$this->delivzonesScheduledForDeletion = clone $this->collDelivzones; $this->areaDeliveryModulesScheduledForDeletion = clone $this->collAreaDeliveryModules;
$this->delivzonesScheduledForDeletion->clear(); $this->areaDeliveryModulesScheduledForDeletion->clear();
} }
$this->delivzonesScheduledForDeletion[]= $delivzone; $this->areaDeliveryModulesScheduledForDeletion[]= clone $areaDeliveryModule;
$delivzone->setArea(null); $areaDeliveryModule->setArea(null);
} }
return $this; return $this;
} }
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Area is new, it will return
* an empty collection; or if this Area has previously
* been saved, it will retrieve related AreaDeliveryModules from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in Area.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildAreaDeliveryModule[] List of ChildAreaDeliveryModule objects
*/
public function getAreaDeliveryModulesJoinModule($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildAreaDeliveryModuleQuery::create(null, $criteria);
$query->joinWith('Module', $joinBehavior);
return $this->getAreaDeliveryModules($query, $con);
}
/** /**
* Clears the current object and sets all attributes to their default values * Clears the current object and sets all attributes to their default values
*/ */
@@ -1715,7 +1739,7 @@ abstract class Area implements ActiveRecordInterface
{ {
$this->id = null; $this->id = null;
$this->name = null; $this->name = null;
$this->unit = null; $this->postage = null;
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
@@ -1742,8 +1766,8 @@ abstract class Area implements ActiveRecordInterface
$o->clearAllReferences($deep); $o->clearAllReferences($deep);
} }
} }
if ($this->collDelivzones) { if ($this->collAreaDeliveryModules) {
foreach ($this->collDelivzones as $o) { foreach ($this->collAreaDeliveryModules as $o) {
$o->clearAllReferences($deep); $o->clearAllReferences($deep);
} }
} }
@@ -1753,10 +1777,10 @@ abstract class Area implements ActiveRecordInterface
$this->collCountries->clearIterator(); $this->collCountries->clearIterator();
} }
$this->collCountries = null; $this->collCountries = null;
if ($this->collDelivzones instanceof Collection) { if ($this->collAreaDeliveryModules instanceof Collection) {
$this->collDelivzones->clearIterator(); $this->collAreaDeliveryModules->clearIterator();
} }
$this->collDelivzones = null; $this->collAreaDeliveryModules = null;
} }
/** /**

View File

@@ -17,17 +17,19 @@ use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime; use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\Area as ChildArea; use Thelia\Model\Area as ChildArea;
use Thelia\Model\AreaDeliveryModule as ChildAreaDeliveryModule;
use Thelia\Model\AreaDeliveryModuleQuery as ChildAreaDeliveryModuleQuery;
use Thelia\Model\AreaQuery as ChildAreaQuery; use Thelia\Model\AreaQuery as ChildAreaQuery;
use Thelia\Model\Delivzone as ChildDelivzone; use Thelia\Model\Module as ChildModule;
use Thelia\Model\DelivzoneQuery as ChildDelivzoneQuery; use Thelia\Model\ModuleQuery as ChildModuleQuery;
use Thelia\Model\Map\DelivzoneTableMap; use Thelia\Model\Map\AreaDeliveryModuleTableMap;
abstract class Delivzone implements ActiveRecordInterface abstract class AreaDeliveryModule implements ActiveRecordInterface
{ {
/** /**
* TableMap class name * TableMap class name
*/ */
const TABLE_MAP = '\\Thelia\\Model\\Map\\DelivzoneTableMap'; const TABLE_MAP = '\\Thelia\\Model\\Map\\AreaDeliveryModuleTableMap';
/** /**
@@ -69,10 +71,10 @@ abstract class Delivzone implements ActiveRecordInterface
protected $area_id; protected $area_id;
/** /**
* The value for the delivery field. * The value for the delivery_module_id field.
* @var string * @var int
*/ */
protected $delivery; protected $delivery_module_id;
/** /**
* The value for the created_at field. * The value for the created_at field.
@@ -91,6 +93,11 @@ abstract class Delivzone implements ActiveRecordInterface
*/ */
protected $aArea; protected $aArea;
/**
* @var Module
*/
protected $aModule;
/** /**
* Flag to prevent endless save loop, if this object is referenced * Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction. * by another object which falls in this transaction.
@@ -100,7 +107,7 @@ abstract class Delivzone implements ActiveRecordInterface
protected $alreadyInSave = false; protected $alreadyInSave = false;
/** /**
* Initializes internal state of Thelia\Model\Base\Delivzone object. * Initializes internal state of Thelia\Model\Base\AreaDeliveryModule object.
*/ */
public function __construct() public function __construct()
{ {
@@ -195,9 +202,9 @@ abstract class Delivzone implements ActiveRecordInterface
} }
/** /**
* Compares this with another <code>Delivzone</code> instance. If * Compares this with another <code>AreaDeliveryModule</code> instance. If
* <code>obj</code> is an instance of <code>Delivzone</code>, delegates to * <code>obj</code> is an instance of <code>AreaDeliveryModule</code>, delegates to
* <code>equals(Delivzone)</code>. Otherwise, returns <code>false</code>. * <code>equals(AreaDeliveryModule)</code>. Otherwise, returns <code>false</code>.
* *
* @param obj The object to compare to. * @param obj The object to compare to.
* @return Whether equal to the object specified. * @return Whether equal to the object specified.
@@ -278,7 +285,7 @@ abstract class Delivzone implements ActiveRecordInterface
* @param string $name The virtual column name * @param string $name The virtual column name
* @param mixed $value The value to give to the virtual column * @param mixed $value The value to give to the virtual column
* *
* @return Delivzone The current object, for fluid interface * @return AreaDeliveryModule The current object, for fluid interface
*/ */
public function setVirtualColumn($name, $value) public function setVirtualColumn($name, $value)
{ {
@@ -310,7 +317,7 @@ abstract class Delivzone implements ActiveRecordInterface
* or a format name ('XML', 'YAML', 'JSON', 'CSV') * or a format name ('XML', 'YAML', 'JSON', 'CSV')
* @param string $data The source data to import from * @param string $data The source data to import from
* *
* @return Delivzone The current object, for fluid interface * @return AreaDeliveryModule The current object, for fluid interface
*/ */
public function importFrom($parser, $data) public function importFrom($parser, $data)
{ {
@@ -376,14 +383,14 @@ abstract class Delivzone implements ActiveRecordInterface
} }
/** /**
* Get the [delivery] column value. * Get the [delivery_module_id] column value.
* *
* @return string * @return int
*/ */
public function getDelivery() public function getDeliveryModuleId()
{ {
return $this->delivery; return $this->delivery_module_id;
} }
/** /**
@@ -430,7 +437,7 @@ abstract class Delivzone implements ActiveRecordInterface
* Set the value of [id] column. * Set the value of [id] column.
* *
* @param int $v new value * @param int $v new value
* @return \Thelia\Model\Delivzone The current object (for fluent API support) * @return \Thelia\Model\AreaDeliveryModule The current object (for fluent API support)
*/ */
public function setId($v) public function setId($v)
{ {
@@ -440,7 +447,7 @@ abstract class Delivzone implements ActiveRecordInterface
if ($this->id !== $v) { if ($this->id !== $v) {
$this->id = $v; $this->id = $v;
$this->modifiedColumns[] = DelivzoneTableMap::ID; $this->modifiedColumns[] = AreaDeliveryModuleTableMap::ID;
} }
@@ -451,7 +458,7 @@ abstract class Delivzone implements ActiveRecordInterface
* Set the value of [area_id] column. * Set the value of [area_id] column.
* *
* @param int $v new value * @param int $v new value
* @return \Thelia\Model\Delivzone The current object (for fluent API support) * @return \Thelia\Model\AreaDeliveryModule The current object (for fluent API support)
*/ */
public function setAreaId($v) public function setAreaId($v)
{ {
@@ -461,7 +468,7 @@ abstract class Delivzone implements ActiveRecordInterface
if ($this->area_id !== $v) { if ($this->area_id !== $v) {
$this->area_id = $v; $this->area_id = $v;
$this->modifiedColumns[] = DelivzoneTableMap::AREA_ID; $this->modifiedColumns[] = AreaDeliveryModuleTableMap::AREA_ID;
} }
if ($this->aArea !== null && $this->aArea->getId() !== $v) { if ($this->aArea !== null && $this->aArea->getId() !== $v) {
@@ -473,32 +480,36 @@ abstract class Delivzone implements ActiveRecordInterface
} // setAreaId() } // setAreaId()
/** /**
* Set the value of [delivery] column. * Set the value of [delivery_module_id] column.
* *
* @param string $v new value * @param int $v new value
* @return \Thelia\Model\Delivzone The current object (for fluent API support) * @return \Thelia\Model\AreaDeliveryModule The current object (for fluent API support)
*/ */
public function setDelivery($v) public function setDeliveryModuleId($v)
{ {
if ($v !== null) { if ($v !== null) {
$v = (string) $v; $v = (int) $v;
} }
if ($this->delivery !== $v) { if ($this->delivery_module_id !== $v) {
$this->delivery = $v; $this->delivery_module_id = $v;
$this->modifiedColumns[] = DelivzoneTableMap::DELIVERY; $this->modifiedColumns[] = AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID;
}
if ($this->aModule !== null && $this->aModule->getId() !== $v) {
$this->aModule = null;
} }
return $this; return $this;
} // setDelivery() } // setDeliveryModuleId()
/** /**
* Sets the value of [created_at] column to a normalized version of the date/time value specified. * Sets the value of [created_at] column to a normalized version of the date/time value specified.
* *
* @param mixed $v string, integer (timestamp), or \DateTime value. * @param mixed $v string, integer (timestamp), or \DateTime value.
* Empty strings are treated as NULL. * Empty strings are treated as NULL.
* @return \Thelia\Model\Delivzone The current object (for fluent API support) * @return \Thelia\Model\AreaDeliveryModule The current object (for fluent API support)
*/ */
public function setCreatedAt($v) public function setCreatedAt($v)
{ {
@@ -506,7 +517,7 @@ abstract class Delivzone implements ActiveRecordInterface
if ($this->created_at !== null || $dt !== null) { if ($this->created_at !== null || $dt !== null) {
if ($dt !== $this->created_at) { if ($dt !== $this->created_at) {
$this->created_at = $dt; $this->created_at = $dt;
$this->modifiedColumns[] = DelivzoneTableMap::CREATED_AT; $this->modifiedColumns[] = AreaDeliveryModuleTableMap::CREATED_AT;
} }
} // if either are not null } // if either are not null
@@ -519,7 +530,7 @@ abstract class Delivzone implements ActiveRecordInterface
* *
* @param mixed $v string, integer (timestamp), or \DateTime value. * @param mixed $v string, integer (timestamp), or \DateTime value.
* Empty strings are treated as NULL. * Empty strings are treated as NULL.
* @return \Thelia\Model\Delivzone The current object (for fluent API support) * @return \Thelia\Model\AreaDeliveryModule The current object (for fluent API support)
*/ */
public function setUpdatedAt($v) public function setUpdatedAt($v)
{ {
@@ -527,7 +538,7 @@ abstract class Delivzone implements ActiveRecordInterface
if ($this->updated_at !== null || $dt !== null) { if ($this->updated_at !== null || $dt !== null) {
if ($dt !== $this->updated_at) { if ($dt !== $this->updated_at) {
$this->updated_at = $dt; $this->updated_at = $dt;
$this->modifiedColumns[] = DelivzoneTableMap::UPDATED_AT; $this->modifiedColumns[] = AreaDeliveryModuleTableMap::UPDATED_AT;
} }
} // if either are not null } // if either are not null
@@ -572,22 +583,22 @@ abstract class Delivzone implements ActiveRecordInterface
try { try {
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : DelivzoneTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : AreaDeliveryModuleTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
$this->id = (null !== $col) ? (int) $col : null; $this->id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : DelivzoneTableMap::translateFieldName('AreaId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AreaDeliveryModuleTableMap::translateFieldName('AreaId', TableMap::TYPE_PHPNAME, $indexType)];
$this->area_id = (null !== $col) ? (int) $col : null; $this->area_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : DelivzoneTableMap::translateFieldName('Delivery', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AreaDeliveryModuleTableMap::translateFieldName('DeliveryModuleId', TableMap::TYPE_PHPNAME, $indexType)];
$this->delivery = (null !== $col) ? (string) $col : null; $this->delivery_module_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : DelivzoneTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AreaDeliveryModuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : DelivzoneTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : AreaDeliveryModuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
@@ -600,10 +611,10 @@ abstract class Delivzone implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 5; // 5 = DelivzoneTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 5; // 5 = AreaDeliveryModuleTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Delivzone object", 0, $e); throw new PropelException("Error populating \Thelia\Model\AreaDeliveryModule object", 0, $e);
} }
} }
@@ -625,6 +636,9 @@ abstract class Delivzone implements ActiveRecordInterface
if ($this->aArea !== null && $this->area_id !== $this->aArea->getId()) { if ($this->aArea !== null && $this->area_id !== $this->aArea->getId()) {
$this->aArea = null; $this->aArea = null;
} }
if ($this->aModule !== null && $this->delivery_module_id !== $this->aModule->getId()) {
$this->aModule = null;
}
} // ensureConsistency } // ensureConsistency
/** /**
@@ -648,13 +662,13 @@ abstract class Delivzone implements ActiveRecordInterface
} }
if ($con === null) { if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(DelivzoneTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getReadConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
} }
// We don't need to alter the object instance pool; we're just modifying this instance // We don't need to alter the object instance pool; we're just modifying this instance
// already in the pool. // already in the pool.
$dataFetcher = ChildDelivzoneQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); $dataFetcher = ChildAreaDeliveryModuleQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
$row = $dataFetcher->fetch(); $row = $dataFetcher->fetch();
$dataFetcher->close(); $dataFetcher->close();
if (!$row) { if (!$row) {
@@ -665,6 +679,7 @@ abstract class Delivzone implements ActiveRecordInterface
if ($deep) { // also de-associate any related objects? if ($deep) { // also de-associate any related objects?
$this->aArea = null; $this->aArea = null;
$this->aModule = null;
} // if (deep) } // if (deep)
} }
@@ -674,8 +689,8 @@ abstract class Delivzone implements ActiveRecordInterface
* @param ConnectionInterface $con * @param ConnectionInterface $con
* @return void * @return void
* @throws PropelException * @throws PropelException
* @see Delivzone::setDeleted() * @see AreaDeliveryModule::setDeleted()
* @see Delivzone::isDeleted() * @see AreaDeliveryModule::isDeleted()
*/ */
public function delete(ConnectionInterface $con = null) public function delete(ConnectionInterface $con = null)
{ {
@@ -684,12 +699,12 @@ abstract class Delivzone implements ActiveRecordInterface
} }
if ($con === null) { if ($con === null) {
$con = Propel::getServiceContainer()->getWriteConnection(DelivzoneTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getWriteConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
} }
$con->beginTransaction(); $con->beginTransaction();
try { try {
$deleteQuery = ChildDelivzoneQuery::create() $deleteQuery = ChildAreaDeliveryModuleQuery::create()
->filterByPrimaryKey($this->getPrimaryKey()); ->filterByPrimaryKey($this->getPrimaryKey());
$ret = $this->preDelete($con); $ret = $this->preDelete($con);
if ($ret) { if ($ret) {
@@ -726,7 +741,7 @@ abstract class Delivzone implements ActiveRecordInterface
} }
if ($con === null) { if ($con === null) {
$con = Propel::getServiceContainer()->getWriteConnection(DelivzoneTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getWriteConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
} }
$con->beginTransaction(); $con->beginTransaction();
@@ -736,16 +751,16 @@ abstract class Delivzone implements ActiveRecordInterface
if ($isInsert) { if ($isInsert) {
$ret = $ret && $this->preInsert($con); $ret = $ret && $this->preInsert($con);
// timestampable behavior // timestampable behavior
if (!$this->isColumnModified(DelivzoneTableMap::CREATED_AT)) { if (!$this->isColumnModified(AreaDeliveryModuleTableMap::CREATED_AT)) {
$this->setCreatedAt(time()); $this->setCreatedAt(time());
} }
if (!$this->isColumnModified(DelivzoneTableMap::UPDATED_AT)) { if (!$this->isColumnModified(AreaDeliveryModuleTableMap::UPDATED_AT)) {
$this->setUpdatedAt(time()); $this->setUpdatedAt(time());
} }
} else { } else {
$ret = $ret && $this->preUpdate($con); $ret = $ret && $this->preUpdate($con);
// timestampable behavior // timestampable behavior
if ($this->isModified() && !$this->isColumnModified(DelivzoneTableMap::UPDATED_AT)) { if ($this->isModified() && !$this->isColumnModified(AreaDeliveryModuleTableMap::UPDATED_AT)) {
$this->setUpdatedAt(time()); $this->setUpdatedAt(time());
} }
} }
@@ -757,7 +772,7 @@ abstract class Delivzone implements ActiveRecordInterface
$this->postUpdate($con); $this->postUpdate($con);
} }
$this->postSave($con); $this->postSave($con);
DelivzoneTableMap::addInstanceToPool($this); AreaDeliveryModuleTableMap::addInstanceToPool($this);
} else { } else {
$affectedRows = 0; $affectedRows = 0;
} }
@@ -799,6 +814,13 @@ abstract class Delivzone implements ActiveRecordInterface
$this->setArea($this->aArea); $this->setArea($this->aArea);
} }
if ($this->aModule !== null) {
if ($this->aModule->isModified() || $this->aModule->isNew()) {
$affectedRows += $this->aModule->save($con);
}
$this->setModule($this->aModule);
}
if ($this->isNew() || $this->isModified()) { if ($this->isNew() || $this->isModified()) {
// persist changes // persist changes
if ($this->isNew()) { if ($this->isNew()) {
@@ -830,30 +852,30 @@ abstract class Delivzone implements ActiveRecordInterface
$modifiedColumns = array(); $modifiedColumns = array();
$index = 0; $index = 0;
$this->modifiedColumns[] = DelivzoneTableMap::ID; $this->modifiedColumns[] = AreaDeliveryModuleTableMap::ID;
if (null !== $this->id) { if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . DelivzoneTableMap::ID . ')'); throw new PropelException('Cannot insert a value for auto-increment primary key (' . AreaDeliveryModuleTableMap::ID . ')');
} }
// check the columns in natural order for more readable SQL queries // check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(DelivzoneTableMap::ID)) { if ($this->isColumnModified(AreaDeliveryModuleTableMap::ID)) {
$modifiedColumns[':p' . $index++] = 'ID'; $modifiedColumns[':p' . $index++] = 'ID';
} }
if ($this->isColumnModified(DelivzoneTableMap::AREA_ID)) { if ($this->isColumnModified(AreaDeliveryModuleTableMap::AREA_ID)) {
$modifiedColumns[':p' . $index++] = 'AREA_ID'; $modifiedColumns[':p' . $index++] = 'AREA_ID';
} }
if ($this->isColumnModified(DelivzoneTableMap::DELIVERY)) { if ($this->isColumnModified(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID)) {
$modifiedColumns[':p' . $index++] = 'DELIVERY'; $modifiedColumns[':p' . $index++] = 'DELIVERY_MODULE_ID';
} }
if ($this->isColumnModified(DelivzoneTableMap::CREATED_AT)) { if ($this->isColumnModified(AreaDeliveryModuleTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT'; $modifiedColumns[':p' . $index++] = 'CREATED_AT';
} }
if ($this->isColumnModified(DelivzoneTableMap::UPDATED_AT)) { if ($this->isColumnModified(AreaDeliveryModuleTableMap::UPDATED_AT)) {
$modifiedColumns[':p' . $index++] = 'UPDATED_AT'; $modifiedColumns[':p' . $index++] = 'UPDATED_AT';
} }
$sql = sprintf( $sql = sprintf(
'INSERT INTO delivzone (%s) VALUES (%s)', 'INSERT INTO area_delivery_module (%s) VALUES (%s)',
implode(', ', $modifiedColumns), implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns)) implode(', ', array_keys($modifiedColumns))
); );
@@ -868,8 +890,8 @@ abstract class Delivzone implements ActiveRecordInterface
case 'AREA_ID': case 'AREA_ID':
$stmt->bindValue($identifier, $this->area_id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->area_id, PDO::PARAM_INT);
break; break;
case 'DELIVERY': case 'DELIVERY_MODULE_ID':
$stmt->bindValue($identifier, $this->delivery, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->delivery_module_id, PDO::PARAM_INT);
break; break;
case 'CREATED_AT': case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
@@ -923,7 +945,7 @@ abstract class Delivzone implements ActiveRecordInterface
*/ */
public function getByName($name, $type = TableMap::TYPE_PHPNAME) public function getByName($name, $type = TableMap::TYPE_PHPNAME)
{ {
$pos = DelivzoneTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $pos = AreaDeliveryModuleTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
$field = $this->getByPosition($pos); $field = $this->getByPosition($pos);
return $field; return $field;
@@ -946,7 +968,7 @@ abstract class Delivzone implements ActiveRecordInterface
return $this->getAreaId(); return $this->getAreaId();
break; break;
case 2: case 2:
return $this->getDelivery(); return $this->getDeliveryModuleId();
break; break;
case 3: case 3:
return $this->getCreatedAt(); return $this->getCreatedAt();
@@ -977,15 +999,15 @@ abstract class Delivzone implements ActiveRecordInterface
*/ */
public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{ {
if (isset($alreadyDumpedObjects['Delivzone'][$this->getPrimaryKey()])) { if (isset($alreadyDumpedObjects['AreaDeliveryModule'][$this->getPrimaryKey()])) {
return '*RECURSION*'; return '*RECURSION*';
} }
$alreadyDumpedObjects['Delivzone'][$this->getPrimaryKey()] = true; $alreadyDumpedObjects['AreaDeliveryModule'][$this->getPrimaryKey()] = true;
$keys = DelivzoneTableMap::getFieldNames($keyType); $keys = AreaDeliveryModuleTableMap::getFieldNames($keyType);
$result = array( $result = array(
$keys[0] => $this->getId(), $keys[0] => $this->getId(),
$keys[1] => $this->getAreaId(), $keys[1] => $this->getAreaId(),
$keys[2] => $this->getDelivery(), $keys[2] => $this->getDeliveryModuleId(),
$keys[3] => $this->getCreatedAt(), $keys[3] => $this->getCreatedAt(),
$keys[4] => $this->getUpdatedAt(), $keys[4] => $this->getUpdatedAt(),
); );
@@ -999,6 +1021,9 @@ abstract class Delivzone implements ActiveRecordInterface
if (null !== $this->aArea) { if (null !== $this->aArea) {
$result['Area'] = $this->aArea->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); $result['Area'] = $this->aArea->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
} }
if (null !== $this->aModule) {
$result['Module'] = $this->aModule->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
} }
return $result; return $result;
@@ -1017,7 +1042,7 @@ abstract class Delivzone implements ActiveRecordInterface
*/ */
public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
{ {
$pos = DelivzoneTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $pos = AreaDeliveryModuleTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
return $this->setByPosition($pos, $value); return $this->setByPosition($pos, $value);
} }
@@ -1040,7 +1065,7 @@ abstract class Delivzone implements ActiveRecordInterface
$this->setAreaId($value); $this->setAreaId($value);
break; break;
case 2: case 2:
$this->setDelivery($value); $this->setDeliveryModuleId($value);
break; break;
case 3: case 3:
$this->setCreatedAt($value); $this->setCreatedAt($value);
@@ -1070,11 +1095,11 @@ abstract class Delivzone implements ActiveRecordInterface
*/ */
public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
{ {
$keys = DelivzoneTableMap::getFieldNames($keyType); $keys = AreaDeliveryModuleTableMap::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setAreaId($arr[$keys[1]]); if (array_key_exists($keys[1], $arr)) $this->setAreaId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDelivery($arr[$keys[2]]); if (array_key_exists($keys[2], $arr)) $this->setDeliveryModuleId($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
} }
@@ -1086,13 +1111,13 @@ abstract class Delivzone implements ActiveRecordInterface
*/ */
public function buildCriteria() public function buildCriteria()
{ {
$criteria = new Criteria(DelivzoneTableMap::DATABASE_NAME); $criteria = new Criteria(AreaDeliveryModuleTableMap::DATABASE_NAME);
if ($this->isColumnModified(DelivzoneTableMap::ID)) $criteria->add(DelivzoneTableMap::ID, $this->id); if ($this->isColumnModified(AreaDeliveryModuleTableMap::ID)) $criteria->add(AreaDeliveryModuleTableMap::ID, $this->id);
if ($this->isColumnModified(DelivzoneTableMap::AREA_ID)) $criteria->add(DelivzoneTableMap::AREA_ID, $this->area_id); if ($this->isColumnModified(AreaDeliveryModuleTableMap::AREA_ID)) $criteria->add(AreaDeliveryModuleTableMap::AREA_ID, $this->area_id);
if ($this->isColumnModified(DelivzoneTableMap::DELIVERY)) $criteria->add(DelivzoneTableMap::DELIVERY, $this->delivery); if ($this->isColumnModified(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID)) $criteria->add(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID, $this->delivery_module_id);
if ($this->isColumnModified(DelivzoneTableMap::CREATED_AT)) $criteria->add(DelivzoneTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(AreaDeliveryModuleTableMap::CREATED_AT)) $criteria->add(AreaDeliveryModuleTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(DelivzoneTableMap::UPDATED_AT)) $criteria->add(DelivzoneTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(AreaDeliveryModuleTableMap::UPDATED_AT)) $criteria->add(AreaDeliveryModuleTableMap::UPDATED_AT, $this->updated_at);
return $criteria; return $criteria;
} }
@@ -1107,8 +1132,8 @@ abstract class Delivzone implements ActiveRecordInterface
*/ */
public function buildPkeyCriteria() public function buildPkeyCriteria()
{ {
$criteria = new Criteria(DelivzoneTableMap::DATABASE_NAME); $criteria = new Criteria(AreaDeliveryModuleTableMap::DATABASE_NAME);
$criteria->add(DelivzoneTableMap::ID, $this->id); $criteria->add(AreaDeliveryModuleTableMap::ID, $this->id);
return $criteria; return $criteria;
} }
@@ -1149,7 +1174,7 @@ abstract class Delivzone implements ActiveRecordInterface
* If desired, this method can also make copies of all associated (fkey referrers) * If desired, this method can also make copies of all associated (fkey referrers)
* objects. * objects.
* *
* @param object $copyObj An object of \Thelia\Model\Delivzone (or compatible) type. * @param object $copyObj An object of \Thelia\Model\AreaDeliveryModule (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @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. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
* @throws PropelException * @throws PropelException
@@ -1157,7 +1182,7 @@ abstract class Delivzone implements ActiveRecordInterface
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{ {
$copyObj->setAreaId($this->getAreaId()); $copyObj->setAreaId($this->getAreaId());
$copyObj->setDelivery($this->getDelivery()); $copyObj->setDeliveryModuleId($this->getDeliveryModuleId());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) { if ($makeNew) {
@@ -1175,7 +1200,7 @@ abstract class Delivzone implements ActiveRecordInterface
* objects. * objects.
* *
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @return \Thelia\Model\Delivzone Clone of current object. * @return \Thelia\Model\AreaDeliveryModule Clone of current object.
* @throws PropelException * @throws PropelException
*/ */
public function copy($deepCopy = false) public function copy($deepCopy = false)
@@ -1192,7 +1217,7 @@ abstract class Delivzone implements ActiveRecordInterface
* Declares an association between this object and a ChildArea object. * Declares an association between this object and a ChildArea object.
* *
* @param ChildArea $v * @param ChildArea $v
* @return \Thelia\Model\Delivzone The current object (for fluent API support) * @return \Thelia\Model\AreaDeliveryModule The current object (for fluent API support)
* @throws PropelException * @throws PropelException
*/ */
public function setArea(ChildArea $v = null) public function setArea(ChildArea $v = null)
@@ -1208,7 +1233,7 @@ abstract class Delivzone implements ActiveRecordInterface
// Add binding for other direction of this n:n relationship. // 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 this object has already been added to the ChildArea object, it will not be re-added.
if ($v !== null) { if ($v !== null) {
$v->addDelivzone($this); $v->addAreaDeliveryModule($this);
} }
@@ -1232,13 +1257,64 @@ abstract class Delivzone implements ActiveRecordInterface
to this object. This level of coupling may, however, be to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection undesirable since it could result in an only partially populated collection
in the referenced object. in the referenced object.
$this->aArea->addDelivzones($this); $this->aArea->addAreaDeliveryModules($this);
*/ */
} }
return $this->aArea; return $this->aArea;
} }
/**
* Declares an association between this object and a ChildModule object.
*
* @param ChildModule $v
* @return \Thelia\Model\AreaDeliveryModule The current object (for fluent API support)
* @throws PropelException
*/
public function setModule(ChildModule $v = null)
{
if ($v === null) {
$this->setDeliveryModuleId(NULL);
} else {
$this->setDeliveryModuleId($v->getId());
}
$this->aModule = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the ChildModule object, it will not be re-added.
if ($v !== null) {
$v->addAreaDeliveryModule($this);
}
return $this;
}
/**
* Get the associated ChildModule object
*
* @param ConnectionInterface $con Optional Connection object.
* @return ChildModule The associated ChildModule object.
* @throws PropelException
*/
public function getModule(ConnectionInterface $con = null)
{
if ($this->aModule === null && ($this->delivery_module_id !== null)) {
$this->aModule = ChildModuleQuery::create()->findPk($this->delivery_module_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->aModule->addAreaDeliveryModules($this);
*/
}
return $this->aModule;
}
/** /**
* Clears the current object and sets all attributes to their default values * Clears the current object and sets all attributes to their default values
*/ */
@@ -1246,7 +1322,7 @@ abstract class Delivzone implements ActiveRecordInterface
{ {
$this->id = null; $this->id = null;
$this->area_id = null; $this->area_id = null;
$this->delivery = null; $this->delivery_module_id = null;
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
@@ -1271,6 +1347,7 @@ abstract class Delivzone implements ActiveRecordInterface
} // if ($deep) } // if ($deep)
$this->aArea = null; $this->aArea = null;
$this->aModule = null;
} }
/** /**
@@ -1280,7 +1357,7 @@ abstract class Delivzone implements ActiveRecordInterface
*/ */
public function __toString() public function __toString()
{ {
return (string) $this->exportTo(DelivzoneTableMap::DEFAULT_STRING_FORMAT); return (string) $this->exportTo(AreaDeliveryModuleTableMap::DEFAULT_STRING_FORMAT);
} }
// timestampable behavior // timestampable behavior
@@ -1288,11 +1365,11 @@ abstract class Delivzone implements ActiveRecordInterface
/** /**
* Mark the current object so that the update date doesn't get updated during next save * Mark the current object so that the update date doesn't get updated during next save
* *
* @return ChildDelivzone The current object (for fluent API support) * @return ChildAreaDeliveryModule The current object (for fluent API support)
*/ */
public function keepUpdateDateUnchanged() public function keepUpdateDateUnchanged()
{ {
$this->modifiedColumns[] = DelivzoneTableMap::UPDATED_AT; $this->modifiedColumns[] = AreaDeliveryModuleTableMap::UPDATED_AT;
return $this; return $this;
} }

View File

@@ -12,80 +12,84 @@ use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Exception\PropelException;
use Thelia\Model\Delivzone as ChildDelivzone; use Thelia\Model\AreaDeliveryModule as ChildAreaDeliveryModule;
use Thelia\Model\DelivzoneQuery as ChildDelivzoneQuery; use Thelia\Model\AreaDeliveryModuleQuery as ChildAreaDeliveryModuleQuery;
use Thelia\Model\Map\DelivzoneTableMap; use Thelia\Model\Map\AreaDeliveryModuleTableMap;
/** /**
* Base class that represents a query for the 'delivzone' table. * Base class that represents a query for the 'area_delivery_module' table.
* *
* *
* *
* @method ChildDelivzoneQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildAreaDeliveryModuleQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildDelivzoneQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column * @method ChildAreaDeliveryModuleQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
* @method ChildDelivzoneQuery orderByDelivery($order = Criteria::ASC) Order by the delivery column * @method ChildAreaDeliveryModuleQuery orderByDeliveryModuleId($order = Criteria::ASC) Order by the delivery_module_id column
* @method ChildDelivzoneQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildAreaDeliveryModuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildDelivzoneQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildAreaDeliveryModuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* *
* @method ChildDelivzoneQuery groupById() Group by the id column * @method ChildAreaDeliveryModuleQuery groupById() Group by the id column
* @method ChildDelivzoneQuery groupByAreaId() Group by the area_id column * @method ChildAreaDeliveryModuleQuery groupByAreaId() Group by the area_id column
* @method ChildDelivzoneQuery groupByDelivery() Group by the delivery column * @method ChildAreaDeliveryModuleQuery groupByDeliveryModuleId() Group by the delivery_module_id column
* @method ChildDelivzoneQuery groupByCreatedAt() Group by the created_at column * @method ChildAreaDeliveryModuleQuery groupByCreatedAt() Group by the created_at column
* @method ChildDelivzoneQuery groupByUpdatedAt() Group by the updated_at column * @method ChildAreaDeliveryModuleQuery groupByUpdatedAt() Group by the updated_at column
* *
* @method ChildDelivzoneQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildAreaDeliveryModuleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildDelivzoneQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildAreaDeliveryModuleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildDelivzoneQuery innerJoin($relation) Adds a INNER JOIN clause to the query * @method ChildAreaDeliveryModuleQuery innerJoin($relation) Adds a INNER JOIN clause to the query
* *
* @method ChildDelivzoneQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation * @method ChildAreaDeliveryModuleQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
* @method ChildDelivzoneQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation * @method ChildAreaDeliveryModuleQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
* @method ChildDelivzoneQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation * @method ChildAreaDeliveryModuleQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
* *
* @method ChildDelivzone findOne(ConnectionInterface $con = null) Return the first ChildDelivzone matching the query * @method ChildAreaDeliveryModuleQuery leftJoinModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the Module relation
* @method ChildDelivzone findOneOrCreate(ConnectionInterface $con = null) Return the first ChildDelivzone matching the query, or a new ChildDelivzone object populated from the query conditions when no match is found * @method ChildAreaDeliveryModuleQuery rightJoinModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Module relation
* @method ChildAreaDeliveryModuleQuery innerJoinModule($relationAlias = null) Adds a INNER JOIN clause to the query using the Module relation
* *
* @method ChildDelivzone findOneById(int $id) Return the first ChildDelivzone filtered by the id column * @method ChildAreaDeliveryModule findOne(ConnectionInterface $con = null) Return the first ChildAreaDeliveryModule matching the query
* @method ChildDelivzone findOneByAreaId(int $area_id) Return the first ChildDelivzone filtered by the area_id column * @method ChildAreaDeliveryModule findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAreaDeliveryModule matching the query, or a new ChildAreaDeliveryModule object populated from the query conditions when no match is found
* @method ChildDelivzone findOneByDelivery(string $delivery) Return the first ChildDelivzone filtered by the delivery column
* @method ChildDelivzone findOneByCreatedAt(string $created_at) Return the first ChildDelivzone filtered by the created_at column
* @method ChildDelivzone findOneByUpdatedAt(string $updated_at) Return the first ChildDelivzone filtered by the updated_at column
* *
* @method array findById(int $id) Return ChildDelivzone objects filtered by the id column * @method ChildAreaDeliveryModule findOneById(int $id) Return the first ChildAreaDeliveryModule filtered by the id column
* @method array findByAreaId(int $area_id) Return ChildDelivzone objects filtered by the area_id column * @method ChildAreaDeliveryModule findOneByAreaId(int $area_id) Return the first ChildAreaDeliveryModule filtered by the area_id column
* @method array findByDelivery(string $delivery) Return ChildDelivzone objects filtered by the delivery column * @method ChildAreaDeliveryModule findOneByDeliveryModuleId(int $delivery_module_id) Return the first ChildAreaDeliveryModule filtered by the delivery_module_id column
* @method array findByCreatedAt(string $created_at) Return ChildDelivzone objects filtered by the created_at column * @method ChildAreaDeliveryModule findOneByCreatedAt(string $created_at) Return the first ChildAreaDeliveryModule filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildDelivzone objects filtered by the updated_at column * @method ChildAreaDeliveryModule findOneByUpdatedAt(string $updated_at) Return the first ChildAreaDeliveryModule filtered by the updated_at column
*
* @method array findById(int $id) Return ChildAreaDeliveryModule objects filtered by the id column
* @method array findByAreaId(int $area_id) Return ChildAreaDeliveryModule objects filtered by the area_id column
* @method array findByDeliveryModuleId(int $delivery_module_id) Return ChildAreaDeliveryModule objects filtered by the delivery_module_id column
* @method array findByCreatedAt(string $created_at) Return ChildAreaDeliveryModule objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildAreaDeliveryModule objects filtered by the updated_at column
* *
*/ */
abstract class DelivzoneQuery extends ModelCriteria abstract class AreaDeliveryModuleQuery extends ModelCriteria
{ {
/** /**
* Initializes internal state of \Thelia\Model\Base\DelivzoneQuery object. * Initializes internal state of \Thelia\Model\Base\AreaDeliveryModuleQuery object.
* *
* @param string $dbName The database name * @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book' * @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b' * @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/ */
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\Delivzone', $modelAlias = null) public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\AreaDeliveryModule', $modelAlias = null)
{ {
parent::__construct($dbName, $modelName, $modelAlias); parent::__construct($dbName, $modelName, $modelAlias);
} }
/** /**
* Returns a new ChildDelivzoneQuery object. * Returns a new ChildAreaDeliveryModuleQuery object.
* *
* @param string $modelAlias The alias of a model in the query * @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from * @param Criteria $criteria Optional Criteria to build the query from
* *
* @return ChildDelivzoneQuery * @return ChildAreaDeliveryModuleQuery
*/ */
public static function create($modelAlias = null, $criteria = null) public static function create($modelAlias = null, $criteria = null)
{ {
if ($criteria instanceof \Thelia\Model\DelivzoneQuery) { if ($criteria instanceof \Thelia\Model\AreaDeliveryModuleQuery) {
return $criteria; return $criteria;
} }
$query = new \Thelia\Model\DelivzoneQuery(); $query = new \Thelia\Model\AreaDeliveryModuleQuery();
if (null !== $modelAlias) { if (null !== $modelAlias) {
$query->setModelAlias($modelAlias); $query->setModelAlias($modelAlias);
} }
@@ -108,19 +112,19 @@ abstract class DelivzoneQuery extends ModelCriteria
* @param mixed $key Primary key to use for the query * @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object * @param ConnectionInterface $con an optional connection object
* *
* @return ChildDelivzone|array|mixed the result, formatted by the current formatter * @return ChildAreaDeliveryModule|array|mixed the result, formatted by the current formatter
*/ */
public function findPk($key, $con = null) public function findPk($key, $con = null)
{ {
if ($key === null) { if ($key === null) {
return null; return null;
} }
if ((null !== ($obj = DelivzoneTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { if ((null !== ($obj = AreaDeliveryModuleTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool // the object is already in the instance pool
return $obj; return $obj;
} }
if ($con === null) { if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(DelivzoneTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getReadConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
} }
$this->basePreSelect($con); $this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select if ($this->formatter || $this->modelAlias || $this->with || $this->select
@@ -139,11 +143,11 @@ abstract class DelivzoneQuery extends ModelCriteria
* @param mixed $key Primary key to use for the query * @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object * @param ConnectionInterface $con A connection object
* *
* @return ChildDelivzone A model object, or null if the key is not found * @return ChildAreaDeliveryModule A model object, or null if the key is not found
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, AREA_ID, DELIVERY, CREATED_AT, UPDATED_AT FROM delivzone WHERE ID = :p0'; $sql = 'SELECT ID, AREA_ID, DELIVERY_MODULE_ID, CREATED_AT, UPDATED_AT FROM area_delivery_module WHERE ID = :p0';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -154,9 +158,9 @@ abstract class DelivzoneQuery extends ModelCriteria
} }
$obj = null; $obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildDelivzone(); $obj = new ChildAreaDeliveryModule();
$obj->hydrate($row); $obj->hydrate($row);
DelivzoneTableMap::addInstanceToPool($obj, (string) $key); AreaDeliveryModuleTableMap::addInstanceToPool($obj, (string) $key);
} }
$stmt->closeCursor(); $stmt->closeCursor();
@@ -169,7 +173,7 @@ abstract class DelivzoneQuery extends ModelCriteria
* @param mixed $key Primary key to use for the query * @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object * @param ConnectionInterface $con A connection object
* *
* @return ChildDelivzone|array|mixed the result, formatted by the current formatter * @return ChildAreaDeliveryModule|array|mixed the result, formatted by the current formatter
*/ */
protected function findPkComplex($key, $con) protected function findPkComplex($key, $con)
{ {
@@ -211,12 +215,12 @@ abstract class DelivzoneQuery extends ModelCriteria
* *
* @param mixed $key Primary key to use for the query * @param mixed $key Primary key to use for the query
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function filterByPrimaryKey($key) public function filterByPrimaryKey($key)
{ {
return $this->addUsingAlias(DelivzoneTableMap::ID, $key, Criteria::EQUAL); return $this->addUsingAlias(AreaDeliveryModuleTableMap::ID, $key, Criteria::EQUAL);
} }
/** /**
@@ -224,12 +228,12 @@ abstract class DelivzoneQuery extends ModelCriteria
* *
* @param array $keys The list of primary key to use for the query * @param array $keys The list of primary key to use for the query
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function filterByPrimaryKeys($keys) public function filterByPrimaryKeys($keys)
{ {
return $this->addUsingAlias(DelivzoneTableMap::ID, $keys, Criteria::IN); return $this->addUsingAlias(AreaDeliveryModuleTableMap::ID, $keys, Criteria::IN);
} }
/** /**
@@ -248,18 +252,18 @@ abstract class DelivzoneQuery extends ModelCriteria
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function filterById($id = null, $comparison = null) public function filterById($id = null, $comparison = null)
{ {
if (is_array($id)) { if (is_array($id)) {
$useMinMax = false; $useMinMax = false;
if (isset($id['min'])) { if (isset($id['min'])) {
$this->addUsingAlias(DelivzoneTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(AreaDeliveryModuleTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($id['max'])) { if (isset($id['max'])) {
$this->addUsingAlias(DelivzoneTableMap::ID, $id['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(AreaDeliveryModuleTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -270,7 +274,7 @@ abstract class DelivzoneQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(DelivzoneTableMap::ID, $id, $comparison); return $this->addUsingAlias(AreaDeliveryModuleTableMap::ID, $id, $comparison);
} }
/** /**
@@ -291,18 +295,18 @@ abstract class DelivzoneQuery extends ModelCriteria
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function filterByAreaId($areaId = null, $comparison = null) public function filterByAreaId($areaId = null, $comparison = null)
{ {
if (is_array($areaId)) { if (is_array($areaId)) {
$useMinMax = false; $useMinMax = false;
if (isset($areaId['min'])) { if (isset($areaId['min'])) {
$this->addUsingAlias(DelivzoneTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(AreaDeliveryModuleTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($areaId['max'])) { if (isset($areaId['max'])) {
$this->addUsingAlias(DelivzoneTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(AreaDeliveryModuleTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -313,36 +317,50 @@ abstract class DelivzoneQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(DelivzoneTableMap::AREA_ID, $areaId, $comparison); return $this->addUsingAlias(AreaDeliveryModuleTableMap::AREA_ID, $areaId, $comparison);
} }
/** /**
* Filter the query on the delivery column * Filter the query on the delivery_module_id column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByDelivery('fooValue'); // WHERE delivery = 'fooValue' * $query->filterByDeliveryModuleId(1234); // WHERE delivery_module_id = 1234
* $query->filterByDelivery('%fooValue%'); // WHERE delivery LIKE '%fooValue%' * $query->filterByDeliveryModuleId(array(12, 34)); // WHERE delivery_module_id IN (12, 34)
* $query->filterByDeliveryModuleId(array('min' => 12)); // WHERE delivery_module_id > 12
* </code> * </code>
* *
* @param string $delivery The value to use as filter. * @see filterByModule()
* Accepts wildcards (* and % trigger a LIKE) *
* @param mixed $deliveryModuleId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function filterByDelivery($delivery = null, $comparison = null) public function filterByDeliveryModuleId($deliveryModuleId = null, $comparison = null)
{ {
if (null === $comparison) { if (is_array($deliveryModuleId)) {
if (is_array($delivery)) { $useMinMax = false;
if (isset($deliveryModuleId['min'])) {
$this->addUsingAlias(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID, $deliveryModuleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($deliveryModuleId['max'])) {
$this->addUsingAlias(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID, $deliveryModuleId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $delivery)) {
$delivery = str_replace('*', '%', $delivery);
$comparison = Criteria::LIKE;
} }
} }
return $this->addUsingAlias(DelivzoneTableMap::DELIVERY, $delivery, $comparison); return $this->addUsingAlias(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID, $deliveryModuleId, $comparison);
} }
/** /**
@@ -363,18 +381,18 @@ abstract class DelivzoneQuery extends ModelCriteria
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function filterByCreatedAt($createdAt = null, $comparison = null) public function filterByCreatedAt($createdAt = null, $comparison = null)
{ {
if (is_array($createdAt)) { if (is_array($createdAt)) {
$useMinMax = false; $useMinMax = false;
if (isset($createdAt['min'])) { if (isset($createdAt['min'])) {
$this->addUsingAlias(DelivzoneTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(AreaDeliveryModuleTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($createdAt['max'])) { if (isset($createdAt['max'])) {
$this->addUsingAlias(DelivzoneTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(AreaDeliveryModuleTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -385,7 +403,7 @@ abstract class DelivzoneQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(DelivzoneTableMap::CREATED_AT, $createdAt, $comparison); return $this->addUsingAlias(AreaDeliveryModuleTableMap::CREATED_AT, $createdAt, $comparison);
} }
/** /**
@@ -406,18 +424,18 @@ abstract class DelivzoneQuery extends ModelCriteria
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function filterByUpdatedAt($updatedAt = null, $comparison = null) public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{ {
if (is_array($updatedAt)) { if (is_array($updatedAt)) {
$useMinMax = false; $useMinMax = false;
if (isset($updatedAt['min'])) { if (isset($updatedAt['min'])) {
$this->addUsingAlias(DelivzoneTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(AreaDeliveryModuleTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($updatedAt['max'])) { if (isset($updatedAt['max'])) {
$this->addUsingAlias(DelivzoneTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(AreaDeliveryModuleTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -428,7 +446,7 @@ abstract class DelivzoneQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(DelivzoneTableMap::UPDATED_AT, $updatedAt, $comparison); return $this->addUsingAlias(AreaDeliveryModuleTableMap::UPDATED_AT, $updatedAt, $comparison);
} }
/** /**
@@ -437,20 +455,20 @@ abstract class DelivzoneQuery extends ModelCriteria
* @param \Thelia\Model\Area|ObjectCollection $area The related object(s) to use as filter * @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 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function filterByArea($area, $comparison = null) public function filterByArea($area, $comparison = null)
{ {
if ($area instanceof \Thelia\Model\Area) { if ($area instanceof \Thelia\Model\Area) {
return $this return $this
->addUsingAlias(DelivzoneTableMap::AREA_ID, $area->getId(), $comparison); ->addUsingAlias(AreaDeliveryModuleTableMap::AREA_ID, $area->getId(), $comparison);
} elseif ($area instanceof ObjectCollection) { } elseif ($area instanceof ObjectCollection) {
if (null === $comparison) { if (null === $comparison) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} }
return $this return $this
->addUsingAlias(DelivzoneTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison); ->addUsingAlias(AreaDeliveryModuleTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else { } else {
throw new PropelException('filterByArea() only accepts arguments of type \Thelia\Model\Area or Collection'); throw new PropelException('filterByArea() only accepts arguments of type \Thelia\Model\Area or Collection');
} }
@@ -462,9 +480,9 @@ abstract class DelivzoneQuery extends ModelCriteria
* @param string $relationAlias optional alias for the relation * @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function joinArea($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinArea($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Area'); $relationMap = $tableMap->getRelation('Area');
@@ -499,7 +517,7 @@ abstract class DelivzoneQuery extends ModelCriteria
* *
* @return \Thelia\Model\AreaQuery A secondary query class using the current class as primary query * @return \Thelia\Model\AreaQuery A secondary query class using the current class as primary query
*/ */
public function useAreaQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useAreaQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinArea($relationAlias, $joinType) ->joinArea($relationAlias, $joinType)
@@ -507,23 +525,98 @@ abstract class DelivzoneQuery extends ModelCriteria
} }
/** /**
* Exclude object from result * Filter the query by a related \Thelia\Model\Module object
* *
* @param ChildDelivzone $delivzone Object to remove from the list of results * @param \Thelia\Model\Module|ObjectCollection $module The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function prune($delivzone = null) public function filterByModule($module, $comparison = null)
{ {
if ($delivzone) { if ($module instanceof \Thelia\Model\Module) {
$this->addUsingAlias(DelivzoneTableMap::ID, $delivzone->getId(), Criteria::NOT_EQUAL); return $this
->addUsingAlias(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID, $module->getId(), $comparison);
} elseif ($module instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID, $module->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByModule() only accepts arguments of type \Thelia\Model\Module or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Module relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/
public function joinModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Module');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'Module');
} }
return $this; return $this;
} }
/** /**
* Deletes all rows from the delivzone table. * Use the Module relation Module object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\ModuleQuery A secondary query class using the current class as primary query
*/
public function useModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinModule($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Module', '\Thelia\Model\ModuleQuery');
}
/**
* Exclude object from result
*
* @param ChildAreaDeliveryModule $areaDeliveryModule Object to remove from the list of results
*
* @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/
public function prune($areaDeliveryModule = null)
{
if ($areaDeliveryModule) {
$this->addUsingAlias(AreaDeliveryModuleTableMap::ID, $areaDeliveryModule->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the area_delivery_module table.
* *
* @param ConnectionInterface $con the connection to use * @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). * @return int The number of affected rows (if supported by underlying database driver).
@@ -531,7 +624,7 @@ abstract class DelivzoneQuery extends ModelCriteria
public function doDeleteAll(ConnectionInterface $con = null) public function doDeleteAll(ConnectionInterface $con = null)
{ {
if (null === $con) { if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(DelivzoneTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getWriteConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
} }
$affectedRows = 0; // initialize var to track total num of affected rows $affectedRows = 0; // initialize var to track total num of affected rows
try { try {
@@ -542,8 +635,8 @@ abstract class DelivzoneQuery extends ModelCriteria
// Because this db requires some delete cascade/set null emulation, we have to // Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since // clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein). // instances get re-added by the select statement contained therein).
DelivzoneTableMap::clearInstancePool(); AreaDeliveryModuleTableMap::clearInstancePool();
DelivzoneTableMap::clearRelatedInstancePool(); AreaDeliveryModuleTableMap::clearRelatedInstancePool();
$con->commit(); $con->commit();
} catch (PropelException $e) { } catch (PropelException $e) {
@@ -555,9 +648,9 @@ abstract class DelivzoneQuery extends ModelCriteria
} }
/** /**
* Performs a DELETE on the database, given a ChildDelivzone or Criteria object OR a primary key value. * Performs a DELETE on the database, given a ChildAreaDeliveryModule or Criteria object OR a primary key value.
* *
* @param mixed $values Criteria or ChildDelivzone object or primary key or array of primary keys * @param mixed $values Criteria or ChildAreaDeliveryModule object or primary key or array of primary keys
* which is used to create the DELETE statement * which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use * @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 * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
@@ -568,13 +661,13 @@ abstract class DelivzoneQuery extends ModelCriteria
public function delete(ConnectionInterface $con = null) public function delete(ConnectionInterface $con = null)
{ {
if (null === $con) { if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(DelivzoneTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getWriteConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
} }
$criteria = $this; $criteria = $this;
// Set the correct dbName // Set the correct dbName
$criteria->setDbName(DelivzoneTableMap::DATABASE_NAME); $criteria->setDbName(AreaDeliveryModuleTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows $affectedRows = 0; // initialize var to track total num of affected rows
@@ -584,10 +677,10 @@ abstract class DelivzoneQuery extends ModelCriteria
$con->beginTransaction(); $con->beginTransaction();
DelivzoneTableMap::removeInstanceFromPool($criteria); AreaDeliveryModuleTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con); $affectedRows += ModelCriteria::delete($con);
DelivzoneTableMap::clearRelatedInstancePool(); AreaDeliveryModuleTableMap::clearRelatedInstancePool();
$con->commit(); $con->commit();
return $affectedRows; return $affectedRows;
@@ -604,11 +697,11 @@ abstract class DelivzoneQuery extends ModelCriteria
* *
* @param int $nbDays Maximum age of the latest update in days * @param int $nbDays Maximum age of the latest update in days
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function recentlyUpdated($nbDays = 7) public function recentlyUpdated($nbDays = 7)
{ {
return $this->addUsingAlias(DelivzoneTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); return $this->addUsingAlias(AreaDeliveryModuleTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
} }
/** /**
@@ -616,51 +709,51 @@ abstract class DelivzoneQuery extends ModelCriteria
* *
* @param int $nbDays Maximum age of in days * @param int $nbDays Maximum age of in days
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function recentlyCreated($nbDays = 7) public function recentlyCreated($nbDays = 7)
{ {
return $this->addUsingAlias(DelivzoneTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); return $this->addUsingAlias(AreaDeliveryModuleTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
} }
/** /**
* Order by update date desc * Order by update date desc
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function lastUpdatedFirst() public function lastUpdatedFirst()
{ {
return $this->addDescendingOrderByColumn(DelivzoneTableMap::UPDATED_AT); return $this->addDescendingOrderByColumn(AreaDeliveryModuleTableMap::UPDATED_AT);
} }
/** /**
* Order by update date asc * Order by update date asc
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function firstUpdatedFirst() public function firstUpdatedFirst()
{ {
return $this->addAscendingOrderByColumn(DelivzoneTableMap::UPDATED_AT); return $this->addAscendingOrderByColumn(AreaDeliveryModuleTableMap::UPDATED_AT);
} }
/** /**
* Order by create date desc * Order by create date desc
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function lastCreatedFirst() public function lastCreatedFirst()
{ {
return $this->addDescendingOrderByColumn(DelivzoneTableMap::CREATED_AT); return $this->addDescendingOrderByColumn(AreaDeliveryModuleTableMap::CREATED_AT);
} }
/** /**
* Order by create date asc * Order by create date asc
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function firstCreatedFirst() public function firstCreatedFirst()
{ {
return $this->addAscendingOrderByColumn(DelivzoneTableMap::CREATED_AT); return $this->addAscendingOrderByColumn(AreaDeliveryModuleTableMap::CREATED_AT);
} }
} // DelivzoneQuery } // AreaDeliveryModuleQuery

View File

@@ -23,13 +23,13 @@ use Thelia\Model\Map\AreaTableMap;
* *
* @method ChildAreaQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildAreaQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildAreaQuery orderByName($order = Criteria::ASC) Order by the name column * @method ChildAreaQuery orderByName($order = Criteria::ASC) Order by the name column
* @method ChildAreaQuery orderByUnit($order = Criteria::ASC) Order by the unit column * @method ChildAreaQuery orderByPostage($order = Criteria::ASC) Order by the postage column
* @method ChildAreaQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildAreaQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildAreaQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildAreaQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* *
* @method ChildAreaQuery groupById() Group by the id column * @method ChildAreaQuery groupById() Group by the id column
* @method ChildAreaQuery groupByName() Group by the name column * @method ChildAreaQuery groupByName() Group by the name column
* @method ChildAreaQuery groupByUnit() Group by the unit column * @method ChildAreaQuery groupByPostage() Group by the postage column
* @method ChildAreaQuery groupByCreatedAt() Group by the created_at column * @method ChildAreaQuery groupByCreatedAt() Group by the created_at column
* @method ChildAreaQuery groupByUpdatedAt() Group by the updated_at column * @method ChildAreaQuery groupByUpdatedAt() Group by the updated_at column
* *
@@ -41,22 +41,22 @@ use Thelia\Model\Map\AreaTableMap;
* @method ChildAreaQuery rightJoinCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Country relation * @method ChildAreaQuery rightJoinCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Country relation
* @method ChildAreaQuery innerJoinCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the Country relation * @method ChildAreaQuery innerJoinCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the Country relation
* *
* @method ChildAreaQuery leftJoinDelivzone($relationAlias = null) Adds a LEFT JOIN clause to the query using the Delivzone relation * @method ChildAreaQuery leftJoinAreaDeliveryModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the AreaDeliveryModule relation
* @method ChildAreaQuery rightJoinDelivzone($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Delivzone relation * @method ChildAreaQuery rightJoinAreaDeliveryModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AreaDeliveryModule relation
* @method ChildAreaQuery innerJoinDelivzone($relationAlias = null) Adds a INNER JOIN clause to the query using the Delivzone relation * @method ChildAreaQuery innerJoinAreaDeliveryModule($relationAlias = null) Adds a INNER JOIN clause to the query using the AreaDeliveryModule relation
* *
* @method ChildArea findOne(ConnectionInterface $con = null) Return the first ChildArea matching the query * @method ChildArea findOne(ConnectionInterface $con = null) Return the first ChildArea matching the query
* @method ChildArea findOneOrCreate(ConnectionInterface $con = null) Return the first ChildArea matching the query, or a new ChildArea object populated from the query conditions when no match is found * @method ChildArea findOneOrCreate(ConnectionInterface $con = null) Return the first ChildArea matching the query, or a new ChildArea object populated from the query conditions when no match is found
* *
* @method ChildArea findOneById(int $id) Return the first ChildArea filtered by the id column * @method ChildArea findOneById(int $id) Return the first ChildArea filtered by the id column
* @method ChildArea findOneByName(string $name) Return the first ChildArea filtered by the name column * @method ChildArea findOneByName(string $name) Return the first ChildArea filtered by the name column
* @method ChildArea findOneByUnit(double $unit) Return the first ChildArea filtered by the unit column * @method ChildArea findOneByPostage(double $postage) Return the first ChildArea filtered by the postage column
* @method ChildArea findOneByCreatedAt(string $created_at) Return the first ChildArea filtered by the created_at column * @method ChildArea findOneByCreatedAt(string $created_at) Return the first ChildArea filtered by the created_at column
* @method ChildArea findOneByUpdatedAt(string $updated_at) Return the first ChildArea filtered by the updated_at column * @method ChildArea findOneByUpdatedAt(string $updated_at) Return the first ChildArea filtered by the updated_at column
* *
* @method array findById(int $id) Return ChildArea objects filtered by the id column * @method array findById(int $id) Return ChildArea objects filtered by the id column
* @method array findByName(string $name) Return ChildArea objects filtered by the name column * @method array findByName(string $name) Return ChildArea objects filtered by the name column
* @method array findByUnit(double $unit) Return ChildArea objects filtered by the unit column * @method array findByPostage(double $postage) Return ChildArea objects filtered by the postage column
* @method array findByCreatedAt(string $created_at) Return ChildArea objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildArea objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildArea objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildArea objects filtered by the updated_at column
* *
@@ -147,7 +147,7 @@ abstract class AreaQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, NAME, UNIT, CREATED_AT, UPDATED_AT FROM area WHERE ID = :p0'; $sql = 'SELECT ID, NAME, POSTAGE, CREATED_AT, UPDATED_AT FROM area WHERE ID = :p0';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -307,16 +307,16 @@ abstract class AreaQuery extends ModelCriteria
} }
/** /**
* Filter the query on the unit column * Filter the query on the postage column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByUnit(1234); // WHERE unit = 1234 * $query->filterByPostage(1234); // WHERE postage = 1234
* $query->filterByUnit(array(12, 34)); // WHERE unit IN (12, 34) * $query->filterByPostage(array(12, 34)); // WHERE postage IN (12, 34)
* $query->filterByUnit(array('min' => 12)); // WHERE unit > 12 * $query->filterByPostage(array('min' => 12)); // WHERE postage > 12
* </code> * </code>
* *
* @param mixed $unit The value to use as filter. * @param mixed $postage The value to use as filter.
* Use scalar values for equality. * Use scalar values for equality.
* Use array values for in_array() equivalent. * Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@@ -324,16 +324,16 @@ abstract class AreaQuery extends ModelCriteria
* *
* @return ChildAreaQuery The current query, for fluid interface * @return ChildAreaQuery The current query, for fluid interface
*/ */
public function filterByUnit($unit = null, $comparison = null) public function filterByPostage($postage = null, $comparison = null)
{ {
if (is_array($unit)) { if (is_array($postage)) {
$useMinMax = false; $useMinMax = false;
if (isset($unit['min'])) { if (isset($postage['min'])) {
$this->addUsingAlias(AreaTableMap::UNIT, $unit['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(AreaTableMap::POSTAGE, $postage['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($unit['max'])) { if (isset($postage['max'])) {
$this->addUsingAlias(AreaTableMap::UNIT, $unit['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(AreaTableMap::POSTAGE, $postage['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -344,7 +344,7 @@ abstract class AreaQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(AreaTableMap::UNIT, $unit, $comparison); return $this->addUsingAlias(AreaTableMap::POSTAGE, $postage, $comparison);
} }
/** /**
@@ -507,40 +507,40 @@ abstract class AreaQuery extends ModelCriteria
} }
/** /**
* Filter the query by a related \Thelia\Model\Delivzone object * Filter the query by a related \Thelia\Model\AreaDeliveryModule object
* *
* @param \Thelia\Model\Delivzone|ObjectCollection $delivzone the related object to use as filter * @param \Thelia\Model\AreaDeliveryModule|ObjectCollection $areaDeliveryModule the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildAreaQuery The current query, for fluid interface * @return ChildAreaQuery The current query, for fluid interface
*/ */
public function filterByDelivzone($delivzone, $comparison = null) public function filterByAreaDeliveryModule($areaDeliveryModule, $comparison = null)
{ {
if ($delivzone instanceof \Thelia\Model\Delivzone) { if ($areaDeliveryModule instanceof \Thelia\Model\AreaDeliveryModule) {
return $this return $this
->addUsingAlias(AreaTableMap::ID, $delivzone->getAreaId(), $comparison); ->addUsingAlias(AreaTableMap::ID, $areaDeliveryModule->getAreaId(), $comparison);
} elseif ($delivzone instanceof ObjectCollection) { } elseif ($areaDeliveryModule instanceof ObjectCollection) {
return $this return $this
->useDelivzoneQuery() ->useAreaDeliveryModuleQuery()
->filterByPrimaryKeys($delivzone->getPrimaryKeys()) ->filterByPrimaryKeys($areaDeliveryModule->getPrimaryKeys())
->endUse(); ->endUse();
} else { } else {
throw new PropelException('filterByDelivzone() only accepts arguments of type \Thelia\Model\Delivzone or Collection'); throw new PropelException('filterByAreaDeliveryModule() only accepts arguments of type \Thelia\Model\AreaDeliveryModule or Collection');
} }
} }
/** /**
* Adds a JOIN clause to the query using the Delivzone relation * Adds a JOIN clause to the query using the AreaDeliveryModule relation
* *
* @param string $relationAlias optional alias for the relation * @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return ChildAreaQuery The current query, for fluid interface * @return ChildAreaQuery The current query, for fluid interface
*/ */
public function joinDelivzone($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinAreaDeliveryModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Delivzone'); $relationMap = $tableMap->getRelation('AreaDeliveryModule');
// create a ModelJoin object for this join // create a ModelJoin object for this join
$join = new ModelJoin(); $join = new ModelJoin();
@@ -555,14 +555,14 @@ abstract class AreaQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias); $this->addJoinObject($join, $relationAlias);
} else { } else {
$this->addJoinObject($join, 'Delivzone'); $this->addJoinObject($join, 'AreaDeliveryModule');
} }
return $this; return $this;
} }
/** /**
* Use the Delivzone relation Delivzone object * Use the AreaDeliveryModule relation AreaDeliveryModule object
* *
* @see useQuery() * @see useQuery()
* *
@@ -570,13 +570,13 @@ abstract class AreaQuery extends ModelCriteria
* to be used as main alias in the secondary query * to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return \Thelia\Model\DelivzoneQuery A secondary query class using the current class as primary query * @return \Thelia\Model\AreaDeliveryModuleQuery A secondary query class using the current class as primary query
*/ */
public function useDelivzoneQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useAreaDeliveryModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinDelivzone($relationAlias, $joinType) ->joinAreaDeliveryModule($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Delivzone', '\Thelia\Model\DelivzoneQuery'); ->useQuery($relationAlias ? $relationAlias : 'AreaDeliveryModule', '\Thelia\Model\AreaDeliveryModuleQuery');
} }
/** /**

View File

@@ -70,6 +70,12 @@ abstract class ContentFolder implements ActiveRecordInterface
*/ */
protected $folder_id; protected $folder_id;
/**
* The value for the default_folder field.
* @var boolean
*/
protected $default_folder;
/** /**
* The value for the created_at field. * The value for the created_at field.
* @var string * @var string
@@ -376,6 +382,17 @@ abstract class ContentFolder implements ActiveRecordInterface
return $this->folder_id; return $this->folder_id;
} }
/**
* Get the [default_folder] column value.
*
* @return boolean
*/
public function getDefaultFolder()
{
return $this->default_folder;
}
/** /**
* Get the [optionally formatted] temporal [created_at] column value. * Get the [optionally formatted] temporal [created_at] column value.
* *
@@ -466,6 +483,35 @@ abstract class ContentFolder implements ActiveRecordInterface
return $this; return $this;
} // setFolderId() } // setFolderId()
/**
* Sets the value of the [default_folder] column.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
*
* @param boolean|integer|string $v The new value
* @return \Thelia\Model\ContentFolder The current object (for fluent API support)
*/
public function setDefaultFolder($v)
{
if ($v !== null) {
if (is_string($v)) {
$v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
} else {
$v = (boolean) $v;
}
}
if ($this->default_folder !== $v) {
$this->default_folder = $v;
$this->modifiedColumns[] = ContentFolderTableMap::DEFAULT_FOLDER;
}
return $this;
} // setDefaultFolder()
/** /**
* Sets the value of [created_at] column to a normalized version of the date/time value specified. * Sets the value of [created_at] column to a normalized version of the date/time value specified.
* *
@@ -551,13 +597,16 @@ abstract class ContentFolder implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ContentFolderTableMap::translateFieldName('FolderId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ContentFolderTableMap::translateFieldName('FolderId', TableMap::TYPE_PHPNAME, $indexType)];
$this->folder_id = (null !== $col) ? (int) $col : null; $this->folder_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ContentFolderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ContentFolderTableMap::translateFieldName('DefaultFolder', TableMap::TYPE_PHPNAME, $indexType)];
$this->default_folder = (null !== $col) ? (boolean) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ContentFolderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ContentFolderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ContentFolderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
@@ -570,7 +619,7 @@ abstract class ContentFolder implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 4; // 4 = ContentFolderTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 5; // 5 = ContentFolderTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ContentFolder object", 0, $e); throw new PropelException("Error populating \Thelia\Model\ContentFolder object", 0, $e);
@@ -819,6 +868,9 @@ abstract class ContentFolder implements ActiveRecordInterface
if ($this->isColumnModified(ContentFolderTableMap::FOLDER_ID)) { if ($this->isColumnModified(ContentFolderTableMap::FOLDER_ID)) {
$modifiedColumns[':p' . $index++] = 'FOLDER_ID'; $modifiedColumns[':p' . $index++] = 'FOLDER_ID';
} }
if ($this->isColumnModified(ContentFolderTableMap::DEFAULT_FOLDER)) {
$modifiedColumns[':p' . $index++] = 'DEFAULT_FOLDER';
}
if ($this->isColumnModified(ContentFolderTableMap::CREATED_AT)) { if ($this->isColumnModified(ContentFolderTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT'; $modifiedColumns[':p' . $index++] = 'CREATED_AT';
} }
@@ -842,6 +894,9 @@ abstract class ContentFolder implements ActiveRecordInterface
case 'FOLDER_ID': case 'FOLDER_ID':
$stmt->bindValue($identifier, $this->folder_id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->folder_id, PDO::PARAM_INT);
break; break;
case 'DEFAULT_FOLDER':
$stmt->bindValue($identifier, (int) $this->default_folder, PDO::PARAM_INT);
break;
case 'CREATED_AT': case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break; break;
@@ -910,9 +965,12 @@ abstract class ContentFolder implements ActiveRecordInterface
return $this->getFolderId(); return $this->getFolderId();
break; break;
case 2: case 2:
return $this->getCreatedAt(); return $this->getDefaultFolder();
break; break;
case 3: case 3:
return $this->getCreatedAt();
break;
case 4:
return $this->getUpdatedAt(); return $this->getUpdatedAt();
break; break;
default: default:
@@ -946,8 +1004,9 @@ abstract class ContentFolder implements ActiveRecordInterface
$result = array( $result = array(
$keys[0] => $this->getContentId(), $keys[0] => $this->getContentId(),
$keys[1] => $this->getFolderId(), $keys[1] => $this->getFolderId(),
$keys[2] => $this->getCreatedAt(), $keys[2] => $this->getDefaultFolder(),
$keys[3] => $this->getUpdatedAt(), $keys[3] => $this->getCreatedAt(),
$keys[4] => $this->getUpdatedAt(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn) foreach($virtualColumns as $key => $virtualColumn)
@@ -1003,9 +1062,12 @@ abstract class ContentFolder implements ActiveRecordInterface
$this->setFolderId($value); $this->setFolderId($value);
break; break;
case 2: case 2:
$this->setCreatedAt($value); $this->setDefaultFolder($value);
break; break;
case 3: case 3:
$this->setCreatedAt($value);
break;
case 4:
$this->setUpdatedAt($value); $this->setUpdatedAt($value);
break; break;
} // switch() } // switch()
@@ -1034,8 +1096,9 @@ abstract class ContentFolder implements ActiveRecordInterface
if (array_key_exists($keys[0], $arr)) $this->setContentId($arr[$keys[0]]); if (array_key_exists($keys[0], $arr)) $this->setContentId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setFolderId($arr[$keys[1]]); if (array_key_exists($keys[1], $arr)) $this->setFolderId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setCreatedAt($arr[$keys[2]]); if (array_key_exists($keys[2], $arr)) $this->setDefaultFolder($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setUpdatedAt($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
} }
/** /**
@@ -1049,6 +1112,7 @@ abstract class ContentFolder implements ActiveRecordInterface
if ($this->isColumnModified(ContentFolderTableMap::CONTENT_ID)) $criteria->add(ContentFolderTableMap::CONTENT_ID, $this->content_id); if ($this->isColumnModified(ContentFolderTableMap::CONTENT_ID)) $criteria->add(ContentFolderTableMap::CONTENT_ID, $this->content_id);
if ($this->isColumnModified(ContentFolderTableMap::FOLDER_ID)) $criteria->add(ContentFolderTableMap::FOLDER_ID, $this->folder_id); if ($this->isColumnModified(ContentFolderTableMap::FOLDER_ID)) $criteria->add(ContentFolderTableMap::FOLDER_ID, $this->folder_id);
if ($this->isColumnModified(ContentFolderTableMap::DEFAULT_FOLDER)) $criteria->add(ContentFolderTableMap::DEFAULT_FOLDER, $this->default_folder);
if ($this->isColumnModified(ContentFolderTableMap::CREATED_AT)) $criteria->add(ContentFolderTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(ContentFolderTableMap::CREATED_AT)) $criteria->add(ContentFolderTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(ContentFolderTableMap::UPDATED_AT)) $criteria->add(ContentFolderTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(ContentFolderTableMap::UPDATED_AT)) $criteria->add(ContentFolderTableMap::UPDATED_AT, $this->updated_at);
@@ -1123,6 +1187,7 @@ abstract class ContentFolder implements ActiveRecordInterface
{ {
$copyObj->setContentId($this->getContentId()); $copyObj->setContentId($this->getContentId());
$copyObj->setFolderId($this->getFolderId()); $copyObj->setFolderId($this->getFolderId());
$copyObj->setDefaultFolder($this->getDefaultFolder());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) { if ($makeNew) {
@@ -1261,6 +1326,7 @@ abstract class ContentFolder implements ActiveRecordInterface
{ {
$this->content_id = null; $this->content_id = null;
$this->folder_id = null; $this->folder_id = null;
$this->default_folder = null;
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;

View File

@@ -23,11 +23,13 @@ use Thelia\Model\Map\ContentFolderTableMap;
* *
* @method ChildContentFolderQuery orderByContentId($order = Criteria::ASC) Order by the content_id column * @method ChildContentFolderQuery orderByContentId($order = Criteria::ASC) Order by the content_id column
* @method ChildContentFolderQuery orderByFolderId($order = Criteria::ASC) Order by the folder_id column * @method ChildContentFolderQuery orderByFolderId($order = Criteria::ASC) Order by the folder_id column
* @method ChildContentFolderQuery orderByDefaultFolder($order = Criteria::ASC) Order by the default_folder column
* @method ChildContentFolderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildContentFolderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildContentFolderQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildContentFolderQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* *
* @method ChildContentFolderQuery groupByContentId() Group by the content_id column * @method ChildContentFolderQuery groupByContentId() Group by the content_id column
* @method ChildContentFolderQuery groupByFolderId() Group by the folder_id column * @method ChildContentFolderQuery groupByFolderId() Group by the folder_id column
* @method ChildContentFolderQuery groupByDefaultFolder() Group by the default_folder column
* @method ChildContentFolderQuery groupByCreatedAt() Group by the created_at column * @method ChildContentFolderQuery groupByCreatedAt() Group by the created_at column
* @method ChildContentFolderQuery groupByUpdatedAt() Group by the updated_at column * @method ChildContentFolderQuery groupByUpdatedAt() Group by the updated_at column
* *
@@ -48,11 +50,13 @@ use Thelia\Model\Map\ContentFolderTableMap;
* *
* @method ChildContentFolder findOneByContentId(int $content_id) Return the first ChildContentFolder filtered by the content_id column * @method ChildContentFolder findOneByContentId(int $content_id) Return the first ChildContentFolder filtered by the content_id column
* @method ChildContentFolder findOneByFolderId(int $folder_id) Return the first ChildContentFolder filtered by the folder_id column * @method ChildContentFolder findOneByFolderId(int $folder_id) Return the first ChildContentFolder filtered by the folder_id column
* @method ChildContentFolder findOneByDefaultFolder(boolean $default_folder) Return the first ChildContentFolder filtered by the default_folder column
* @method ChildContentFolder findOneByCreatedAt(string $created_at) Return the first ChildContentFolder filtered by the created_at column * @method ChildContentFolder findOneByCreatedAt(string $created_at) Return the first ChildContentFolder filtered by the created_at column
* @method ChildContentFolder findOneByUpdatedAt(string $updated_at) Return the first ChildContentFolder filtered by the updated_at column * @method ChildContentFolder findOneByUpdatedAt(string $updated_at) Return the first ChildContentFolder filtered by the updated_at column
* *
* @method array findByContentId(int $content_id) Return ChildContentFolder objects filtered by the content_id column * @method array findByContentId(int $content_id) Return ChildContentFolder objects filtered by the content_id column
* @method array findByFolderId(int $folder_id) Return ChildContentFolder objects filtered by the folder_id column * @method array findByFolderId(int $folder_id) Return ChildContentFolder objects filtered by the folder_id column
* @method array findByDefaultFolder(boolean $default_folder) Return ChildContentFolder objects filtered by the default_folder column
* @method array findByCreatedAt(string $created_at) Return ChildContentFolder objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildContentFolder objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildContentFolder objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildContentFolder objects filtered by the updated_at column
* *
@@ -143,7 +147,7 @@ abstract class ContentFolderQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT CONTENT_ID, FOLDER_ID, CREATED_AT, UPDATED_AT FROM content_folder WHERE CONTENT_ID = :p0 AND FOLDER_ID = :p1'; $sql = 'SELECT CONTENT_ID, FOLDER_ID, DEFAULT_FOLDER, CREATED_AT, UPDATED_AT FROM content_folder WHERE CONTENT_ID = :p0 AND FOLDER_ID = :p1';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -330,6 +334,33 @@ abstract class ContentFolderQuery extends ModelCriteria
return $this->addUsingAlias(ContentFolderTableMap::FOLDER_ID, $folderId, $comparison); return $this->addUsingAlias(ContentFolderTableMap::FOLDER_ID, $folderId, $comparison);
} }
/**
* Filter the query on the default_folder column
*
* Example usage:
* <code>
* $query->filterByDefaultFolder(true); // WHERE default_folder = true
* $query->filterByDefaultFolder('yes'); // WHERE default_folder = true
* </code>
*
* @param boolean|string $defaultFolder The value to use as filter.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildContentFolderQuery The current query, for fluid interface
*/
public function filterByDefaultFolder($defaultFolder = null, $comparison = null)
{
if (is_string($defaultFolder)) {
$default_folder = in_array(strtolower($defaultFolder), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(ContentFolderTableMap::DEFAULT_FOLDER, $defaultFolder, $comparison);
}
/** /**
* Filter the query on the created_at column * Filter the query on the created_at column
* *

View File

@@ -987,10 +987,9 @@ abstract class Currency implements ActiveRecordInterface
if ($this->ordersScheduledForDeletion !== null) { if ($this->ordersScheduledForDeletion !== null) {
if (!$this->ordersScheduledForDeletion->isEmpty()) { if (!$this->ordersScheduledForDeletion->isEmpty()) {
foreach ($this->ordersScheduledForDeletion as $order) { \Thelia\Model\OrderQuery::create()
// need to save related object because we set the relation to null ->filterByPrimaryKeys($this->ordersScheduledForDeletion->getPrimaryKeys(false))
$order->save($con); ->delete($con);
}
$this->ordersScheduledForDeletion = null; $this->ordersScheduledForDeletion = null;
} }
} }
@@ -1758,7 +1757,7 @@ abstract class Currency implements ActiveRecordInterface
$this->ordersScheduledForDeletion = clone $this->collOrders; $this->ordersScheduledForDeletion = clone $this->collOrders;
$this->ordersScheduledForDeletion->clear(); $this->ordersScheduledForDeletion->clear();
} }
$this->ordersScheduledForDeletion[]= $order; $this->ordersScheduledForDeletion[]= clone $order;
$order->setCurrency(null); $order->setCurrency(null);
} }
@@ -1807,10 +1806,10 @@ abstract class Currency implements ActiveRecordInterface
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects * @return Collection|ChildOrder[] List of ChildOrder objects
*/ */
public function getOrdersJoinOrderAddressRelatedByAddressInvoice($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) public function getOrdersJoinOrderAddressRelatedByInvoiceOrderAddressId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{ {
$query = ChildOrderQuery::create(null, $criteria); $query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('OrderAddressRelatedByAddressInvoice', $joinBehavior); $query->joinWith('OrderAddressRelatedByInvoiceOrderAddressId', $joinBehavior);
return $this->getOrders($query, $con); return $this->getOrders($query, $con);
} }
@@ -1832,10 +1831,10 @@ abstract class Currency implements ActiveRecordInterface
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects * @return Collection|ChildOrder[] List of ChildOrder objects
*/ */
public function getOrdersJoinOrderAddressRelatedByAddressDelivery($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) public function getOrdersJoinOrderAddressRelatedByDeliveryOrderAddressId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{ {
$query = ChildOrderQuery::create(null, $criteria); $query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('OrderAddressRelatedByAddressDelivery', $joinBehavior); $query->joinWith('OrderAddressRelatedByDeliveryOrderAddressId', $joinBehavior);
return $this->getOrders($query, $con); return $this->getOrders($query, $con);
} }
@@ -1865,6 +1864,81 @@ abstract class Currency implements ActiveRecordInterface
return $this->getOrders($query, $con); return $this->getOrders($query, $con);
} }
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Currency is new, it will return
* an empty collection; or if this Currency has previously
* been saved, it will retrieve related Orders from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in Currency.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersJoinModuleRelatedByPaymentModuleId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('ModuleRelatedByPaymentModuleId', $joinBehavior);
return $this->getOrders($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Currency is new, it will return
* an empty collection; or if this Currency has previously
* been saved, it will retrieve related Orders from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in Currency.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersJoinModuleRelatedByDeliveryModuleId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('ModuleRelatedByDeliveryModuleId', $joinBehavior);
return $this->getOrders($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Currency is new, it will return
* an empty collection; or if this Currency has previously
* been saved, it will retrieve related Orders from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in Currency.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersJoinLang($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('Lang', $joinBehavior);
return $this->getOrders($query, $con);
}
/** /**
* Clears out the collCarts collection * Clears out the collCarts collection
* *

View File

@@ -596,7 +596,7 @@ abstract class CurrencyQuery extends ModelCriteria
* *
* @return ChildCurrencyQuery The current query, for fluid interface * @return ChildCurrencyQuery The current query, for fluid interface
*/ */
public function joinOrder($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Order'); $relationMap = $tableMap->getRelation('Order');
@@ -631,7 +631,7 @@ abstract class CurrencyQuery extends ModelCriteria
* *
* @return \Thelia\Model\OrderQuery A secondary query class using the current class as primary query * @return \Thelia\Model\OrderQuery A secondary query class using the current class as primary query
*/ */
public function useOrderQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinOrder($relationAlias, $joinType) ->joinOrder($relationAlias, $joinType)

View File

@@ -2552,10 +2552,10 @@ abstract class Customer implements ActiveRecordInterface
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects * @return Collection|ChildOrder[] List of ChildOrder objects
*/ */
public function getOrdersJoinOrderAddressRelatedByAddressInvoice($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) public function getOrdersJoinOrderAddressRelatedByInvoiceOrderAddressId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{ {
$query = ChildOrderQuery::create(null, $criteria); $query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('OrderAddressRelatedByAddressInvoice', $joinBehavior); $query->joinWith('OrderAddressRelatedByInvoiceOrderAddressId', $joinBehavior);
return $this->getOrders($query, $con); return $this->getOrders($query, $con);
} }
@@ -2577,10 +2577,10 @@ abstract class Customer implements ActiveRecordInterface
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects * @return Collection|ChildOrder[] List of ChildOrder objects
*/ */
public function getOrdersJoinOrderAddressRelatedByAddressDelivery($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) public function getOrdersJoinOrderAddressRelatedByDeliveryOrderAddressId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{ {
$query = ChildOrderQuery::create(null, $criteria); $query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('OrderAddressRelatedByAddressDelivery', $joinBehavior); $query->joinWith('OrderAddressRelatedByDeliveryOrderAddressId', $joinBehavior);
return $this->getOrders($query, $con); return $this->getOrders($query, $con);
} }
@@ -2610,6 +2610,81 @@ abstract class Customer implements ActiveRecordInterface
return $this->getOrders($query, $con); return $this->getOrders($query, $con);
} }
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Customer is new, it will return
* an empty collection; or if this Customer has previously
* been saved, it will retrieve related Orders from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in Customer.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersJoinModuleRelatedByPaymentModuleId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('ModuleRelatedByPaymentModuleId', $joinBehavior);
return $this->getOrders($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Customer is new, it will return
* an empty collection; or if this Customer has previously
* been saved, it will retrieve related Orders from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in Customer.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersJoinModuleRelatedByDeliveryModuleId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('ModuleRelatedByDeliveryModuleId', $joinBehavior);
return $this->getOrders($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Customer is new, it will return
* an empty collection; or if this Customer has previously
* been saved, it will retrieve related Orders from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in Customer.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersJoinLang($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('Lang', $joinBehavior);
return $this->getOrders($query, $con);
}
/** /**
* Clears out the collCarts collection * Clears out the collCarts collection
* *

View File

@@ -10,6 +10,7 @@ use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveRecord\ActiveRecordInterface; use Propel\Runtime\ActiveRecord\ActiveRecordInterface;
use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\BadMethodCallException; use Propel\Runtime\Exception\BadMethodCallException;
use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Exception\PropelException;
@@ -18,6 +19,8 @@ use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime; use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\Lang as ChildLang; use Thelia\Model\Lang as ChildLang;
use Thelia\Model\LangQuery as ChildLangQuery; use Thelia\Model\LangQuery as ChildLangQuery;
use Thelia\Model\Order as ChildOrder;
use Thelia\Model\OrderQuery as ChildOrderQuery;
use Thelia\Model\Map\LangTableMap; use Thelia\Model\Map\LangTableMap;
abstract class Lang implements ActiveRecordInterface abstract class Lang implements ActiveRecordInterface
@@ -144,6 +147,12 @@ abstract class Lang implements ActiveRecordInterface
*/ */
protected $updated_at; protected $updated_at;
/**
* @var ObjectCollection|ChildOrder[] Collection to store aggregation of ChildOrder objects.
*/
protected $collOrders;
protected $collOrdersPartial;
/** /**
* Flag to prevent endless save loop, if this object is referenced * Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction. * by another object which falls in this transaction.
@@ -152,6 +161,12 @@ abstract class Lang implements ActiveRecordInterface
*/ */
protected $alreadyInSave = false; protected $alreadyInSave = false;
/**
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $ordersScheduledForDeletion = null;
/** /**
* Initializes internal state of Thelia\Model\Base\Lang object. * Initializes internal state of Thelia\Model\Base\Lang object.
*/ */
@@ -1060,6 +1075,8 @@ abstract class Lang implements ActiveRecordInterface
if ($deep) { // also de-associate any related objects? if ($deep) { // also de-associate any related objects?
$this->collOrders = null;
} // if (deep) } // if (deep)
} }
@@ -1193,6 +1210,23 @@ abstract class Lang implements ActiveRecordInterface
$this->resetModified(); $this->resetModified();
} }
if ($this->ordersScheduledForDeletion !== null) {
if (!$this->ordersScheduledForDeletion->isEmpty()) {
\Thelia\Model\OrderQuery::create()
->filterByPrimaryKeys($this->ordersScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->ordersScheduledForDeletion = null;
}
}
if ($this->collOrders !== null) {
foreach ($this->collOrders as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false; $this->alreadyInSave = false;
} }
@@ -1444,10 +1478,11 @@ abstract class Lang implements ActiveRecordInterface
* Defaults to TableMap::TYPE_PHPNAME. * Defaults to TableMap::TYPE_PHPNAME.
* @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. * @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 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 * @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()) public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{ {
if (isset($alreadyDumpedObjects['Lang'][$this->getPrimaryKey()])) { if (isset($alreadyDumpedObjects['Lang'][$this->getPrimaryKey()])) {
return '*RECURSION*'; return '*RECURSION*';
@@ -1477,6 +1512,11 @@ abstract class Lang implements ActiveRecordInterface
$result[$key] = $virtualColumn; $result[$key] = $virtualColumn;
} }
if ($includeForeignObjects) {
if (null !== $this->collOrders) {
$result['Orders'] = $this->collOrders->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
}
return $result; return $result;
} }
@@ -1697,6 +1737,20 @@ abstract class Lang implements ActiveRecordInterface
$copyObj->setPosition($this->getPosition()); $copyObj->setPosition($this->getPosition());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
if ($deepCopy) {
// important: temporarily setNew(false) because this affects the behavior of
// the getter/setter methods for fkey referrer objects.
$copyObj->setNew(false);
foreach ($this->getOrders() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addOrder($relObj->copy($deepCopy));
}
}
} // if ($deepCopy)
if ($makeNew) { if ($makeNew) {
$copyObj->setNew(true); $copyObj->setNew(true);
$copyObj->setId(NULL); // this is a auto-increment column, so set to default value $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
@@ -1725,6 +1779,415 @@ abstract class Lang implements ActiveRecordInterface
return $copyObj; return $copyObj;
} }
/**
* Initializes a collection based on the name of a relation.
* Avoids crafting an 'init[$relationName]s' method name
* that wouldn't work when StandardEnglishPluralizer is used.
*
* @param string $relationName The name of the relation to initialize
* @return void
*/
public function initRelation($relationName)
{
if ('Order' == $relationName) {
return $this->initOrders();
}
}
/**
* Clears out the collOrders collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return void
* @see addOrders()
*/
public function clearOrders()
{
$this->collOrders = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Reset is the collOrders collection loaded partially.
*/
public function resetPartialOrders($v = true)
{
$this->collOrdersPartial = $v;
}
/**
* Initializes the collOrders collection.
*
* By default this just sets the collOrders collection to an empty array (like clearcollOrders());
* however, you may wish to override this method in your stub class to provide setting appropriate
* to your application -- for example, setting the initial array to the values stored in database.
*
* @param boolean $overrideExisting If set to true, the method call initializes
* the collection even if it is not empty
*
* @return void
*/
public function initOrders($overrideExisting = true)
{
if (null !== $this->collOrders && !$overrideExisting) {
return;
}
$this->collOrders = new ObjectCollection();
$this->collOrders->setModel('\Thelia\Model\Order');
}
/**
* Gets an array of ChildOrder objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this ChildLang is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @return Collection|ChildOrder[] List of ChildOrder objects
* @throws PropelException
*/
public function getOrders($criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collOrdersPartial && !$this->isNew();
if (null === $this->collOrders || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collOrders) {
// return empty collection
$this->initOrders();
} else {
$collOrders = ChildOrderQuery::create(null, $criteria)
->filterByLang($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collOrdersPartial && count($collOrders)) {
$this->initOrders(false);
foreach ($collOrders as $obj) {
if (false == $this->collOrders->contains($obj)) {
$this->collOrders->append($obj);
}
}
$this->collOrdersPartial = true;
}
$collOrders->getInternalIterator()->rewind();
return $collOrders;
}
if ($partial && $this->collOrders) {
foreach ($this->collOrders as $obj) {
if ($obj->isNew()) {
$collOrders[] = $obj;
}
}
}
$this->collOrders = $collOrders;
$this->collOrdersPartial = false;
}
}
return $this->collOrders;
}
/**
* Sets a collection of Order objects related by a one-to-many relationship
* to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection.
*
* @param Collection $orders A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildLang The current object (for fluent API support)
*/
public function setOrders(Collection $orders, ConnectionInterface $con = null)
{
$ordersToDelete = $this->getOrders(new Criteria(), $con)->diff($orders);
$this->ordersScheduledForDeletion = $ordersToDelete;
foreach ($ordersToDelete as $orderRemoved) {
$orderRemoved->setLang(null);
}
$this->collOrders = null;
foreach ($orders as $order) {
$this->addOrder($order);
}
$this->collOrders = $orders;
$this->collOrdersPartial = false;
return $this;
}
/**
* Returns the number of related Order objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param ConnectionInterface $con
* @return int Count of related Order objects.
* @throws PropelException
*/
public function countOrders(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collOrdersPartial && !$this->isNew();
if (null === $this->collOrders || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collOrders) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getOrders());
}
$query = ChildOrderQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByLang($this)
->count($con);
}
return count($this->collOrders);
}
/**
* Method called to associate a ChildOrder object to this object
* through the ChildOrder foreign key attribute.
*
* @param ChildOrder $l ChildOrder
* @return \Thelia\Model\Lang The current object (for fluent API support)
*/
public function addOrder(ChildOrder $l)
{
if ($this->collOrders === null) {
$this->initOrders();
$this->collOrdersPartial = true;
}
if (!in_array($l, $this->collOrders->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddOrder($l);
}
return $this;
}
/**
* @param Order $order The order object to add.
*/
protected function doAddOrder($order)
{
$this->collOrders[]= $order;
$order->setLang($this);
}
/**
* @param Order $order The order object to remove.
* @return ChildLang The current object (for fluent API support)
*/
public function removeOrder($order)
{
if ($this->getOrders()->contains($order)) {
$this->collOrders->remove($this->collOrders->search($order));
if (null === $this->ordersScheduledForDeletion) {
$this->ordersScheduledForDeletion = clone $this->collOrders;
$this->ordersScheduledForDeletion->clear();
}
$this->ordersScheduledForDeletion[]= clone $order;
$order->setLang(null);
}
return $this;
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Lang is new, it will return
* an empty collection; or if this Lang has previously
* been saved, it will retrieve related Orders from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in Lang.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersJoinCurrency($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('Currency', $joinBehavior);
return $this->getOrders($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Lang is new, it will return
* an empty collection; or if this Lang has previously
* been saved, it will retrieve related Orders from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in Lang.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersJoinCustomer($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('Customer', $joinBehavior);
return $this->getOrders($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Lang is new, it will return
* an empty collection; or if this Lang has previously
* been saved, it will retrieve related Orders from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in Lang.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersJoinOrderAddressRelatedByInvoiceOrderAddressId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('OrderAddressRelatedByInvoiceOrderAddressId', $joinBehavior);
return $this->getOrders($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Lang is new, it will return
* an empty collection; or if this Lang has previously
* been saved, it will retrieve related Orders from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in Lang.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersJoinOrderAddressRelatedByDeliveryOrderAddressId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('OrderAddressRelatedByDeliveryOrderAddressId', $joinBehavior);
return $this->getOrders($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Lang is new, it will return
* an empty collection; or if this Lang has previously
* been saved, it will retrieve related Orders from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in Lang.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersJoinOrderStatus($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('OrderStatus', $joinBehavior);
return $this->getOrders($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Lang is new, it will return
* an empty collection; or if this Lang has previously
* been saved, it will retrieve related Orders from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in Lang.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersJoinModuleRelatedByPaymentModuleId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('ModuleRelatedByPaymentModuleId', $joinBehavior);
return $this->getOrders($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Lang is new, it will return
* an empty collection; or if this Lang has previously
* been saved, it will retrieve related Orders from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in Lang.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersJoinModuleRelatedByDeliveryModuleId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('ModuleRelatedByDeliveryModuleId', $joinBehavior);
return $this->getOrders($query, $con);
}
/** /**
* Clears the current object and sets all attributes to their default values * Clears the current object and sets all attributes to their default values
*/ */
@@ -1764,8 +2227,17 @@ abstract class Lang implements ActiveRecordInterface
public function clearAllReferences($deep = false) public function clearAllReferences($deep = false)
{ {
if ($deep) { if ($deep) {
if ($this->collOrders) {
foreach ($this->collOrders as $o) {
$o->clearAllReferences($deep);
}
}
} // if ($deep) } // if ($deep)
if ($this->collOrders instanceof Collection) {
$this->collOrders->clearIterator();
}
$this->collOrders = null;
} }
/** /**

View File

@@ -7,6 +7,9 @@ use \PDO;
use Propel\Runtime\Propel; use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Exception\PropelException;
use Thelia\Model\Lang as ChildLang; use Thelia\Model\Lang as ChildLang;
@@ -54,6 +57,10 @@ use Thelia\Model\Map\LangTableMap;
* @method ChildLangQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildLangQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildLangQuery innerJoin($relation) Adds a INNER JOIN clause to the query * @method ChildLangQuery innerJoin($relation) Adds a INNER JOIN clause to the query
* *
* @method ChildLangQuery leftJoinOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the Order relation
* @method ChildLangQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation
* @method ChildLangQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation
*
* @method ChildLang findOne(ConnectionInterface $con = null) Return the first ChildLang matching the query * @method ChildLang findOne(ConnectionInterface $con = null) Return the first ChildLang matching the query
* @method ChildLang findOneOrCreate(ConnectionInterface $con = null) Return the first ChildLang matching the query, or a new ChildLang object populated from the query conditions when no match is found * @method ChildLang findOneOrCreate(ConnectionInterface $con = null) Return the first ChildLang matching the query, or a new ChildLang object populated from the query conditions when no match is found
* *
@@ -764,6 +771,79 @@ abstract class LangQuery extends ModelCriteria
return $this->addUsingAlias(LangTableMap::UPDATED_AT, $updatedAt, $comparison); return $this->addUsingAlias(LangTableMap::UPDATED_AT, $updatedAt, $comparison);
} }
/**
* Filter the query by a related \Thelia\Model\Order object
*
* @param \Thelia\Model\Order|ObjectCollection $order the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildLangQuery The current query, for fluid interface
*/
public function filterByOrder($order, $comparison = null)
{
if ($order instanceof \Thelia\Model\Order) {
return $this
->addUsingAlias(LangTableMap::ID, $order->getLangId(), $comparison);
} elseif ($order instanceof ObjectCollection) {
return $this
->useOrderQuery()
->filterByPrimaryKeys($order->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByOrder() only accepts arguments of type \Thelia\Model\Order or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Order relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildLangQuery The current query, for fluid interface
*/
public function joinOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Order');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'Order');
}
return $this;
}
/**
* Use the Order relation Order object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\OrderQuery A secondary query class using the current class as primary query
*/
public function useOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinOrder($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Order', '\Thelia\Model\OrderQuery');
}
/** /**
* Exclude object from result * Exclude object from result
* *

File diff suppressed because it is too large Load Diff

View File

@@ -44,6 +44,18 @@ use Thelia\Model\Map\ModuleTableMap;
* @method ChildModuleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildModuleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildModuleQuery innerJoin($relation) Adds a INNER JOIN clause to the query * @method ChildModuleQuery innerJoin($relation) Adds a INNER JOIN clause to the query
* *
* @method ChildModuleQuery leftJoinOrderRelatedByPaymentModuleId($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderRelatedByPaymentModuleId relation
* @method ChildModuleQuery rightJoinOrderRelatedByPaymentModuleId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderRelatedByPaymentModuleId relation
* @method ChildModuleQuery innerJoinOrderRelatedByPaymentModuleId($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderRelatedByPaymentModuleId relation
*
* @method ChildModuleQuery leftJoinOrderRelatedByDeliveryModuleId($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderRelatedByDeliveryModuleId relation
* @method ChildModuleQuery rightJoinOrderRelatedByDeliveryModuleId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderRelatedByDeliveryModuleId relation
* @method ChildModuleQuery innerJoinOrderRelatedByDeliveryModuleId($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderRelatedByDeliveryModuleId relation
*
* @method ChildModuleQuery leftJoinAreaDeliveryModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the AreaDeliveryModule relation
* @method ChildModuleQuery rightJoinAreaDeliveryModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AreaDeliveryModule relation
* @method ChildModuleQuery innerJoinAreaDeliveryModule($relationAlias = null) Adds a INNER JOIN clause to the query using the AreaDeliveryModule relation
*
* @method ChildModuleQuery leftJoinGroupModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the GroupModule relation * @method ChildModuleQuery leftJoinGroupModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the GroupModule relation
* @method ChildModuleQuery rightJoinGroupModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GroupModule relation * @method ChildModuleQuery rightJoinGroupModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GroupModule relation
* @method ChildModuleQuery innerJoinGroupModule($relationAlias = null) Adds a INNER JOIN clause to the query using the GroupModule relation * @method ChildModuleQuery innerJoinGroupModule($relationAlias = null) Adds a INNER JOIN clause to the query using the GroupModule relation
@@ -557,6 +569,225 @@ abstract class ModuleQuery extends ModelCriteria
return $this->addUsingAlias(ModuleTableMap::UPDATED_AT, $updatedAt, $comparison); return $this->addUsingAlias(ModuleTableMap::UPDATED_AT, $updatedAt, $comparison);
} }
/**
* Filter the query by a related \Thelia\Model\Order object
*
* @param \Thelia\Model\Order|ObjectCollection $order the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildModuleQuery The current query, for fluid interface
*/
public function filterByOrderRelatedByPaymentModuleId($order, $comparison = null)
{
if ($order instanceof \Thelia\Model\Order) {
return $this
->addUsingAlias(ModuleTableMap::ID, $order->getPaymentModuleId(), $comparison);
} elseif ($order instanceof ObjectCollection) {
return $this
->useOrderRelatedByPaymentModuleIdQuery()
->filterByPrimaryKeys($order->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByOrderRelatedByPaymentModuleId() only accepts arguments of type \Thelia\Model\Order or Collection');
}
}
/**
* Adds a JOIN clause to the query using the OrderRelatedByPaymentModuleId relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildModuleQuery The current query, for fluid interface
*/
public function joinOrderRelatedByPaymentModuleId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('OrderRelatedByPaymentModuleId');
// 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, 'OrderRelatedByPaymentModuleId');
}
return $this;
}
/**
* Use the OrderRelatedByPaymentModuleId relation Order object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\OrderQuery A secondary query class using the current class as primary query
*/
public function useOrderRelatedByPaymentModuleIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinOrderRelatedByPaymentModuleId($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderRelatedByPaymentModuleId', '\Thelia\Model\OrderQuery');
}
/**
* Filter the query by a related \Thelia\Model\Order object
*
* @param \Thelia\Model\Order|ObjectCollection $order the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildModuleQuery The current query, for fluid interface
*/
public function filterByOrderRelatedByDeliveryModuleId($order, $comparison = null)
{
if ($order instanceof \Thelia\Model\Order) {
return $this
->addUsingAlias(ModuleTableMap::ID, $order->getDeliveryModuleId(), $comparison);
} elseif ($order instanceof ObjectCollection) {
return $this
->useOrderRelatedByDeliveryModuleIdQuery()
->filterByPrimaryKeys($order->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByOrderRelatedByDeliveryModuleId() only accepts arguments of type \Thelia\Model\Order or Collection');
}
}
/**
* Adds a JOIN clause to the query using the OrderRelatedByDeliveryModuleId relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildModuleQuery The current query, for fluid interface
*/
public function joinOrderRelatedByDeliveryModuleId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('OrderRelatedByDeliveryModuleId');
// 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, 'OrderRelatedByDeliveryModuleId');
}
return $this;
}
/**
* Use the OrderRelatedByDeliveryModuleId relation Order object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\OrderQuery A secondary query class using the current class as primary query
*/
public function useOrderRelatedByDeliveryModuleIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinOrderRelatedByDeliveryModuleId($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderRelatedByDeliveryModuleId', '\Thelia\Model\OrderQuery');
}
/**
* Filter the query by a related \Thelia\Model\AreaDeliveryModule object
*
* @param \Thelia\Model\AreaDeliveryModule|ObjectCollection $areaDeliveryModule the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildModuleQuery The current query, for fluid interface
*/
public function filterByAreaDeliveryModule($areaDeliveryModule, $comparison = null)
{
if ($areaDeliveryModule instanceof \Thelia\Model\AreaDeliveryModule) {
return $this
->addUsingAlias(ModuleTableMap::ID, $areaDeliveryModule->getDeliveryModuleId(), $comparison);
} elseif ($areaDeliveryModule instanceof ObjectCollection) {
return $this
->useAreaDeliveryModuleQuery()
->filterByPrimaryKeys($areaDeliveryModule->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByAreaDeliveryModule() only accepts arguments of type \Thelia\Model\AreaDeliveryModule or Collection');
}
}
/**
* Adds a JOIN clause to the query using the AreaDeliveryModule relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildModuleQuery The current query, for fluid interface
*/
public function joinAreaDeliveryModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AreaDeliveryModule');
// 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, 'AreaDeliveryModule');
}
return $this;
}
/**
* Use the AreaDeliveryModule relation AreaDeliveryModule 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\AreaDeliveryModuleQuery A secondary query class using the current class as primary query
*/
public function useAreaDeliveryModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAreaDeliveryModule($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AreaDeliveryModule', '\Thelia\Model\AreaDeliveryModuleQuery');
}
/** /**
* Filter the query by a related \Thelia\Model\GroupModule object * Filter the query by a related \Thelia\Model\GroupModule object
* *

File diff suppressed because it is too large Load Diff

View File

@@ -144,14 +144,14 @@ abstract class OrderAddress implements ActiveRecordInterface
/** /**
* @var ObjectCollection|ChildOrder[] Collection to store aggregation of ChildOrder objects. * @var ObjectCollection|ChildOrder[] Collection to store aggregation of ChildOrder objects.
*/ */
protected $collOrdersRelatedByAddressInvoice; protected $collOrdersRelatedByInvoiceOrderAddressId;
protected $collOrdersRelatedByAddressInvoicePartial; protected $collOrdersRelatedByInvoiceOrderAddressIdPartial;
/** /**
* @var ObjectCollection|ChildOrder[] Collection to store aggregation of ChildOrder objects. * @var ObjectCollection|ChildOrder[] Collection to store aggregation of ChildOrder objects.
*/ */
protected $collOrdersRelatedByAddressDelivery; protected $collOrdersRelatedByDeliveryOrderAddressId;
protected $collOrdersRelatedByAddressDeliveryPartial; protected $collOrdersRelatedByDeliveryOrderAddressIdPartial;
/** /**
* Flag to prevent endless save loop, if this object is referenced * Flag to prevent endless save loop, if this object is referenced
@@ -165,13 +165,13 @@ abstract class OrderAddress implements ActiveRecordInterface
* An array of objects scheduled for deletion. * An array of objects scheduled for deletion.
* @var ObjectCollection * @var ObjectCollection
*/ */
protected $ordersRelatedByAddressInvoiceScheduledForDeletion = null; protected $ordersRelatedByInvoiceOrderAddressIdScheduledForDeletion = null;
/** /**
* An array of objects scheduled for deletion. * An array of objects scheduled for deletion.
* @var ObjectCollection * @var ObjectCollection
*/ */
protected $ordersRelatedByAddressDeliveryScheduledForDeletion = null; protected $ordersRelatedByDeliveryOrderAddressIdScheduledForDeletion = null;
/** /**
* Initializes internal state of Thelia\Model\Base\OrderAddress object. * Initializes internal state of Thelia\Model\Base\OrderAddress object.
@@ -1046,9 +1046,9 @@ abstract class OrderAddress implements ActiveRecordInterface
if ($deep) { // also de-associate any related objects? if ($deep) { // also de-associate any related objects?
$this->collOrdersRelatedByAddressInvoice = null; $this->collOrdersRelatedByInvoiceOrderAddressId = null;
$this->collOrdersRelatedByAddressDelivery = null; $this->collOrdersRelatedByDeliveryOrderAddressId = null;
} // if (deep) } // if (deep)
} }
@@ -1183,36 +1183,34 @@ abstract class OrderAddress implements ActiveRecordInterface
$this->resetModified(); $this->resetModified();
} }
if ($this->ordersRelatedByAddressInvoiceScheduledForDeletion !== null) { if ($this->ordersRelatedByInvoiceOrderAddressIdScheduledForDeletion !== null) {
if (!$this->ordersRelatedByAddressInvoiceScheduledForDeletion->isEmpty()) { if (!$this->ordersRelatedByInvoiceOrderAddressIdScheduledForDeletion->isEmpty()) {
foreach ($this->ordersRelatedByAddressInvoiceScheduledForDeletion as $orderRelatedByAddressInvoice) { \Thelia\Model\OrderQuery::create()
// need to save related object because we set the relation to null ->filterByPrimaryKeys($this->ordersRelatedByInvoiceOrderAddressIdScheduledForDeletion->getPrimaryKeys(false))
$orderRelatedByAddressInvoice->save($con); ->delete($con);
} $this->ordersRelatedByInvoiceOrderAddressIdScheduledForDeletion = null;
$this->ordersRelatedByAddressInvoiceScheduledForDeletion = null;
} }
} }
if ($this->collOrdersRelatedByAddressInvoice !== null) { if ($this->collOrdersRelatedByInvoiceOrderAddressId !== null) {
foreach ($this->collOrdersRelatedByAddressInvoice as $referrerFK) { foreach ($this->collOrdersRelatedByInvoiceOrderAddressId as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con); $affectedRows += $referrerFK->save($con);
} }
} }
} }
if ($this->ordersRelatedByAddressDeliveryScheduledForDeletion !== null) { if ($this->ordersRelatedByDeliveryOrderAddressIdScheduledForDeletion !== null) {
if (!$this->ordersRelatedByAddressDeliveryScheduledForDeletion->isEmpty()) { if (!$this->ordersRelatedByDeliveryOrderAddressIdScheduledForDeletion->isEmpty()) {
foreach ($this->ordersRelatedByAddressDeliveryScheduledForDeletion as $orderRelatedByAddressDelivery) { \Thelia\Model\OrderQuery::create()
// need to save related object because we set the relation to null ->filterByPrimaryKeys($this->ordersRelatedByDeliveryOrderAddressIdScheduledForDeletion->getPrimaryKeys(false))
$orderRelatedByAddressDelivery->save($con); ->delete($con);
} $this->ordersRelatedByDeliveryOrderAddressIdScheduledForDeletion = null;
$this->ordersRelatedByAddressDeliveryScheduledForDeletion = null;
} }
} }
if ($this->collOrdersRelatedByAddressDelivery !== null) { if ($this->collOrdersRelatedByDeliveryOrderAddressId !== null) {
foreach ($this->collOrdersRelatedByAddressDelivery as $referrerFK) { foreach ($this->collOrdersRelatedByDeliveryOrderAddressId as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con); $affectedRows += $referrerFK->save($con);
} }
@@ -1495,11 +1493,11 @@ abstract class OrderAddress implements ActiveRecordInterface
} }
if ($includeForeignObjects) { if ($includeForeignObjects) {
if (null !== $this->collOrdersRelatedByAddressInvoice) { if (null !== $this->collOrdersRelatedByInvoiceOrderAddressId) {
$result['OrdersRelatedByAddressInvoice'] = $this->collOrdersRelatedByAddressInvoice->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); $result['OrdersRelatedByInvoiceOrderAddressId'] = $this->collOrdersRelatedByInvoiceOrderAddressId->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
} }
if (null !== $this->collOrdersRelatedByAddressDelivery) { if (null !== $this->collOrdersRelatedByDeliveryOrderAddressId) {
$result['OrdersRelatedByAddressDelivery'] = $this->collOrdersRelatedByAddressDelivery->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); $result['OrdersRelatedByDeliveryOrderAddressId'] = $this->collOrdersRelatedByDeliveryOrderAddressId->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
} }
} }
@@ -1722,15 +1720,15 @@ abstract class OrderAddress implements ActiveRecordInterface
// the getter/setter methods for fkey referrer objects. // the getter/setter methods for fkey referrer objects.
$copyObj->setNew(false); $copyObj->setNew(false);
foreach ($this->getOrdersRelatedByAddressInvoice() as $relObj) { foreach ($this->getOrdersRelatedByInvoiceOrderAddressId() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addOrderRelatedByAddressInvoice($relObj->copy($deepCopy)); $copyObj->addOrderRelatedByInvoiceOrderAddressId($relObj->copy($deepCopy));
} }
} }
foreach ($this->getOrdersRelatedByAddressDelivery() as $relObj) { foreach ($this->getOrdersRelatedByDeliveryOrderAddressId() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addOrderRelatedByAddressDelivery($relObj->copy($deepCopy)); $copyObj->addOrderRelatedByDeliveryOrderAddressId($relObj->copy($deepCopy));
} }
} }
@@ -1775,40 +1773,40 @@ abstract class OrderAddress implements ActiveRecordInterface
*/ */
public function initRelation($relationName) public function initRelation($relationName)
{ {
if ('OrderRelatedByAddressInvoice' == $relationName) { if ('OrderRelatedByInvoiceOrderAddressId' == $relationName) {
return $this->initOrdersRelatedByAddressInvoice(); return $this->initOrdersRelatedByInvoiceOrderAddressId();
} }
if ('OrderRelatedByAddressDelivery' == $relationName) { if ('OrderRelatedByDeliveryOrderAddressId' == $relationName) {
return $this->initOrdersRelatedByAddressDelivery(); return $this->initOrdersRelatedByDeliveryOrderAddressId();
} }
} }
/** /**
* Clears out the collOrdersRelatedByAddressInvoice collection * Clears out the collOrdersRelatedByInvoiceOrderAddressId collection
* *
* This does not modify the database; however, it will remove any associated objects, causing * This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method. * them to be refetched by subsequent calls to accessor method.
* *
* @return void * @return void
* @see addOrdersRelatedByAddressInvoice() * @see addOrdersRelatedByInvoiceOrderAddressId()
*/ */
public function clearOrdersRelatedByAddressInvoice() public function clearOrdersRelatedByInvoiceOrderAddressId()
{ {
$this->collOrdersRelatedByAddressInvoice = null; // important to set this to NULL since that means it is uninitialized $this->collOrdersRelatedByInvoiceOrderAddressId = null; // important to set this to NULL since that means it is uninitialized
} }
/** /**
* Reset is the collOrdersRelatedByAddressInvoice collection loaded partially. * Reset is the collOrdersRelatedByInvoiceOrderAddressId collection loaded partially.
*/ */
public function resetPartialOrdersRelatedByAddressInvoice($v = true) public function resetPartialOrdersRelatedByInvoiceOrderAddressId($v = true)
{ {
$this->collOrdersRelatedByAddressInvoicePartial = $v; $this->collOrdersRelatedByInvoiceOrderAddressIdPartial = $v;
} }
/** /**
* Initializes the collOrdersRelatedByAddressInvoice collection. * Initializes the collOrdersRelatedByInvoiceOrderAddressId collection.
* *
* By default this just sets the collOrdersRelatedByAddressInvoice collection to an empty array (like clearcollOrdersRelatedByAddressInvoice()); * By default this just sets the collOrdersRelatedByInvoiceOrderAddressId collection to an empty array (like clearcollOrdersRelatedByInvoiceOrderAddressId());
* however, you may wish to override this method in your stub class to provide setting appropriate * however, you may wish to override this method in your stub class to provide setting appropriate
* to your application -- for example, setting the initial array to the values stored in database. * to your application -- for example, setting the initial array to the values stored in database.
* *
@@ -1817,13 +1815,13 @@ abstract class OrderAddress implements ActiveRecordInterface
* *
* @return void * @return void
*/ */
public function initOrdersRelatedByAddressInvoice($overrideExisting = true) public function initOrdersRelatedByInvoiceOrderAddressId($overrideExisting = true)
{ {
if (null !== $this->collOrdersRelatedByAddressInvoice && !$overrideExisting) { if (null !== $this->collOrdersRelatedByInvoiceOrderAddressId && !$overrideExisting) {
return; return;
} }
$this->collOrdersRelatedByAddressInvoice = new ObjectCollection(); $this->collOrdersRelatedByInvoiceOrderAddressId = new ObjectCollection();
$this->collOrdersRelatedByAddressInvoice->setModel('\Thelia\Model\Order'); $this->collOrdersRelatedByInvoiceOrderAddressId->setModel('\Thelia\Model\Order');
} }
/** /**
@@ -1840,80 +1838,80 @@ abstract class OrderAddress implements ActiveRecordInterface
* @return Collection|ChildOrder[] List of ChildOrder objects * @return Collection|ChildOrder[] List of ChildOrder objects
* @throws PropelException * @throws PropelException
*/ */
public function getOrdersRelatedByAddressInvoice($criteria = null, ConnectionInterface $con = null) public function getOrdersRelatedByInvoiceOrderAddressId($criteria = null, ConnectionInterface $con = null)
{ {
$partial = $this->collOrdersRelatedByAddressInvoicePartial && !$this->isNew(); $partial = $this->collOrdersRelatedByInvoiceOrderAddressIdPartial && !$this->isNew();
if (null === $this->collOrdersRelatedByAddressInvoice || null !== $criteria || $partial) { if (null === $this->collOrdersRelatedByInvoiceOrderAddressId || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collOrdersRelatedByAddressInvoice) { if ($this->isNew() && null === $this->collOrdersRelatedByInvoiceOrderAddressId) {
// return empty collection // return empty collection
$this->initOrdersRelatedByAddressInvoice(); $this->initOrdersRelatedByInvoiceOrderAddressId();
} else { } else {
$collOrdersRelatedByAddressInvoice = ChildOrderQuery::create(null, $criteria) $collOrdersRelatedByInvoiceOrderAddressId = ChildOrderQuery::create(null, $criteria)
->filterByOrderAddressRelatedByAddressInvoice($this) ->filterByOrderAddressRelatedByInvoiceOrderAddressId($this)
->find($con); ->find($con);
if (null !== $criteria) { if (null !== $criteria) {
if (false !== $this->collOrdersRelatedByAddressInvoicePartial && count($collOrdersRelatedByAddressInvoice)) { if (false !== $this->collOrdersRelatedByInvoiceOrderAddressIdPartial && count($collOrdersRelatedByInvoiceOrderAddressId)) {
$this->initOrdersRelatedByAddressInvoice(false); $this->initOrdersRelatedByInvoiceOrderAddressId(false);
foreach ($collOrdersRelatedByAddressInvoice as $obj) { foreach ($collOrdersRelatedByInvoiceOrderAddressId as $obj) {
if (false == $this->collOrdersRelatedByAddressInvoice->contains($obj)) { if (false == $this->collOrdersRelatedByInvoiceOrderAddressId->contains($obj)) {
$this->collOrdersRelatedByAddressInvoice->append($obj); $this->collOrdersRelatedByInvoiceOrderAddressId->append($obj);
} }
} }
$this->collOrdersRelatedByAddressInvoicePartial = true; $this->collOrdersRelatedByInvoiceOrderAddressIdPartial = true;
} }
$collOrdersRelatedByAddressInvoice->getInternalIterator()->rewind(); $collOrdersRelatedByInvoiceOrderAddressId->getInternalIterator()->rewind();
return $collOrdersRelatedByAddressInvoice; return $collOrdersRelatedByInvoiceOrderAddressId;
} }
if ($partial && $this->collOrdersRelatedByAddressInvoice) { if ($partial && $this->collOrdersRelatedByInvoiceOrderAddressId) {
foreach ($this->collOrdersRelatedByAddressInvoice as $obj) { foreach ($this->collOrdersRelatedByInvoiceOrderAddressId as $obj) {
if ($obj->isNew()) { if ($obj->isNew()) {
$collOrdersRelatedByAddressInvoice[] = $obj; $collOrdersRelatedByInvoiceOrderAddressId[] = $obj;
} }
} }
} }
$this->collOrdersRelatedByAddressInvoice = $collOrdersRelatedByAddressInvoice; $this->collOrdersRelatedByInvoiceOrderAddressId = $collOrdersRelatedByInvoiceOrderAddressId;
$this->collOrdersRelatedByAddressInvoicePartial = false; $this->collOrdersRelatedByInvoiceOrderAddressIdPartial = false;
} }
} }
return $this->collOrdersRelatedByAddressInvoice; return $this->collOrdersRelatedByInvoiceOrderAddressId;
} }
/** /**
* Sets a collection of OrderRelatedByAddressInvoice objects related by a one-to-many relationship * Sets a collection of OrderRelatedByInvoiceOrderAddressId objects related by a one-to-many relationship
* to the current object. * to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted) * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection. * and new objects from the given Propel collection.
* *
* @param Collection $ordersRelatedByAddressInvoice A Propel collection. * @param Collection $ordersRelatedByInvoiceOrderAddressId A Propel collection.
* @param ConnectionInterface $con Optional connection object * @param ConnectionInterface $con Optional connection object
* @return ChildOrderAddress The current object (for fluent API support) * @return ChildOrderAddress The current object (for fluent API support)
*/ */
public function setOrdersRelatedByAddressInvoice(Collection $ordersRelatedByAddressInvoice, ConnectionInterface $con = null) public function setOrdersRelatedByInvoiceOrderAddressId(Collection $ordersRelatedByInvoiceOrderAddressId, ConnectionInterface $con = null)
{ {
$ordersRelatedByAddressInvoiceToDelete = $this->getOrdersRelatedByAddressInvoice(new Criteria(), $con)->diff($ordersRelatedByAddressInvoice); $ordersRelatedByInvoiceOrderAddressIdToDelete = $this->getOrdersRelatedByInvoiceOrderAddressId(new Criteria(), $con)->diff($ordersRelatedByInvoiceOrderAddressId);
$this->ordersRelatedByAddressInvoiceScheduledForDeletion = $ordersRelatedByAddressInvoiceToDelete; $this->ordersRelatedByInvoiceOrderAddressIdScheduledForDeletion = $ordersRelatedByInvoiceOrderAddressIdToDelete;
foreach ($ordersRelatedByAddressInvoiceToDelete as $orderRelatedByAddressInvoiceRemoved) { foreach ($ordersRelatedByInvoiceOrderAddressIdToDelete as $orderRelatedByInvoiceOrderAddressIdRemoved) {
$orderRelatedByAddressInvoiceRemoved->setOrderAddressRelatedByAddressInvoice(null); $orderRelatedByInvoiceOrderAddressIdRemoved->setOrderAddressRelatedByInvoiceOrderAddressId(null);
} }
$this->collOrdersRelatedByAddressInvoice = null; $this->collOrdersRelatedByInvoiceOrderAddressId = null;
foreach ($ordersRelatedByAddressInvoice as $orderRelatedByAddressInvoice) { foreach ($ordersRelatedByInvoiceOrderAddressId as $orderRelatedByInvoiceOrderAddressId) {
$this->addOrderRelatedByAddressInvoice($orderRelatedByAddressInvoice); $this->addOrderRelatedByInvoiceOrderAddressId($orderRelatedByInvoiceOrderAddressId);
} }
$this->collOrdersRelatedByAddressInvoice = $ordersRelatedByAddressInvoice; $this->collOrdersRelatedByInvoiceOrderAddressId = $ordersRelatedByInvoiceOrderAddressId;
$this->collOrdersRelatedByAddressInvoicePartial = false; $this->collOrdersRelatedByInvoiceOrderAddressIdPartial = false;
return $this; return $this;
} }
@@ -1927,16 +1925,16 @@ abstract class OrderAddress implements ActiveRecordInterface
* @return int Count of related Order objects. * @return int Count of related Order objects.
* @throws PropelException * @throws PropelException
*/ */
public function countOrdersRelatedByAddressInvoice(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) public function countOrdersRelatedByInvoiceOrderAddressId(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{ {
$partial = $this->collOrdersRelatedByAddressInvoicePartial && !$this->isNew(); $partial = $this->collOrdersRelatedByInvoiceOrderAddressIdPartial && !$this->isNew();
if (null === $this->collOrdersRelatedByAddressInvoice || null !== $criteria || $partial) { if (null === $this->collOrdersRelatedByInvoiceOrderAddressId || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collOrdersRelatedByAddressInvoice) { if ($this->isNew() && null === $this->collOrdersRelatedByInvoiceOrderAddressId) {
return 0; return 0;
} }
if ($partial && !$criteria) { if ($partial && !$criteria) {
return count($this->getOrdersRelatedByAddressInvoice()); return count($this->getOrdersRelatedByInvoiceOrderAddressId());
} }
$query = ChildOrderQuery::create(null, $criteria); $query = ChildOrderQuery::create(null, $criteria);
@@ -1945,11 +1943,11 @@ abstract class OrderAddress implements ActiveRecordInterface
} }
return $query return $query
->filterByOrderAddressRelatedByAddressInvoice($this) ->filterByOrderAddressRelatedByInvoiceOrderAddressId($this)
->count($con); ->count($con);
} }
return count($this->collOrdersRelatedByAddressInvoice); return count($this->collOrdersRelatedByInvoiceOrderAddressId);
} }
/** /**
@@ -1959,43 +1957,43 @@ abstract class OrderAddress implements ActiveRecordInterface
* @param ChildOrder $l ChildOrder * @param ChildOrder $l ChildOrder
* @return \Thelia\Model\OrderAddress The current object (for fluent API support) * @return \Thelia\Model\OrderAddress The current object (for fluent API support)
*/ */
public function addOrderRelatedByAddressInvoice(ChildOrder $l) public function addOrderRelatedByInvoiceOrderAddressId(ChildOrder $l)
{ {
if ($this->collOrdersRelatedByAddressInvoice === null) { if ($this->collOrdersRelatedByInvoiceOrderAddressId === null) {
$this->initOrdersRelatedByAddressInvoice(); $this->initOrdersRelatedByInvoiceOrderAddressId();
$this->collOrdersRelatedByAddressInvoicePartial = true; $this->collOrdersRelatedByInvoiceOrderAddressIdPartial = true;
} }
if (!in_array($l, $this->collOrdersRelatedByAddressInvoice->getArrayCopy(), true)) { // only add it if the **same** object is not already associated if (!in_array($l, $this->collOrdersRelatedByInvoiceOrderAddressId->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddOrderRelatedByAddressInvoice($l); $this->doAddOrderRelatedByInvoiceOrderAddressId($l);
} }
return $this; return $this;
} }
/** /**
* @param OrderRelatedByAddressInvoice $orderRelatedByAddressInvoice The orderRelatedByAddressInvoice object to add. * @param OrderRelatedByInvoiceOrderAddressId $orderRelatedByInvoiceOrderAddressId The orderRelatedByInvoiceOrderAddressId object to add.
*/ */
protected function doAddOrderRelatedByAddressInvoice($orderRelatedByAddressInvoice) protected function doAddOrderRelatedByInvoiceOrderAddressId($orderRelatedByInvoiceOrderAddressId)
{ {
$this->collOrdersRelatedByAddressInvoice[]= $orderRelatedByAddressInvoice; $this->collOrdersRelatedByInvoiceOrderAddressId[]= $orderRelatedByInvoiceOrderAddressId;
$orderRelatedByAddressInvoice->setOrderAddressRelatedByAddressInvoice($this); $orderRelatedByInvoiceOrderAddressId->setOrderAddressRelatedByInvoiceOrderAddressId($this);
} }
/** /**
* @param OrderRelatedByAddressInvoice $orderRelatedByAddressInvoice The orderRelatedByAddressInvoice object to remove. * @param OrderRelatedByInvoiceOrderAddressId $orderRelatedByInvoiceOrderAddressId The orderRelatedByInvoiceOrderAddressId object to remove.
* @return ChildOrderAddress The current object (for fluent API support) * @return ChildOrderAddress The current object (for fluent API support)
*/ */
public function removeOrderRelatedByAddressInvoice($orderRelatedByAddressInvoice) public function removeOrderRelatedByInvoiceOrderAddressId($orderRelatedByInvoiceOrderAddressId)
{ {
if ($this->getOrdersRelatedByAddressInvoice()->contains($orderRelatedByAddressInvoice)) { if ($this->getOrdersRelatedByInvoiceOrderAddressId()->contains($orderRelatedByInvoiceOrderAddressId)) {
$this->collOrdersRelatedByAddressInvoice->remove($this->collOrdersRelatedByAddressInvoice->search($orderRelatedByAddressInvoice)); $this->collOrdersRelatedByInvoiceOrderAddressId->remove($this->collOrdersRelatedByInvoiceOrderAddressId->search($orderRelatedByInvoiceOrderAddressId));
if (null === $this->ordersRelatedByAddressInvoiceScheduledForDeletion) { if (null === $this->ordersRelatedByInvoiceOrderAddressIdScheduledForDeletion) {
$this->ordersRelatedByAddressInvoiceScheduledForDeletion = clone $this->collOrdersRelatedByAddressInvoice; $this->ordersRelatedByInvoiceOrderAddressIdScheduledForDeletion = clone $this->collOrdersRelatedByInvoiceOrderAddressId;
$this->ordersRelatedByAddressInvoiceScheduledForDeletion->clear(); $this->ordersRelatedByInvoiceOrderAddressIdScheduledForDeletion->clear();
} }
$this->ordersRelatedByAddressInvoiceScheduledForDeletion[]= $orderRelatedByAddressInvoice; $this->ordersRelatedByInvoiceOrderAddressIdScheduledForDeletion[]= clone $orderRelatedByInvoiceOrderAddressId;
$orderRelatedByAddressInvoice->setOrderAddressRelatedByAddressInvoice(null); $orderRelatedByInvoiceOrderAddressId->setOrderAddressRelatedByInvoiceOrderAddressId(null);
} }
return $this; return $this;
@@ -2007,7 +2005,7 @@ abstract class OrderAddress implements ActiveRecordInterface
* an identical criteria, it returns the collection. * an identical criteria, it returns the collection.
* Otherwise if this OrderAddress is new, it will return * Otherwise if this OrderAddress is new, it will return
* an empty collection; or if this OrderAddress has previously * an empty collection; or if this OrderAddress has previously
* been saved, it will retrieve related OrdersRelatedByAddressInvoice from storage. * been saved, it will retrieve related OrdersRelatedByInvoiceOrderAddressId from storage.
* *
* This method is protected by default in order to keep the public * This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you * api reasonable. You can provide public methods for those you
@@ -2018,12 +2016,12 @@ abstract class OrderAddress implements ActiveRecordInterface
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects * @return Collection|ChildOrder[] List of ChildOrder objects
*/ */
public function getOrdersRelatedByAddressInvoiceJoinCurrency($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) public function getOrdersRelatedByInvoiceOrderAddressIdJoinCurrency($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{ {
$query = ChildOrderQuery::create(null, $criteria); $query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('Currency', $joinBehavior); $query->joinWith('Currency', $joinBehavior);
return $this->getOrdersRelatedByAddressInvoice($query, $con); return $this->getOrdersRelatedByInvoiceOrderAddressId($query, $con);
} }
@@ -2032,7 +2030,7 @@ abstract class OrderAddress implements ActiveRecordInterface
* an identical criteria, it returns the collection. * an identical criteria, it returns the collection.
* Otherwise if this OrderAddress is new, it will return * Otherwise if this OrderAddress is new, it will return
* an empty collection; or if this OrderAddress has previously * an empty collection; or if this OrderAddress has previously
* been saved, it will retrieve related OrdersRelatedByAddressInvoice from storage. * been saved, it will retrieve related OrdersRelatedByInvoiceOrderAddressId from storage.
* *
* This method is protected by default in order to keep the public * This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you * api reasonable. You can provide public methods for those you
@@ -2043,12 +2041,12 @@ abstract class OrderAddress implements ActiveRecordInterface
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects * @return Collection|ChildOrder[] List of ChildOrder objects
*/ */
public function getOrdersRelatedByAddressInvoiceJoinCustomer($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) public function getOrdersRelatedByInvoiceOrderAddressIdJoinCustomer($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{ {
$query = ChildOrderQuery::create(null, $criteria); $query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('Customer', $joinBehavior); $query->joinWith('Customer', $joinBehavior);
return $this->getOrdersRelatedByAddressInvoice($query, $con); return $this->getOrdersRelatedByInvoiceOrderAddressId($query, $con);
} }
@@ -2057,7 +2055,7 @@ abstract class OrderAddress implements ActiveRecordInterface
* an identical criteria, it returns the collection. * an identical criteria, it returns the collection.
* Otherwise if this OrderAddress is new, it will return * Otherwise if this OrderAddress is new, it will return
* an empty collection; or if this OrderAddress has previously * an empty collection; or if this OrderAddress has previously
* been saved, it will retrieve related OrdersRelatedByAddressInvoice from storage. * been saved, it will retrieve related OrdersRelatedByInvoiceOrderAddressId from storage.
* *
* This method is protected by default in order to keep the public * This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you * api reasonable. You can provide public methods for those you
@@ -2068,40 +2066,115 @@ abstract class OrderAddress implements ActiveRecordInterface
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects * @return Collection|ChildOrder[] List of ChildOrder objects
*/ */
public function getOrdersRelatedByAddressInvoiceJoinOrderStatus($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) public function getOrdersRelatedByInvoiceOrderAddressIdJoinOrderStatus($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{ {
$query = ChildOrderQuery::create(null, $criteria); $query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('OrderStatus', $joinBehavior); $query->joinWith('OrderStatus', $joinBehavior);
return $this->getOrdersRelatedByAddressInvoice($query, $con); return $this->getOrdersRelatedByInvoiceOrderAddressId($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this OrderAddress is new, it will return
* an empty collection; or if this OrderAddress has previously
* been saved, it will retrieve related OrdersRelatedByInvoiceOrderAddressId from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in OrderAddress.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersRelatedByInvoiceOrderAddressIdJoinModuleRelatedByPaymentModuleId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('ModuleRelatedByPaymentModuleId', $joinBehavior);
return $this->getOrdersRelatedByInvoiceOrderAddressId($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this OrderAddress is new, it will return
* an empty collection; or if this OrderAddress has previously
* been saved, it will retrieve related OrdersRelatedByInvoiceOrderAddressId from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in OrderAddress.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersRelatedByInvoiceOrderAddressIdJoinModuleRelatedByDeliveryModuleId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('ModuleRelatedByDeliveryModuleId', $joinBehavior);
return $this->getOrdersRelatedByInvoiceOrderAddressId($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this OrderAddress is new, it will return
* an empty collection; or if this OrderAddress has previously
* been saved, it will retrieve related OrdersRelatedByInvoiceOrderAddressId from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in OrderAddress.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersRelatedByInvoiceOrderAddressIdJoinLang($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('Lang', $joinBehavior);
return $this->getOrdersRelatedByInvoiceOrderAddressId($query, $con);
} }
/** /**
* Clears out the collOrdersRelatedByAddressDelivery collection * Clears out the collOrdersRelatedByDeliveryOrderAddressId collection
* *
* This does not modify the database; however, it will remove any associated objects, causing * This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method. * them to be refetched by subsequent calls to accessor method.
* *
* @return void * @return void
* @see addOrdersRelatedByAddressDelivery() * @see addOrdersRelatedByDeliveryOrderAddressId()
*/ */
public function clearOrdersRelatedByAddressDelivery() public function clearOrdersRelatedByDeliveryOrderAddressId()
{ {
$this->collOrdersRelatedByAddressDelivery = null; // important to set this to NULL since that means it is uninitialized $this->collOrdersRelatedByDeliveryOrderAddressId = null; // important to set this to NULL since that means it is uninitialized
} }
/** /**
* Reset is the collOrdersRelatedByAddressDelivery collection loaded partially. * Reset is the collOrdersRelatedByDeliveryOrderAddressId collection loaded partially.
*/ */
public function resetPartialOrdersRelatedByAddressDelivery($v = true) public function resetPartialOrdersRelatedByDeliveryOrderAddressId($v = true)
{ {
$this->collOrdersRelatedByAddressDeliveryPartial = $v; $this->collOrdersRelatedByDeliveryOrderAddressIdPartial = $v;
} }
/** /**
* Initializes the collOrdersRelatedByAddressDelivery collection. * Initializes the collOrdersRelatedByDeliveryOrderAddressId collection.
* *
* By default this just sets the collOrdersRelatedByAddressDelivery collection to an empty array (like clearcollOrdersRelatedByAddressDelivery()); * By default this just sets the collOrdersRelatedByDeliveryOrderAddressId collection to an empty array (like clearcollOrdersRelatedByDeliveryOrderAddressId());
* however, you may wish to override this method in your stub class to provide setting appropriate * however, you may wish to override this method in your stub class to provide setting appropriate
* to your application -- for example, setting the initial array to the values stored in database. * to your application -- for example, setting the initial array to the values stored in database.
* *
@@ -2110,13 +2183,13 @@ abstract class OrderAddress implements ActiveRecordInterface
* *
* @return void * @return void
*/ */
public function initOrdersRelatedByAddressDelivery($overrideExisting = true) public function initOrdersRelatedByDeliveryOrderAddressId($overrideExisting = true)
{ {
if (null !== $this->collOrdersRelatedByAddressDelivery && !$overrideExisting) { if (null !== $this->collOrdersRelatedByDeliveryOrderAddressId && !$overrideExisting) {
return; return;
} }
$this->collOrdersRelatedByAddressDelivery = new ObjectCollection(); $this->collOrdersRelatedByDeliveryOrderAddressId = new ObjectCollection();
$this->collOrdersRelatedByAddressDelivery->setModel('\Thelia\Model\Order'); $this->collOrdersRelatedByDeliveryOrderAddressId->setModel('\Thelia\Model\Order');
} }
/** /**
@@ -2133,80 +2206,80 @@ abstract class OrderAddress implements ActiveRecordInterface
* @return Collection|ChildOrder[] List of ChildOrder objects * @return Collection|ChildOrder[] List of ChildOrder objects
* @throws PropelException * @throws PropelException
*/ */
public function getOrdersRelatedByAddressDelivery($criteria = null, ConnectionInterface $con = null) public function getOrdersRelatedByDeliveryOrderAddressId($criteria = null, ConnectionInterface $con = null)
{ {
$partial = $this->collOrdersRelatedByAddressDeliveryPartial && !$this->isNew(); $partial = $this->collOrdersRelatedByDeliveryOrderAddressIdPartial && !$this->isNew();
if (null === $this->collOrdersRelatedByAddressDelivery || null !== $criteria || $partial) { if (null === $this->collOrdersRelatedByDeliveryOrderAddressId || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collOrdersRelatedByAddressDelivery) { if ($this->isNew() && null === $this->collOrdersRelatedByDeliveryOrderAddressId) {
// return empty collection // return empty collection
$this->initOrdersRelatedByAddressDelivery(); $this->initOrdersRelatedByDeliveryOrderAddressId();
} else { } else {
$collOrdersRelatedByAddressDelivery = ChildOrderQuery::create(null, $criteria) $collOrdersRelatedByDeliveryOrderAddressId = ChildOrderQuery::create(null, $criteria)
->filterByOrderAddressRelatedByAddressDelivery($this) ->filterByOrderAddressRelatedByDeliveryOrderAddressId($this)
->find($con); ->find($con);
if (null !== $criteria) { if (null !== $criteria) {
if (false !== $this->collOrdersRelatedByAddressDeliveryPartial && count($collOrdersRelatedByAddressDelivery)) { if (false !== $this->collOrdersRelatedByDeliveryOrderAddressIdPartial && count($collOrdersRelatedByDeliveryOrderAddressId)) {
$this->initOrdersRelatedByAddressDelivery(false); $this->initOrdersRelatedByDeliveryOrderAddressId(false);
foreach ($collOrdersRelatedByAddressDelivery as $obj) { foreach ($collOrdersRelatedByDeliveryOrderAddressId as $obj) {
if (false == $this->collOrdersRelatedByAddressDelivery->contains($obj)) { if (false == $this->collOrdersRelatedByDeliveryOrderAddressId->contains($obj)) {
$this->collOrdersRelatedByAddressDelivery->append($obj); $this->collOrdersRelatedByDeliveryOrderAddressId->append($obj);
} }
} }
$this->collOrdersRelatedByAddressDeliveryPartial = true; $this->collOrdersRelatedByDeliveryOrderAddressIdPartial = true;
} }
$collOrdersRelatedByAddressDelivery->getInternalIterator()->rewind(); $collOrdersRelatedByDeliveryOrderAddressId->getInternalIterator()->rewind();
return $collOrdersRelatedByAddressDelivery; return $collOrdersRelatedByDeliveryOrderAddressId;
} }
if ($partial && $this->collOrdersRelatedByAddressDelivery) { if ($partial && $this->collOrdersRelatedByDeliveryOrderAddressId) {
foreach ($this->collOrdersRelatedByAddressDelivery as $obj) { foreach ($this->collOrdersRelatedByDeliveryOrderAddressId as $obj) {
if ($obj->isNew()) { if ($obj->isNew()) {
$collOrdersRelatedByAddressDelivery[] = $obj; $collOrdersRelatedByDeliveryOrderAddressId[] = $obj;
} }
} }
} }
$this->collOrdersRelatedByAddressDelivery = $collOrdersRelatedByAddressDelivery; $this->collOrdersRelatedByDeliveryOrderAddressId = $collOrdersRelatedByDeliveryOrderAddressId;
$this->collOrdersRelatedByAddressDeliveryPartial = false; $this->collOrdersRelatedByDeliveryOrderAddressIdPartial = false;
} }
} }
return $this->collOrdersRelatedByAddressDelivery; return $this->collOrdersRelatedByDeliveryOrderAddressId;
} }
/** /**
* Sets a collection of OrderRelatedByAddressDelivery objects related by a one-to-many relationship * Sets a collection of OrderRelatedByDeliveryOrderAddressId objects related by a one-to-many relationship
* to the current object. * to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted) * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection. * and new objects from the given Propel collection.
* *
* @param Collection $ordersRelatedByAddressDelivery A Propel collection. * @param Collection $ordersRelatedByDeliveryOrderAddressId A Propel collection.
* @param ConnectionInterface $con Optional connection object * @param ConnectionInterface $con Optional connection object
* @return ChildOrderAddress The current object (for fluent API support) * @return ChildOrderAddress The current object (for fluent API support)
*/ */
public function setOrdersRelatedByAddressDelivery(Collection $ordersRelatedByAddressDelivery, ConnectionInterface $con = null) public function setOrdersRelatedByDeliveryOrderAddressId(Collection $ordersRelatedByDeliveryOrderAddressId, ConnectionInterface $con = null)
{ {
$ordersRelatedByAddressDeliveryToDelete = $this->getOrdersRelatedByAddressDelivery(new Criteria(), $con)->diff($ordersRelatedByAddressDelivery); $ordersRelatedByDeliveryOrderAddressIdToDelete = $this->getOrdersRelatedByDeliveryOrderAddressId(new Criteria(), $con)->diff($ordersRelatedByDeliveryOrderAddressId);
$this->ordersRelatedByAddressDeliveryScheduledForDeletion = $ordersRelatedByAddressDeliveryToDelete; $this->ordersRelatedByDeliveryOrderAddressIdScheduledForDeletion = $ordersRelatedByDeliveryOrderAddressIdToDelete;
foreach ($ordersRelatedByAddressDeliveryToDelete as $orderRelatedByAddressDeliveryRemoved) { foreach ($ordersRelatedByDeliveryOrderAddressIdToDelete as $orderRelatedByDeliveryOrderAddressIdRemoved) {
$orderRelatedByAddressDeliveryRemoved->setOrderAddressRelatedByAddressDelivery(null); $orderRelatedByDeliveryOrderAddressIdRemoved->setOrderAddressRelatedByDeliveryOrderAddressId(null);
} }
$this->collOrdersRelatedByAddressDelivery = null; $this->collOrdersRelatedByDeliveryOrderAddressId = null;
foreach ($ordersRelatedByAddressDelivery as $orderRelatedByAddressDelivery) { foreach ($ordersRelatedByDeliveryOrderAddressId as $orderRelatedByDeliveryOrderAddressId) {
$this->addOrderRelatedByAddressDelivery($orderRelatedByAddressDelivery); $this->addOrderRelatedByDeliveryOrderAddressId($orderRelatedByDeliveryOrderAddressId);
} }
$this->collOrdersRelatedByAddressDelivery = $ordersRelatedByAddressDelivery; $this->collOrdersRelatedByDeliveryOrderAddressId = $ordersRelatedByDeliveryOrderAddressId;
$this->collOrdersRelatedByAddressDeliveryPartial = false; $this->collOrdersRelatedByDeliveryOrderAddressIdPartial = false;
return $this; return $this;
} }
@@ -2220,16 +2293,16 @@ abstract class OrderAddress implements ActiveRecordInterface
* @return int Count of related Order objects. * @return int Count of related Order objects.
* @throws PropelException * @throws PropelException
*/ */
public function countOrdersRelatedByAddressDelivery(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) public function countOrdersRelatedByDeliveryOrderAddressId(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{ {
$partial = $this->collOrdersRelatedByAddressDeliveryPartial && !$this->isNew(); $partial = $this->collOrdersRelatedByDeliveryOrderAddressIdPartial && !$this->isNew();
if (null === $this->collOrdersRelatedByAddressDelivery || null !== $criteria || $partial) { if (null === $this->collOrdersRelatedByDeliveryOrderAddressId || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collOrdersRelatedByAddressDelivery) { if ($this->isNew() && null === $this->collOrdersRelatedByDeliveryOrderAddressId) {
return 0; return 0;
} }
if ($partial && !$criteria) { if ($partial && !$criteria) {
return count($this->getOrdersRelatedByAddressDelivery()); return count($this->getOrdersRelatedByDeliveryOrderAddressId());
} }
$query = ChildOrderQuery::create(null, $criteria); $query = ChildOrderQuery::create(null, $criteria);
@@ -2238,11 +2311,11 @@ abstract class OrderAddress implements ActiveRecordInterface
} }
return $query return $query
->filterByOrderAddressRelatedByAddressDelivery($this) ->filterByOrderAddressRelatedByDeliveryOrderAddressId($this)
->count($con); ->count($con);
} }
return count($this->collOrdersRelatedByAddressDelivery); return count($this->collOrdersRelatedByDeliveryOrderAddressId);
} }
/** /**
@@ -2252,43 +2325,43 @@ abstract class OrderAddress implements ActiveRecordInterface
* @param ChildOrder $l ChildOrder * @param ChildOrder $l ChildOrder
* @return \Thelia\Model\OrderAddress The current object (for fluent API support) * @return \Thelia\Model\OrderAddress The current object (for fluent API support)
*/ */
public function addOrderRelatedByAddressDelivery(ChildOrder $l) public function addOrderRelatedByDeliveryOrderAddressId(ChildOrder $l)
{ {
if ($this->collOrdersRelatedByAddressDelivery === null) { if ($this->collOrdersRelatedByDeliveryOrderAddressId === null) {
$this->initOrdersRelatedByAddressDelivery(); $this->initOrdersRelatedByDeliveryOrderAddressId();
$this->collOrdersRelatedByAddressDeliveryPartial = true; $this->collOrdersRelatedByDeliveryOrderAddressIdPartial = true;
} }
if (!in_array($l, $this->collOrdersRelatedByAddressDelivery->getArrayCopy(), true)) { // only add it if the **same** object is not already associated if (!in_array($l, $this->collOrdersRelatedByDeliveryOrderAddressId->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddOrderRelatedByAddressDelivery($l); $this->doAddOrderRelatedByDeliveryOrderAddressId($l);
} }
return $this; return $this;
} }
/** /**
* @param OrderRelatedByAddressDelivery $orderRelatedByAddressDelivery The orderRelatedByAddressDelivery object to add. * @param OrderRelatedByDeliveryOrderAddressId $orderRelatedByDeliveryOrderAddressId The orderRelatedByDeliveryOrderAddressId object to add.
*/ */
protected function doAddOrderRelatedByAddressDelivery($orderRelatedByAddressDelivery) protected function doAddOrderRelatedByDeliveryOrderAddressId($orderRelatedByDeliveryOrderAddressId)
{ {
$this->collOrdersRelatedByAddressDelivery[]= $orderRelatedByAddressDelivery; $this->collOrdersRelatedByDeliveryOrderAddressId[]= $orderRelatedByDeliveryOrderAddressId;
$orderRelatedByAddressDelivery->setOrderAddressRelatedByAddressDelivery($this); $orderRelatedByDeliveryOrderAddressId->setOrderAddressRelatedByDeliveryOrderAddressId($this);
} }
/** /**
* @param OrderRelatedByAddressDelivery $orderRelatedByAddressDelivery The orderRelatedByAddressDelivery object to remove. * @param OrderRelatedByDeliveryOrderAddressId $orderRelatedByDeliveryOrderAddressId The orderRelatedByDeliveryOrderAddressId object to remove.
* @return ChildOrderAddress The current object (for fluent API support) * @return ChildOrderAddress The current object (for fluent API support)
*/ */
public function removeOrderRelatedByAddressDelivery($orderRelatedByAddressDelivery) public function removeOrderRelatedByDeliveryOrderAddressId($orderRelatedByDeliveryOrderAddressId)
{ {
if ($this->getOrdersRelatedByAddressDelivery()->contains($orderRelatedByAddressDelivery)) { if ($this->getOrdersRelatedByDeliveryOrderAddressId()->contains($orderRelatedByDeliveryOrderAddressId)) {
$this->collOrdersRelatedByAddressDelivery->remove($this->collOrdersRelatedByAddressDelivery->search($orderRelatedByAddressDelivery)); $this->collOrdersRelatedByDeliveryOrderAddressId->remove($this->collOrdersRelatedByDeliveryOrderAddressId->search($orderRelatedByDeliveryOrderAddressId));
if (null === $this->ordersRelatedByAddressDeliveryScheduledForDeletion) { if (null === $this->ordersRelatedByDeliveryOrderAddressIdScheduledForDeletion) {
$this->ordersRelatedByAddressDeliveryScheduledForDeletion = clone $this->collOrdersRelatedByAddressDelivery; $this->ordersRelatedByDeliveryOrderAddressIdScheduledForDeletion = clone $this->collOrdersRelatedByDeliveryOrderAddressId;
$this->ordersRelatedByAddressDeliveryScheduledForDeletion->clear(); $this->ordersRelatedByDeliveryOrderAddressIdScheduledForDeletion->clear();
} }
$this->ordersRelatedByAddressDeliveryScheduledForDeletion[]= $orderRelatedByAddressDelivery; $this->ordersRelatedByDeliveryOrderAddressIdScheduledForDeletion[]= clone $orderRelatedByDeliveryOrderAddressId;
$orderRelatedByAddressDelivery->setOrderAddressRelatedByAddressDelivery(null); $orderRelatedByDeliveryOrderAddressId->setOrderAddressRelatedByDeliveryOrderAddressId(null);
} }
return $this; return $this;
@@ -2300,7 +2373,7 @@ abstract class OrderAddress implements ActiveRecordInterface
* an identical criteria, it returns the collection. * an identical criteria, it returns the collection.
* Otherwise if this OrderAddress is new, it will return * Otherwise if this OrderAddress is new, it will return
* an empty collection; or if this OrderAddress has previously * an empty collection; or if this OrderAddress has previously
* been saved, it will retrieve related OrdersRelatedByAddressDelivery from storage. * been saved, it will retrieve related OrdersRelatedByDeliveryOrderAddressId from storage.
* *
* This method is protected by default in order to keep the public * This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you * api reasonable. You can provide public methods for those you
@@ -2311,12 +2384,12 @@ abstract class OrderAddress implements ActiveRecordInterface
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects * @return Collection|ChildOrder[] List of ChildOrder objects
*/ */
public function getOrdersRelatedByAddressDeliveryJoinCurrency($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) public function getOrdersRelatedByDeliveryOrderAddressIdJoinCurrency($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{ {
$query = ChildOrderQuery::create(null, $criteria); $query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('Currency', $joinBehavior); $query->joinWith('Currency', $joinBehavior);
return $this->getOrdersRelatedByAddressDelivery($query, $con); return $this->getOrdersRelatedByDeliveryOrderAddressId($query, $con);
} }
@@ -2325,7 +2398,7 @@ abstract class OrderAddress implements ActiveRecordInterface
* an identical criteria, it returns the collection. * an identical criteria, it returns the collection.
* Otherwise if this OrderAddress is new, it will return * Otherwise if this OrderAddress is new, it will return
* an empty collection; or if this OrderAddress has previously * an empty collection; or if this OrderAddress has previously
* been saved, it will retrieve related OrdersRelatedByAddressDelivery from storage. * been saved, it will retrieve related OrdersRelatedByDeliveryOrderAddressId from storage.
* *
* This method is protected by default in order to keep the public * This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you * api reasonable. You can provide public methods for those you
@@ -2336,12 +2409,12 @@ abstract class OrderAddress implements ActiveRecordInterface
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects * @return Collection|ChildOrder[] List of ChildOrder objects
*/ */
public function getOrdersRelatedByAddressDeliveryJoinCustomer($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) public function getOrdersRelatedByDeliveryOrderAddressIdJoinCustomer($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{ {
$query = ChildOrderQuery::create(null, $criteria); $query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('Customer', $joinBehavior); $query->joinWith('Customer', $joinBehavior);
return $this->getOrdersRelatedByAddressDelivery($query, $con); return $this->getOrdersRelatedByDeliveryOrderAddressId($query, $con);
} }
@@ -2350,7 +2423,7 @@ abstract class OrderAddress implements ActiveRecordInterface
* an identical criteria, it returns the collection. * an identical criteria, it returns the collection.
* Otherwise if this OrderAddress is new, it will return * Otherwise if this OrderAddress is new, it will return
* an empty collection; or if this OrderAddress has previously * an empty collection; or if this OrderAddress has previously
* been saved, it will retrieve related OrdersRelatedByAddressDelivery from storage. * been saved, it will retrieve related OrdersRelatedByDeliveryOrderAddressId from storage.
* *
* This method is protected by default in order to keep the public * This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you * api reasonable. You can provide public methods for those you
@@ -2361,12 +2434,87 @@ abstract class OrderAddress implements ActiveRecordInterface
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects * @return Collection|ChildOrder[] List of ChildOrder objects
*/ */
public function getOrdersRelatedByAddressDeliveryJoinOrderStatus($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) public function getOrdersRelatedByDeliveryOrderAddressIdJoinOrderStatus($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{ {
$query = ChildOrderQuery::create(null, $criteria); $query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('OrderStatus', $joinBehavior); $query->joinWith('OrderStatus', $joinBehavior);
return $this->getOrdersRelatedByAddressDelivery($query, $con); return $this->getOrdersRelatedByDeliveryOrderAddressId($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this OrderAddress is new, it will return
* an empty collection; or if this OrderAddress has previously
* been saved, it will retrieve related OrdersRelatedByDeliveryOrderAddressId from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in OrderAddress.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersRelatedByDeliveryOrderAddressIdJoinModuleRelatedByPaymentModuleId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('ModuleRelatedByPaymentModuleId', $joinBehavior);
return $this->getOrdersRelatedByDeliveryOrderAddressId($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this OrderAddress is new, it will return
* an empty collection; or if this OrderAddress has previously
* been saved, it will retrieve related OrdersRelatedByDeliveryOrderAddressId from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in OrderAddress.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersRelatedByDeliveryOrderAddressIdJoinModuleRelatedByDeliveryModuleId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('ModuleRelatedByDeliveryModuleId', $joinBehavior);
return $this->getOrdersRelatedByDeliveryOrderAddressId($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this OrderAddress is new, it will return
* an empty collection; or if this OrderAddress has previously
* been saved, it will retrieve related OrdersRelatedByDeliveryOrderAddressId from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in OrderAddress.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersRelatedByDeliveryOrderAddressIdJoinLang($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('Lang', $joinBehavior);
return $this->getOrdersRelatedByDeliveryOrderAddressId($query, $con);
} }
/** /**
@@ -2407,26 +2555,26 @@ abstract class OrderAddress implements ActiveRecordInterface
public function clearAllReferences($deep = false) public function clearAllReferences($deep = false)
{ {
if ($deep) { if ($deep) {
if ($this->collOrdersRelatedByAddressInvoice) { if ($this->collOrdersRelatedByInvoiceOrderAddressId) {
foreach ($this->collOrdersRelatedByAddressInvoice as $o) { foreach ($this->collOrdersRelatedByInvoiceOrderAddressId as $o) {
$o->clearAllReferences($deep); $o->clearAllReferences($deep);
} }
} }
if ($this->collOrdersRelatedByAddressDelivery) { if ($this->collOrdersRelatedByDeliveryOrderAddressId) {
foreach ($this->collOrdersRelatedByAddressDelivery as $o) { foreach ($this->collOrdersRelatedByDeliveryOrderAddressId as $o) {
$o->clearAllReferences($deep); $o->clearAllReferences($deep);
} }
} }
} // if ($deep) } // if ($deep)
if ($this->collOrdersRelatedByAddressInvoice instanceof Collection) { if ($this->collOrdersRelatedByInvoiceOrderAddressId instanceof Collection) {
$this->collOrdersRelatedByAddressInvoice->clearIterator(); $this->collOrdersRelatedByInvoiceOrderAddressId->clearIterator();
} }
$this->collOrdersRelatedByAddressInvoice = null; $this->collOrdersRelatedByInvoiceOrderAddressId = null;
if ($this->collOrdersRelatedByAddressDelivery instanceof Collection) { if ($this->collOrdersRelatedByDeliveryOrderAddressId instanceof Collection) {
$this->collOrdersRelatedByAddressDelivery->clearIterator(); $this->collOrdersRelatedByDeliveryOrderAddressId->clearIterator();
} }
$this->collOrdersRelatedByAddressDelivery = null; $this->collOrdersRelatedByDeliveryOrderAddressId = null;
} }
/** /**

View File

@@ -55,13 +55,13 @@ use Thelia\Model\Map\OrderAddressTableMap;
* @method ChildOrderAddressQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildOrderAddressQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildOrderAddressQuery innerJoin($relation) Adds a INNER JOIN clause to the query * @method ChildOrderAddressQuery innerJoin($relation) Adds a INNER JOIN clause to the query
* *
* @method ChildOrderAddressQuery leftJoinOrderRelatedByAddressInvoice($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderRelatedByAddressInvoice relation * @method ChildOrderAddressQuery leftJoinOrderRelatedByInvoiceOrderAddressId($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderRelatedByInvoiceOrderAddressId relation
* @method ChildOrderAddressQuery rightJoinOrderRelatedByAddressInvoice($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderRelatedByAddressInvoice relation * @method ChildOrderAddressQuery rightJoinOrderRelatedByInvoiceOrderAddressId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderRelatedByInvoiceOrderAddressId relation
* @method ChildOrderAddressQuery innerJoinOrderRelatedByAddressInvoice($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderRelatedByAddressInvoice relation * @method ChildOrderAddressQuery innerJoinOrderRelatedByInvoiceOrderAddressId($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderRelatedByInvoiceOrderAddressId relation
* *
* @method ChildOrderAddressQuery leftJoinOrderRelatedByAddressDelivery($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderRelatedByAddressDelivery relation * @method ChildOrderAddressQuery leftJoinOrderRelatedByDeliveryOrderAddressId($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderRelatedByDeliveryOrderAddressId relation
* @method ChildOrderAddressQuery rightJoinOrderRelatedByAddressDelivery($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderRelatedByAddressDelivery relation * @method ChildOrderAddressQuery rightJoinOrderRelatedByDeliveryOrderAddressId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderRelatedByDeliveryOrderAddressId relation
* @method ChildOrderAddressQuery innerJoinOrderRelatedByAddressDelivery($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderRelatedByAddressDelivery relation * @method ChildOrderAddressQuery innerJoinOrderRelatedByDeliveryOrderAddressId($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderRelatedByDeliveryOrderAddressId relation
* *
* @method ChildOrderAddress findOne(ConnectionInterface $con = null) Return the first ChildOrderAddress matching the query * @method ChildOrderAddress findOne(ConnectionInterface $con = null) Return the first ChildOrderAddress matching the query
* @method ChildOrderAddress findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderAddress matching the query, or a new ChildOrderAddress object populated from the query conditions when no match is found * @method ChildOrderAddress findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderAddress matching the query, or a new ChildOrderAddress object populated from the query conditions when no match is found
@@ -750,33 +750,33 @@ abstract class OrderAddressQuery extends ModelCriteria
* *
* @return ChildOrderAddressQuery The current query, for fluid interface * @return ChildOrderAddressQuery The current query, for fluid interface
*/ */
public function filterByOrderRelatedByAddressInvoice($order, $comparison = null) public function filterByOrderRelatedByInvoiceOrderAddressId($order, $comparison = null)
{ {
if ($order instanceof \Thelia\Model\Order) { if ($order instanceof \Thelia\Model\Order) {
return $this return $this
->addUsingAlias(OrderAddressTableMap::ID, $order->getAddressInvoice(), $comparison); ->addUsingAlias(OrderAddressTableMap::ID, $order->getInvoiceOrderAddressId(), $comparison);
} elseif ($order instanceof ObjectCollection) { } elseif ($order instanceof ObjectCollection) {
return $this return $this
->useOrderRelatedByAddressInvoiceQuery() ->useOrderRelatedByInvoiceOrderAddressIdQuery()
->filterByPrimaryKeys($order->getPrimaryKeys()) ->filterByPrimaryKeys($order->getPrimaryKeys())
->endUse(); ->endUse();
} else { } else {
throw new PropelException('filterByOrderRelatedByAddressInvoice() only accepts arguments of type \Thelia\Model\Order or Collection'); throw new PropelException('filterByOrderRelatedByInvoiceOrderAddressId() only accepts arguments of type \Thelia\Model\Order or Collection');
} }
} }
/** /**
* Adds a JOIN clause to the query using the OrderRelatedByAddressInvoice relation * Adds a JOIN clause to the query using the OrderRelatedByInvoiceOrderAddressId relation
* *
* @param string $relationAlias optional alias for the relation * @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return ChildOrderAddressQuery The current query, for fluid interface * @return ChildOrderAddressQuery The current query, for fluid interface
*/ */
public function joinOrderRelatedByAddressInvoice($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinOrderRelatedByInvoiceOrderAddressId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('OrderRelatedByAddressInvoice'); $relationMap = $tableMap->getRelation('OrderRelatedByInvoiceOrderAddressId');
// create a ModelJoin object for this join // create a ModelJoin object for this join
$join = new ModelJoin(); $join = new ModelJoin();
@@ -791,14 +791,14 @@ abstract class OrderAddressQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias); $this->addJoinObject($join, $relationAlias);
} else { } else {
$this->addJoinObject($join, 'OrderRelatedByAddressInvoice'); $this->addJoinObject($join, 'OrderRelatedByInvoiceOrderAddressId');
} }
return $this; return $this;
} }
/** /**
* Use the OrderRelatedByAddressInvoice relation Order object * Use the OrderRelatedByInvoiceOrderAddressId relation Order object
* *
* @see useQuery() * @see useQuery()
* *
@@ -808,11 +808,11 @@ abstract class OrderAddressQuery extends ModelCriteria
* *
* @return \Thelia\Model\OrderQuery A secondary query class using the current class as primary query * @return \Thelia\Model\OrderQuery A secondary query class using the current class as primary query
*/ */
public function useOrderRelatedByAddressInvoiceQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useOrderRelatedByInvoiceOrderAddressIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinOrderRelatedByAddressInvoice($relationAlias, $joinType) ->joinOrderRelatedByInvoiceOrderAddressId($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderRelatedByAddressInvoice', '\Thelia\Model\OrderQuery'); ->useQuery($relationAlias ? $relationAlias : 'OrderRelatedByInvoiceOrderAddressId', '\Thelia\Model\OrderQuery');
} }
/** /**
@@ -823,33 +823,33 @@ abstract class OrderAddressQuery extends ModelCriteria
* *
* @return ChildOrderAddressQuery The current query, for fluid interface * @return ChildOrderAddressQuery The current query, for fluid interface
*/ */
public function filterByOrderRelatedByAddressDelivery($order, $comparison = null) public function filterByOrderRelatedByDeliveryOrderAddressId($order, $comparison = null)
{ {
if ($order instanceof \Thelia\Model\Order) { if ($order instanceof \Thelia\Model\Order) {
return $this return $this
->addUsingAlias(OrderAddressTableMap::ID, $order->getAddressDelivery(), $comparison); ->addUsingAlias(OrderAddressTableMap::ID, $order->getDeliveryOrderAddressId(), $comparison);
} elseif ($order instanceof ObjectCollection) { } elseif ($order instanceof ObjectCollection) {
return $this return $this
->useOrderRelatedByAddressDeliveryQuery() ->useOrderRelatedByDeliveryOrderAddressIdQuery()
->filterByPrimaryKeys($order->getPrimaryKeys()) ->filterByPrimaryKeys($order->getPrimaryKeys())
->endUse(); ->endUse();
} else { } else {
throw new PropelException('filterByOrderRelatedByAddressDelivery() only accepts arguments of type \Thelia\Model\Order or Collection'); throw new PropelException('filterByOrderRelatedByDeliveryOrderAddressId() only accepts arguments of type \Thelia\Model\Order or Collection');
} }
} }
/** /**
* Adds a JOIN clause to the query using the OrderRelatedByAddressDelivery relation * Adds a JOIN clause to the query using the OrderRelatedByDeliveryOrderAddressId relation
* *
* @param string $relationAlias optional alias for the relation * @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return ChildOrderAddressQuery The current query, for fluid interface * @return ChildOrderAddressQuery The current query, for fluid interface
*/ */
public function joinOrderRelatedByAddressDelivery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinOrderRelatedByDeliveryOrderAddressId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('OrderRelatedByAddressDelivery'); $relationMap = $tableMap->getRelation('OrderRelatedByDeliveryOrderAddressId');
// create a ModelJoin object for this join // create a ModelJoin object for this join
$join = new ModelJoin(); $join = new ModelJoin();
@@ -864,14 +864,14 @@ abstract class OrderAddressQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias); $this->addJoinObject($join, $relationAlias);
} else { } else {
$this->addJoinObject($join, 'OrderRelatedByAddressDelivery'); $this->addJoinObject($join, 'OrderRelatedByDeliveryOrderAddressId');
} }
return $this; return $this;
} }
/** /**
* Use the OrderRelatedByAddressDelivery relation Order object * Use the OrderRelatedByDeliveryOrderAddressId relation Order object
* *
* @see useQuery() * @see useQuery()
* *
@@ -881,11 +881,11 @@ abstract class OrderAddressQuery extends ModelCriteria
* *
* @return \Thelia\Model\OrderQuery A secondary query class using the current class as primary query * @return \Thelia\Model\OrderQuery A secondary query class using the current class as primary query
*/ */
public function useOrderRelatedByAddressDeliveryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useOrderRelatedByDeliveryOrderAddressIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinOrderRelatedByAddressDelivery($relationAlias, $joinType) ->joinOrderRelatedByDeliveryOrderAddressId($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderRelatedByAddressDelivery', '\Thelia\Model\OrderQuery'); ->useQuery($relationAlias ? $relationAlias : 'OrderRelatedByDeliveryOrderAddressId', '\Thelia\Model\OrderQuery');
} }
/** /**

View File

@@ -24,38 +24,38 @@ use Thelia\Model\Map\OrderTableMap;
* @method ChildOrderQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildOrderQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildOrderQuery orderByRef($order = Criteria::ASC) Order by the ref column * @method ChildOrderQuery orderByRef($order = Criteria::ASC) Order by the ref column
* @method ChildOrderQuery orderByCustomerId($order = Criteria::ASC) Order by the customer_id column * @method ChildOrderQuery orderByCustomerId($order = Criteria::ASC) Order by the customer_id column
* @method ChildOrderQuery orderByAddressInvoice($order = Criteria::ASC) Order by the address_invoice column * @method ChildOrderQuery orderByInvoiceOrderAddressId($order = Criteria::ASC) Order by the invoice_order_address_id column
* @method ChildOrderQuery orderByAddressDelivery($order = Criteria::ASC) Order by the address_delivery column * @method ChildOrderQuery orderByDeliveryOrderAddressId($order = Criteria::ASC) Order by the delivery_order_address_id column
* @method ChildOrderQuery orderByInvoiceDate($order = Criteria::ASC) Order by the invoice_date column * @method ChildOrderQuery orderByInvoiceDate($order = Criteria::ASC) Order by the invoice_date column
* @method ChildOrderQuery orderByCurrencyId($order = Criteria::ASC) Order by the currency_id column * @method ChildOrderQuery orderByCurrencyId($order = Criteria::ASC) Order by the currency_id column
* @method ChildOrderQuery orderByCurrencyRate($order = Criteria::ASC) Order by the currency_rate column * @method ChildOrderQuery orderByCurrencyRate($order = Criteria::ASC) Order by the currency_rate column
* @method ChildOrderQuery orderByTransaction($order = Criteria::ASC) Order by the transaction column * @method ChildOrderQuery orderByTransactionRef($order = Criteria::ASC) Order by the transaction_ref column
* @method ChildOrderQuery orderByDeliveryNum($order = Criteria::ASC) Order by the delivery_num column * @method ChildOrderQuery orderByDeliveryRef($order = Criteria::ASC) Order by the delivery_ref column
* @method ChildOrderQuery orderByInvoice($order = Criteria::ASC) Order by the invoice column * @method ChildOrderQuery orderByInvoiceRef($order = Criteria::ASC) Order by the invoice_ref column
* @method ChildOrderQuery orderByPostage($order = Criteria::ASC) Order by the postage column * @method ChildOrderQuery orderByPostage($order = Criteria::ASC) Order by the postage column
* @method ChildOrderQuery orderByPayment($order = Criteria::ASC) Order by the payment column * @method ChildOrderQuery orderByPaymentModuleId($order = Criteria::ASC) Order by the payment_module_id column
* @method ChildOrderQuery orderByCarrier($order = Criteria::ASC) Order by the carrier column * @method ChildOrderQuery orderByDeliveryModuleId($order = Criteria::ASC) Order by the delivery_module_id column
* @method ChildOrderQuery orderByStatusId($order = Criteria::ASC) Order by the status_id column * @method ChildOrderQuery orderByStatusId($order = Criteria::ASC) Order by the status_id column
* @method ChildOrderQuery orderByLang($order = Criteria::ASC) Order by the lang column * @method ChildOrderQuery orderByLangId($order = Criteria::ASC) Order by the lang_id column
* @method ChildOrderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildOrderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildOrderQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildOrderQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* *
* @method ChildOrderQuery groupById() Group by the id column * @method ChildOrderQuery groupById() Group by the id column
* @method ChildOrderQuery groupByRef() Group by the ref column * @method ChildOrderQuery groupByRef() Group by the ref column
* @method ChildOrderQuery groupByCustomerId() Group by the customer_id column * @method ChildOrderQuery groupByCustomerId() Group by the customer_id column
* @method ChildOrderQuery groupByAddressInvoice() Group by the address_invoice column * @method ChildOrderQuery groupByInvoiceOrderAddressId() Group by the invoice_order_address_id column
* @method ChildOrderQuery groupByAddressDelivery() Group by the address_delivery column * @method ChildOrderQuery groupByDeliveryOrderAddressId() Group by the delivery_order_address_id column
* @method ChildOrderQuery groupByInvoiceDate() Group by the invoice_date column * @method ChildOrderQuery groupByInvoiceDate() Group by the invoice_date column
* @method ChildOrderQuery groupByCurrencyId() Group by the currency_id column * @method ChildOrderQuery groupByCurrencyId() Group by the currency_id column
* @method ChildOrderQuery groupByCurrencyRate() Group by the currency_rate column * @method ChildOrderQuery groupByCurrencyRate() Group by the currency_rate column
* @method ChildOrderQuery groupByTransaction() Group by the transaction column * @method ChildOrderQuery groupByTransactionRef() Group by the transaction_ref column
* @method ChildOrderQuery groupByDeliveryNum() Group by the delivery_num column * @method ChildOrderQuery groupByDeliveryRef() Group by the delivery_ref column
* @method ChildOrderQuery groupByInvoice() Group by the invoice column * @method ChildOrderQuery groupByInvoiceRef() Group by the invoice_ref column
* @method ChildOrderQuery groupByPostage() Group by the postage column * @method ChildOrderQuery groupByPostage() Group by the postage column
* @method ChildOrderQuery groupByPayment() Group by the payment column * @method ChildOrderQuery groupByPaymentModuleId() Group by the payment_module_id column
* @method ChildOrderQuery groupByCarrier() Group by the carrier column * @method ChildOrderQuery groupByDeliveryModuleId() Group by the delivery_module_id column
* @method ChildOrderQuery groupByStatusId() Group by the status_id column * @method ChildOrderQuery groupByStatusId() Group by the status_id column
* @method ChildOrderQuery groupByLang() Group by the lang column * @method ChildOrderQuery groupByLangId() Group by the lang_id column
* @method ChildOrderQuery groupByCreatedAt() Group by the created_at column * @method ChildOrderQuery groupByCreatedAt() Group by the created_at column
* @method ChildOrderQuery groupByUpdatedAt() Group by the updated_at column * @method ChildOrderQuery groupByUpdatedAt() Group by the updated_at column
* *
@@ -71,18 +71,30 @@ use Thelia\Model\Map\OrderTableMap;
* @method ChildOrderQuery rightJoinCustomer($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Customer relation * @method ChildOrderQuery rightJoinCustomer($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Customer relation
* @method ChildOrderQuery innerJoinCustomer($relationAlias = null) Adds a INNER JOIN clause to the query using the Customer relation * @method ChildOrderQuery innerJoinCustomer($relationAlias = null) Adds a INNER JOIN clause to the query using the Customer relation
* *
* @method ChildOrderQuery leftJoinOrderAddressRelatedByAddressInvoice($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderAddressRelatedByAddressInvoice relation * @method ChildOrderQuery leftJoinOrderAddressRelatedByInvoiceOrderAddressId($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderAddressRelatedByInvoiceOrderAddressId relation
* @method ChildOrderQuery rightJoinOrderAddressRelatedByAddressInvoice($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderAddressRelatedByAddressInvoice relation * @method ChildOrderQuery rightJoinOrderAddressRelatedByInvoiceOrderAddressId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderAddressRelatedByInvoiceOrderAddressId relation
* @method ChildOrderQuery innerJoinOrderAddressRelatedByAddressInvoice($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderAddressRelatedByAddressInvoice relation * @method ChildOrderQuery innerJoinOrderAddressRelatedByInvoiceOrderAddressId($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderAddressRelatedByInvoiceOrderAddressId relation
* *
* @method ChildOrderQuery leftJoinOrderAddressRelatedByAddressDelivery($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderAddressRelatedByAddressDelivery relation * @method ChildOrderQuery leftJoinOrderAddressRelatedByDeliveryOrderAddressId($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderAddressRelatedByDeliveryOrderAddressId relation
* @method ChildOrderQuery rightJoinOrderAddressRelatedByAddressDelivery($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderAddressRelatedByAddressDelivery relation * @method ChildOrderQuery rightJoinOrderAddressRelatedByDeliveryOrderAddressId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderAddressRelatedByDeliveryOrderAddressId relation
* @method ChildOrderQuery innerJoinOrderAddressRelatedByAddressDelivery($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderAddressRelatedByAddressDelivery relation * @method ChildOrderQuery innerJoinOrderAddressRelatedByDeliveryOrderAddressId($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderAddressRelatedByDeliveryOrderAddressId relation
* *
* @method ChildOrderQuery leftJoinOrderStatus($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderStatus relation * @method ChildOrderQuery leftJoinOrderStatus($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderStatus relation
* @method ChildOrderQuery rightJoinOrderStatus($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderStatus relation * @method ChildOrderQuery rightJoinOrderStatus($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderStatus relation
* @method ChildOrderQuery innerJoinOrderStatus($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderStatus relation * @method ChildOrderQuery innerJoinOrderStatus($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderStatus relation
* *
* @method ChildOrderQuery leftJoinModuleRelatedByPaymentModuleId($relationAlias = null) Adds a LEFT JOIN clause to the query using the ModuleRelatedByPaymentModuleId relation
* @method ChildOrderQuery rightJoinModuleRelatedByPaymentModuleId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleRelatedByPaymentModuleId relation
* @method ChildOrderQuery innerJoinModuleRelatedByPaymentModuleId($relationAlias = null) Adds a INNER JOIN clause to the query using the ModuleRelatedByPaymentModuleId relation
*
* @method ChildOrderQuery leftJoinModuleRelatedByDeliveryModuleId($relationAlias = null) Adds a LEFT JOIN clause to the query using the ModuleRelatedByDeliveryModuleId relation
* @method ChildOrderQuery rightJoinModuleRelatedByDeliveryModuleId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleRelatedByDeliveryModuleId relation
* @method ChildOrderQuery innerJoinModuleRelatedByDeliveryModuleId($relationAlias = null) Adds a INNER JOIN clause to the query using the ModuleRelatedByDeliveryModuleId relation
*
* @method ChildOrderQuery leftJoinLang($relationAlias = null) Adds a LEFT JOIN clause to the query using the Lang relation
* @method ChildOrderQuery rightJoinLang($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Lang relation
* @method ChildOrderQuery innerJoinLang($relationAlias = null) Adds a INNER JOIN clause to the query using the Lang relation
*
* @method ChildOrderQuery leftJoinOrderProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderProduct relation * @method ChildOrderQuery leftJoinOrderProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderProduct relation
* @method ChildOrderQuery rightJoinOrderProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProduct relation * @method ChildOrderQuery rightJoinOrderProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProduct relation
* @method ChildOrderQuery innerJoinOrderProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProduct relation * @method ChildOrderQuery innerJoinOrderProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProduct relation
@@ -97,38 +109,38 @@ use Thelia\Model\Map\OrderTableMap;
* @method ChildOrder findOneById(int $id) Return the first ChildOrder filtered by the id column * @method ChildOrder findOneById(int $id) Return the first ChildOrder filtered by the id column
* @method ChildOrder findOneByRef(string $ref) Return the first ChildOrder filtered by the ref column * @method ChildOrder findOneByRef(string $ref) Return the first ChildOrder filtered by the ref column
* @method ChildOrder findOneByCustomerId(int $customer_id) Return the first ChildOrder filtered by the customer_id column * @method ChildOrder findOneByCustomerId(int $customer_id) Return the first ChildOrder filtered by the customer_id column
* @method ChildOrder findOneByAddressInvoice(int $address_invoice) Return the first ChildOrder filtered by the address_invoice column * @method ChildOrder findOneByInvoiceOrderAddressId(int $invoice_order_address_id) Return the first ChildOrder filtered by the invoice_order_address_id column
* @method ChildOrder findOneByAddressDelivery(int $address_delivery) Return the first ChildOrder filtered by the address_delivery column * @method ChildOrder findOneByDeliveryOrderAddressId(int $delivery_order_address_id) Return the first ChildOrder filtered by the delivery_order_address_id column
* @method ChildOrder findOneByInvoiceDate(string $invoice_date) Return the first ChildOrder filtered by the invoice_date column * @method ChildOrder findOneByInvoiceDate(string $invoice_date) Return the first ChildOrder filtered by the invoice_date column
* @method ChildOrder findOneByCurrencyId(int $currency_id) Return the first ChildOrder filtered by the currency_id column * @method ChildOrder findOneByCurrencyId(int $currency_id) Return the first ChildOrder filtered by the currency_id column
* @method ChildOrder findOneByCurrencyRate(double $currency_rate) Return the first ChildOrder filtered by the currency_rate column * @method ChildOrder findOneByCurrencyRate(double $currency_rate) Return the first ChildOrder filtered by the currency_rate column
* @method ChildOrder findOneByTransaction(string $transaction) Return the first ChildOrder filtered by the transaction column * @method ChildOrder findOneByTransactionRef(string $transaction_ref) Return the first ChildOrder filtered by the transaction_ref column
* @method ChildOrder findOneByDeliveryNum(string $delivery_num) Return the first ChildOrder filtered by the delivery_num column * @method ChildOrder findOneByDeliveryRef(string $delivery_ref) Return the first ChildOrder filtered by the delivery_ref column
* @method ChildOrder findOneByInvoice(string $invoice) Return the first ChildOrder filtered by the invoice column * @method ChildOrder findOneByInvoiceRef(string $invoice_ref) Return the first ChildOrder filtered by the invoice_ref column
* @method ChildOrder findOneByPostage(double $postage) Return the first ChildOrder filtered by the postage column * @method ChildOrder findOneByPostage(double $postage) Return the first ChildOrder filtered by the postage column
* @method ChildOrder findOneByPayment(string $payment) Return the first ChildOrder filtered by the payment column * @method ChildOrder findOneByPaymentModuleId(int $payment_module_id) Return the first ChildOrder filtered by the payment_module_id column
* @method ChildOrder findOneByCarrier(string $carrier) Return the first ChildOrder filtered by the carrier column * @method ChildOrder findOneByDeliveryModuleId(int $delivery_module_id) Return the first ChildOrder filtered by the delivery_module_id column
* @method ChildOrder findOneByStatusId(int $status_id) Return the first ChildOrder filtered by the status_id column * @method ChildOrder findOneByStatusId(int $status_id) Return the first ChildOrder filtered by the status_id column
* @method ChildOrder findOneByLang(string $lang) Return the first ChildOrder filtered by the lang column * @method ChildOrder findOneByLangId(int $lang_id) Return the first ChildOrder filtered by the lang_id column
* @method ChildOrder findOneByCreatedAt(string $created_at) Return the first ChildOrder filtered by the created_at column * @method ChildOrder findOneByCreatedAt(string $created_at) Return the first ChildOrder filtered by the created_at column
* @method ChildOrder findOneByUpdatedAt(string $updated_at) Return the first ChildOrder filtered by the updated_at column * @method ChildOrder findOneByUpdatedAt(string $updated_at) Return the first ChildOrder filtered by the updated_at column
* *
* @method array findById(int $id) Return ChildOrder objects filtered by the id column * @method array findById(int $id) Return ChildOrder objects filtered by the id column
* @method array findByRef(string $ref) Return ChildOrder objects filtered by the ref column * @method array findByRef(string $ref) Return ChildOrder objects filtered by the ref column
* @method array findByCustomerId(int $customer_id) Return ChildOrder objects filtered by the customer_id column * @method array findByCustomerId(int $customer_id) Return ChildOrder objects filtered by the customer_id column
* @method array findByAddressInvoice(int $address_invoice) Return ChildOrder objects filtered by the address_invoice column * @method array findByInvoiceOrderAddressId(int $invoice_order_address_id) Return ChildOrder objects filtered by the invoice_order_address_id column
* @method array findByAddressDelivery(int $address_delivery) Return ChildOrder objects filtered by the address_delivery column * @method array findByDeliveryOrderAddressId(int $delivery_order_address_id) Return ChildOrder objects filtered by the delivery_order_address_id column
* @method array findByInvoiceDate(string $invoice_date) Return ChildOrder objects filtered by the invoice_date column * @method array findByInvoiceDate(string $invoice_date) Return ChildOrder objects filtered by the invoice_date column
* @method array findByCurrencyId(int $currency_id) Return ChildOrder objects filtered by the currency_id column * @method array findByCurrencyId(int $currency_id) Return ChildOrder objects filtered by the currency_id column
* @method array findByCurrencyRate(double $currency_rate) Return ChildOrder objects filtered by the currency_rate column * @method array findByCurrencyRate(double $currency_rate) Return ChildOrder objects filtered by the currency_rate column
* @method array findByTransaction(string $transaction) Return ChildOrder objects filtered by the transaction column * @method array findByTransactionRef(string $transaction_ref) Return ChildOrder objects filtered by the transaction_ref column
* @method array findByDeliveryNum(string $delivery_num) Return ChildOrder objects filtered by the delivery_num column * @method array findByDeliveryRef(string $delivery_ref) Return ChildOrder objects filtered by the delivery_ref column
* @method array findByInvoice(string $invoice) Return ChildOrder objects filtered by the invoice column * @method array findByInvoiceRef(string $invoice_ref) Return ChildOrder objects filtered by the invoice_ref column
* @method array findByPostage(double $postage) Return ChildOrder objects filtered by the postage column * @method array findByPostage(double $postage) Return ChildOrder objects filtered by the postage column
* @method array findByPayment(string $payment) Return ChildOrder objects filtered by the payment column * @method array findByPaymentModuleId(int $payment_module_id) Return ChildOrder objects filtered by the payment_module_id column
* @method array findByCarrier(string $carrier) Return ChildOrder objects filtered by the carrier column * @method array findByDeliveryModuleId(int $delivery_module_id) Return ChildOrder objects filtered by the delivery_module_id column
* @method array findByStatusId(int $status_id) Return ChildOrder objects filtered by the status_id column * @method array findByStatusId(int $status_id) Return ChildOrder objects filtered by the status_id column
* @method array findByLang(string $lang) Return ChildOrder objects filtered by the lang column * @method array findByLangId(int $lang_id) Return ChildOrder objects filtered by the lang_id column
* @method array findByCreatedAt(string $created_at) Return ChildOrder objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildOrder objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildOrder objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildOrder objects filtered by the updated_at column
* *
@@ -219,7 +231,7 @@ abstract class OrderQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, REF, CUSTOMER_ID, ADDRESS_INVOICE, ADDRESS_DELIVERY, INVOICE_DATE, CURRENCY_ID, CURRENCY_RATE, TRANSACTION, DELIVERY_NUM, INVOICE, POSTAGE, PAYMENT, CARRIER, STATUS_ID, LANG, CREATED_AT, UPDATED_AT FROM order WHERE ID = :p0'; $sql = 'SELECT ID, REF, CUSTOMER_ID, INVOICE_ORDER_ADDRESS_ID, DELIVERY_ORDER_ADDRESS_ID, INVOICE_DATE, CURRENCY_ID, CURRENCY_RATE, TRANSACTION_REF, DELIVERY_REF, INVOICE_REF, POSTAGE, PAYMENT_MODULE_ID, DELIVERY_MODULE_ID, STATUS_ID, LANG_ID, CREATED_AT, UPDATED_AT FROM order WHERE ID = :p0';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -422,18 +434,18 @@ abstract class OrderQuery extends ModelCriteria
} }
/** /**
* Filter the query on the address_invoice column * Filter the query on the invoice_order_address_id column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByAddressInvoice(1234); // WHERE address_invoice = 1234 * $query->filterByInvoiceOrderAddressId(1234); // WHERE invoice_order_address_id = 1234
* $query->filterByAddressInvoice(array(12, 34)); // WHERE address_invoice IN (12, 34) * $query->filterByInvoiceOrderAddressId(array(12, 34)); // WHERE invoice_order_address_id IN (12, 34)
* $query->filterByAddressInvoice(array('min' => 12)); // WHERE address_invoice > 12 * $query->filterByInvoiceOrderAddressId(array('min' => 12)); // WHERE invoice_order_address_id > 12
* </code> * </code>
* *
* @see filterByOrderAddressRelatedByAddressInvoice() * @see filterByOrderAddressRelatedByInvoiceOrderAddressId()
* *
* @param mixed $addressInvoice The value to use as filter. * @param mixed $invoiceOrderAddressId The value to use as filter.
* Use scalar values for equality. * Use scalar values for equality.
* Use array values for in_array() equivalent. * Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@@ -441,16 +453,16 @@ abstract class OrderQuery extends ModelCriteria
* *
* @return ChildOrderQuery The current query, for fluid interface * @return ChildOrderQuery The current query, for fluid interface
*/ */
public function filterByAddressInvoice($addressInvoice = null, $comparison = null) public function filterByInvoiceOrderAddressId($invoiceOrderAddressId = null, $comparison = null)
{ {
if (is_array($addressInvoice)) { if (is_array($invoiceOrderAddressId)) {
$useMinMax = false; $useMinMax = false;
if (isset($addressInvoice['min'])) { if (isset($invoiceOrderAddressId['min'])) {
$this->addUsingAlias(OrderTableMap::ADDRESS_INVOICE, $addressInvoice['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(OrderTableMap::INVOICE_ORDER_ADDRESS_ID, $invoiceOrderAddressId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($addressInvoice['max'])) { if (isset($invoiceOrderAddressId['max'])) {
$this->addUsingAlias(OrderTableMap::ADDRESS_INVOICE, $addressInvoice['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(OrderTableMap::INVOICE_ORDER_ADDRESS_ID, $invoiceOrderAddressId['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -461,22 +473,22 @@ abstract class OrderQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(OrderTableMap::ADDRESS_INVOICE, $addressInvoice, $comparison); return $this->addUsingAlias(OrderTableMap::INVOICE_ORDER_ADDRESS_ID, $invoiceOrderAddressId, $comparison);
} }
/** /**
* Filter the query on the address_delivery column * Filter the query on the delivery_order_address_id column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByAddressDelivery(1234); // WHERE address_delivery = 1234 * $query->filterByDeliveryOrderAddressId(1234); // WHERE delivery_order_address_id = 1234
* $query->filterByAddressDelivery(array(12, 34)); // WHERE address_delivery IN (12, 34) * $query->filterByDeliveryOrderAddressId(array(12, 34)); // WHERE delivery_order_address_id IN (12, 34)
* $query->filterByAddressDelivery(array('min' => 12)); // WHERE address_delivery > 12 * $query->filterByDeliveryOrderAddressId(array('min' => 12)); // WHERE delivery_order_address_id > 12
* </code> * </code>
* *
* @see filterByOrderAddressRelatedByAddressDelivery() * @see filterByOrderAddressRelatedByDeliveryOrderAddressId()
* *
* @param mixed $addressDelivery The value to use as filter. * @param mixed $deliveryOrderAddressId The value to use as filter.
* Use scalar values for equality. * Use scalar values for equality.
* Use array values for in_array() equivalent. * Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@@ -484,16 +496,16 @@ abstract class OrderQuery extends ModelCriteria
* *
* @return ChildOrderQuery The current query, for fluid interface * @return ChildOrderQuery The current query, for fluid interface
*/ */
public function filterByAddressDelivery($addressDelivery = null, $comparison = null) public function filterByDeliveryOrderAddressId($deliveryOrderAddressId = null, $comparison = null)
{ {
if (is_array($addressDelivery)) { if (is_array($deliveryOrderAddressId)) {
$useMinMax = false; $useMinMax = false;
if (isset($addressDelivery['min'])) { if (isset($deliveryOrderAddressId['min'])) {
$this->addUsingAlias(OrderTableMap::ADDRESS_DELIVERY, $addressDelivery['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(OrderTableMap::DELIVERY_ORDER_ADDRESS_ID, $deliveryOrderAddressId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($addressDelivery['max'])) { if (isset($deliveryOrderAddressId['max'])) {
$this->addUsingAlias(OrderTableMap::ADDRESS_DELIVERY, $addressDelivery['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(OrderTableMap::DELIVERY_ORDER_ADDRESS_ID, $deliveryOrderAddressId['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -504,7 +516,7 @@ abstract class OrderQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(OrderTableMap::ADDRESS_DELIVERY, $addressDelivery, $comparison); return $this->addUsingAlias(OrderTableMap::DELIVERY_ORDER_ADDRESS_ID, $deliveryOrderAddressId, $comparison);
} }
/** /**
@@ -635,90 +647,90 @@ abstract class OrderQuery extends ModelCriteria
} }
/** /**
* Filter the query on the transaction column * Filter the query on the transaction_ref column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByTransaction('fooValue'); // WHERE transaction = 'fooValue' * $query->filterByTransactionRef('fooValue'); // WHERE transaction_ref = 'fooValue'
* $query->filterByTransaction('%fooValue%'); // WHERE transaction LIKE '%fooValue%' * $query->filterByTransactionRef('%fooValue%'); // WHERE transaction_ref LIKE '%fooValue%'
* </code> * </code>
* *
* @param string $transaction The value to use as filter. * @param string $transactionRef The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE) * Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildOrderQuery The current query, for fluid interface * @return ChildOrderQuery The current query, for fluid interface
*/ */
public function filterByTransaction($transaction = null, $comparison = null) public function filterByTransactionRef($transactionRef = null, $comparison = null)
{ {
if (null === $comparison) { if (null === $comparison) {
if (is_array($transaction)) { if (is_array($transactionRef)) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $transaction)) { } elseif (preg_match('/[\%\*]/', $transactionRef)) {
$transaction = str_replace('*', '%', $transaction); $transactionRef = str_replace('*', '%', $transactionRef);
$comparison = Criteria::LIKE; $comparison = Criteria::LIKE;
} }
} }
return $this->addUsingAlias(OrderTableMap::TRANSACTION, $transaction, $comparison); return $this->addUsingAlias(OrderTableMap::TRANSACTION_REF, $transactionRef, $comparison);
} }
/** /**
* Filter the query on the delivery_num column * Filter the query on the delivery_ref column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByDeliveryNum('fooValue'); // WHERE delivery_num = 'fooValue' * $query->filterByDeliveryRef('fooValue'); // WHERE delivery_ref = 'fooValue'
* $query->filterByDeliveryNum('%fooValue%'); // WHERE delivery_num LIKE '%fooValue%' * $query->filterByDeliveryRef('%fooValue%'); // WHERE delivery_ref LIKE '%fooValue%'
* </code> * </code>
* *
* @param string $deliveryNum The value to use as filter. * @param string $deliveryRef The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE) * Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildOrderQuery The current query, for fluid interface * @return ChildOrderQuery The current query, for fluid interface
*/ */
public function filterByDeliveryNum($deliveryNum = null, $comparison = null) public function filterByDeliveryRef($deliveryRef = null, $comparison = null)
{ {
if (null === $comparison) { if (null === $comparison) {
if (is_array($deliveryNum)) { if (is_array($deliveryRef)) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $deliveryNum)) { } elseif (preg_match('/[\%\*]/', $deliveryRef)) {
$deliveryNum = str_replace('*', '%', $deliveryNum); $deliveryRef = str_replace('*', '%', $deliveryRef);
$comparison = Criteria::LIKE; $comparison = Criteria::LIKE;
} }
} }
return $this->addUsingAlias(OrderTableMap::DELIVERY_NUM, $deliveryNum, $comparison); return $this->addUsingAlias(OrderTableMap::DELIVERY_REF, $deliveryRef, $comparison);
} }
/** /**
* Filter the query on the invoice column * Filter the query on the invoice_ref column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByInvoice('fooValue'); // WHERE invoice = 'fooValue' * $query->filterByInvoiceRef('fooValue'); // WHERE invoice_ref = 'fooValue'
* $query->filterByInvoice('%fooValue%'); // WHERE invoice LIKE '%fooValue%' * $query->filterByInvoiceRef('%fooValue%'); // WHERE invoice_ref LIKE '%fooValue%'
* </code> * </code>
* *
* @param string $invoice The value to use as filter. * @param string $invoiceRef The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE) * Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildOrderQuery The current query, for fluid interface * @return ChildOrderQuery The current query, for fluid interface
*/ */
public function filterByInvoice($invoice = null, $comparison = null) public function filterByInvoiceRef($invoiceRef = null, $comparison = null)
{ {
if (null === $comparison) { if (null === $comparison) {
if (is_array($invoice)) { if (is_array($invoiceRef)) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $invoice)) { } elseif (preg_match('/[\%\*]/', $invoiceRef)) {
$invoice = str_replace('*', '%', $invoice); $invoiceRef = str_replace('*', '%', $invoiceRef);
$comparison = Criteria::LIKE; $comparison = Criteria::LIKE;
} }
} }
return $this->addUsingAlias(OrderTableMap::INVOICE, $invoice, $comparison); return $this->addUsingAlias(OrderTableMap::INVOICE_REF, $invoiceRef, $comparison);
} }
/** /**
@@ -763,61 +775,89 @@ abstract class OrderQuery extends ModelCriteria
} }
/** /**
* Filter the query on the payment column * Filter the query on the payment_module_id column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByPayment('fooValue'); // WHERE payment = 'fooValue' * $query->filterByPaymentModuleId(1234); // WHERE payment_module_id = 1234
* $query->filterByPayment('%fooValue%'); // WHERE payment LIKE '%fooValue%' * $query->filterByPaymentModuleId(array(12, 34)); // WHERE payment_module_id IN (12, 34)
* $query->filterByPaymentModuleId(array('min' => 12)); // WHERE payment_module_id > 12
* </code> * </code>
* *
* @param string $payment The value to use as filter. * @see filterByModuleRelatedByPaymentModuleId()
* Accepts wildcards (* and % trigger a LIKE) *
* @param mixed $paymentModuleId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildOrderQuery The current query, for fluid interface * @return ChildOrderQuery The current query, for fluid interface
*/ */
public function filterByPayment($payment = null, $comparison = null) public function filterByPaymentModuleId($paymentModuleId = null, $comparison = null)
{ {
if (null === $comparison) { if (is_array($paymentModuleId)) {
if (is_array($payment)) { $useMinMax = false;
if (isset($paymentModuleId['min'])) {
$this->addUsingAlias(OrderTableMap::PAYMENT_MODULE_ID, $paymentModuleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($paymentModuleId['max'])) {
$this->addUsingAlias(OrderTableMap::PAYMENT_MODULE_ID, $paymentModuleId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $payment)) {
$payment = str_replace('*', '%', $payment);
$comparison = Criteria::LIKE;
} }
} }
return $this->addUsingAlias(OrderTableMap::PAYMENT, $payment, $comparison); return $this->addUsingAlias(OrderTableMap::PAYMENT_MODULE_ID, $paymentModuleId, $comparison);
} }
/** /**
* Filter the query on the carrier column * Filter the query on the delivery_module_id column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByCarrier('fooValue'); // WHERE carrier = 'fooValue' * $query->filterByDeliveryModuleId(1234); // WHERE delivery_module_id = 1234
* $query->filterByCarrier('%fooValue%'); // WHERE carrier LIKE '%fooValue%' * $query->filterByDeliveryModuleId(array(12, 34)); // WHERE delivery_module_id IN (12, 34)
* $query->filterByDeliveryModuleId(array('min' => 12)); // WHERE delivery_module_id > 12
* </code> * </code>
* *
* @param string $carrier The value to use as filter. * @see filterByModuleRelatedByDeliveryModuleId()
* Accepts wildcards (* and % trigger a LIKE) *
* @param mixed $deliveryModuleId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildOrderQuery The current query, for fluid interface * @return ChildOrderQuery The current query, for fluid interface
*/ */
public function filterByCarrier($carrier = null, $comparison = null) public function filterByDeliveryModuleId($deliveryModuleId = null, $comparison = null)
{ {
if (null === $comparison) { if (is_array($deliveryModuleId)) {
if (is_array($carrier)) { $useMinMax = false;
if (isset($deliveryModuleId['min'])) {
$this->addUsingAlias(OrderTableMap::DELIVERY_MODULE_ID, $deliveryModuleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($deliveryModuleId['max'])) {
$this->addUsingAlias(OrderTableMap::DELIVERY_MODULE_ID, $deliveryModuleId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $carrier)) {
$carrier = str_replace('*', '%', $carrier);
$comparison = Criteria::LIKE;
} }
} }
return $this->addUsingAlias(OrderTableMap::CARRIER, $carrier, $comparison); return $this->addUsingAlias(OrderTableMap::DELIVERY_MODULE_ID, $deliveryModuleId, $comparison);
} }
/** /**
@@ -864,32 +904,46 @@ abstract class OrderQuery extends ModelCriteria
} }
/** /**
* Filter the query on the lang column * Filter the query on the lang_id column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' * $query->filterByLangId(1234); // WHERE lang_id = 1234
* $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' * $query->filterByLangId(array(12, 34)); // WHERE lang_id IN (12, 34)
* $query->filterByLangId(array('min' => 12)); // WHERE lang_id > 12
* </code> * </code>
* *
* @param string $lang The value to use as filter. * @see filterByLang()
* Accepts wildcards (* and % trigger a LIKE) *
* @param mixed $langId 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 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildOrderQuery The current query, for fluid interface * @return ChildOrderQuery The current query, for fluid interface
*/ */
public function filterByLang($lang = null, $comparison = null) public function filterByLangId($langId = null, $comparison = null)
{ {
if (null === $comparison) { if (is_array($langId)) {
if (is_array($lang)) { $useMinMax = false;
if (isset($langId['min'])) {
$this->addUsingAlias(OrderTableMap::LANG_ID, $langId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($langId['max'])) {
$this->addUsingAlias(OrderTableMap::LANG_ID, $langId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $lang)) {
$lang = str_replace('*', '%', $lang);
$comparison = Criteria::LIKE;
} }
} }
return $this->addUsingAlias(OrderTableMap::LANG, $lang, $comparison); return $this->addUsingAlias(OrderTableMap::LANG_ID, $langId, $comparison);
} }
/** /**
@@ -1011,7 +1065,7 @@ abstract class OrderQuery extends ModelCriteria
* *
* @return ChildOrderQuery The current query, for fluid interface * @return ChildOrderQuery The current query, for fluid interface
*/ */
public function joinCurrency($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinCurrency($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Currency'); $relationMap = $tableMap->getRelation('Currency');
@@ -1046,7 +1100,7 @@ abstract class OrderQuery extends ModelCriteria
* *
* @return \Thelia\Model\CurrencyQuery A secondary query class using the current class as primary query * @return \Thelia\Model\CurrencyQuery A secondary query class using the current class as primary query
*/ */
public function useCurrencyQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useCurrencyQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinCurrency($relationAlias, $joinType) ->joinCurrency($relationAlias, $joinType)
@@ -1136,35 +1190,35 @@ abstract class OrderQuery extends ModelCriteria
* *
* @return ChildOrderQuery The current query, for fluid interface * @return ChildOrderQuery The current query, for fluid interface
*/ */
public function filterByOrderAddressRelatedByAddressInvoice($orderAddress, $comparison = null) public function filterByOrderAddressRelatedByInvoiceOrderAddressId($orderAddress, $comparison = null)
{ {
if ($orderAddress instanceof \Thelia\Model\OrderAddress) { if ($orderAddress instanceof \Thelia\Model\OrderAddress) {
return $this return $this
->addUsingAlias(OrderTableMap::ADDRESS_INVOICE, $orderAddress->getId(), $comparison); ->addUsingAlias(OrderTableMap::INVOICE_ORDER_ADDRESS_ID, $orderAddress->getId(), $comparison);
} elseif ($orderAddress instanceof ObjectCollection) { } elseif ($orderAddress instanceof ObjectCollection) {
if (null === $comparison) { if (null === $comparison) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} }
return $this return $this
->addUsingAlias(OrderTableMap::ADDRESS_INVOICE, $orderAddress->toKeyValue('PrimaryKey', 'Id'), $comparison); ->addUsingAlias(OrderTableMap::INVOICE_ORDER_ADDRESS_ID, $orderAddress->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else { } else {
throw new PropelException('filterByOrderAddressRelatedByAddressInvoice() only accepts arguments of type \Thelia\Model\OrderAddress or Collection'); throw new PropelException('filterByOrderAddressRelatedByInvoiceOrderAddressId() only accepts arguments of type \Thelia\Model\OrderAddress or Collection');
} }
} }
/** /**
* Adds a JOIN clause to the query using the OrderAddressRelatedByAddressInvoice relation * Adds a JOIN clause to the query using the OrderAddressRelatedByInvoiceOrderAddressId relation
* *
* @param string $relationAlias optional alias for the relation * @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return ChildOrderQuery The current query, for fluid interface * @return ChildOrderQuery The current query, for fluid interface
*/ */
public function joinOrderAddressRelatedByAddressInvoice($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinOrderAddressRelatedByInvoiceOrderAddressId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('OrderAddressRelatedByAddressInvoice'); $relationMap = $tableMap->getRelation('OrderAddressRelatedByInvoiceOrderAddressId');
// create a ModelJoin object for this join // create a ModelJoin object for this join
$join = new ModelJoin(); $join = new ModelJoin();
@@ -1179,14 +1233,14 @@ abstract class OrderQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias); $this->addJoinObject($join, $relationAlias);
} else { } else {
$this->addJoinObject($join, 'OrderAddressRelatedByAddressInvoice'); $this->addJoinObject($join, 'OrderAddressRelatedByInvoiceOrderAddressId');
} }
return $this; return $this;
} }
/** /**
* Use the OrderAddressRelatedByAddressInvoice relation OrderAddress object * Use the OrderAddressRelatedByInvoiceOrderAddressId relation OrderAddress object
* *
* @see useQuery() * @see useQuery()
* *
@@ -1196,11 +1250,11 @@ abstract class OrderQuery extends ModelCriteria
* *
* @return \Thelia\Model\OrderAddressQuery A secondary query class using the current class as primary query * @return \Thelia\Model\OrderAddressQuery A secondary query class using the current class as primary query
*/ */
public function useOrderAddressRelatedByAddressInvoiceQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useOrderAddressRelatedByInvoiceOrderAddressIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinOrderAddressRelatedByAddressInvoice($relationAlias, $joinType) ->joinOrderAddressRelatedByInvoiceOrderAddressId($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderAddressRelatedByAddressInvoice', '\Thelia\Model\OrderAddressQuery'); ->useQuery($relationAlias ? $relationAlias : 'OrderAddressRelatedByInvoiceOrderAddressId', '\Thelia\Model\OrderAddressQuery');
} }
/** /**
@@ -1211,35 +1265,35 @@ abstract class OrderQuery extends ModelCriteria
* *
* @return ChildOrderQuery The current query, for fluid interface * @return ChildOrderQuery The current query, for fluid interface
*/ */
public function filterByOrderAddressRelatedByAddressDelivery($orderAddress, $comparison = null) public function filterByOrderAddressRelatedByDeliveryOrderAddressId($orderAddress, $comparison = null)
{ {
if ($orderAddress instanceof \Thelia\Model\OrderAddress) { if ($orderAddress instanceof \Thelia\Model\OrderAddress) {
return $this return $this
->addUsingAlias(OrderTableMap::ADDRESS_DELIVERY, $orderAddress->getId(), $comparison); ->addUsingAlias(OrderTableMap::DELIVERY_ORDER_ADDRESS_ID, $orderAddress->getId(), $comparison);
} elseif ($orderAddress instanceof ObjectCollection) { } elseif ($orderAddress instanceof ObjectCollection) {
if (null === $comparison) { if (null === $comparison) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} }
return $this return $this
->addUsingAlias(OrderTableMap::ADDRESS_DELIVERY, $orderAddress->toKeyValue('PrimaryKey', 'Id'), $comparison); ->addUsingAlias(OrderTableMap::DELIVERY_ORDER_ADDRESS_ID, $orderAddress->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else { } else {
throw new PropelException('filterByOrderAddressRelatedByAddressDelivery() only accepts arguments of type \Thelia\Model\OrderAddress or Collection'); throw new PropelException('filterByOrderAddressRelatedByDeliveryOrderAddressId() only accepts arguments of type \Thelia\Model\OrderAddress or Collection');
} }
} }
/** /**
* Adds a JOIN clause to the query using the OrderAddressRelatedByAddressDelivery relation * Adds a JOIN clause to the query using the OrderAddressRelatedByDeliveryOrderAddressId relation
* *
* @param string $relationAlias optional alias for the relation * @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return ChildOrderQuery The current query, for fluid interface * @return ChildOrderQuery The current query, for fluid interface
*/ */
public function joinOrderAddressRelatedByAddressDelivery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinOrderAddressRelatedByDeliveryOrderAddressId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('OrderAddressRelatedByAddressDelivery'); $relationMap = $tableMap->getRelation('OrderAddressRelatedByDeliveryOrderAddressId');
// create a ModelJoin object for this join // create a ModelJoin object for this join
$join = new ModelJoin(); $join = new ModelJoin();
@@ -1254,14 +1308,14 @@ abstract class OrderQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias); $this->addJoinObject($join, $relationAlias);
} else { } else {
$this->addJoinObject($join, 'OrderAddressRelatedByAddressDelivery'); $this->addJoinObject($join, 'OrderAddressRelatedByDeliveryOrderAddressId');
} }
return $this; return $this;
} }
/** /**
* Use the OrderAddressRelatedByAddressDelivery relation OrderAddress object * Use the OrderAddressRelatedByDeliveryOrderAddressId relation OrderAddress object
* *
* @see useQuery() * @see useQuery()
* *
@@ -1271,11 +1325,11 @@ abstract class OrderQuery extends ModelCriteria
* *
* @return \Thelia\Model\OrderAddressQuery A secondary query class using the current class as primary query * @return \Thelia\Model\OrderAddressQuery A secondary query class using the current class as primary query
*/ */
public function useOrderAddressRelatedByAddressDeliveryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useOrderAddressRelatedByDeliveryOrderAddressIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinOrderAddressRelatedByAddressDelivery($relationAlias, $joinType) ->joinOrderAddressRelatedByDeliveryOrderAddressId($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderAddressRelatedByAddressDelivery', '\Thelia\Model\OrderAddressQuery'); ->useQuery($relationAlias ? $relationAlias : 'OrderAddressRelatedByDeliveryOrderAddressId', '\Thelia\Model\OrderAddressQuery');
} }
/** /**
@@ -1311,7 +1365,7 @@ abstract class OrderQuery extends ModelCriteria
* *
* @return ChildOrderQuery The current query, for fluid interface * @return ChildOrderQuery The current query, for fluid interface
*/ */
public function joinOrderStatus($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinOrderStatus($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('OrderStatus'); $relationMap = $tableMap->getRelation('OrderStatus');
@@ -1346,13 +1400,238 @@ abstract class OrderQuery extends ModelCriteria
* *
* @return \Thelia\Model\OrderStatusQuery A secondary query class using the current class as primary query * @return \Thelia\Model\OrderStatusQuery A secondary query class using the current class as primary query
*/ */
public function useOrderStatusQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useOrderStatusQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinOrderStatus($relationAlias, $joinType) ->joinOrderStatus($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderStatus', '\Thelia\Model\OrderStatusQuery'); ->useQuery($relationAlias ? $relationAlias : 'OrderStatus', '\Thelia\Model\OrderStatusQuery');
} }
/**
* Filter the query by a related \Thelia\Model\Module object
*
* @param \Thelia\Model\Module|ObjectCollection $module The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderQuery The current query, for fluid interface
*/
public function filterByModuleRelatedByPaymentModuleId($module, $comparison = null)
{
if ($module instanceof \Thelia\Model\Module) {
return $this
->addUsingAlias(OrderTableMap::PAYMENT_MODULE_ID, $module->getId(), $comparison);
} elseif ($module instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(OrderTableMap::PAYMENT_MODULE_ID, $module->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByModuleRelatedByPaymentModuleId() only accepts arguments of type \Thelia\Model\Module or Collection');
}
}
/**
* Adds a JOIN clause to the query using the ModuleRelatedByPaymentModuleId relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildOrderQuery The current query, for fluid interface
*/
public function joinModuleRelatedByPaymentModuleId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ModuleRelatedByPaymentModuleId');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'ModuleRelatedByPaymentModuleId');
}
return $this;
}
/**
* Use the ModuleRelatedByPaymentModuleId relation Module object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\ModuleQuery A secondary query class using the current class as primary query
*/
public function useModuleRelatedByPaymentModuleIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinModuleRelatedByPaymentModuleId($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ModuleRelatedByPaymentModuleId', '\Thelia\Model\ModuleQuery');
}
/**
* Filter the query by a related \Thelia\Model\Module object
*
* @param \Thelia\Model\Module|ObjectCollection $module The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderQuery The current query, for fluid interface
*/
public function filterByModuleRelatedByDeliveryModuleId($module, $comparison = null)
{
if ($module instanceof \Thelia\Model\Module) {
return $this
->addUsingAlias(OrderTableMap::DELIVERY_MODULE_ID, $module->getId(), $comparison);
} elseif ($module instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(OrderTableMap::DELIVERY_MODULE_ID, $module->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByModuleRelatedByDeliveryModuleId() only accepts arguments of type \Thelia\Model\Module or Collection');
}
}
/**
* Adds a JOIN clause to the query using the ModuleRelatedByDeliveryModuleId relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildOrderQuery The current query, for fluid interface
*/
public function joinModuleRelatedByDeliveryModuleId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ModuleRelatedByDeliveryModuleId');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'ModuleRelatedByDeliveryModuleId');
}
return $this;
}
/**
* Use the ModuleRelatedByDeliveryModuleId relation Module object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\ModuleQuery A secondary query class using the current class as primary query
*/
public function useModuleRelatedByDeliveryModuleIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinModuleRelatedByDeliveryModuleId($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ModuleRelatedByDeliveryModuleId', '\Thelia\Model\ModuleQuery');
}
/**
* Filter the query by a related \Thelia\Model\Lang object
*
* @param \Thelia\Model\Lang|ObjectCollection $lang The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderQuery The current query, for fluid interface
*/
public function filterByLang($lang, $comparison = null)
{
if ($lang instanceof \Thelia\Model\Lang) {
return $this
->addUsingAlias(OrderTableMap::LANG_ID, $lang->getId(), $comparison);
} elseif ($lang instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(OrderTableMap::LANG_ID, $lang->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByLang() only accepts arguments of type \Thelia\Model\Lang or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Lang relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildOrderQuery The current query, for fluid interface
*/
public function joinLang($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Lang');
// 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, 'Lang');
}
return $this;
}
/**
* Use the Lang relation Lang 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\LangQuery A secondary query class using the current class as primary query
*/
public function useLangQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinLang($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Lang', '\Thelia\Model\LangQuery');
}
/** /**
* Filter the query by a related \Thelia\Model\OrderProduct object * Filter the query by a related \Thelia\Model\OrderProduct object
* *

View File

@@ -791,10 +791,9 @@ abstract class OrderStatus implements ActiveRecordInterface
if ($this->ordersScheduledForDeletion !== null) { if ($this->ordersScheduledForDeletion !== null) {
if (!$this->ordersScheduledForDeletion->isEmpty()) { if (!$this->ordersScheduledForDeletion->isEmpty()) {
foreach ($this->ordersScheduledForDeletion as $order) { \Thelia\Model\OrderQuery::create()
// need to save related object because we set the relation to null ->filterByPrimaryKeys($this->ordersScheduledForDeletion->getPrimaryKeys(false))
$order->save($con); ->delete($con);
}
$this->ordersScheduledForDeletion = null; $this->ordersScheduledForDeletion = null;
} }
} }
@@ -1439,7 +1438,7 @@ abstract class OrderStatus implements ActiveRecordInterface
$this->ordersScheduledForDeletion = clone $this->collOrders; $this->ordersScheduledForDeletion = clone $this->collOrders;
$this->ordersScheduledForDeletion->clear(); $this->ordersScheduledForDeletion->clear();
} }
$this->ordersScheduledForDeletion[]= $order; $this->ordersScheduledForDeletion[]= clone $order;
$order->setOrderStatus(null); $order->setOrderStatus(null);
} }
@@ -1513,10 +1512,10 @@ abstract class OrderStatus implements ActiveRecordInterface
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects * @return Collection|ChildOrder[] List of ChildOrder objects
*/ */
public function getOrdersJoinOrderAddressRelatedByAddressInvoice($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) public function getOrdersJoinOrderAddressRelatedByInvoiceOrderAddressId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{ {
$query = ChildOrderQuery::create(null, $criteria); $query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('OrderAddressRelatedByAddressInvoice', $joinBehavior); $query->joinWith('OrderAddressRelatedByInvoiceOrderAddressId', $joinBehavior);
return $this->getOrders($query, $con); return $this->getOrders($query, $con);
} }
@@ -1538,10 +1537,85 @@ abstract class OrderStatus implements ActiveRecordInterface
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects * @return Collection|ChildOrder[] List of ChildOrder objects
*/ */
public function getOrdersJoinOrderAddressRelatedByAddressDelivery($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) public function getOrdersJoinOrderAddressRelatedByDeliveryOrderAddressId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{ {
$query = ChildOrderQuery::create(null, $criteria); $query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('OrderAddressRelatedByAddressDelivery', $joinBehavior); $query->joinWith('OrderAddressRelatedByDeliveryOrderAddressId', $joinBehavior);
return $this->getOrders($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this OrderStatus is new, it will return
* an empty collection; or if this OrderStatus has previously
* been saved, it will retrieve related Orders from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in OrderStatus.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersJoinModuleRelatedByPaymentModuleId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('ModuleRelatedByPaymentModuleId', $joinBehavior);
return $this->getOrders($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this OrderStatus is new, it will return
* an empty collection; or if this OrderStatus has previously
* been saved, it will retrieve related Orders from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in OrderStatus.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersJoinModuleRelatedByDeliveryModuleId($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('ModuleRelatedByDeliveryModuleId', $joinBehavior);
return $this->getOrders($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this OrderStatus is new, it will return
* an empty collection; or if this OrderStatus has previously
* been saved, it will retrieve related Orders from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in OrderStatus.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildOrder[] List of ChildOrder objects
*/
public function getOrdersJoinLang($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildOrderQuery::create(null, $criteria);
$query->joinWith('Lang', $joinBehavior);
return $this->getOrders($query, $con); return $this->getOrders($query, $con);
} }

View File

@@ -420,7 +420,7 @@ abstract class OrderStatusQuery extends ModelCriteria
* *
* @return ChildOrderStatusQuery The current query, for fluid interface * @return ChildOrderStatusQuery The current query, for fluid interface
*/ */
public function joinOrder($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Order'); $relationMap = $tableMap->getRelation('Order');
@@ -455,7 +455,7 @@ abstract class OrderStatusQuery extends ModelCriteria
* *
* @return \Thelia\Model\OrderQuery A secondary query class using the current class as primary query * @return \Thelia\Model\OrderQuery A secondary query class using the current class as primary query
*/ */
public function useOrderQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinOrder($relationAlias, $joinType) ->joinOrder($relationAlias, $joinType)

View File

@@ -70,6 +70,12 @@ abstract class ProductCategory implements ActiveRecordInterface
*/ */
protected $category_id; protected $category_id;
/**
* The value for the default_category field.
* @var boolean
*/
protected $default_category;
/** /**
* The value for the created_at field. * The value for the created_at field.
* @var string * @var string
@@ -376,6 +382,17 @@ abstract class ProductCategory implements ActiveRecordInterface
return $this->category_id; return $this->category_id;
} }
/**
* Get the [default_category] column value.
*
* @return boolean
*/
public function getDefaultCategory()
{
return $this->default_category;
}
/** /**
* Get the [optionally formatted] temporal [created_at] column value. * Get the [optionally formatted] temporal [created_at] column value.
* *
@@ -466,6 +483,35 @@ abstract class ProductCategory implements ActiveRecordInterface
return $this; return $this;
} // setCategoryId() } // setCategoryId()
/**
* Sets the value of the [default_category] column.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
*
* @param boolean|integer|string $v The new value
* @return \Thelia\Model\ProductCategory The current object (for fluent API support)
*/
public function setDefaultCategory($v)
{
if ($v !== null) {
if (is_string($v)) {
$v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
} else {
$v = (boolean) $v;
}
}
if ($this->default_category !== $v) {
$this->default_category = $v;
$this->modifiedColumns[] = ProductCategoryTableMap::DEFAULT_CATEGORY;
}
return $this;
} // setDefaultCategory()
/** /**
* Sets the value of [created_at] column to a normalized version of the date/time value specified. * Sets the value of [created_at] column to a normalized version of the date/time value specified.
* *
@@ -551,13 +597,16 @@ abstract class ProductCategory implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProductCategoryTableMap::translateFieldName('CategoryId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProductCategoryTableMap::translateFieldName('CategoryId', TableMap::TYPE_PHPNAME, $indexType)];
$this->category_id = (null !== $col) ? (int) $col : null; $this->category_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProductCategoryTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProductCategoryTableMap::translateFieldName('DefaultCategory', TableMap::TYPE_PHPNAME, $indexType)];
$this->default_category = (null !== $col) ? (boolean) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProductCategoryTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProductCategoryTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductCategoryTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
@@ -570,7 +619,7 @@ abstract class ProductCategory implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 4; // 4 = ProductCategoryTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 5; // 5 = ProductCategoryTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ProductCategory object", 0, $e); throw new PropelException("Error populating \Thelia\Model\ProductCategory object", 0, $e);
@@ -819,6 +868,9 @@ abstract class ProductCategory implements ActiveRecordInterface
if ($this->isColumnModified(ProductCategoryTableMap::CATEGORY_ID)) { if ($this->isColumnModified(ProductCategoryTableMap::CATEGORY_ID)) {
$modifiedColumns[':p' . $index++] = 'CATEGORY_ID'; $modifiedColumns[':p' . $index++] = 'CATEGORY_ID';
} }
if ($this->isColumnModified(ProductCategoryTableMap::DEFAULT_CATEGORY)) {
$modifiedColumns[':p' . $index++] = 'DEFAULT_CATEGORY';
}
if ($this->isColumnModified(ProductCategoryTableMap::CREATED_AT)) { if ($this->isColumnModified(ProductCategoryTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT'; $modifiedColumns[':p' . $index++] = 'CREATED_AT';
} }
@@ -842,6 +894,9 @@ abstract class ProductCategory implements ActiveRecordInterface
case 'CATEGORY_ID': case 'CATEGORY_ID':
$stmt->bindValue($identifier, $this->category_id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->category_id, PDO::PARAM_INT);
break; break;
case 'DEFAULT_CATEGORY':
$stmt->bindValue($identifier, (int) $this->default_category, PDO::PARAM_INT);
break;
case 'CREATED_AT': case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break; break;
@@ -910,9 +965,12 @@ abstract class ProductCategory implements ActiveRecordInterface
return $this->getCategoryId(); return $this->getCategoryId();
break; break;
case 2: case 2:
return $this->getCreatedAt(); return $this->getDefaultCategory();
break; break;
case 3: case 3:
return $this->getCreatedAt();
break;
case 4:
return $this->getUpdatedAt(); return $this->getUpdatedAt();
break; break;
default: default:
@@ -946,8 +1004,9 @@ abstract class ProductCategory implements ActiveRecordInterface
$result = array( $result = array(
$keys[0] => $this->getProductId(), $keys[0] => $this->getProductId(),
$keys[1] => $this->getCategoryId(), $keys[1] => $this->getCategoryId(),
$keys[2] => $this->getCreatedAt(), $keys[2] => $this->getDefaultCategory(),
$keys[3] => $this->getUpdatedAt(), $keys[3] => $this->getCreatedAt(),
$keys[4] => $this->getUpdatedAt(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn) foreach($virtualColumns as $key => $virtualColumn)
@@ -1003,9 +1062,12 @@ abstract class ProductCategory implements ActiveRecordInterface
$this->setCategoryId($value); $this->setCategoryId($value);
break; break;
case 2: case 2:
$this->setCreatedAt($value); $this->setDefaultCategory($value);
break; break;
case 3: case 3:
$this->setCreatedAt($value);
break;
case 4:
$this->setUpdatedAt($value); $this->setUpdatedAt($value);
break; break;
} // switch() } // switch()
@@ -1034,8 +1096,9 @@ abstract class ProductCategory implements ActiveRecordInterface
if (array_key_exists($keys[0], $arr)) $this->setProductId($arr[$keys[0]]); if (array_key_exists($keys[0], $arr)) $this->setProductId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setCategoryId($arr[$keys[1]]); if (array_key_exists($keys[1], $arr)) $this->setCategoryId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setCreatedAt($arr[$keys[2]]); if (array_key_exists($keys[2], $arr)) $this->setDefaultCategory($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setUpdatedAt($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
} }
/** /**
@@ -1049,6 +1112,7 @@ abstract class ProductCategory implements ActiveRecordInterface
if ($this->isColumnModified(ProductCategoryTableMap::PRODUCT_ID)) $criteria->add(ProductCategoryTableMap::PRODUCT_ID, $this->product_id); if ($this->isColumnModified(ProductCategoryTableMap::PRODUCT_ID)) $criteria->add(ProductCategoryTableMap::PRODUCT_ID, $this->product_id);
if ($this->isColumnModified(ProductCategoryTableMap::CATEGORY_ID)) $criteria->add(ProductCategoryTableMap::CATEGORY_ID, $this->category_id); if ($this->isColumnModified(ProductCategoryTableMap::CATEGORY_ID)) $criteria->add(ProductCategoryTableMap::CATEGORY_ID, $this->category_id);
if ($this->isColumnModified(ProductCategoryTableMap::DEFAULT_CATEGORY)) $criteria->add(ProductCategoryTableMap::DEFAULT_CATEGORY, $this->default_category);
if ($this->isColumnModified(ProductCategoryTableMap::CREATED_AT)) $criteria->add(ProductCategoryTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(ProductCategoryTableMap::CREATED_AT)) $criteria->add(ProductCategoryTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(ProductCategoryTableMap::UPDATED_AT)) $criteria->add(ProductCategoryTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(ProductCategoryTableMap::UPDATED_AT)) $criteria->add(ProductCategoryTableMap::UPDATED_AT, $this->updated_at);
@@ -1123,6 +1187,7 @@ abstract class ProductCategory implements ActiveRecordInterface
{ {
$copyObj->setProductId($this->getProductId()); $copyObj->setProductId($this->getProductId());
$copyObj->setCategoryId($this->getCategoryId()); $copyObj->setCategoryId($this->getCategoryId());
$copyObj->setDefaultCategory($this->getDefaultCategory());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) { if ($makeNew) {
@@ -1261,6 +1326,7 @@ abstract class ProductCategory implements ActiveRecordInterface
{ {
$this->product_id = null; $this->product_id = null;
$this->category_id = null; $this->category_id = null;
$this->default_category = null;
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;

View File

@@ -23,11 +23,13 @@ use Thelia\Model\Map\ProductCategoryTableMap;
* *
* @method ChildProductCategoryQuery orderByProductId($order = Criteria::ASC) Order by the product_id column * @method ChildProductCategoryQuery orderByProductId($order = Criteria::ASC) Order by the product_id column
* @method ChildProductCategoryQuery orderByCategoryId($order = Criteria::ASC) Order by the category_id column * @method ChildProductCategoryQuery orderByCategoryId($order = Criteria::ASC) Order by the category_id column
* @method ChildProductCategoryQuery orderByDefaultCategory($order = Criteria::ASC) Order by the default_category column
* @method ChildProductCategoryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildProductCategoryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildProductCategoryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildProductCategoryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* *
* @method ChildProductCategoryQuery groupByProductId() Group by the product_id column * @method ChildProductCategoryQuery groupByProductId() Group by the product_id column
* @method ChildProductCategoryQuery groupByCategoryId() Group by the category_id column * @method ChildProductCategoryQuery groupByCategoryId() Group by the category_id column
* @method ChildProductCategoryQuery groupByDefaultCategory() Group by the default_category column
* @method ChildProductCategoryQuery groupByCreatedAt() Group by the created_at column * @method ChildProductCategoryQuery groupByCreatedAt() Group by the created_at column
* @method ChildProductCategoryQuery groupByUpdatedAt() Group by the updated_at column * @method ChildProductCategoryQuery groupByUpdatedAt() Group by the updated_at column
* *
@@ -48,11 +50,13 @@ use Thelia\Model\Map\ProductCategoryTableMap;
* *
* @method ChildProductCategory findOneByProductId(int $product_id) Return the first ChildProductCategory filtered by the product_id column * @method ChildProductCategory findOneByProductId(int $product_id) Return the first ChildProductCategory filtered by the product_id column
* @method ChildProductCategory findOneByCategoryId(int $category_id) Return the first ChildProductCategory filtered by the category_id column * @method ChildProductCategory findOneByCategoryId(int $category_id) Return the first ChildProductCategory filtered by the category_id column
* @method ChildProductCategory findOneByDefaultCategory(boolean $default_category) Return the first ChildProductCategory filtered by the default_category column
* @method ChildProductCategory findOneByCreatedAt(string $created_at) Return the first ChildProductCategory filtered by the created_at column * @method ChildProductCategory findOneByCreatedAt(string $created_at) Return the first ChildProductCategory filtered by the created_at column
* @method ChildProductCategory findOneByUpdatedAt(string $updated_at) Return the first ChildProductCategory filtered by the updated_at column * @method ChildProductCategory findOneByUpdatedAt(string $updated_at) Return the first ChildProductCategory filtered by the updated_at column
* *
* @method array findByProductId(int $product_id) Return ChildProductCategory objects filtered by the product_id column * @method array findByProductId(int $product_id) Return ChildProductCategory objects filtered by the product_id column
* @method array findByCategoryId(int $category_id) Return ChildProductCategory objects filtered by the category_id column * @method array findByCategoryId(int $category_id) Return ChildProductCategory objects filtered by the category_id column
* @method array findByDefaultCategory(boolean $default_category) Return ChildProductCategory objects filtered by the default_category column
* @method array findByCreatedAt(string $created_at) Return ChildProductCategory objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildProductCategory objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildProductCategory objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildProductCategory objects filtered by the updated_at column
* *
@@ -143,7 +147,7 @@ abstract class ProductCategoryQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT PRODUCT_ID, CATEGORY_ID, CREATED_AT, UPDATED_AT FROM product_category WHERE PRODUCT_ID = :p0 AND CATEGORY_ID = :p1'; $sql = 'SELECT PRODUCT_ID, CATEGORY_ID, DEFAULT_CATEGORY, CREATED_AT, UPDATED_AT FROM product_category WHERE PRODUCT_ID = :p0 AND CATEGORY_ID = :p1';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -330,6 +334,33 @@ abstract class ProductCategoryQuery extends ModelCriteria
return $this->addUsingAlias(ProductCategoryTableMap::CATEGORY_ID, $categoryId, $comparison); return $this->addUsingAlias(ProductCategoryTableMap::CATEGORY_ID, $categoryId, $comparison);
} }
/**
* Filter the query on the default_category column
*
* Example usage:
* <code>
* $query->filterByDefaultCategory(true); // WHERE default_category = true
* $query->filterByDefaultCategory('yes'); // WHERE default_category = true
* </code>
*
* @param boolean|string $defaultCategory The value to use as filter.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildProductCategoryQuery The current query, for fluid interface
*/
public function filterByDefaultCategory($defaultCategory = null, $comparison = null)
{
if (is_string($defaultCategory)) {
$default_category = in_array(strtolower($defaultCategory), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(ProductCategoryTableMap::DEFAULT_CATEGORY, $defaultCategory, $comparison);
}
/** /**
* Filter the query on the created_at column * Filter the query on the created_at column
* *

View File

@@ -857,7 +857,7 @@ abstract class ProductQuery extends ModelCriteria
* *
* @return ChildProductQuery The current query, for fluid interface * @return ChildProductQuery The current query, for fluid interface
*/ */
public function joinTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function joinTemplate($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Template'); $relationMap = $tableMap->getRelation('Template');
@@ -892,7 +892,7 @@ abstract class ProductQuery extends ModelCriteria
* *
* @return \Thelia\Model\TemplateQuery A secondary query class using the current class as primary query * @return \Thelia\Model\TemplateQuery A secondary query class using the current class as primary query
*/ */
public function useTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function useTemplateQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{ {
return $this return $this
->joinTemplate($relationAlias, $joinType) ->joinTemplate($relationAlias, $joinType)

View File

@@ -864,9 +864,10 @@ abstract class Template implements ActiveRecordInterface
if ($this->productsScheduledForDeletion !== null) { if ($this->productsScheduledForDeletion !== null) {
if (!$this->productsScheduledForDeletion->isEmpty()) { if (!$this->productsScheduledForDeletion->isEmpty()) {
\Thelia\Model\ProductQuery::create() foreach ($this->productsScheduledForDeletion as $product) {
->filterByPrimaryKeys($this->productsScheduledForDeletion->getPrimaryKeys(false)) // need to save related object because we set the relation to null
->delete($con); $product->save($con);
}
$this->productsScheduledForDeletion = null; $this->productsScheduledForDeletion = null;
} }
} }
@@ -1553,7 +1554,7 @@ abstract class Template implements ActiveRecordInterface
$this->productsScheduledForDeletion = clone $this->collProducts; $this->productsScheduledForDeletion = clone $this->collProducts;
$this->productsScheduledForDeletion->clear(); $this->productsScheduledForDeletion->clear();
} }
$this->productsScheduledForDeletion[]= clone $product; $this->productsScheduledForDeletion[]= $product;
$product->setTemplate(null); $product->setTemplate(null);
} }

View File

@@ -395,7 +395,7 @@ abstract class TemplateQuery extends ModelCriteria
* *
* @return ChildTemplateQuery The current query, for fluid interface * @return ChildTemplateQuery The current query, for fluid interface
*/ */
public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function joinProduct($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Product'); $relationMap = $tableMap->getRelation('Product');
@@ -430,7 +430,7 @@ abstract class TemplateQuery extends ModelCriteria
* *
* @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query * @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query
*/ */
public function useProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) public function useProductQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{ {
return $this return $this
->joinProduct($relationAlias, $joinType) ->joinProduct($relationAlias, $joinType)

View File

@@ -8,6 +8,7 @@ use Thelia\Model\Base\Cart as BaseCart;
use Thelia\Model\ProductSaleElementsQuery; use Thelia\Model\ProductSaleElementsQuery;
use Thelia\Model\ProductPriceQuery; use Thelia\Model\ProductPriceQuery;
use Thelia\Model\CartItemQuery; use Thelia\Model\CartItemQuery;
use Thelia\TaxEngine\Calculator;
class Cart extends BaseCart class Cart extends BaseCart
{ {
@@ -74,9 +75,25 @@ class Cart extends BaseCart
; ;
} }
public function getTaxedAmount() public function getTaxedAmount(Country $country)
{ {
$taxCalculator = new Calculator();
$total = 0;
foreach($this->getCartItems() as $cartItem) {
$subtotal = $cartItem->getRealPrice();
$subtotal -= $cartItem->getDiscount();
/* we round it for the unit price, before the quantity factor */
$subtotal = round($taxCalculator->load($cartItem->getProduct(), $country)->getTaxedPrice($subtotal), 2);
$subtotal *= $cartItem->getQuantity();
$total += $subtotal;
}
$total -= $this->getDiscount();
return $total;
} }
public function getTotalAmount() public function getTotalAmount()
@@ -84,7 +101,11 @@ class Cart extends BaseCart
$total = 0; $total = 0;
foreach($this->getCartItems() as $cartItem) { foreach($this->getCartItems() as $cartItem) {
$total += $cartItem->getPrice()-$cartItem->getDiscount(); $subtotal = $cartItem->getRealPrice();
$subtotal -= $cartItem->getDiscount();
$subtotal *= $cartItem->getQuantity();
$total += $subtotal;
} }
$total -= $this->getDiscount(); $total -= $this->getDiscount();

View File

@@ -8,6 +8,7 @@ use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\Base\CartItem as BaseCartItem; use Thelia\Model\Base\CartItem as BaseCartItem;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
use Thelia\Core\Event\CartEvent; use Thelia\Core\Event\CartEvent;
use Thelia\TaxEngine\Calculator;
class CartItem extends BaseCartItem class CartItem extends BaseCartItem
{ {
@@ -64,4 +65,20 @@ class CartItem extends BaseCartItem
return $this; return $this;
} }
public function getRealPrice()
{
return $this->getPromo() == 1 ? $this->getPromoPrice() : $this->getPrice();
}
public function getTaxedPrice(Country $country)
{
$taxCalculator = new Calculator();
return round($taxCalculator->load($this->getProduct(), $country)->getTaxedPrice($this->getPrice()), 2);
}
public function getTaxedPromoPrice(Country $country)
{
$taxCalculator = new Calculator();
return round($taxCalculator->load($this->getProduct(), $country)->getTaxedPrice($this->getPromoPrice()), 2);
}
} }

View File

@@ -28,7 +28,7 @@ class Category extends BaseCategory
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected function getRewritenUrlViewName() { protected function getRewrittenUrlViewName() {
return 'category'; return 'category';
} }
@@ -69,8 +69,6 @@ class Category extends BaseCategory
{ {
$this->setPosition($this->getNextPosition()); $this->setPosition($this->getNextPosition());
$this->generateRewritenUrl($this->getLocale());
$this->dispatchEvent(TheliaEvents::BEFORE_CREATECATEGORY, new CategoryEvent($this)); $this->dispatchEvent(TheliaEvents::BEFORE_CREATECATEGORY, new CategoryEvent($this));
return true; return true;

View File

@@ -3,8 +3,26 @@
namespace Thelia\Model; namespace Thelia\Model;
use Thelia\Model\Base\CategoryDocument as BaseCategoryDocument; use Thelia\Model\Base\CategoryDocument as BaseCategoryDocument;
use Propel\Runtime\Connection\ConnectionInterface;
class CategoryDocument extends BaseCategoryDocument class CategoryDocument extends BaseCategoryDocument
{ {
use \Thelia\Model\Tools\PositionManagementTrait;
} /**
* Calculate next position relative to our parent
*/
protected function addCriteriaToPositionQuery($query) {
$query->filterByCategory($this->getCategory());
}
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->setPosition($this->getNextPosition());
return true;
}
}

View File

@@ -3,8 +3,26 @@
namespace Thelia\Model; namespace Thelia\Model;
use Thelia\Model\Base\CategoryImage as BaseCategoryImage; use Thelia\Model\Base\CategoryImage as BaseCategoryImage;
use Propel\Runtime\Connection\ConnectionInterface;
class CategoryImage extends BaseCategoryImage class CategoryImage extends BaseCategoryImage
{ {
use \Thelia\Model\Tools\PositionManagementTrait;
/**
* Calculate next position relative to our parent
*/
protected function addCriteriaToPositionQuery($query) {
$query->filterByCategory($this->getCategory());
}
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->setPosition($this->getNextPosition());
return true;
}
} }

View File

@@ -17,7 +17,7 @@ class Content extends BaseContent
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected function getRewritenUrlViewName() { protected function getRewrittenUrlViewName() {
return 'content'; return 'content';
} }
@@ -37,8 +37,6 @@ class Content extends BaseContent
{ {
$this->setPosition($this->getNextPosition()); $this->setPosition($this->getNextPosition());
$this->generateRewritenUrl($this->getLocale());
return true; return true;
} }
} }

View File

@@ -3,8 +3,26 @@
namespace Thelia\Model; namespace Thelia\Model;
use Thelia\Model\Base\ContentDocument as BaseContentDocument; use Thelia\Model\Base\ContentDocument as BaseContentDocument;
use Propel\Runtime\Connection\ConnectionInterface;
class ContentDocument extends BaseContentDocument class ContentDocument extends BaseContentDocument
{ {
use \Thelia\Model\Tools\PositionManagementTrait;
/**
* Calculate next position relative to our parent
*/
protected function addCriteriaToPositionQuery($query) {
$query->filterByContent($this->getContent());
}
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->setPosition($this->getNextPosition());
return true;
}
} }

View File

@@ -3,8 +3,26 @@
namespace Thelia\Model; namespace Thelia\Model;
use Thelia\Model\Base\ContentImage as BaseContentImage; use Thelia\Model\Base\ContentImage as BaseContentImage;
use Propel\Runtime\Connection\ConnectionInterface;
class ContentImage extends BaseContentImage class ContentImage extends BaseContentImage
{ {
use \Thelia\Model\Tools\PositionManagementTrait;
} /**
* Calculate next position relative to our parent
*/
protected function addCriteriaToPositionQuery($query) {
$query->filterByContent($this->getContent());
}
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->setPosition($this->getNextPosition());
return true;
}
}

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