Worked on catalog
This commit is contained in:
@@ -220,6 +220,7 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
->setWeight($pse->getWeight())
|
||||
->setTaxRuleTitle($taxRuleI18n->getTitle())
|
||||
->setTaxRuleDescription($taxRuleI18n->getDescription())
|
||||
->setEanCode($pse->getEanCode())
|
||||
;
|
||||
$orderProduct->setDispatcher($this->getDispatcher());
|
||||
$orderProduct->save($con);
|
||||
|
||||
@@ -54,10 +54,10 @@ use Thelia\Core\Event\Product\ProductDeleteCategoryEvent;
|
||||
use Thelia\Core\Event\Product\ProductAddCategoryEvent;
|
||||
use Thelia\Model\AttributeAvQuery;
|
||||
use Thelia\Model\AttributeCombination;
|
||||
use Thelia\Core\Event\Product\ProductCreateCombinationEvent;
|
||||
use Thelia\Core\Event\Product\ProductSaleElementCreateEvent;
|
||||
use Propel\Runtime\Propel;
|
||||
use Thelia\Model\Map\ProductTableMap;
|
||||
use Thelia\Core\Event\Product\ProductDeleteCombinationEvent;
|
||||
use Thelia\Core\Event\Product\ProductSaleElementDeleteEvent;
|
||||
use Thelia\Model\ProductPrice;
|
||||
use Thelia\Model\ProductSaleElements;
|
||||
use Thelia\Core\Event\Product\ProductAddAccessoryEvent;
|
||||
@@ -85,8 +85,6 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
// Set the default tax rule to this product
|
||||
->setTaxRule(TaxRuleQuery::create()->findOneByIsDefault(true))
|
||||
|
||||
//public function create($defaultCategoryId, $basePrice, $priceCurrencyId, $taxRuleId, $baseWeight) {
|
||||
|
||||
->create(
|
||||
$event->getDefaultCategory(),
|
||||
$event->getBasePrice(),
|
||||
@@ -304,6 +302,11 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
return $this->genericUpdatePosition(ProductAssociatedContentQuery::create(), $event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the value of a product feature.
|
||||
*
|
||||
* @param FeatureProductUpdateEvent $event
|
||||
*/
|
||||
public function updateFeatureProductValue(FeatureProductUpdateEvent $event)
|
||||
{
|
||||
// If the feature is not free text, it may have one ore more values.
|
||||
@@ -346,6 +349,11 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
$event->setFeatureProduct($featureProduct);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a product feature value
|
||||
*
|
||||
* @param FeatureProductDeleteEvent $event
|
||||
*/
|
||||
public function deleteFeatureProductValue(FeatureProductDeleteEvent $event)
|
||||
{
|
||||
$featureProduct = FeatureProductQuery::create()
|
||||
@@ -355,76 +363,6 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
;
|
||||
}
|
||||
|
||||
public function createProductCombination(ProductCreateCombinationEvent $event)
|
||||
{
|
||||
$con = Propel::getWriteConnection(ProductTableMap::DATABASE_NAME);
|
||||
|
||||
$con->beginTransaction();
|
||||
|
||||
try {
|
||||
$product = $event->getProduct();
|
||||
|
||||
// Create an empty product sale element
|
||||
$salesElement = new ProductSaleElements();
|
||||
|
||||
$salesElement
|
||||
->setProduct($product)
|
||||
->setRef($product->getRef())
|
||||
->setPromo(0)
|
||||
->setNewness(0)
|
||||
->setWeight(0)
|
||||
->setIsDefault(false)
|
||||
->save($con)
|
||||
;
|
||||
|
||||
// Create an empty product price in the default currency
|
||||
$product_price = new ProductPrice();
|
||||
|
||||
$product_price
|
||||
->setProductSaleElements($salesElement)
|
||||
->setPromoPrice(0)
|
||||
->setPrice(0)
|
||||
->setCurrencyId($event->getCurrencyId())
|
||||
->save($con)
|
||||
;
|
||||
|
||||
$combinationAttributes = $event->getAttributeAvList();
|
||||
|
||||
if (count($combinationAttributes) > 0) {
|
||||
|
||||
foreach ($combinationAttributes as $attributeAvId) {
|
||||
|
||||
$attributeAv = AttributeAvQuery::create()->findPk($attributeAvId);
|
||||
|
||||
if ($attributeAv !== null) {
|
||||
$attributeCombination = new AttributeCombination();
|
||||
|
||||
$attributeCombination
|
||||
->setAttributeAvId($attributeAvId)
|
||||
->setAttribute($attributeAv->getAttribute())
|
||||
->setProductSaleElements($salesElement)
|
||||
->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store all the stuff !
|
||||
$con->commit();
|
||||
} catch (\Exception $ex) {
|
||||
|
||||
$con->rollback();
|
||||
|
||||
throw $ex;
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteProductCombination(ProductDeleteCombinationEvent $event)
|
||||
{
|
||||
if (null !== $pse = ProductSaleElementsQuery::create()->findPk($event->getProductSaleElementId())) {
|
||||
$pse->delete();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -436,18 +374,15 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
TheliaEvents::PRODUCT_DELETE => array("delete", 128),
|
||||
TheliaEvents::PRODUCT_TOGGLE_VISIBILITY => array("toggleVisibility", 128),
|
||||
|
||||
TheliaEvents::PRODUCT_UPDATE_POSITION => array("updatePosition", 128),
|
||||
TheliaEvents::PRODUCT_UPDATE_POSITION => array("updatePosition", 128),
|
||||
|
||||
TheliaEvents::PRODUCT_ADD_CONTENT => array("addContent", 128),
|
||||
TheliaEvents::PRODUCT_REMOVE_CONTENT => array("removeContent", 128),
|
||||
TheliaEvents::PRODUCT_UPDATE_ACCESSORY_POSITION => array("updateAccessoryPosition", 128),
|
||||
TheliaEvents::PRODUCT_UPDATE_CONTENT_POSITION => array("updateContentPosition", 128),
|
||||
|
||||
TheliaEvents::PRODUCT_ADD_COMBINATION => array("createProductCombination", 128),
|
||||
TheliaEvents::PRODUCT_DELETE_COMBINATION => array("deleteProductCombination", 128),
|
||||
|
||||
TheliaEvents::PRODUCT_ADD_ACCESSORY => array("addAccessory", 128),
|
||||
TheliaEvents::PRODUCT_REMOVE_ACCESSORY => array("removeAccessory", 128),
|
||||
TheliaEvents::PRODUCT_ADD_ACCESSORY => array("addAccessory", 128),
|
||||
TheliaEvents::PRODUCT_REMOVE_ACCESSORY => array("removeAccessory", 128),
|
||||
TheliaEvents::PRODUCT_UPDATE_ACCESSORY_POSITION => array("updateAccessoryPosition", 128),
|
||||
|
||||
TheliaEvents::PRODUCT_ADD_CATEGORY => array("addCategory", 128),
|
||||
TheliaEvents::PRODUCT_REMOVE_CATEGORY => array("removeCategory", 128),
|
||||
@@ -456,7 +391,6 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
TheliaEvents::PRODUCT_FEATURE_UPDATE_VALUE => array("updateFeatureProductValue", 128),
|
||||
TheliaEvents::PRODUCT_FEATURE_DELETE_VALUE => array("deleteFeatureProductValue", 128),
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,11 @@
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.product_sale_element" class="Thelia\Action\ProductSaleElement">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.config" class="Thelia\Action\Config">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
|
||||
@@ -68,10 +68,12 @@
|
||||
|
||||
<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.details.modification" class="Thelia\Form\ProductDetailsModificationForm"/>
|
||||
<form name="thelia.admin.product.image.modification" class="Thelia\Form\ProductImageModification"/>
|
||||
<form name="thelia.admin.product.document.modification" class="Thelia\Form\ProductDocumentModification"/>
|
||||
|
||||
<form name="thelia.admin.product_sale_element.update" class="Thelia\Form\ProductSaleElementUpdateForm"/>
|
||||
<form name="thelia.admin.product_default_sale_element.update" class="Thelia\Form\ProductDefaultSaleElementUpdateForm"/>
|
||||
|
||||
<form name="thelia.admin.product.deletion" class="Thelia\Form\ProductModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.folder.creation" class="Thelia\Form\FolderCreationForm"/>
|
||||
@@ -119,6 +121,8 @@
|
||||
|
||||
<form name="thelia.admin.profile.modification" class="Thelia\Form\ProfileModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.test.form" class="Thelia\Form\TestForm"/>
|
||||
|
||||
</forms>
|
||||
|
||||
|
||||
|
||||
@@ -274,6 +274,10 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::updateContentPositionAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.product.update-content-position" path="/admin/product/calculate-price">
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::priceCaclulator</default>
|
||||
</route>
|
||||
|
||||
<!-- accessories -->
|
||||
|
||||
<route id="admin.products.accessories.add" path="/admin/products/accessory/add">
|
||||
@@ -320,19 +324,19 @@
|
||||
</route>
|
||||
|
||||
<route id="admin.product.combination.add" path="/admin/product/combination/add">
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::addCombinationAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::addProductSaleElementAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.product.combination.delete" path="/admin/product/combination/delete">
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::deleteCombinationAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::deleteProductSaleElementAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.product.combination.update" path="/admin/product/combination/update">
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::updateCombinationAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::updateProductSaleElementAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.product.combination.defaut-price.update" path="/admin/product/default-price/update">
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::updateDefaultPriceAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::updateProductDefaultSaleElementAction</default>
|
||||
</route>
|
||||
|
||||
|
||||
@@ -741,6 +745,13 @@
|
||||
|
||||
<!-- end Modules rule management -->
|
||||
|
||||
<!-- test form !!! -->
|
||||
<route id="admin.testform" path="/admin/testform">
|
||||
<default key="_controller">Thelia\Controller\Admin\TestController::updateAction</default>
|
||||
</route>
|
||||
<route id="admin.testformupdate" path="/admin/testformupdate">
|
||||
<default key="_controller">Thelia\Controller\Admin\TestController::processUpdateAction</default>
|
||||
</route>
|
||||
|
||||
<!-- The default route, to display a template -->
|
||||
|
||||
|
||||
@@ -46,6 +46,23 @@ use Thelia\Model\CategoryQuery;
|
||||
use Thelia\Core\Event\Product\ProductAddAccessoryEvent;
|
||||
use Thelia\Core\Event\Product\ProductDeleteAccessoryEvent;
|
||||
use Thelia\Model\ProductSaleElementsQuery;
|
||||
use Thelia\Core\Event\ProductSaleElement\ProductSaleElementDeleteEvent;
|
||||
use Thelia\Core\Event\ProductSaleElement\ProductSaleElementUpdateEvent;
|
||||
use Thelia\Core\Event\ProductSaleElement\ProductSaleElementCreateEvent;
|
||||
use Thelia\Model\AttributeQuery;
|
||||
use Thelia\Model\AttributeAvQuery;
|
||||
use Thelia\Form\ProductSaleElementUpdateForm;
|
||||
use Thelia\Model\ProductSaleElements;
|
||||
use Thelia\Model\ProductPriceQuery;
|
||||
use Thelia\Form\ProductDefaultSaleElementUpdateForm;
|
||||
use Thelia\Model\ProductPrice;
|
||||
use Thelia\Model\Currency;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Thelia\TaxEngine\Calculator;
|
||||
use Thelia\Model\Country;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Model\TaxRuleQuery;
|
||||
use Thelia\Tools\NumberFormat;
|
||||
|
||||
/**
|
||||
* Manages products
|
||||
@@ -173,10 +190,58 @@ class ProductController extends AbstractCrudController
|
||||
|
||||
protected function hydrateObjectForm($object)
|
||||
{
|
||||
// Get the default produc sales element
|
||||
$salesElement = ProductSaleElementsQuery::create()->filterByProduct($object)->filterByIsDefault(true)->findOne();
|
||||
$defaultPseData = $combinationPseData = array();
|
||||
|
||||
// $prices = $salesElement->getProductPrices();
|
||||
// Find product's sale elements
|
||||
$saleElements = ProductSaleElementsQuery::create()
|
||||
->filterByProduct($object)
|
||||
->find();
|
||||
|
||||
foreach($saleElements as $saleElement) {
|
||||
|
||||
// Get the product price for the current currency
|
||||
|
||||
$productPrice = ProductPriceQuery::create()
|
||||
->filterByCurrency($this->getCurrentEditionCurrency())
|
||||
->filterByProductSaleElements($saleElement)
|
||||
->findOne()
|
||||
;
|
||||
|
||||
if ($productPrice == null) $productPrice = new ProductPrice();
|
||||
|
||||
$isDefaultPse = count($saleElement->getAttributeCombinations()) == 0;
|
||||
|
||||
// If this PSE has no combination -> this is the default one
|
||||
// affect it to the thelia.admin.product_sale_element.update form
|
||||
if ($isDefaultPse) {
|
||||
|
||||
$defaultPseData = array(
|
||||
"product_id" => $object->getId(),
|
||||
"product_sale_element_id" => $saleElement->getId(),
|
||||
"reference" => $saleElement->getRef(),
|
||||
"price" => $productPrice->getPrice(),
|
||||
"use_exchange_rate" => $productPrice->getFromDefaultCurrency() ? 1 : 0,
|
||||
"tax_rule" => $object->getTaxRuleId(),
|
||||
"currency" => $productPrice->getCurrencyId(),
|
||||
"weight" => $saleElement->getWeight(),
|
||||
"quantity" => $saleElement->getQuantity(),
|
||||
"sale_price" => $productPrice->getPromoPrice(),
|
||||
"onsale" => $saleElement->getPromo() > 0 ? 1 : 0,
|
||||
"isnew" => $saleElement->getNewness() > 0 ? 1 : 0,
|
||||
"isdefault" => $saleElement->getIsDefault() > 0 ? 1 : 0,
|
||||
"ean_code" => $saleElement->getEanCode()
|
||||
);
|
||||
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
$defaultPseForm = new ProductDefaultSaleElementUpdateForm($this->getRequest(), "form", $defaultPseData);
|
||||
$this->getParserContext()->addForm($defaultPseForm);
|
||||
|
||||
$combinationPseForm = new ProductSaleElementUpdateForm($this->getRequest(), "form", $combinationPseData);
|
||||
$this->getParserContext()->addForm($combinationPseForm);
|
||||
}
|
||||
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
@@ -227,7 +292,7 @@ class ProductController extends AbstractCrudController
|
||||
'product_id' => $this->getRequest()->get('product_id', 0),
|
||||
'folder_id' => $this->getRequest()->get('folder_id', 0),
|
||||
'accessory_category_id' => $this->getRequest()->get('accessory_category_id', 0),
|
||||
'current_tab' => $this->getRequest()->get('current_tab', 'general')
|
||||
'current_tab' => $this->getRequest()->get('current_tab', 'general')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -731,20 +796,21 @@ class ProductController extends AbstractCrudController
|
||||
/**
|
||||
* A a new combination to a product
|
||||
*/
|
||||
public function addCombinationAction()
|
||||
public function addProductSaleElementAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
|
||||
|
||||
$event = new ProductCreateCombinationEvent(
|
||||
$event = new ProductSaleElementCreateEvent(
|
||||
$this->getExistingObject(),
|
||||
$this->getRequest()->get('combination_attributes', array()),
|
||||
$this->getCurrentEditionCurrency()->getId()
|
||||
);
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::PRODUCT_ADD_COMBINATION, $event);
|
||||
} catch (\Exception $ex) {
|
||||
$this->dispatch(TheliaEvents::PRODUCT_ADD_PRODUCT_SALE_ELEMENT, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
@@ -752,23 +818,23 @@ class ProductController extends AbstractCrudController
|
||||
$this->redirectToEditionTemplate();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A a new combination to a product
|
||||
*/
|
||||
public function deleteCombinationAction()
|
||||
public function deleteProductSaleElementAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
|
||||
|
||||
$event = new ProductDeleteCombinationEvent(
|
||||
$this->getExistingObject(),
|
||||
$this->getRequest()->get('product_sale_element_id',0)
|
||||
$event = new ProductSaleElementDeleteEvent(
|
||||
$this->getRequest()->get('product_sale_element_id',0),
|
||||
$this->getCurrentEditionCurrency()->getId()
|
||||
);
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::PRODUCT_DELETE_COMBINATION, $event);
|
||||
} catch (\Exception $ex) {
|
||||
$this->dispatch(TheliaEvents::PRODUCT_DELETE_PRODUCT_SALE_ELEMENT, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
@@ -776,4 +842,124 @@ class ProductController extends AbstractCrudController
|
||||
$this->redirectToEditionTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Change a product sale element
|
||||
*/
|
||||
protected function processProductSaleElementUpdate($changeForm) {
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
try {
|
||||
|
||||
// Check the form against constraints violations
|
||||
$form = $this->validateForm($changeForm, "POST");
|
||||
|
||||
// Get the form field values
|
||||
$data = $form->getData();
|
||||
|
||||
$event = new ProductSaleElementUpdateEvent(
|
||||
$this->getExistingObject(),
|
||||
$data['product_sale_element_id']
|
||||
);
|
||||
|
||||
$event
|
||||
->setReference($data['reference'])
|
||||
->setPrice($data['price'])
|
||||
->setCurrencyId($data['currency'])
|
||||
->setWeight($data['weight'])
|
||||
->setQuantity($data['quantity'])
|
||||
->setSalePrice($data['sale_price'])
|
||||
->setOnsale($data['onsale'])
|
||||
->setIsnew($data['isnew'])
|
||||
->setIsdefault($data['isdefault'])
|
||||
->setEanCode($data['ean_code'])
|
||||
->setTaxrule($data['tax_rule'])
|
||||
;
|
||||
|
||||
$this->dispatch(TheliaEvents::PRODUCT_UPDATE_PRODUCT_SALE_ELEMENT, $event);
|
||||
|
||||
// Log object modification
|
||||
if (null !== $changedObject = $event->getProductSaleElement()) {
|
||||
$this->adminLogAppend(sprintf("Product Sale Element (ID %s) for product reference %s modified", $changedObject->getId(), $event->getProduct()->getRef()));
|
||||
}
|
||||
|
||||
// If we have to stay on the same page, do not redirect to the succesUrl, just redirect to the edit page again.
|
||||
if ($this->getRequest()->get('save_mode') == 'stay') {
|
||||
$this->redirectToEditionTemplate($this->getRequest());
|
||||
}
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($changeForm->getSuccessUrl());
|
||||
}
|
||||
catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$error_msg = $ex->getMessage();
|
||||
}
|
||||
|
||||
$this->setupFormErrorContext(
|
||||
$this->getTranslator()->trans("ProductSaleElement modification"), $error_msg, $changeForm, $ex);
|
||||
|
||||
// At this point, the form has errors, and should be redisplayed.
|
||||
return $this->renderEditionTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Change a product sale element attached to a combination
|
||||
*/
|
||||
public function updateProductSaleElementAction() {
|
||||
return $this->processProductSaleElementUpdate(
|
||||
new ProductSaleElementUpdateForm($this->getRequest())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update default product sale element (not attached to any combination)
|
||||
*/
|
||||
public function updateProductDefaultSaleElementAction() {
|
||||
|
||||
return $this->processProductSaleElementUpdate(
|
||||
new ProductDefaultSaleElementUpdateForm($this->getRequest())
|
||||
);
|
||||
}
|
||||
|
||||
public function priceCaclulator() {
|
||||
|
||||
$price = floatval($this->getRequest()->get('price', 0));
|
||||
$tax_rule = intval($this->getRequest()->get('tax_rule_id', 0)); // The tax rule ID
|
||||
$action = $this->getRequest()->get('action', ''); // With ot without tax
|
||||
$convert = intval($this->getRequest()->get('convert_from_default_currency', 0));
|
||||
|
||||
$calc = new Calculator();
|
||||
|
||||
$calc->loadTaxRule(
|
||||
TaxRuleQuery::create()->findPk($tax_rule),
|
||||
Country::getShopLocation()
|
||||
);
|
||||
|
||||
if ($action == 'to_tax') {
|
||||
$return_price = $calc->getTaxedPrice($price);
|
||||
}
|
||||
else if ($action == 'from_tax') {
|
||||
$return_price = $calc->getUntaxedPrice($price);
|
||||
}
|
||||
else {
|
||||
$return_price = $price;
|
||||
}
|
||||
|
||||
if ($convert != 0) {
|
||||
$return_price = $prix * Currency::getDefaultCurrency()->getRate();
|
||||
}
|
||||
|
||||
// Format the number using '.', to perform further calculation
|
||||
$return_price = NumberFormat::getInstance($this->getRequest())->format($return_price, null, '.');
|
||||
|
||||
return new JsonResponse(array('result' => $return_price));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,8 +160,12 @@ class BaseController extends ContainerAware
|
||||
}
|
||||
|
||||
foreach ($form->all() as $child) {
|
||||
|
||||
if (!$child->isValid()) {
|
||||
$errors .= $this->getErrorMessages($child) . ', ';
|
||||
|
||||
$fieldName = $child->getConfig()->getOption('label', $child->getName());
|
||||
|
||||
$errors .= sprintf("[%s] %s, ", $fieldName, $this->getErrorMessages($child));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,13 +194,15 @@ class BaseController extends ContainerAware
|
||||
$errorMessage = null;
|
||||
if ($form->get("error_message")->getData() != null) {
|
||||
$errorMessage = $form->get("error_message")->getData();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$errorMessage = sprintf("Missing or invalid data: %s", $this->getErrorMessages($form));
|
||||
}
|
||||
|
||||
throw new FormValidationException($errorMessage);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
throw new FormValidationException(sprintf("Wrong form method, %s expected.", $expectedMethod));
|
||||
}
|
||||
}
|
||||
@@ -221,7 +227,8 @@ class BaseController extends ContainerAware
|
||||
{
|
||||
if ($form != null) {
|
||||
$url = $form->getSuccessUrl();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$url = $this->getRequest()->get("success_url");
|
||||
}
|
||||
|
||||
|
||||
@@ -21,21 +21,24 @@
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event\Product;
|
||||
namespace Thelia\Core\Event\ProductSaleElement;
|
||||
|
||||
use Thelia\Model\Product;
|
||||
use Thelia\Core\Event\Product\ProductEvent;
|
||||
|
||||
class ProductCreateCombinationEvent extends ProductEvent
|
||||
class ProductSaleElementCreateEvent extends ProductSaleElementEvent
|
||||
{
|
||||
protected $product;
|
||||
protected $attribute_av_list;
|
||||
protected $currency_id;
|
||||
|
||||
public function __construct(Product $product, $attribute_av_list, $currency_id)
|
||||
{
|
||||
parent::__construct($product);
|
||||
parent::__construct();
|
||||
|
||||
$this->attribute_av_list = $attribute_av_list;
|
||||
$this->currency_id = $currency_id;
|
||||
$this->setAttributeAvList($attribute_av_list);
|
||||
$this->setCurrencyId($currency_id);
|
||||
$this->setProduct($product);
|
||||
}
|
||||
|
||||
public function getAttributeAvList()
|
||||
@@ -62,4 +65,15 @@ class ProductCreateCombinationEvent extends ProductEvent
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getProduct() {
|
||||
return $this->product;
|
||||
}
|
||||
|
||||
public function setProduct($product) {
|
||||
$this->product = $product;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -21,19 +21,21 @@
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event\Product;
|
||||
|
||||
namespace Thelia\Core\Event\ProductSaleElement;
|
||||
use Thelia\Model\Product;
|
||||
use Thelia\Core\Event\Product\ProductEvent;
|
||||
|
||||
class ProductDeleteCombinationEvent extends ProductEvent
|
||||
class ProductSaleElementDeleteEvent extends ProductSaleElementEvent
|
||||
{
|
||||
protected $product_sale_element_id;
|
||||
protected $currency_id;
|
||||
|
||||
public function __construct(Product $product, $product_sale_element_id)
|
||||
public function __construct($product_sale_element_id, $currency_id)
|
||||
{
|
||||
parent::__construct($product);
|
||||
parent::__construct();
|
||||
|
||||
$this->product_sale_element_id = $product_sale_element_id;
|
||||
$this->setCurrencyId($currency_id);
|
||||
}
|
||||
|
||||
public function getProductSaleElementId()
|
||||
@@ -44,5 +46,19 @@ class ProductDeleteCombinationEvent extends ProductEvent
|
||||
public function setProductSaleElementId($product_sale_element_id)
|
||||
{
|
||||
$this->product_sale_element_id = $product_sale_element_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCurrencyId()
|
||||
{
|
||||
return $this->currency_id;
|
||||
}
|
||||
|
||||
public function setCurrencyId($currency_id)
|
||||
{
|
||||
$this->currency_id = $currency_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -208,14 +208,14 @@ final class TheliaEvents
|
||||
|
||||
// -- Categories Associated Content ----------------------------------------
|
||||
|
||||
const BEFORE_CREATECATEGORY_ASSOCIATED_CONTENT = "action.before_createCategoryAssociatedContent";
|
||||
const AFTER_CREATECATEGORY_ASSOCIATED_CONTENT = "action.after_createCategoryAssociatedContent";
|
||||
const BEFORE_CREATECATEGORY_ASSOCIATED_CONTENT = "action.before_createCategoryAssociatedContent";
|
||||
const AFTER_CREATECATEGORY_ASSOCIATED_CONTENT = "action.after_createCategoryAssociatedContent";
|
||||
|
||||
const BEFORE_DELETECATEGORY_ASSOCIATED_CONTENT = "action.before_deleteCategoryAssociatedContent";
|
||||
const AFTER_DELETECATEGORY_ASSOCIATED_CONTENT = "action.after_deleteCategoryAssociatedContent";
|
||||
const BEFORE_DELETECATEGORY_ASSOCIATED_CONTENT = "action.before_deleteCategoryAssociatedContent";
|
||||
const AFTER_DELETECATEGORY_ASSOCIATED_CONTENT = "action.after_deleteCategoryAssociatedContent";
|
||||
|
||||
const BEFORE_UPDATECATEGORY_ASSOCIATED_CONTENT = "action.before_updateCategoryAssociatedContent";
|
||||
const AFTER_UPDATECATEGORY_ASSOCIATED_CONTENT = "action.after_updateCategoryAssociatedContent";
|
||||
const BEFORE_UPDATECATEGORY_ASSOCIATED_CONTENT = "action.before_updateCategoryAssociatedContent";
|
||||
const AFTER_UPDATECATEGORY_ASSOCIATED_CONTENT = "action.after_updateCategoryAssociatedContent";
|
||||
|
||||
// -- Product management -----------------------------------------------
|
||||
|
||||
@@ -229,8 +229,9 @@ final class TheliaEvents
|
||||
const PRODUCT_REMOVE_CONTENT = "action.productRemoveContent";
|
||||
const PRODUCT_UPDATE_CONTENT_POSITION = "action.updateProductContentPosition";
|
||||
|
||||
const PRODUCT_ADD_COMBINATION = "action.productAddCombination";
|
||||
const PRODUCT_DELETE_COMBINATION = "action.productDeleteCombination";
|
||||
const PRODUCT_ADD_PRODUCT_SALE_ELEMENT = "action.addProductSaleElement";
|
||||
const PRODUCT_DELETE_PRODUCT_SALE_ELEMENT = "action.deleteProductSaleElement";
|
||||
const PRODUCT_UPDATE_PRODUCT_SALE_ELEMENT = "action.updateProductSaleElement";
|
||||
|
||||
const PRODUCT_SET_TEMPLATE = "action.productSetTemplate";
|
||||
|
||||
|
||||
@@ -115,7 +115,10 @@ class Country extends BaseI18nLoop
|
||||
->set("POSTSCRIPTUM", $country->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("ISOCODE", $country->getIsocode())
|
||||
->set("ISOALPHA2", $country->getIsoalpha2())
|
||||
->set("ISOALPHA3", $country->getIsoalpha3());
|
||||
->set("ISOALPHA3", $country->getIsoalpha3())
|
||||
->set("IS_DEFAULT", $country->getByDefault() ? "1" : "0")
|
||||
->set("IS_SHOP_COUNTRY", $country->getShopCountry() ? "1" : "0")
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ class OrderProduct extends BaseLoop
|
||||
->set("TAX_RULE_TITLE", $product->getTaxRuleTitle())
|
||||
->set("TAX_RULE_DESCRIPTION", $product->getTaxRuledescription())
|
||||
->set("PARENT", $product->getParent())
|
||||
->set("EAN_CODE", $product->getEanCode())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -177,6 +177,7 @@ class ProductSaleElements extends BaseLoop
|
||||
->set("IS_NEW" , $PSEValue->getNewness() === 1 ? 1 : 0)
|
||||
->set("IS_DEFAULT" , $PSEValue->getIsDefault() === 1 ? 1 : 0)
|
||||
->set("WEIGHT" , $PSEValue->getWeight())
|
||||
->set("EAN_CODE" , $PSEValue->getEanCode())
|
||||
->set("PRICE" , $price)
|
||||
->set("PRICE_TAX" , $taxedPrice - $price)
|
||||
->set("TAXED_PRICE" , $taxedPrice)
|
||||
|
||||
@@ -28,6 +28,7 @@ use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
||||
use Thelia\Core\Template\Smarty\Exception\SmartyPluginException;
|
||||
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
||||
use Thelia\Tools\DateTimeFormat;
|
||||
use Thelia\Tools\NumberFormat;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -69,21 +70,20 @@ class Format extends AbstractSmartyPlugin
|
||||
*/
|
||||
public function formatDate($params, $template = null)
|
||||
{
|
||||
$date = $this->getParam("date", false);
|
||||
|
||||
if (array_key_exists("date", $params) === false) {
|
||||
if ($date === false) {
|
||||
throw new SmartyPluginException("date is a mandatory parameter in format_date function");
|
||||
}
|
||||
|
||||
$date = $params["date"];
|
||||
|
||||
if (!$date instanceof \DateTime) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (array_key_exists("format", $params)) {
|
||||
$format = $params["format"];
|
||||
} else {
|
||||
$format = DateTimeFormat::getInstance($this->request)->getFormat(array_key_exists("output", $params) ? $params["output"] : null);
|
||||
$format = $this->getParam("format", false);
|
||||
|
||||
if ($format === false) {
|
||||
$format = DateTimeFormat::getInstance($this->request)->getFormat($this->getParam("output", null));
|
||||
}
|
||||
|
||||
return $date->format($format);
|
||||
@@ -109,23 +109,22 @@ class Format extends AbstractSmartyPlugin
|
||||
*/
|
||||
public function formatNumber($params, $template = null)
|
||||
{
|
||||
if (array_key_exists("number", $params) === false) {
|
||||
$number = $this->getParam("number", false);
|
||||
|
||||
if ($number === false) {
|
||||
throw new SmartyPluginException("number is a mandatory parameter in format_number function");
|
||||
}
|
||||
|
||||
$number = $params["number"];
|
||||
|
||||
if (empty($number)) {
|
||||
if ($number == '') {
|
||||
return "";
|
||||
}
|
||||
|
||||
$lang = $this->request->getSession()->getLang();
|
||||
|
||||
$decimals = array_key_exists("decimals", $params) ? $params["decimals"] : $lang->getDecimals();
|
||||
$decPoint = array_key_exists("dec_point", $params) ? $params["dec_point"] : $lang->getDecimalSeparator();
|
||||
$thousandsSep = array_key_exists("thousands_sep", $params) ? $params["thousands_sep"] : $lang->getThousandsSeparator();
|
||||
|
||||
return number_format($number, $decimals, $decPoint, $thousandsSep);
|
||||
return NumberFormat::getInstance($this->request)->format(
|
||||
$number,
|
||||
$this->getParam("decimals", null),
|
||||
$this->getParam("dec_point", null),
|
||||
$this->getParam("thousands_sep", null)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,28 +25,33 @@ namespace Thelia\Form;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Thelia\Model\Currency;
|
||||
|
||||
class ProductDetailsModificationForm extends BaseForm
|
||||
class ProductSaleElementUpdateForm extends BaseForm
|
||||
{
|
||||
use StandardDescriptionFieldsTrait;
|
||||
|
||||
protected function buildForm()
|
||||
{
|
||||
$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("product_id", "integer", array(
|
||||
"label" => Translator::getInstance()->trans("Product ID *"),
|
||||
"label_attr" => array("for" => "product_id_field"),
|
||||
"constraints" => array(new GreaterThan(array('value' => 0)))
|
||||
))
|
||||
->add("product_sale_element_id", "integer", array(
|
||||
"label" => Translator::getInstance()->trans("Product sale element ID *"),
|
||||
"label_attr" => array("for" => "product_sale_element_id_field")
|
||||
))
|
||||
->add("reference", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Reference *"),
|
||||
"label_attr" => array("for" => "reference_field")
|
||||
))
|
||||
->add("price", "number", array(
|
||||
"constraints" => array(new NotBlank()),
|
||||
"label" => Translator::getInstance()->trans("Product base price excluding taxes *"),
|
||||
"label" => Translator::getInstance()->trans("Product price excluding taxes *"),
|
||||
"label_attr" => array("for" => "price_field")
|
||||
))
|
||||
->add("price_with_tax", "number", array(
|
||||
"label" => Translator::getInstance()->trans("Product base price including taxes *"),
|
||||
"label_attr" => array("for" => "price_with_tax_field")
|
||||
))
|
||||
->add("currency", "integer", array(
|
||||
"constraints" => array(new NotBlank()),
|
||||
"label" => Translator::getInstance()->trans("Price currency *"),
|
||||
@@ -64,11 +69,11 @@ class ProductDetailsModificationForm extends BaseForm
|
||||
))
|
||||
->add("quantity", "number", array(
|
||||
"constraints" => array(new NotBlank()),
|
||||
"label" => Translator::getInstance()->trans("Current quantity *"),
|
||||
"label" => Translator::getInstance()->trans("Available quantity *"),
|
||||
"label_attr" => array("for" => "quantity_field")
|
||||
))
|
||||
->add("sale_price", "number", array(
|
||||
"label" => Translator::getInstance()->trans("Sale price *"),
|
||||
"label" => Translator::getInstance()->trans("Sale price without taxes *"),
|
||||
"label_attr" => array("for" => "price_with_tax_field")
|
||||
))
|
||||
->add("onsale", "integer", array(
|
||||
@@ -79,12 +84,23 @@ class ProductDetailsModificationForm extends BaseForm
|
||||
"label" => Translator::getInstance()->trans("Advertise this product as new"),
|
||||
"label_attr" => array("for" => "isnew_field")
|
||||
))
|
||||
|
||||
->add("isdefault", "integer", array(
|
||||
"label" => Translator::getInstance()->trans("Is it the default product sale element ?"),
|
||||
"label_attr" => array("for" => "isdefault_field")
|
||||
))
|
||||
->add("ean_code", "integer", array(
|
||||
"label" => Translator::getInstance()->trans("EAN Code"),
|
||||
"label_attr" => array("for" => "ean_code_field")
|
||||
))
|
||||
->add("use_exchange_rate", "integer", array(
|
||||
"label" => Translator::getInstance()->trans("Apply exchange rates on price in %sym", array("%sym" => Currency::getDefaultCurrency()->getSymbol())),
|
||||
"label_attr" => array("for" => "use_exchange_rate_field")
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "thelia_product_details_modification";
|
||||
return "thelia_product_sale_element_update_form";
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\ActiveRecord\ActiveRecordInterface;
|
||||
use Propel\Runtime\Collection\Collection;
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\BadMethodCallException;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
@@ -18,11 +17,9 @@ use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Parser\AbstractParser;
|
||||
use Propel\Runtime\Util\PropelDateTime;
|
||||
use Thelia\Model\Admin as ChildAdmin;
|
||||
use Thelia\Model\AdminGroup as ChildAdminGroup;
|
||||
use Thelia\Model\AdminGroupQuery as ChildAdminGroupQuery;
|
||||
use Thelia\Model\AdminQuery as ChildAdminQuery;
|
||||
use Thelia\Model\Group as ChildGroup;
|
||||
use Thelia\Model\GroupQuery as ChildGroupQuery;
|
||||
use Thelia\Model\Profile as ChildProfile;
|
||||
use Thelia\Model\ProfileQuery as ChildProfileQuery;
|
||||
use Thelia\Model\Map\AdminTableMap;
|
||||
|
||||
abstract class Admin implements ActiveRecordInterface
|
||||
@@ -65,6 +62,12 @@ abstract class Admin implements ActiveRecordInterface
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* The value for the profile_id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $profile_id;
|
||||
|
||||
/**
|
||||
* The value for the firstname field.
|
||||
* @var string
|
||||
@@ -126,15 +129,9 @@ abstract class Admin implements ActiveRecordInterface
|
||||
protected $updated_at;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildAdminGroup[] Collection to store aggregation of ChildAdminGroup objects.
|
||||
* @var Profile
|
||||
*/
|
||||
protected $collAdminGroups;
|
||||
protected $collAdminGroupsPartial;
|
||||
|
||||
/**
|
||||
* @var ChildGroup[] Collection to store aggregation of ChildGroup objects.
|
||||
*/
|
||||
protected $collGroups;
|
||||
protected $aProfile;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
@@ -144,18 +141,6 @@ abstract class Admin implements ActiveRecordInterface
|
||||
*/
|
||||
protected $alreadyInSave = false;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $groupsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $adminGroupsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Initializes internal state of Thelia\Model\Base\Admin object.
|
||||
*/
|
||||
@@ -425,6 +410,17 @@ abstract class Admin implements ActiveRecordInterface
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [profile_id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getProfileId()
|
||||
{
|
||||
|
||||
return $this->profile_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [firstname] column value.
|
||||
*
|
||||
@@ -574,6 +570,31 @@ abstract class Admin implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setId()
|
||||
|
||||
/**
|
||||
* Set the value of [profile_id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return \Thelia\Model\Admin The current object (for fluent API support)
|
||||
*/
|
||||
public function setProfileId($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->profile_id !== $v) {
|
||||
$this->profile_id = $v;
|
||||
$this->modifiedColumns[] = AdminTableMap::PROFILE_ID;
|
||||
}
|
||||
|
||||
if ($this->aProfile !== null && $this->aProfile->getId() !== $v) {
|
||||
$this->aProfile = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setProfileId()
|
||||
|
||||
/**
|
||||
* Set the value of [firstname] column.
|
||||
*
|
||||
@@ -824,37 +845,40 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : AdminTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AdminTableMap::translateFieldName('Firstname', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AdminTableMap::translateFieldName('ProfileId', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->profile_id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AdminTableMap::translateFieldName('Firstname', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->firstname = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AdminTableMap::translateFieldName('Lastname', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AdminTableMap::translateFieldName('Lastname', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->lastname = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AdminTableMap::translateFieldName('Login', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : AdminTableMap::translateFieldName('Login', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->login = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : AdminTableMap::translateFieldName('Password', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : AdminTableMap::translateFieldName('Password', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->password = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : AdminTableMap::translateFieldName('Algo', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : AdminTableMap::translateFieldName('Algo', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->algo = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : AdminTableMap::translateFieldName('Salt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : AdminTableMap::translateFieldName('Salt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->salt = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : AdminTableMap::translateFieldName('RememberMeToken', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : AdminTableMap::translateFieldName('RememberMeToken', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->remember_me_token = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : AdminTableMap::translateFieldName('RememberMeSerial', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : AdminTableMap::translateFieldName('RememberMeSerial', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->remember_me_serial = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : AdminTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : AdminTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : AdminTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : AdminTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -867,7 +891,7 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 11; // 11 = AdminTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 12; // 12 = AdminTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\Admin object", 0, $e);
|
||||
@@ -889,6 +913,9 @@ abstract class Admin implements ActiveRecordInterface
|
||||
*/
|
||||
public function ensureConsistency()
|
||||
{
|
||||
if ($this->aProfile !== null && $this->profile_id !== $this->aProfile->getId()) {
|
||||
$this->aProfile = null;
|
||||
}
|
||||
} // ensureConsistency
|
||||
|
||||
/**
|
||||
@@ -928,9 +955,7 @@ abstract class Admin implements ActiveRecordInterface
|
||||
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->collAdminGroups = null;
|
||||
|
||||
$this->collGroups = null;
|
||||
$this->aProfile = null;
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -1053,6 +1078,18 @@ abstract class Admin implements ActiveRecordInterface
|
||||
if (!$this->alreadyInSave) {
|
||||
$this->alreadyInSave = true;
|
||||
|
||||
// We call the save method on the following object(s) if they
|
||||
// were passed to this object by their corresponding set
|
||||
// method. This object relates to these object(s) by a
|
||||
// foreign key reference.
|
||||
|
||||
if ($this->aProfile !== null) {
|
||||
if ($this->aProfile->isModified() || $this->aProfile->isNew()) {
|
||||
$affectedRows += $this->aProfile->save($con);
|
||||
}
|
||||
$this->setProfile($this->aProfile);
|
||||
}
|
||||
|
||||
if ($this->isNew() || $this->isModified()) {
|
||||
// persist changes
|
||||
if ($this->isNew()) {
|
||||
@@ -1064,50 +1101,6 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->groupsScheduledForDeletion !== null) {
|
||||
if (!$this->groupsScheduledForDeletion->isEmpty()) {
|
||||
$pks = array();
|
||||
$pk = $this->getPrimaryKey();
|
||||
foreach ($this->groupsScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
|
||||
$pks[] = array($remotePk, $pk);
|
||||
}
|
||||
|
||||
AdminGroupQuery::create()
|
||||
->filterByPrimaryKeys($pks)
|
||||
->delete($con);
|
||||
$this->groupsScheduledForDeletion = null;
|
||||
}
|
||||
|
||||
foreach ($this->getGroups() as $group) {
|
||||
if ($group->isModified()) {
|
||||
$group->save($con);
|
||||
}
|
||||
}
|
||||
} elseif ($this->collGroups) {
|
||||
foreach ($this->collGroups as $group) {
|
||||
if ($group->isModified()) {
|
||||
$group->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->adminGroupsScheduledForDeletion !== null) {
|
||||
if (!$this->adminGroupsScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\AdminGroupQuery::create()
|
||||
->filterByPrimaryKeys($this->adminGroupsScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->adminGroupsScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collAdminGroups !== null) {
|
||||
foreach ($this->collAdminGroups as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
}
|
||||
@@ -1137,6 +1130,9 @@ abstract class Admin implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(AdminTableMap::ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'ID';
|
||||
}
|
||||
if ($this->isColumnModified(AdminTableMap::PROFILE_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'PROFILE_ID';
|
||||
}
|
||||
if ($this->isColumnModified(AdminTableMap::FIRSTNAME)) {
|
||||
$modifiedColumns[':p' . $index++] = 'FIRSTNAME';
|
||||
}
|
||||
@@ -1181,6 +1177,9 @@ abstract class Admin implements ActiveRecordInterface
|
||||
case 'ID':
|
||||
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'PROFILE_ID':
|
||||
$stmt->bindValue($identifier, $this->profile_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'FIRSTNAME':
|
||||
$stmt->bindValue($identifier, $this->firstname, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1277,33 +1276,36 @@ abstract class Admin implements ActiveRecordInterface
|
||||
return $this->getId();
|
||||
break;
|
||||
case 1:
|
||||
return $this->getFirstname();
|
||||
return $this->getProfileId();
|
||||
break;
|
||||
case 2:
|
||||
return $this->getLastname();
|
||||
return $this->getFirstname();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getLogin();
|
||||
return $this->getLastname();
|
||||
break;
|
||||
case 4:
|
||||
return $this->getPassword();
|
||||
return $this->getLogin();
|
||||
break;
|
||||
case 5:
|
||||
return $this->getAlgo();
|
||||
return $this->getPassword();
|
||||
break;
|
||||
case 6:
|
||||
return $this->getSalt();
|
||||
return $this->getAlgo();
|
||||
break;
|
||||
case 7:
|
||||
return $this->getRememberMeToken();
|
||||
return $this->getSalt();
|
||||
break;
|
||||
case 8:
|
||||
return $this->getRememberMeSerial();
|
||||
return $this->getRememberMeToken();
|
||||
break;
|
||||
case 9:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getRememberMeSerial();
|
||||
break;
|
||||
case 10:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 11:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1336,16 +1338,17 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$keys = AdminTableMap::getFieldNames($keyType);
|
||||
$result = array(
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getFirstname(),
|
||||
$keys[2] => $this->getLastname(),
|
||||
$keys[3] => $this->getLogin(),
|
||||
$keys[4] => $this->getPassword(),
|
||||
$keys[5] => $this->getAlgo(),
|
||||
$keys[6] => $this->getSalt(),
|
||||
$keys[7] => $this->getRememberMeToken(),
|
||||
$keys[8] => $this->getRememberMeSerial(),
|
||||
$keys[9] => $this->getCreatedAt(),
|
||||
$keys[10] => $this->getUpdatedAt(),
|
||||
$keys[1] => $this->getProfileId(),
|
||||
$keys[2] => $this->getFirstname(),
|
||||
$keys[3] => $this->getLastname(),
|
||||
$keys[4] => $this->getLogin(),
|
||||
$keys[5] => $this->getPassword(),
|
||||
$keys[6] => $this->getAlgo(),
|
||||
$keys[7] => $this->getSalt(),
|
||||
$keys[8] => $this->getRememberMeToken(),
|
||||
$keys[9] => $this->getRememberMeSerial(),
|
||||
$keys[10] => $this->getCreatedAt(),
|
||||
$keys[11] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach ($virtualColumns as $key => $virtualColumn) {
|
||||
@@ -1353,8 +1356,8 @@ abstract class Admin implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->collAdminGroups) {
|
||||
$result['AdminGroups'] = $this->collAdminGroups->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
if (null !== $this->aProfile) {
|
||||
$result['Profile'] = $this->aProfile->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1394,33 +1397,36 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$this->setId($value);
|
||||
break;
|
||||
case 1:
|
||||
$this->setFirstname($value);
|
||||
$this->setProfileId($value);
|
||||
break;
|
||||
case 2:
|
||||
$this->setLastname($value);
|
||||
$this->setFirstname($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setLogin($value);
|
||||
$this->setLastname($value);
|
||||
break;
|
||||
case 4:
|
||||
$this->setPassword($value);
|
||||
$this->setLogin($value);
|
||||
break;
|
||||
case 5:
|
||||
$this->setAlgo($value);
|
||||
$this->setPassword($value);
|
||||
break;
|
||||
case 6:
|
||||
$this->setSalt($value);
|
||||
$this->setAlgo($value);
|
||||
break;
|
||||
case 7:
|
||||
$this->setRememberMeToken($value);
|
||||
$this->setSalt($value);
|
||||
break;
|
||||
case 8:
|
||||
$this->setRememberMeSerial($value);
|
||||
$this->setRememberMeToken($value);
|
||||
break;
|
||||
case 9:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setRememberMeSerial($value);
|
||||
break;
|
||||
case 10:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 11:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1448,16 +1454,17 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$keys = AdminTableMap::getFieldNames($keyType);
|
||||
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setFirstname($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setLastname($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setLogin($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setPassword($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setAlgo($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setSalt($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setRememberMeToken($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setRememberMeSerial($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setCreatedAt($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setUpdatedAt($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setProfileId($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setFirstname($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setLastname($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setLogin($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setPassword($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setAlgo($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setSalt($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setRememberMeToken($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setRememberMeSerial($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setCreatedAt($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[11], $arr)) $this->setUpdatedAt($arr[$keys[11]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1470,6 +1477,7 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$criteria = new Criteria(AdminTableMap::DATABASE_NAME);
|
||||
|
||||
if ($this->isColumnModified(AdminTableMap::ID)) $criteria->add(AdminTableMap::ID, $this->id);
|
||||
if ($this->isColumnModified(AdminTableMap::PROFILE_ID)) $criteria->add(AdminTableMap::PROFILE_ID, $this->profile_id);
|
||||
if ($this->isColumnModified(AdminTableMap::FIRSTNAME)) $criteria->add(AdminTableMap::FIRSTNAME, $this->firstname);
|
||||
if ($this->isColumnModified(AdminTableMap::LASTNAME)) $criteria->add(AdminTableMap::LASTNAME, $this->lastname);
|
||||
if ($this->isColumnModified(AdminTableMap::LOGIN)) $criteria->add(AdminTableMap::LOGIN, $this->login);
|
||||
@@ -1543,6 +1551,7 @@ abstract class Admin implements ActiveRecordInterface
|
||||
*/
|
||||
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
|
||||
{
|
||||
$copyObj->setProfileId($this->getProfileId());
|
||||
$copyObj->setFirstname($this->getFirstname());
|
||||
$copyObj->setLastname($this->getLastname());
|
||||
$copyObj->setLogin($this->getLogin());
|
||||
@@ -1553,20 +1562,6 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$copyObj->setRememberMeSerial($this->getRememberMeSerial());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$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->getAdminGroups() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addAdminGroup($relObj->copy($deepCopy));
|
||||
}
|
||||
}
|
||||
|
||||
} // if ($deepCopy)
|
||||
|
||||
if ($makeNew) {
|
||||
$copyObj->setNew(true);
|
||||
$copyObj->setId(NULL); // this is a auto-increment column, so set to default value
|
||||
@@ -1595,449 +1590,55 @@ abstract class Admin implements ActiveRecordInterface
|
||||
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.
|
||||
* Declares an association between this object and a ChildProfile object.
|
||||
*
|
||||
* @param string $relationName The name of the relation to initialize
|
||||
* @return void
|
||||
*/
|
||||
public function initRelation($relationName)
|
||||
{
|
||||
if ('AdminGroup' == $relationName) {
|
||||
return $this->initAdminGroups();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collAdminGroups 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 addAdminGroups()
|
||||
*/
|
||||
public function clearAdminGroups()
|
||||
{
|
||||
$this->collAdminGroups = null; // important to set this to NULL since that means it is uninitialized
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset is the collAdminGroups collection loaded partially.
|
||||
*/
|
||||
public function resetPartialAdminGroups($v = true)
|
||||
{
|
||||
$this->collAdminGroupsPartial = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collAdminGroups collection.
|
||||
*
|
||||
* By default this just sets the collAdminGroups collection to an empty array (like clearcollAdminGroups());
|
||||
* 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 initAdminGroups($overrideExisting = true)
|
||||
{
|
||||
if (null !== $this->collAdminGroups && !$overrideExisting) {
|
||||
return;
|
||||
}
|
||||
$this->collAdminGroups = new ObjectCollection();
|
||||
$this->collAdminGroups->setModel('\Thelia\Model\AdminGroup');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of ChildAdminGroup 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 ChildAdmin 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|ChildAdminGroup[] List of ChildAdminGroup objects
|
||||
* @param ChildProfile $v
|
||||
* @return \Thelia\Model\Admin The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAdminGroups($criteria = null, ConnectionInterface $con = null)
|
||||
public function setProfile(ChildProfile $v = null)
|
||||
{
|
||||
$partial = $this->collAdminGroupsPartial && !$this->isNew();
|
||||
if (null === $this->collAdminGroups || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAdminGroups) {
|
||||
// return empty collection
|
||||
$this->initAdminGroups();
|
||||
} else {
|
||||
$collAdminGroups = ChildAdminGroupQuery::create(null, $criteria)
|
||||
->filterByAdmin($this)
|
||||
->find($con);
|
||||
|
||||
if (null !== $criteria) {
|
||||
if (false !== $this->collAdminGroupsPartial && count($collAdminGroups)) {
|
||||
$this->initAdminGroups(false);
|
||||
|
||||
foreach ($collAdminGroups as $obj) {
|
||||
if (false == $this->collAdminGroups->contains($obj)) {
|
||||
$this->collAdminGroups->append($obj);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collAdminGroupsPartial = true;
|
||||
}
|
||||
|
||||
$collAdminGroups->getInternalIterator()->rewind();
|
||||
|
||||
return $collAdminGroups;
|
||||
}
|
||||
|
||||
if ($partial && $this->collAdminGroups) {
|
||||
foreach ($this->collAdminGroups as $obj) {
|
||||
if ($obj->isNew()) {
|
||||
$collAdminGroups[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->collAdminGroups = $collAdminGroups;
|
||||
$this->collAdminGroupsPartial = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collAdminGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of AdminGroup 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 $adminGroups A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildAdmin The current object (for fluent API support)
|
||||
*/
|
||||
public function setAdminGroups(Collection $adminGroups, ConnectionInterface $con = null)
|
||||
{
|
||||
$adminGroupsToDelete = $this->getAdminGroups(new Criteria(), $con)->diff($adminGroups);
|
||||
|
||||
|
||||
//since at least one column in the foreign key is at the same time a PK
|
||||
//we can not just set a PK to NULL in the lines below. We have to store
|
||||
//a backup of all values, so we are able to manipulate these items based on the onDelete value later.
|
||||
$this->adminGroupsScheduledForDeletion = clone $adminGroupsToDelete;
|
||||
|
||||
foreach ($adminGroupsToDelete as $adminGroupRemoved) {
|
||||
$adminGroupRemoved->setAdmin(null);
|
||||
}
|
||||
|
||||
$this->collAdminGroups = null;
|
||||
foreach ($adminGroups as $adminGroup) {
|
||||
$this->addAdminGroup($adminGroup);
|
||||
}
|
||||
|
||||
$this->collAdminGroups = $adminGroups;
|
||||
$this->collAdminGroupsPartial = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related AdminGroup objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param ConnectionInterface $con
|
||||
* @return int Count of related AdminGroup objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countAdminGroups(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collAdminGroupsPartial && !$this->isNew();
|
||||
if (null === $this->collAdminGroups || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAdminGroups) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($partial && !$criteria) {
|
||||
return count($this->getAdminGroups());
|
||||
}
|
||||
|
||||
$query = ChildAdminGroupQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
|
||||
return $query
|
||||
->filterByAdmin($this)
|
||||
->count($con);
|
||||
}
|
||||
|
||||
return count($this->collAdminGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called to associate a ChildAdminGroup object to this object
|
||||
* through the ChildAdminGroup foreign key attribute.
|
||||
*
|
||||
* @param ChildAdminGroup $l ChildAdminGroup
|
||||
* @return \Thelia\Model\Admin The current object (for fluent API support)
|
||||
*/
|
||||
public function addAdminGroup(ChildAdminGroup $l)
|
||||
{
|
||||
if ($this->collAdminGroups === null) {
|
||||
$this->initAdminGroups();
|
||||
$this->collAdminGroupsPartial = true;
|
||||
}
|
||||
|
||||
if (!in_array($l, $this->collAdminGroups->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddAdminGroup($l);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AdminGroup $adminGroup The adminGroup object to add.
|
||||
*/
|
||||
protected function doAddAdminGroup($adminGroup)
|
||||
{
|
||||
$this->collAdminGroups[]= $adminGroup;
|
||||
$adminGroup->setAdmin($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AdminGroup $adminGroup The adminGroup object to remove.
|
||||
* @return ChildAdmin The current object (for fluent API support)
|
||||
*/
|
||||
public function removeAdminGroup($adminGroup)
|
||||
{
|
||||
if ($this->getAdminGroups()->contains($adminGroup)) {
|
||||
$this->collAdminGroups->remove($this->collAdminGroups->search($adminGroup));
|
||||
if (null === $this->adminGroupsScheduledForDeletion) {
|
||||
$this->adminGroupsScheduledForDeletion = clone $this->collAdminGroups;
|
||||
$this->adminGroupsScheduledForDeletion->clear();
|
||||
}
|
||||
$this->adminGroupsScheduledForDeletion[]= clone $adminGroup;
|
||||
$adminGroup->setAdmin(null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this Admin is new, it will return
|
||||
* an empty collection; or if this Admin has previously
|
||||
* been saved, it will retrieve related AdminGroups 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 Admin.
|
||||
*
|
||||
* @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|ChildAdminGroup[] List of ChildAdminGroup objects
|
||||
*/
|
||||
public function getAdminGroupsJoinGroup($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = ChildAdminGroupQuery::create(null, $criteria);
|
||||
$query->joinWith('Group', $joinBehavior);
|
||||
|
||||
return $this->getAdminGroups($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collGroups 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 addGroups()
|
||||
*/
|
||||
public function clearGroups()
|
||||
{
|
||||
$this->collGroups = null; // important to set this to NULL since that means it is uninitialized
|
||||
$this->collGroupsPartial = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collGroups collection.
|
||||
*
|
||||
* By default this just sets the collGroups collection to an empty collection (like clearGroups());
|
||||
* 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.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initGroups()
|
||||
{
|
||||
$this->collGroups = new ObjectCollection();
|
||||
$this->collGroups->setModel('\Thelia\Model\Group');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a collection of ChildGroup objects related by a many-to-many relationship
|
||||
* to the current object by way of the admin_group cross-reference table.
|
||||
*
|
||||
* 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 ChildAdmin is new, it will return
|
||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||
*
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return ObjectCollection|ChildGroup[] List of ChildGroup objects
|
||||
*/
|
||||
public function getGroups($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collGroups || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collGroups) {
|
||||
// return empty collection
|
||||
$this->initGroups();
|
||||
} else {
|
||||
$collGroups = ChildGroupQuery::create(null, $criteria)
|
||||
->filterByAdmin($this)
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
return $collGroups;
|
||||
}
|
||||
$this->collGroups = $collGroups;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of Group objects related by a many-to-many relationship
|
||||
* to the current object by way of the admin_group cross-reference table.
|
||||
* 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 $groups A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildAdmin The current object (for fluent API support)
|
||||
*/
|
||||
public function setGroups(Collection $groups, ConnectionInterface $con = null)
|
||||
{
|
||||
$this->clearGroups();
|
||||
$currentGroups = $this->getGroups();
|
||||
|
||||
$this->groupsScheduledForDeletion = $currentGroups->diff($groups);
|
||||
|
||||
foreach ($groups as $group) {
|
||||
if (!$currentGroups->contains($group)) {
|
||||
$this->doAddGroup($group);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collGroups = $groups;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of ChildGroup objects related by a many-to-many relationship
|
||||
* to the current object by way of the admin_group cross-reference table.
|
||||
*
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param boolean $distinct Set to true to force count distinct
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return int the number of related ChildGroup objects
|
||||
*/
|
||||
public function countGroups($criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collGroups || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collGroups) {
|
||||
return 0;
|
||||
} else {
|
||||
$query = ChildGroupQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
|
||||
return $query
|
||||
->filterByAdmin($this)
|
||||
->count($con);
|
||||
}
|
||||
if ($v === null) {
|
||||
$this->setProfileId(NULL);
|
||||
} else {
|
||||
return count($this->collGroups);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate a ChildGroup object to this object
|
||||
* through the admin_group cross reference table.
|
||||
*
|
||||
* @param ChildGroup $group The ChildAdminGroup object to relate
|
||||
* @return ChildAdmin The current object (for fluent API support)
|
||||
*/
|
||||
public function addGroup(ChildGroup $group)
|
||||
{
|
||||
if ($this->collGroups === null) {
|
||||
$this->initGroups();
|
||||
$this->setProfileId($v->getId());
|
||||
}
|
||||
|
||||
if (!$this->collGroups->contains($group)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddGroup($group);
|
||||
$this->collGroups[] = $group;
|
||||
$this->aProfile = $v;
|
||||
|
||||
// Add binding for other direction of this n:n relationship.
|
||||
// If this object has already been added to the ChildProfile object, it will not be re-added.
|
||||
if ($v !== null) {
|
||||
$v->addAdmin($this);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Group $group The group object to add.
|
||||
*/
|
||||
protected function doAddGroup($group)
|
||||
{
|
||||
$adminGroup = new ChildAdminGroup();
|
||||
$adminGroup->setGroup($group);
|
||||
$this->addAdminGroup($adminGroup);
|
||||
// set the back reference to this object directly as using provided method either results
|
||||
// in endless loop or in multiple relations
|
||||
if (!$group->getAdmins()->contains($this)) {
|
||||
$foreignCollection = $group->getAdmins();
|
||||
$foreignCollection[] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a ChildGroup object to this object
|
||||
* through the admin_group cross reference table.
|
||||
* Get the associated ChildProfile object
|
||||
*
|
||||
* @param ChildGroup $group The ChildAdminGroup object to relate
|
||||
* @return ChildAdmin The current object (for fluent API support)
|
||||
* @param ConnectionInterface $con Optional Connection object.
|
||||
* @return ChildProfile The associated ChildProfile object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function removeGroup(ChildGroup $group)
|
||||
public function getProfile(ConnectionInterface $con = null)
|
||||
{
|
||||
if ($this->getGroups()->contains($group)) {
|
||||
$this->collGroups->remove($this->collGroups->search($group));
|
||||
|
||||
if (null === $this->groupsScheduledForDeletion) {
|
||||
$this->groupsScheduledForDeletion = clone $this->collGroups;
|
||||
$this->groupsScheduledForDeletion->clear();
|
||||
}
|
||||
|
||||
$this->groupsScheduledForDeletion[] = $group;
|
||||
if ($this->aProfile === null && ($this->profile_id !== null)) {
|
||||
$this->aProfile = ChildProfileQuery::create()->findPk($this->profile_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->aProfile->addAdmins($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this;
|
||||
return $this->aProfile;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2046,6 +1647,7 @@ abstract class Admin implements ActiveRecordInterface
|
||||
public function clear()
|
||||
{
|
||||
$this->id = null;
|
||||
$this->profile_id = null;
|
||||
$this->firstname = null;
|
||||
$this->lastname = null;
|
||||
$this->login = null;
|
||||
@@ -2075,26 +1677,9 @@ abstract class Admin implements ActiveRecordInterface
|
||||
public function clearAllReferences($deep = false)
|
||||
{
|
||||
if ($deep) {
|
||||
if ($this->collAdminGroups) {
|
||||
foreach ($this->collAdminGroups as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collGroups) {
|
||||
foreach ($this->collGroups as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
if ($this->collAdminGroups instanceof Collection) {
|
||||
$this->collAdminGroups->clearIterator();
|
||||
}
|
||||
$this->collAdminGroups = null;
|
||||
if ($this->collGroups instanceof Collection) {
|
||||
$this->collGroups->clearIterator();
|
||||
}
|
||||
$this->collGroups = null;
|
||||
$this->aProfile = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,7 @@ use Thelia\Model\Map\AdminTableMap;
|
||||
*
|
||||
*
|
||||
* @method ChildAdminQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildAdminQuery orderByProfileId($order = Criteria::ASC) Order by the profile_id column
|
||||
* @method ChildAdminQuery orderByFirstname($order = Criteria::ASC) Order by the firstname column
|
||||
* @method ChildAdminQuery orderByLastname($order = Criteria::ASC) Order by the lastname column
|
||||
* @method ChildAdminQuery orderByLogin($order = Criteria::ASC) Order by the login column
|
||||
@@ -34,6 +35,7 @@ use Thelia\Model\Map\AdminTableMap;
|
||||
* @method ChildAdminQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
* @method ChildAdminQuery groupById() Group by the id column
|
||||
* @method ChildAdminQuery groupByProfileId() Group by the profile_id column
|
||||
* @method ChildAdminQuery groupByFirstname() Group by the firstname column
|
||||
* @method ChildAdminQuery groupByLastname() Group by the lastname column
|
||||
* @method ChildAdminQuery groupByLogin() Group by the login column
|
||||
@@ -49,14 +51,15 @@ use Thelia\Model\Map\AdminTableMap;
|
||||
* @method ChildAdminQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildAdminQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildAdminQuery leftJoinAdminGroup($relationAlias = null) Adds a LEFT JOIN clause to the query using the AdminGroup relation
|
||||
* @method ChildAdminQuery rightJoinAdminGroup($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AdminGroup relation
|
||||
* @method ChildAdminQuery innerJoinAdminGroup($relationAlias = null) Adds a INNER JOIN clause to the query using the AdminGroup relation
|
||||
* @method ChildAdminQuery leftJoinProfile($relationAlias = null) Adds a LEFT JOIN clause to the query using the Profile relation
|
||||
* @method ChildAdminQuery rightJoinProfile($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Profile relation
|
||||
* @method ChildAdminQuery innerJoinProfile($relationAlias = null) Adds a INNER JOIN clause to the query using the Profile relation
|
||||
*
|
||||
* @method ChildAdmin findOne(ConnectionInterface $con = null) Return the first ChildAdmin matching the query
|
||||
* @method ChildAdmin findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAdmin matching the query, or a new ChildAdmin object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildAdmin findOneById(int $id) Return the first ChildAdmin filtered by the id column
|
||||
* @method ChildAdmin findOneByProfileId(int $profile_id) Return the first ChildAdmin filtered by the profile_id column
|
||||
* @method ChildAdmin findOneByFirstname(string $firstname) Return the first ChildAdmin filtered by the firstname column
|
||||
* @method ChildAdmin findOneByLastname(string $lastname) Return the first ChildAdmin filtered by the lastname column
|
||||
* @method ChildAdmin findOneByLogin(string $login) Return the first ChildAdmin filtered by the login column
|
||||
@@ -69,6 +72,7 @@ use Thelia\Model\Map\AdminTableMap;
|
||||
* @method ChildAdmin findOneByUpdatedAt(string $updated_at) Return the first ChildAdmin filtered by the updated_at column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildAdmin objects filtered by the id column
|
||||
* @method array findByProfileId(int $profile_id) Return ChildAdmin objects filtered by the profile_id column
|
||||
* @method array findByFirstname(string $firstname) Return ChildAdmin objects filtered by the firstname column
|
||||
* @method array findByLastname(string $lastname) Return ChildAdmin objects filtered by the lastname column
|
||||
* @method array findByLogin(string $login) Return ChildAdmin objects filtered by the login column
|
||||
@@ -167,7 +171,7 @@ abstract class AdminQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, FIRSTNAME, LASTNAME, LOGIN, PASSWORD, ALGO, SALT, REMEMBER_ME_TOKEN, REMEMBER_ME_SERIAL, CREATED_AT, UPDATED_AT FROM admin WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, PROFILE_ID, FIRSTNAME, LASTNAME, LOGIN, PASSWORD, ALGO, SALT, REMEMBER_ME_TOKEN, REMEMBER_ME_SERIAL, CREATED_AT, UPDATED_AT FROM admin WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -297,6 +301,49 @@ abstract class AdminQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(AdminTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the profile_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByProfileId(1234); // WHERE profile_id = 1234
|
||||
* $query->filterByProfileId(array(12, 34)); // WHERE profile_id IN (12, 34)
|
||||
* $query->filterByProfileId(array('min' => 12)); // WHERE profile_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByProfile()
|
||||
*
|
||||
* @param mixed $profileId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAdminQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByProfileId($profileId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($profileId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($profileId['min'])) {
|
||||
$this->addUsingAlias(AdminTableMap::PROFILE_ID, $profileId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($profileId['max'])) {
|
||||
$this->addUsingAlias(AdminTableMap::PROFILE_ID, $profileId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AdminTableMap::PROFILE_ID, $profileId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the firstname column
|
||||
*
|
||||
@@ -616,40 +663,42 @@ abstract class AdminQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\AdminGroup object
|
||||
* Filter the query by a related \Thelia\Model\Profile object
|
||||
*
|
||||
* @param \Thelia\Model\AdminGroup|ObjectCollection $adminGroup the related object to use as filter
|
||||
* @param \Thelia\Model\Profile|ObjectCollection $profile The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAdminQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAdminGroup($adminGroup, $comparison = null)
|
||||
public function filterByProfile($profile, $comparison = null)
|
||||
{
|
||||
if ($adminGroup instanceof \Thelia\Model\AdminGroup) {
|
||||
if ($profile instanceof \Thelia\Model\Profile) {
|
||||
return $this
|
||||
->addUsingAlias(AdminTableMap::ID, $adminGroup->getAdminId(), $comparison);
|
||||
} elseif ($adminGroup instanceof ObjectCollection) {
|
||||
->addUsingAlias(AdminTableMap::PROFILE_ID, $profile->getId(), $comparison);
|
||||
} elseif ($profile instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->useAdminGroupQuery()
|
||||
->filterByPrimaryKeys($adminGroup->getPrimaryKeys())
|
||||
->endUse();
|
||||
->addUsingAlias(AdminTableMap::PROFILE_ID, $profile->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByAdminGroup() only accepts arguments of type \Thelia\Model\AdminGroup or Collection');
|
||||
throw new PropelException('filterByProfile() only accepts arguments of type \Thelia\Model\Profile or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the AdminGroup relation
|
||||
* Adds a JOIN clause to the query using the Profile relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildAdminQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinAdminGroup($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinProfile($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('AdminGroup');
|
||||
$relationMap = $tableMap->getRelation('Profile');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
@@ -664,14 +713,14 @@ abstract class AdminQuery extends ModelCriteria
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'AdminGroup');
|
||||
$this->addJoinObject($join, 'Profile');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the AdminGroup relation AdminGroup object
|
||||
* Use the Profile relation Profile object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
@@ -679,30 +728,13 @@ abstract class AdminQuery extends ModelCriteria
|
||||
* 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\AdminGroupQuery A secondary query class using the current class as primary query
|
||||
* @return \Thelia\Model\ProfileQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAdminGroupQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useProfileQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinAdminGroup($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'AdminGroup', '\Thelia\Model\AdminGroupQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Group object
|
||||
* using the admin_group table as cross reference
|
||||
*
|
||||
* @param Group $group the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAdminQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByGroup($group, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useAdminGroupQuery()
|
||||
->filterByGroup($group, $comparison)
|
||||
->endUse();
|
||||
->joinProfile($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Profile', '\Thelia\Model\ProfileQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -95,10 +95,18 @@ abstract class Country implements ActiveRecordInterface
|
||||
|
||||
/**
|
||||
* The value for the by_default field.
|
||||
* Note: this column has a database default value of: 0
|
||||
* @var int
|
||||
*/
|
||||
protected $by_default;
|
||||
|
||||
/**
|
||||
* The value for the shop_country field.
|
||||
* Note: this column has a database default value of: false
|
||||
* @var boolean
|
||||
*/
|
||||
protected $shop_country;
|
||||
|
||||
/**
|
||||
* The value for the created_at field.
|
||||
* @var string
|
||||
@@ -174,11 +182,25 @@ abstract class Country implements ActiveRecordInterface
|
||||
*/
|
||||
protected $countryI18nsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Applies default values to this object.
|
||||
* This method should be called from the object's constructor (or
|
||||
* equivalent initialization method).
|
||||
* @see __construct()
|
||||
*/
|
||||
public function applyDefaultValues()
|
||||
{
|
||||
$this->by_default = 0;
|
||||
$this->shop_country = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes internal state of Thelia\Model\Base\Country object.
|
||||
* @see applyDefaults()
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->applyDefaultValues();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -498,6 +520,17 @@ abstract class Country implements ActiveRecordInterface
|
||||
return $this->by_default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [shop_country] column value.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShopCountry()
|
||||
{
|
||||
|
||||
return $this->shop_country;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
@@ -668,6 +701,35 @@ abstract class Country implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setByDefault()
|
||||
|
||||
/**
|
||||
* Sets the value of the [shop_country] 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\Country The current object (for fluent API support)
|
||||
*/
|
||||
public function setShopCountry($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->shop_country !== $v) {
|
||||
$this->shop_country = $v;
|
||||
$this->modifiedColumns[] = CountryTableMap::SHOP_COUNTRY;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setShopCountry()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
@@ -720,6 +782,14 @@ abstract class Country implements ActiveRecordInterface
|
||||
*/
|
||||
public function hasOnlyDefaultValues()
|
||||
{
|
||||
if ($this->by_default !== 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->shop_country !== false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// otherwise, everything was equal, so return TRUE
|
||||
return true;
|
||||
} // hasOnlyDefaultValues()
|
||||
@@ -765,13 +835,16 @@ abstract class Country implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CountryTableMap::translateFieldName('ByDefault', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->by_default = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CountryTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CountryTableMap::translateFieldName('ShopCountry', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->shop_country = (null !== $col) ? (boolean) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CountryTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CountryTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CountryTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -784,7 +857,7 @@ abstract class Country implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 8; // 8 = CountryTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 9; // 9 = CountryTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\Country object", 0, $e);
|
||||
@@ -1071,6 +1144,10 @@ abstract class Country implements ActiveRecordInterface
|
||||
$modifiedColumns = array();
|
||||
$index = 0;
|
||||
|
||||
$this->modifiedColumns[] = CountryTableMap::ID;
|
||||
if (null !== $this->id) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key (' . CountryTableMap::ID . ')');
|
||||
}
|
||||
|
||||
// check the columns in natural order for more readable SQL queries
|
||||
if ($this->isColumnModified(CountryTableMap::ID)) {
|
||||
@@ -1091,6 +1168,9 @@ abstract class Country implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CountryTableMap::BY_DEFAULT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'BY_DEFAULT';
|
||||
}
|
||||
if ($this->isColumnModified(CountryTableMap::SHOP_COUNTRY)) {
|
||||
$modifiedColumns[':p' . $index++] = 'SHOP_COUNTRY';
|
||||
}
|
||||
if ($this->isColumnModified(CountryTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||
}
|
||||
@@ -1126,6 +1206,9 @@ abstract class Country implements ActiveRecordInterface
|
||||
case 'BY_DEFAULT':
|
||||
$stmt->bindValue($identifier, $this->by_default, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'SHOP_COUNTRY':
|
||||
$stmt->bindValue($identifier, (int) $this->shop_country, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'CREATED_AT':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1140,6 +1223,13 @@ abstract class Country implements ActiveRecordInterface
|
||||
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
|
||||
}
|
||||
|
||||
try {
|
||||
$pk = $con->lastInsertId();
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException('Unable to get autoincrement id.', 0, $e);
|
||||
}
|
||||
$this->setId($pk);
|
||||
|
||||
$this->setNew(false);
|
||||
}
|
||||
|
||||
@@ -1206,9 +1296,12 @@ abstract class Country implements ActiveRecordInterface
|
||||
return $this->getByDefault();
|
||||
break;
|
||||
case 6:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getShopCountry();
|
||||
break;
|
||||
case 7:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 8:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1246,8 +1339,9 @@ abstract class Country implements ActiveRecordInterface
|
||||
$keys[3] => $this->getIsoalpha2(),
|
||||
$keys[4] => $this->getIsoalpha3(),
|
||||
$keys[5] => $this->getByDefault(),
|
||||
$keys[6] => $this->getCreatedAt(),
|
||||
$keys[7] => $this->getUpdatedAt(),
|
||||
$keys[6] => $this->getShopCountry(),
|
||||
$keys[7] => $this->getCreatedAt(),
|
||||
$keys[8] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach ($virtualColumns as $key => $virtualColumn) {
|
||||
@@ -1320,9 +1414,12 @@ abstract class Country implements ActiveRecordInterface
|
||||
$this->setByDefault($value);
|
||||
break;
|
||||
case 6:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setShopCountry($value);
|
||||
break;
|
||||
case 7:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 8:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1355,8 +1452,9 @@ abstract class Country implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[3], $arr)) $this->setIsoalpha2($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setIsoalpha3($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setByDefault($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setShopCountry($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1374,6 +1472,7 @@ abstract class Country implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CountryTableMap::ISOALPHA2)) $criteria->add(CountryTableMap::ISOALPHA2, $this->isoalpha2);
|
||||
if ($this->isColumnModified(CountryTableMap::ISOALPHA3)) $criteria->add(CountryTableMap::ISOALPHA3, $this->isoalpha3);
|
||||
if ($this->isColumnModified(CountryTableMap::BY_DEFAULT)) $criteria->add(CountryTableMap::BY_DEFAULT, $this->by_default);
|
||||
if ($this->isColumnModified(CountryTableMap::SHOP_COUNTRY)) $criteria->add(CountryTableMap::SHOP_COUNTRY, $this->shop_country);
|
||||
if ($this->isColumnModified(CountryTableMap::CREATED_AT)) $criteria->add(CountryTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(CountryTableMap::UPDATED_AT)) $criteria->add(CountryTableMap::UPDATED_AT, $this->updated_at);
|
||||
|
||||
@@ -1439,12 +1538,12 @@ abstract class Country implements ActiveRecordInterface
|
||||
*/
|
||||
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
|
||||
{
|
||||
$copyObj->setId($this->getId());
|
||||
$copyObj->setAreaId($this->getAreaId());
|
||||
$copyObj->setIsocode($this->getIsocode());
|
||||
$copyObj->setIsoalpha2($this->getIsoalpha2());
|
||||
$copyObj->setIsoalpha3($this->getIsoalpha3());
|
||||
$copyObj->setByDefault($this->getByDefault());
|
||||
$copyObj->setShopCountry($this->getShopCountry());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
|
||||
@@ -1475,6 +1574,7 @@ abstract class Country implements ActiveRecordInterface
|
||||
|
||||
if ($makeNew) {
|
||||
$copyObj->setNew(true);
|
||||
$copyObj->setId(NULL); // this is a auto-increment column, so set to default value
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2348,10 +2448,12 @@ abstract class Country implements ActiveRecordInterface
|
||||
$this->isoalpha2 = null;
|
||||
$this->isoalpha3 = null;
|
||||
$this->by_default = null;
|
||||
$this->shop_country = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->alreadyInSave = false;
|
||||
$this->clearAllReferences();
|
||||
$this->applyDefaultValues();
|
||||
$this->resetModified();
|
||||
$this->setNew(true);
|
||||
$this->setDeleted(false);
|
||||
|
||||
@@ -28,6 +28,7 @@ use Thelia\Model\Map\CountryTableMap;
|
||||
* @method ChildCountryQuery orderByIsoalpha2($order = Criteria::ASC) Order by the isoalpha2 column
|
||||
* @method ChildCountryQuery orderByIsoalpha3($order = Criteria::ASC) Order by the isoalpha3 column
|
||||
* @method ChildCountryQuery orderByByDefault($order = Criteria::ASC) Order by the by_default column
|
||||
* @method ChildCountryQuery orderByShopCountry($order = Criteria::ASC) Order by the shop_country column
|
||||
* @method ChildCountryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildCountryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
@@ -37,6 +38,7 @@ use Thelia\Model\Map\CountryTableMap;
|
||||
* @method ChildCountryQuery groupByIsoalpha2() Group by the isoalpha2 column
|
||||
* @method ChildCountryQuery groupByIsoalpha3() Group by the isoalpha3 column
|
||||
* @method ChildCountryQuery groupByByDefault() Group by the by_default column
|
||||
* @method ChildCountryQuery groupByShopCountry() Group by the shop_country column
|
||||
* @method ChildCountryQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildCountryQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
@@ -69,6 +71,7 @@ use Thelia\Model\Map\CountryTableMap;
|
||||
* @method ChildCountry findOneByIsoalpha2(string $isoalpha2) Return the first ChildCountry filtered by the isoalpha2 column
|
||||
* @method ChildCountry findOneByIsoalpha3(string $isoalpha3) Return the first ChildCountry filtered by the isoalpha3 column
|
||||
* @method ChildCountry findOneByByDefault(int $by_default) Return the first ChildCountry filtered by the by_default column
|
||||
* @method ChildCountry findOneByShopCountry(boolean $shop_country) Return the first ChildCountry filtered by the shop_country column
|
||||
* @method ChildCountry findOneByCreatedAt(string $created_at) Return the first ChildCountry filtered by the created_at column
|
||||
* @method ChildCountry findOneByUpdatedAt(string $updated_at) Return the first ChildCountry filtered by the updated_at column
|
||||
*
|
||||
@@ -78,6 +81,7 @@ use Thelia\Model\Map\CountryTableMap;
|
||||
* @method array findByIsoalpha2(string $isoalpha2) Return ChildCountry objects filtered by the isoalpha2 column
|
||||
* @method array findByIsoalpha3(string $isoalpha3) Return ChildCountry objects filtered by the isoalpha3 column
|
||||
* @method array findByByDefault(int $by_default) Return ChildCountry objects filtered by the by_default column
|
||||
* @method array findByShopCountry(boolean $shop_country) Return ChildCountry objects filtered by the shop_country column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildCountry objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildCountry objects filtered by the updated_at column
|
||||
*
|
||||
@@ -168,7 +172,7 @@ abstract class CountryQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, AREA_ID, ISOCODE, ISOALPHA2, ISOALPHA3, BY_DEFAULT, CREATED_AT, UPDATED_AT FROM country WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, AREA_ID, ISOCODE, ISOALPHA2, ISOALPHA3, BY_DEFAULT, SHOP_COUNTRY, CREATED_AT, UPDATED_AT FROM country WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -469,6 +473,33 @@ abstract class CountryQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(CountryTableMap::BY_DEFAULT, $byDefault, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the shop_country column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByShopCountry(true); // WHERE shop_country = true
|
||||
* $query->filterByShopCountry('yes'); // WHERE shop_country = true
|
||||
* </code>
|
||||
*
|
||||
* @param boolean|string $shopCountry 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 ChildCountryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByShopCountry($shopCountry = null, $comparison = null)
|
||||
{
|
||||
if (is_string($shopCountry)) {
|
||||
$shop_country = in_array(strtolower($shopCountry), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CountryTableMap::SHOP_COUNTRY, $shopCountry, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
|
||||
@@ -19,8 +19,6 @@ use Propel\Runtime\Parser\AbstractParser;
|
||||
use Propel\Runtime\Util\PropelDateTime;
|
||||
use Thelia\Model\AreaDeliveryModule as ChildAreaDeliveryModule;
|
||||
use Thelia\Model\AreaDeliveryModuleQuery as ChildAreaDeliveryModuleQuery;
|
||||
use Thelia\Model\GroupModule as ChildGroupModule;
|
||||
use Thelia\Model\GroupModuleQuery as ChildGroupModuleQuery;
|
||||
use Thelia\Model\Module as ChildModule;
|
||||
use Thelia\Model\ModuleI18n as ChildModuleI18n;
|
||||
use Thelia\Model\ModuleI18nQuery as ChildModuleI18nQuery;
|
||||
@@ -29,6 +27,8 @@ use Thelia\Model\ModuleImageQuery as ChildModuleImageQuery;
|
||||
use Thelia\Model\ModuleQuery as ChildModuleQuery;
|
||||
use Thelia\Model\Order as ChildOrder;
|
||||
use Thelia\Model\OrderQuery as ChildOrderQuery;
|
||||
use Thelia\Model\ProfileModule as ChildProfileModule;
|
||||
use Thelia\Model\ProfileModuleQuery as ChildProfileModuleQuery;
|
||||
use Thelia\Model\Map\ModuleTableMap;
|
||||
|
||||
abstract class Module implements ActiveRecordInterface
|
||||
@@ -132,10 +132,10 @@ abstract class Module implements ActiveRecordInterface
|
||||
protected $collAreaDeliveryModulesPartial;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildGroupModule[] Collection to store aggregation of ChildGroupModule objects.
|
||||
* @var ObjectCollection|ChildProfileModule[] Collection to store aggregation of ChildProfileModule objects.
|
||||
*/
|
||||
protected $collGroupModules;
|
||||
protected $collGroupModulesPartial;
|
||||
protected $collProfileModules;
|
||||
protected $collProfileModulesPartial;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildModuleImage[] Collection to store aggregation of ChildModuleImage objects.
|
||||
@@ -193,7 +193,7 @@ abstract class Module implements ActiveRecordInterface
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $groupModulesScheduledForDeletion = null;
|
||||
protected $profileModulesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
@@ -880,7 +880,7 @@ abstract class Module implements ActiveRecordInterface
|
||||
|
||||
$this->collAreaDeliveryModules = null;
|
||||
|
||||
$this->collGroupModules = null;
|
||||
$this->collProfileModules = null;
|
||||
|
||||
$this->collModuleImages = null;
|
||||
|
||||
@@ -1070,17 +1070,17 @@ abstract class Module implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->groupModulesScheduledForDeletion !== null) {
|
||||
if (!$this->groupModulesScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\GroupModuleQuery::create()
|
||||
->filterByPrimaryKeys($this->groupModulesScheduledForDeletion->getPrimaryKeys(false))
|
||||
if ($this->profileModulesScheduledForDeletion !== null) {
|
||||
if (!$this->profileModulesScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\ProfileModuleQuery::create()
|
||||
->filterByPrimaryKeys($this->profileModulesScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->groupModulesScheduledForDeletion = null;
|
||||
$this->profileModulesScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collGroupModules !== null) {
|
||||
foreach ($this->collGroupModules as $referrerFK) {
|
||||
if ($this->collProfileModules !== null) {
|
||||
foreach ($this->collProfileModules as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
@@ -1345,8 +1345,8 @@ abstract class Module implements ActiveRecordInterface
|
||||
if (null !== $this->collAreaDeliveryModules) {
|
||||
$result['AreaDeliveryModules'] = $this->collAreaDeliveryModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->collGroupModules) {
|
||||
$result['GroupModules'] = $this->collGroupModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
if (null !== $this->collProfileModules) {
|
||||
$result['ProfileModules'] = $this->collProfileModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->collModuleImages) {
|
||||
$result['ModuleImages'] = $this->collModuleImages->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
@@ -1557,9 +1557,9 @@ abstract class Module implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->getGroupModules() as $relObj) {
|
||||
foreach ($this->getProfileModules() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addGroupModule($relObj->copy($deepCopy));
|
||||
$copyObj->addProfileModule($relObj->copy($deepCopy));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1625,8 +1625,8 @@ abstract class Module implements ActiveRecordInterface
|
||||
if ('AreaDeliveryModule' == $relationName) {
|
||||
return $this->initAreaDeliveryModules();
|
||||
}
|
||||
if ('GroupModule' == $relationName) {
|
||||
return $this->initGroupModules();
|
||||
if ('ProfileModule' == $relationName) {
|
||||
return $this->initProfileModules();
|
||||
}
|
||||
if ('ModuleImage' == $relationName) {
|
||||
return $this->initModuleImages();
|
||||
@@ -2616,31 +2616,31 @@ abstract class Module implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collGroupModules collection
|
||||
* Clears out the collProfileModules 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 addGroupModules()
|
||||
* @see addProfileModules()
|
||||
*/
|
||||
public function clearGroupModules()
|
||||
public function clearProfileModules()
|
||||
{
|
||||
$this->collGroupModules = null; // important to set this to NULL since that means it is uninitialized
|
||||
$this->collProfileModules = null; // important to set this to NULL since that means it is uninitialized
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset is the collGroupModules collection loaded partially.
|
||||
* Reset is the collProfileModules collection loaded partially.
|
||||
*/
|
||||
public function resetPartialGroupModules($v = true)
|
||||
public function resetPartialProfileModules($v = true)
|
||||
{
|
||||
$this->collGroupModulesPartial = $v;
|
||||
$this->collProfileModulesPartial = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collGroupModules collection.
|
||||
* Initializes the collProfileModules collection.
|
||||
*
|
||||
* By default this just sets the collGroupModules collection to an empty array (like clearcollGroupModules());
|
||||
* By default this just sets the collProfileModules collection to an empty array (like clearcollProfileModules());
|
||||
* 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.
|
||||
*
|
||||
@@ -2649,17 +2649,17 @@ abstract class Module implements ActiveRecordInterface
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initGroupModules($overrideExisting = true)
|
||||
public function initProfileModules($overrideExisting = true)
|
||||
{
|
||||
if (null !== $this->collGroupModules && !$overrideExisting) {
|
||||
if (null !== $this->collProfileModules && !$overrideExisting) {
|
||||
return;
|
||||
}
|
||||
$this->collGroupModules = new ObjectCollection();
|
||||
$this->collGroupModules->setModel('\Thelia\Model\GroupModule');
|
||||
$this->collProfileModules = new ObjectCollection();
|
||||
$this->collProfileModules->setModel('\Thelia\Model\ProfileModule');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of ChildGroupModule objects which contain a foreign key that references this object.
|
||||
* Gets an array of ChildProfileModule 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.
|
||||
@@ -2669,109 +2669,112 @@ abstract class Module implements ActiveRecordInterface
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @return Collection|ChildGroupModule[] List of ChildGroupModule objects
|
||||
* @return Collection|ChildProfileModule[] List of ChildProfileModule objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getGroupModules($criteria = null, ConnectionInterface $con = null)
|
||||
public function getProfileModules($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collGroupModulesPartial && !$this->isNew();
|
||||
if (null === $this->collGroupModules || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collGroupModules) {
|
||||
$partial = $this->collProfileModulesPartial && !$this->isNew();
|
||||
if (null === $this->collProfileModules || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collProfileModules) {
|
||||
// return empty collection
|
||||
$this->initGroupModules();
|
||||
$this->initProfileModules();
|
||||
} else {
|
||||
$collGroupModules = ChildGroupModuleQuery::create(null, $criteria)
|
||||
$collProfileModules = ChildProfileModuleQuery::create(null, $criteria)
|
||||
->filterByModule($this)
|
||||
->find($con);
|
||||
|
||||
if (null !== $criteria) {
|
||||
if (false !== $this->collGroupModulesPartial && count($collGroupModules)) {
|
||||
$this->initGroupModules(false);
|
||||
if (false !== $this->collProfileModulesPartial && count($collProfileModules)) {
|
||||
$this->initProfileModules(false);
|
||||
|
||||
foreach ($collGroupModules as $obj) {
|
||||
if (false == $this->collGroupModules->contains($obj)) {
|
||||
$this->collGroupModules->append($obj);
|
||||
foreach ($collProfileModules as $obj) {
|
||||
if (false == $this->collProfileModules->contains($obj)) {
|
||||
$this->collProfileModules->append($obj);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collGroupModulesPartial = true;
|
||||
$this->collProfileModulesPartial = true;
|
||||
}
|
||||
|
||||
$collGroupModules->getInternalIterator()->rewind();
|
||||
$collProfileModules->getInternalIterator()->rewind();
|
||||
|
||||
return $collGroupModules;
|
||||
return $collProfileModules;
|
||||
}
|
||||
|
||||
if ($partial && $this->collGroupModules) {
|
||||
foreach ($this->collGroupModules as $obj) {
|
||||
if ($partial && $this->collProfileModules) {
|
||||
foreach ($this->collProfileModules as $obj) {
|
||||
if ($obj->isNew()) {
|
||||
$collGroupModules[] = $obj;
|
||||
$collProfileModules[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->collGroupModules = $collGroupModules;
|
||||
$this->collGroupModulesPartial = false;
|
||||
$this->collProfileModules = $collProfileModules;
|
||||
$this->collProfileModulesPartial = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collGroupModules;
|
||||
return $this->collProfileModules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of GroupModule objects related by a one-to-many relationship
|
||||
* Sets a collection of ProfileModule 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 $groupModules A Propel collection.
|
||||
* @param Collection $profileModules A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildModule The current object (for fluent API support)
|
||||
*/
|
||||
public function setGroupModules(Collection $groupModules, ConnectionInterface $con = null)
|
||||
public function setProfileModules(Collection $profileModules, ConnectionInterface $con = null)
|
||||
{
|
||||
$groupModulesToDelete = $this->getGroupModules(new Criteria(), $con)->diff($groupModules);
|
||||
$profileModulesToDelete = $this->getProfileModules(new Criteria(), $con)->diff($profileModules);
|
||||
|
||||
|
||||
$this->groupModulesScheduledForDeletion = $groupModulesToDelete;
|
||||
//since at least one column in the foreign key is at the same time a PK
|
||||
//we can not just set a PK to NULL in the lines below. We have to store
|
||||
//a backup of all values, so we are able to manipulate these items based on the onDelete value later.
|
||||
$this->profileModulesScheduledForDeletion = clone $profileModulesToDelete;
|
||||
|
||||
foreach ($groupModulesToDelete as $groupModuleRemoved) {
|
||||
$groupModuleRemoved->setModule(null);
|
||||
foreach ($profileModulesToDelete as $profileModuleRemoved) {
|
||||
$profileModuleRemoved->setModule(null);
|
||||
}
|
||||
|
||||
$this->collGroupModules = null;
|
||||
foreach ($groupModules as $groupModule) {
|
||||
$this->addGroupModule($groupModule);
|
||||
$this->collProfileModules = null;
|
||||
foreach ($profileModules as $profileModule) {
|
||||
$this->addProfileModule($profileModule);
|
||||
}
|
||||
|
||||
$this->collGroupModules = $groupModules;
|
||||
$this->collGroupModulesPartial = false;
|
||||
$this->collProfileModules = $profileModules;
|
||||
$this->collProfileModulesPartial = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related GroupModule objects.
|
||||
* Returns the number of related ProfileModule objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param ConnectionInterface $con
|
||||
* @return int Count of related GroupModule objects.
|
||||
* @return int Count of related ProfileModule objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countGroupModules(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
public function countProfileModules(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collGroupModulesPartial && !$this->isNew();
|
||||
if (null === $this->collGroupModules || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collGroupModules) {
|
||||
$partial = $this->collProfileModulesPartial && !$this->isNew();
|
||||
if (null === $this->collProfileModules || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collProfileModules) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($partial && !$criteria) {
|
||||
return count($this->getGroupModules());
|
||||
return count($this->getProfileModules());
|
||||
}
|
||||
|
||||
$query = ChildGroupModuleQuery::create(null, $criteria);
|
||||
$query = ChildProfileModuleQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
@@ -2781,53 +2784,53 @@ abstract class Module implements ActiveRecordInterface
|
||||
->count($con);
|
||||
}
|
||||
|
||||
return count($this->collGroupModules);
|
||||
return count($this->collProfileModules);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called to associate a ChildGroupModule object to this object
|
||||
* through the ChildGroupModule foreign key attribute.
|
||||
* Method called to associate a ChildProfileModule object to this object
|
||||
* through the ChildProfileModule foreign key attribute.
|
||||
*
|
||||
* @param ChildGroupModule $l ChildGroupModule
|
||||
* @param ChildProfileModule $l ChildProfileModule
|
||||
* @return \Thelia\Model\Module The current object (for fluent API support)
|
||||
*/
|
||||
public function addGroupModule(ChildGroupModule $l)
|
||||
public function addProfileModule(ChildProfileModule $l)
|
||||
{
|
||||
if ($this->collGroupModules === null) {
|
||||
$this->initGroupModules();
|
||||
$this->collGroupModulesPartial = true;
|
||||
if ($this->collProfileModules === null) {
|
||||
$this->initProfileModules();
|
||||
$this->collProfileModulesPartial = true;
|
||||
}
|
||||
|
||||
if (!in_array($l, $this->collGroupModules->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddGroupModule($l);
|
||||
if (!in_array($l, $this->collProfileModules->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddProfileModule($l);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param GroupModule $groupModule The groupModule object to add.
|
||||
* @param ProfileModule $profileModule The profileModule object to add.
|
||||
*/
|
||||
protected function doAddGroupModule($groupModule)
|
||||
protected function doAddProfileModule($profileModule)
|
||||
{
|
||||
$this->collGroupModules[]= $groupModule;
|
||||
$groupModule->setModule($this);
|
||||
$this->collProfileModules[]= $profileModule;
|
||||
$profileModule->setModule($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param GroupModule $groupModule The groupModule object to remove.
|
||||
* @param ProfileModule $profileModule The profileModule object to remove.
|
||||
* @return ChildModule The current object (for fluent API support)
|
||||
*/
|
||||
public function removeGroupModule($groupModule)
|
||||
public function removeProfileModule($profileModule)
|
||||
{
|
||||
if ($this->getGroupModules()->contains($groupModule)) {
|
||||
$this->collGroupModules->remove($this->collGroupModules->search($groupModule));
|
||||
if (null === $this->groupModulesScheduledForDeletion) {
|
||||
$this->groupModulesScheduledForDeletion = clone $this->collGroupModules;
|
||||
$this->groupModulesScheduledForDeletion->clear();
|
||||
if ($this->getProfileModules()->contains($profileModule)) {
|
||||
$this->collProfileModules->remove($this->collProfileModules->search($profileModule));
|
||||
if (null === $this->profileModulesScheduledForDeletion) {
|
||||
$this->profileModulesScheduledForDeletion = clone $this->collProfileModules;
|
||||
$this->profileModulesScheduledForDeletion->clear();
|
||||
}
|
||||
$this->groupModulesScheduledForDeletion[]= $groupModule;
|
||||
$groupModule->setModule(null);
|
||||
$this->profileModulesScheduledForDeletion[]= clone $profileModule;
|
||||
$profileModule->setModule(null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -2839,7 +2842,7 @@ abstract class Module implements ActiveRecordInterface
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this Module is new, it will return
|
||||
* an empty collection; or if this Module has previously
|
||||
* been saved, it will retrieve related GroupModules from storage.
|
||||
* been saved, it will retrieve related ProfileModules from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
@@ -2848,14 +2851,14 @@ abstract class Module implements ActiveRecordInterface
|
||||
* @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|ChildGroupModule[] List of ChildGroupModule objects
|
||||
* @return Collection|ChildProfileModule[] List of ChildProfileModule objects
|
||||
*/
|
||||
public function getGroupModulesJoinGroup($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
public function getProfileModulesJoinProfile($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = ChildGroupModuleQuery::create(null, $criteria);
|
||||
$query->joinWith('Group', $joinBehavior);
|
||||
$query = ChildProfileModuleQuery::create(null, $criteria);
|
||||
$query->joinWith('Profile', $joinBehavior);
|
||||
|
||||
return $this->getGroupModules($query, $con);
|
||||
return $this->getProfileModules($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3348,8 +3351,8 @@ abstract class Module implements ActiveRecordInterface
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collGroupModules) {
|
||||
foreach ($this->collGroupModules as $o) {
|
||||
if ($this->collProfileModules) {
|
||||
foreach ($this->collProfileModules as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
@@ -3381,10 +3384,10 @@ abstract class Module implements ActiveRecordInterface
|
||||
$this->collAreaDeliveryModules->clearIterator();
|
||||
}
|
||||
$this->collAreaDeliveryModules = null;
|
||||
if ($this->collGroupModules instanceof Collection) {
|
||||
$this->collGroupModules->clearIterator();
|
||||
if ($this->collProfileModules instanceof Collection) {
|
||||
$this->collProfileModules->clearIterator();
|
||||
}
|
||||
$this->collGroupModules = null;
|
||||
$this->collProfileModules = null;
|
||||
if ($this->collModuleImages instanceof Collection) {
|
||||
$this->collModuleImages->clearIterator();
|
||||
}
|
||||
|
||||
@@ -56,9 +56,9 @@ use Thelia\Model\Map\ModuleTableMap;
|
||||
* @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 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 leftJoinProfileModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProfileModule relation
|
||||
* @method ChildModuleQuery rightJoinProfileModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProfileModule relation
|
||||
* @method ChildModuleQuery innerJoinProfileModule($relationAlias = null) Adds a INNER JOIN clause to the query using the ProfileModule relation
|
||||
*
|
||||
* @method ChildModuleQuery leftJoinModuleImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the ModuleImage relation
|
||||
* @method ChildModuleQuery rightJoinModuleImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleImage relation
|
||||
@@ -793,40 +793,40 @@ abstract class ModuleQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\GroupModule object
|
||||
* Filter the query by a related \Thelia\Model\ProfileModule object
|
||||
*
|
||||
* @param \Thelia\Model\GroupModule|ObjectCollection $groupModule the related object to use as filter
|
||||
* @param \Thelia\Model\ProfileModule|ObjectCollection $profileModule 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 filterByGroupModule($groupModule, $comparison = null)
|
||||
public function filterByProfileModule($profileModule, $comparison = null)
|
||||
{
|
||||
if ($groupModule instanceof \Thelia\Model\GroupModule) {
|
||||
if ($profileModule instanceof \Thelia\Model\ProfileModule) {
|
||||
return $this
|
||||
->addUsingAlias(ModuleTableMap::ID, $groupModule->getModuleId(), $comparison);
|
||||
} elseif ($groupModule instanceof ObjectCollection) {
|
||||
->addUsingAlias(ModuleTableMap::ID, $profileModule->getModuleId(), $comparison);
|
||||
} elseif ($profileModule instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useGroupModuleQuery()
|
||||
->filterByPrimaryKeys($groupModule->getPrimaryKeys())
|
||||
->useProfileModuleQuery()
|
||||
->filterByPrimaryKeys($profileModule->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByGroupModule() only accepts arguments of type \Thelia\Model\GroupModule or Collection');
|
||||
throw new PropelException('filterByProfileModule() only accepts arguments of type \Thelia\Model\ProfileModule or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the GroupModule relation
|
||||
* Adds a JOIN clause to the query using the ProfileModule 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 joinGroupModule($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
public function joinProfileModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('GroupModule');
|
||||
$relationMap = $tableMap->getRelation('ProfileModule');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
@@ -841,14 +841,14 @@ abstract class ModuleQuery extends ModelCriteria
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'GroupModule');
|
||||
$this->addJoinObject($join, 'ProfileModule');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the GroupModule relation GroupModule object
|
||||
* Use the ProfileModule relation ProfileModule object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
@@ -856,13 +856,13 @@ abstract class ModuleQuery extends ModelCriteria
|
||||
* 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\GroupModuleQuery A secondary query class using the current class as primary query
|
||||
* @return \Thelia\Model\ProfileModuleQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useGroupModuleQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
public function useProfileModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinGroupModule($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'GroupModule', '\Thelia\Model\GroupModuleQuery');
|
||||
->joinProfileModule($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'ProfileModule', '\Thelia\Model\ProfileModuleQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -145,6 +145,12 @@ abstract class OrderProduct implements ActiveRecordInterface
|
||||
*/
|
||||
protected $weight;
|
||||
|
||||
/**
|
||||
* The value for the ean_code field.
|
||||
* @var string
|
||||
*/
|
||||
protected $ean_code;
|
||||
|
||||
/**
|
||||
* The value for the tax_rule_title field.
|
||||
* @var string
|
||||
@@ -624,6 +630,17 @@ abstract class OrderProduct implements ActiveRecordInterface
|
||||
return $this->weight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [ean_code] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEanCode()
|
||||
{
|
||||
|
||||
return $this->ean_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [tax_rule_title] column value.
|
||||
*
|
||||
@@ -995,6 +1012,27 @@ abstract class OrderProduct implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setWeight()
|
||||
|
||||
/**
|
||||
* Set the value of [ean_code] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\OrderProduct The current object (for fluent API support)
|
||||
*/
|
||||
public function setEanCode($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->ean_code !== $v) {
|
||||
$this->ean_code = $v;
|
||||
$this->modifiedColumns[] = OrderProductTableMap::EAN_CODE;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setEanCode()
|
||||
|
||||
/**
|
||||
* Set the value of [tax_rule_title] column.
|
||||
*
|
||||
@@ -1179,22 +1217,25 @@ abstract class OrderProduct implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : OrderProductTableMap::translateFieldName('Weight', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->weight = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : OrderProductTableMap::translateFieldName('TaxRuleTitle', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : OrderProductTableMap::translateFieldName('EanCode', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->ean_code = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : OrderProductTableMap::translateFieldName('TaxRuleTitle', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->tax_rule_title = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : OrderProductTableMap::translateFieldName('TaxRuleDescription', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : OrderProductTableMap::translateFieldName('TaxRuleDescription', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->tax_rule_description = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : OrderProductTableMap::translateFieldName('Parent', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : OrderProductTableMap::translateFieldName('Parent', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->parent = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : OrderProductTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 18 + $startcol : OrderProductTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 18 + $startcol : OrderProductTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 19 + $startcol : OrderProductTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -1207,7 +1248,7 @@ abstract class OrderProduct implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 19; // 19 = OrderProductTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 20; // 20 = OrderProductTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\OrderProduct object", 0, $e);
|
||||
@@ -1523,6 +1564,9 @@ abstract class OrderProduct implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(OrderProductTableMap::WEIGHT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'WEIGHT';
|
||||
}
|
||||
if ($this->isColumnModified(OrderProductTableMap::EAN_CODE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'EAN_CODE';
|
||||
}
|
||||
if ($this->isColumnModified(OrderProductTableMap::TAX_RULE_TITLE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'TAX_RULE_TITLE';
|
||||
}
|
||||
@@ -1591,6 +1635,9 @@ abstract class OrderProduct implements ActiveRecordInterface
|
||||
case 'WEIGHT':
|
||||
$stmt->bindValue($identifier, $this->weight, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'EAN_CODE':
|
||||
$stmt->bindValue($identifier, $this->ean_code, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'TAX_RULE_TITLE':
|
||||
$stmt->bindValue($identifier, $this->tax_rule_title, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1711,18 +1758,21 @@ abstract class OrderProduct implements ActiveRecordInterface
|
||||
return $this->getWeight();
|
||||
break;
|
||||
case 14:
|
||||
return $this->getTaxRuleTitle();
|
||||
return $this->getEanCode();
|
||||
break;
|
||||
case 15:
|
||||
return $this->getTaxRuleDescription();
|
||||
return $this->getTaxRuleTitle();
|
||||
break;
|
||||
case 16:
|
||||
return $this->getParent();
|
||||
return $this->getTaxRuleDescription();
|
||||
break;
|
||||
case 17:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getParent();
|
||||
break;
|
||||
case 18:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 19:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1768,11 +1818,12 @@ abstract class OrderProduct implements ActiveRecordInterface
|
||||
$keys[11] => $this->getWasNew(),
|
||||
$keys[12] => $this->getWasInPromo(),
|
||||
$keys[13] => $this->getWeight(),
|
||||
$keys[14] => $this->getTaxRuleTitle(),
|
||||
$keys[15] => $this->getTaxRuleDescription(),
|
||||
$keys[16] => $this->getParent(),
|
||||
$keys[17] => $this->getCreatedAt(),
|
||||
$keys[18] => $this->getUpdatedAt(),
|
||||
$keys[14] => $this->getEanCode(),
|
||||
$keys[15] => $this->getTaxRuleTitle(),
|
||||
$keys[16] => $this->getTaxRuleDescription(),
|
||||
$keys[17] => $this->getParent(),
|
||||
$keys[18] => $this->getCreatedAt(),
|
||||
$keys[19] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach ($virtualColumns as $key => $virtualColumn) {
|
||||
@@ -1866,18 +1917,21 @@ abstract class OrderProduct implements ActiveRecordInterface
|
||||
$this->setWeight($value);
|
||||
break;
|
||||
case 14:
|
||||
$this->setTaxRuleTitle($value);
|
||||
$this->setEanCode($value);
|
||||
break;
|
||||
case 15:
|
||||
$this->setTaxRuleDescription($value);
|
||||
$this->setTaxRuleTitle($value);
|
||||
break;
|
||||
case 16:
|
||||
$this->setParent($value);
|
||||
$this->setTaxRuleDescription($value);
|
||||
break;
|
||||
case 17:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setParent($value);
|
||||
break;
|
||||
case 18:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 19:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1918,11 +1972,12 @@ abstract class OrderProduct implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[11], $arr)) $this->setWasNew($arr[$keys[11]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setWasInPromo($arr[$keys[12]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setWeight($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[14], $arr)) $this->setTaxRuleTitle($arr[$keys[14]]);
|
||||
if (array_key_exists($keys[15], $arr)) $this->setTaxRuleDescription($arr[$keys[15]]);
|
||||
if (array_key_exists($keys[16], $arr)) $this->setParent($arr[$keys[16]]);
|
||||
if (array_key_exists($keys[17], $arr)) $this->setCreatedAt($arr[$keys[17]]);
|
||||
if (array_key_exists($keys[18], $arr)) $this->setUpdatedAt($arr[$keys[18]]);
|
||||
if (array_key_exists($keys[14], $arr)) $this->setEanCode($arr[$keys[14]]);
|
||||
if (array_key_exists($keys[15], $arr)) $this->setTaxRuleTitle($arr[$keys[15]]);
|
||||
if (array_key_exists($keys[16], $arr)) $this->setTaxRuleDescription($arr[$keys[16]]);
|
||||
if (array_key_exists($keys[17], $arr)) $this->setParent($arr[$keys[17]]);
|
||||
if (array_key_exists($keys[18], $arr)) $this->setCreatedAt($arr[$keys[18]]);
|
||||
if (array_key_exists($keys[19], $arr)) $this->setUpdatedAt($arr[$keys[19]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1948,6 +2003,7 @@ abstract class OrderProduct implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(OrderProductTableMap::WAS_NEW)) $criteria->add(OrderProductTableMap::WAS_NEW, $this->was_new);
|
||||
if ($this->isColumnModified(OrderProductTableMap::WAS_IN_PROMO)) $criteria->add(OrderProductTableMap::WAS_IN_PROMO, $this->was_in_promo);
|
||||
if ($this->isColumnModified(OrderProductTableMap::WEIGHT)) $criteria->add(OrderProductTableMap::WEIGHT, $this->weight);
|
||||
if ($this->isColumnModified(OrderProductTableMap::EAN_CODE)) $criteria->add(OrderProductTableMap::EAN_CODE, $this->ean_code);
|
||||
if ($this->isColumnModified(OrderProductTableMap::TAX_RULE_TITLE)) $criteria->add(OrderProductTableMap::TAX_RULE_TITLE, $this->tax_rule_title);
|
||||
if ($this->isColumnModified(OrderProductTableMap::TAX_RULE_DESCRIPTION)) $criteria->add(OrderProductTableMap::TAX_RULE_DESCRIPTION, $this->tax_rule_description);
|
||||
if ($this->isColumnModified(OrderProductTableMap::PARENT)) $criteria->add(OrderProductTableMap::PARENT, $this->parent);
|
||||
@@ -2029,6 +2085,7 @@ abstract class OrderProduct implements ActiveRecordInterface
|
||||
$copyObj->setWasNew($this->getWasNew());
|
||||
$copyObj->setWasInPromo($this->getWasInPromo());
|
||||
$copyObj->setWeight($this->getWeight());
|
||||
$copyObj->setEanCode($this->getEanCode());
|
||||
$copyObj->setTaxRuleTitle($this->getTaxRuleTitle());
|
||||
$copyObj->setTaxRuleDescription($this->getTaxRuleDescription());
|
||||
$copyObj->setParent($this->getParent());
|
||||
@@ -2607,6 +2664,7 @@ abstract class OrderProduct implements ActiveRecordInterface
|
||||
$this->was_new = null;
|
||||
$this->was_in_promo = null;
|
||||
$this->weight = null;
|
||||
$this->ean_code = null;
|
||||
$this->tax_rule_title = null;
|
||||
$this->tax_rule_description = null;
|
||||
$this->parent = null;
|
||||
|
||||
@@ -35,6 +35,7 @@ use Thelia\Model\Map\OrderProductTableMap;
|
||||
* @method ChildOrderProductQuery orderByWasNew($order = Criteria::ASC) Order by the was_new column
|
||||
* @method ChildOrderProductQuery orderByWasInPromo($order = Criteria::ASC) Order by the was_in_promo column
|
||||
* @method ChildOrderProductQuery orderByWeight($order = Criteria::ASC) Order by the weight column
|
||||
* @method ChildOrderProductQuery orderByEanCode($order = Criteria::ASC) Order by the ean_code column
|
||||
* @method ChildOrderProductQuery orderByTaxRuleTitle($order = Criteria::ASC) Order by the tax_rule_title column
|
||||
* @method ChildOrderProductQuery orderByTaxRuleDescription($order = Criteria::ASC) Order by the tax_rule_description column
|
||||
* @method ChildOrderProductQuery orderByParent($order = Criteria::ASC) Order by the parent column
|
||||
@@ -55,6 +56,7 @@ use Thelia\Model\Map\OrderProductTableMap;
|
||||
* @method ChildOrderProductQuery groupByWasNew() Group by the was_new column
|
||||
* @method ChildOrderProductQuery groupByWasInPromo() Group by the was_in_promo column
|
||||
* @method ChildOrderProductQuery groupByWeight() Group by the weight column
|
||||
* @method ChildOrderProductQuery groupByEanCode() Group by the ean_code column
|
||||
* @method ChildOrderProductQuery groupByTaxRuleTitle() Group by the tax_rule_title column
|
||||
* @method ChildOrderProductQuery groupByTaxRuleDescription() Group by the tax_rule_description column
|
||||
* @method ChildOrderProductQuery groupByParent() Group by the parent column
|
||||
@@ -94,6 +96,7 @@ use Thelia\Model\Map\OrderProductTableMap;
|
||||
* @method ChildOrderProduct findOneByWasNew(int $was_new) Return the first ChildOrderProduct filtered by the was_new column
|
||||
* @method ChildOrderProduct findOneByWasInPromo(int $was_in_promo) Return the first ChildOrderProduct filtered by the was_in_promo column
|
||||
* @method ChildOrderProduct findOneByWeight(string $weight) Return the first ChildOrderProduct filtered by the weight column
|
||||
* @method ChildOrderProduct findOneByEanCode(string $ean_code) Return the first ChildOrderProduct filtered by the ean_code column
|
||||
* @method ChildOrderProduct findOneByTaxRuleTitle(string $tax_rule_title) Return the first ChildOrderProduct filtered by the tax_rule_title column
|
||||
* @method ChildOrderProduct findOneByTaxRuleDescription(string $tax_rule_description) Return the first ChildOrderProduct filtered by the tax_rule_description column
|
||||
* @method ChildOrderProduct findOneByParent(int $parent) Return the first ChildOrderProduct filtered by the parent column
|
||||
@@ -114,6 +117,7 @@ use Thelia\Model\Map\OrderProductTableMap;
|
||||
* @method array findByWasNew(int $was_new) Return ChildOrderProduct objects filtered by the was_new column
|
||||
* @method array findByWasInPromo(int $was_in_promo) Return ChildOrderProduct objects filtered by the was_in_promo column
|
||||
* @method array findByWeight(string $weight) Return ChildOrderProduct objects filtered by the weight column
|
||||
* @method array findByEanCode(string $ean_code) Return ChildOrderProduct objects filtered by the ean_code column
|
||||
* @method array findByTaxRuleTitle(string $tax_rule_title) Return ChildOrderProduct objects filtered by the tax_rule_title column
|
||||
* @method array findByTaxRuleDescription(string $tax_rule_description) Return ChildOrderProduct objects filtered by the tax_rule_description column
|
||||
* @method array findByParent(int $parent) Return ChildOrderProduct objects filtered by the parent column
|
||||
@@ -207,7 +211,7 @@ abstract class OrderProductQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, ORDER_ID, PRODUCT_REF, PRODUCT_SALE_ELEMENTS_REF, TITLE, CHAPO, DESCRIPTION, POSTSCRIPTUM, QUANTITY, PRICE, PROMO_PRICE, WAS_NEW, WAS_IN_PROMO, WEIGHT, TAX_RULE_TITLE, TAX_RULE_DESCRIPTION, PARENT, CREATED_AT, UPDATED_AT FROM order_product WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, ORDER_ID, PRODUCT_REF, PRODUCT_SALE_ELEMENTS_REF, TITLE, CHAPO, DESCRIPTION, POSTSCRIPTUM, QUANTITY, PRICE, PROMO_PRICE, WAS_NEW, WAS_IN_PROMO, WEIGHT, EAN_CODE, TAX_RULE_TITLE, TAX_RULE_DESCRIPTION, PARENT, CREATED_AT, UPDATED_AT FROM order_product WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -776,6 +780,35 @@ abstract class OrderProductQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(OrderProductTableMap::WEIGHT, $weight, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the ean_code column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByEanCode('fooValue'); // WHERE ean_code = 'fooValue'
|
||||
* $query->filterByEanCode('%fooValue%'); // WHERE ean_code LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $eanCode The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildOrderProductQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByEanCode($eanCode = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($eanCode)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $eanCode)) {
|
||||
$eanCode = str_replace('*', '%', $eanCode);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(OrderProductTableMap::EAN_CODE, $eanCode, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the tax_rule_title column
|
||||
*
|
||||
|
||||
@@ -82,6 +82,13 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
*/
|
||||
protected $promo_price;
|
||||
|
||||
/**
|
||||
* The value for the from_default_currency field.
|
||||
* Note: this column has a database default value of: false
|
||||
* @var boolean
|
||||
*/
|
||||
protected $from_default_currency;
|
||||
|
||||
/**
|
||||
* The value for the created_at field.
|
||||
* @var string
|
||||
@@ -112,11 +119,24 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
*/
|
||||
protected $alreadyInSave = false;
|
||||
|
||||
/**
|
||||
* Applies default values to this object.
|
||||
* This method should be called from the object's constructor (or
|
||||
* equivalent initialization method).
|
||||
* @see __construct()
|
||||
*/
|
||||
public function applyDefaultValues()
|
||||
{
|
||||
$this->from_default_currency = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes internal state of Thelia\Model\Base\ProductPrice object.
|
||||
* @see applyDefaults()
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->applyDefaultValues();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -414,6 +434,17 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
return $this->promo_price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [from_default_currency] column value.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getFromDefaultCurrency()
|
||||
{
|
||||
|
||||
return $this->from_default_currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
@@ -546,6 +577,35 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setPromoPrice()
|
||||
|
||||
/**
|
||||
* Sets the value of the [from_default_currency] 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\ProductPrice The current object (for fluent API support)
|
||||
*/
|
||||
public function setFromDefaultCurrency($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->from_default_currency !== $v) {
|
||||
$this->from_default_currency = $v;
|
||||
$this->modifiedColumns[] = ProductPriceTableMap::FROM_DEFAULT_CURRENCY;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setFromDefaultCurrency()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
@@ -598,6 +658,10 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
*/
|
||||
public function hasOnlyDefaultValues()
|
||||
{
|
||||
if ($this->from_default_currency !== false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// otherwise, everything was equal, so return TRUE
|
||||
return true;
|
||||
} // hasOnlyDefaultValues()
|
||||
@@ -637,13 +701,16 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProductPriceTableMap::translateFieldName('PromoPrice', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->promo_price = (null !== $col) ? (double) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductPriceTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductPriceTableMap::translateFieldName('FromDefaultCurrency', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->from_default_currency = (null !== $col) ? (boolean) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductPriceTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductPriceTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductPriceTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -656,7 +723,7 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 6; // 6 = ProductPriceTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 7; // 7 = ProductPriceTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\ProductPrice object", 0, $e);
|
||||
@@ -911,6 +978,9 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(ProductPriceTableMap::PROMO_PRICE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'PROMO_PRICE';
|
||||
}
|
||||
if ($this->isColumnModified(ProductPriceTableMap::FROM_DEFAULT_CURRENCY)) {
|
||||
$modifiedColumns[':p' . $index++] = 'FROM_DEFAULT_CURRENCY';
|
||||
}
|
||||
if ($this->isColumnModified(ProductPriceTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||
}
|
||||
@@ -940,6 +1010,9 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
case 'PROMO_PRICE':
|
||||
$stmt->bindValue($identifier, $this->promo_price, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'FROM_DEFAULT_CURRENCY':
|
||||
$stmt->bindValue($identifier, (int) $this->from_default_currency, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'CREATED_AT':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1014,9 +1087,12 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
return $this->getPromoPrice();
|
||||
break;
|
||||
case 4:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getFromDefaultCurrency();
|
||||
break;
|
||||
case 5:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 6:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1052,8 +1128,9 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
$keys[1] => $this->getCurrencyId(),
|
||||
$keys[2] => $this->getPrice(),
|
||||
$keys[3] => $this->getPromoPrice(),
|
||||
$keys[4] => $this->getCreatedAt(),
|
||||
$keys[5] => $this->getUpdatedAt(),
|
||||
$keys[4] => $this->getFromDefaultCurrency(),
|
||||
$keys[5] => $this->getCreatedAt(),
|
||||
$keys[6] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach ($virtualColumns as $key => $virtualColumn) {
|
||||
@@ -1114,9 +1191,12 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
$this->setPromoPrice($value);
|
||||
break;
|
||||
case 4:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setFromDefaultCurrency($value);
|
||||
break;
|
||||
case 5:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 6:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1147,8 +1227,9 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[1], $arr)) $this->setCurrencyId($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setPrice($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setPromoPrice($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setFromDefaultCurrency($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1164,6 +1245,7 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(ProductPriceTableMap::CURRENCY_ID)) $criteria->add(ProductPriceTableMap::CURRENCY_ID, $this->currency_id);
|
||||
if ($this->isColumnModified(ProductPriceTableMap::PRICE)) $criteria->add(ProductPriceTableMap::PRICE, $this->price);
|
||||
if ($this->isColumnModified(ProductPriceTableMap::PROMO_PRICE)) $criteria->add(ProductPriceTableMap::PROMO_PRICE, $this->promo_price);
|
||||
if ($this->isColumnModified(ProductPriceTableMap::FROM_DEFAULT_CURRENCY)) $criteria->add(ProductPriceTableMap::FROM_DEFAULT_CURRENCY, $this->from_default_currency);
|
||||
if ($this->isColumnModified(ProductPriceTableMap::CREATED_AT)) $criteria->add(ProductPriceTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(ProductPriceTableMap::UPDATED_AT)) $criteria->add(ProductPriceTableMap::UPDATED_AT, $this->updated_at);
|
||||
|
||||
@@ -1240,6 +1322,7 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
$copyObj->setCurrencyId($this->getCurrencyId());
|
||||
$copyObj->setPrice($this->getPrice());
|
||||
$copyObj->setPromoPrice($this->getPromoPrice());
|
||||
$copyObj->setFromDefaultCurrency($this->getFromDefaultCurrency());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
if ($makeNew) {
|
||||
@@ -1380,10 +1463,12 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
$this->currency_id = null;
|
||||
$this->price = null;
|
||||
$this->promo_price = null;
|
||||
$this->from_default_currency = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->alreadyInSave = false;
|
||||
$this->clearAllReferences();
|
||||
$this->applyDefaultValues();
|
||||
$this->resetModified();
|
||||
$this->setNew(true);
|
||||
$this->setDeleted(false);
|
||||
|
||||
@@ -25,6 +25,7 @@ use Thelia\Model\Map\ProductPriceTableMap;
|
||||
* @method ChildProductPriceQuery orderByCurrencyId($order = Criteria::ASC) Order by the currency_id column
|
||||
* @method ChildProductPriceQuery orderByPrice($order = Criteria::ASC) Order by the price column
|
||||
* @method ChildProductPriceQuery orderByPromoPrice($order = Criteria::ASC) Order by the promo_price column
|
||||
* @method ChildProductPriceQuery orderByFromDefaultCurrency($order = Criteria::ASC) Order by the from_default_currency column
|
||||
* @method ChildProductPriceQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildProductPriceQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
@@ -32,6 +33,7 @@ use Thelia\Model\Map\ProductPriceTableMap;
|
||||
* @method ChildProductPriceQuery groupByCurrencyId() Group by the currency_id column
|
||||
* @method ChildProductPriceQuery groupByPrice() Group by the price column
|
||||
* @method ChildProductPriceQuery groupByPromoPrice() Group by the promo_price column
|
||||
* @method ChildProductPriceQuery groupByFromDefaultCurrency() Group by the from_default_currency column
|
||||
* @method ChildProductPriceQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildProductPriceQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
@@ -54,6 +56,7 @@ use Thelia\Model\Map\ProductPriceTableMap;
|
||||
* @method ChildProductPrice findOneByCurrencyId(int $currency_id) Return the first ChildProductPrice filtered by the currency_id column
|
||||
* @method ChildProductPrice findOneByPrice(double $price) Return the first ChildProductPrice filtered by the price column
|
||||
* @method ChildProductPrice findOneByPromoPrice(double $promo_price) Return the first ChildProductPrice filtered by the promo_price column
|
||||
* @method ChildProductPrice findOneByFromDefaultCurrency(boolean $from_default_currency) Return the first ChildProductPrice filtered by the from_default_currency column
|
||||
* @method ChildProductPrice findOneByCreatedAt(string $created_at) Return the first ChildProductPrice filtered by the created_at column
|
||||
* @method ChildProductPrice findOneByUpdatedAt(string $updated_at) Return the first ChildProductPrice filtered by the updated_at column
|
||||
*
|
||||
@@ -61,6 +64,7 @@ use Thelia\Model\Map\ProductPriceTableMap;
|
||||
* @method array findByCurrencyId(int $currency_id) Return ChildProductPrice objects filtered by the currency_id column
|
||||
* @method array findByPrice(double $price) Return ChildProductPrice objects filtered by the price column
|
||||
* @method array findByPromoPrice(double $promo_price) Return ChildProductPrice objects filtered by the promo_price column
|
||||
* @method array findByFromDefaultCurrency(boolean $from_default_currency) Return ChildProductPrice objects filtered by the from_default_currency column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildProductPrice objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildProductPrice objects filtered by the updated_at column
|
||||
*
|
||||
@@ -151,7 +155,7 @@ abstract class ProductPriceQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT PRODUCT_SALE_ELEMENTS_ID, CURRENCY_ID, PRICE, PROMO_PRICE, CREATED_AT, UPDATED_AT FROM product_price WHERE PRODUCT_SALE_ELEMENTS_ID = :p0 AND CURRENCY_ID = :p1';
|
||||
$sql = 'SELECT PRODUCT_SALE_ELEMENTS_ID, CURRENCY_ID, PRICE, PROMO_PRICE, FROM_DEFAULT_CURRENCY, CREATED_AT, UPDATED_AT FROM product_price WHERE PRODUCT_SALE_ELEMENTS_ID = :p0 AND CURRENCY_ID = :p1';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
|
||||
@@ -420,6 +424,33 @@ abstract class ProductPriceQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(ProductPriceTableMap::PROMO_PRICE, $promoPrice, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the from_default_currency column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByFromDefaultCurrency(true); // WHERE from_default_currency = true
|
||||
* $query->filterByFromDefaultCurrency('yes'); // WHERE from_default_currency = true
|
||||
* </code>
|
||||
*
|
||||
* @param boolean|string $fromDefaultCurrency 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 ChildProductPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByFromDefaultCurrency($fromDefaultCurrency = null, $comparison = null)
|
||||
{
|
||||
if (is_string($fromDefaultCurrency)) {
|
||||
$from_default_currency = in_array(strtolower($fromDefaultCurrency), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ProductPriceTableMap::FROM_DEFAULT_CURRENCY, $fromDefaultCurrency, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
|
||||
@@ -115,6 +115,12 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
*/
|
||||
protected $is_default;
|
||||
|
||||
/**
|
||||
* The value for the ean_code field.
|
||||
* @var string
|
||||
*/
|
||||
protected $ean_code;
|
||||
|
||||
/**
|
||||
* The value for the created_at field.
|
||||
* @var string
|
||||
@@ -538,6 +544,17 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
return $this->is_default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [ean_code] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEanCode()
|
||||
{
|
||||
|
||||
return $this->ean_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
@@ -758,6 +775,27 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setIsDefault()
|
||||
|
||||
/**
|
||||
* Set the value of [ean_code] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\ProductSaleElements The current object (for fluent API support)
|
||||
*/
|
||||
public function setEanCode($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->ean_code !== $v) {
|
||||
$this->ean_code = $v;
|
||||
$this->modifiedColumns[] = ProductSaleElementsTableMap::EAN_CODE;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setEanCode()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
@@ -877,13 +915,16 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductSaleElementsTableMap::translateFieldName('IsDefault', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->is_default = (null !== $col) ? (boolean) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductSaleElementsTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductSaleElementsTableMap::translateFieldName('EanCode', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->ean_code = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductSaleElementsTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductSaleElementsTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : ProductSaleElementsTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -896,7 +937,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 10; // 10 = ProductSaleElementsTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 11; // 11 = ProductSaleElementsTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\ProductSaleElements object", 0, $e);
|
||||
@@ -1213,6 +1254,9 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::IS_DEFAULT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'IS_DEFAULT';
|
||||
}
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::EAN_CODE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'EAN_CODE';
|
||||
}
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||
}
|
||||
@@ -1254,6 +1298,9 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
case 'IS_DEFAULT':
|
||||
$stmt->bindValue($identifier, (int) $this->is_default, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'EAN_CODE':
|
||||
$stmt->bindValue($identifier, $this->ean_code, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'CREATED_AT':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1347,9 +1394,12 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
return $this->getIsDefault();
|
||||
break;
|
||||
case 8:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getEanCode();
|
||||
break;
|
||||
case 9:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 10:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1389,8 +1439,9 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
$keys[5] => $this->getNewness(),
|
||||
$keys[6] => $this->getWeight(),
|
||||
$keys[7] => $this->getIsDefault(),
|
||||
$keys[8] => $this->getCreatedAt(),
|
||||
$keys[9] => $this->getUpdatedAt(),
|
||||
$keys[8] => $this->getEanCode(),
|
||||
$keys[9] => $this->getCreatedAt(),
|
||||
$keys[10] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach ($virtualColumns as $key => $virtualColumn) {
|
||||
@@ -1469,9 +1520,12 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
$this->setIsDefault($value);
|
||||
break;
|
||||
case 8:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setEanCode($value);
|
||||
break;
|
||||
case 9:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 10:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1506,8 +1560,9 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[5], $arr)) $this->setNewness($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setWeight($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setIsDefault($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setCreatedAt($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setUpdatedAt($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setEanCode($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setCreatedAt($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setUpdatedAt($arr[$keys[10]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1527,6 +1582,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::NEWNESS)) $criteria->add(ProductSaleElementsTableMap::NEWNESS, $this->newness);
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::WEIGHT)) $criteria->add(ProductSaleElementsTableMap::WEIGHT, $this->weight);
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::IS_DEFAULT)) $criteria->add(ProductSaleElementsTableMap::IS_DEFAULT, $this->is_default);
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::EAN_CODE)) $criteria->add(ProductSaleElementsTableMap::EAN_CODE, $this->ean_code);
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::CREATED_AT)) $criteria->add(ProductSaleElementsTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(ProductSaleElementsTableMap::UPDATED_AT)) $criteria->add(ProductSaleElementsTableMap::UPDATED_AT, $this->updated_at);
|
||||
|
||||
@@ -1599,6 +1655,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
$copyObj->setNewness($this->getNewness());
|
||||
$copyObj->setWeight($this->getWeight());
|
||||
$copyObj->setIsDefault($this->getIsDefault());
|
||||
$copyObj->setEanCode($this->getEanCode());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
|
||||
@@ -2526,6 +2583,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
$this->newness = null;
|
||||
$this->weight = null;
|
||||
$this->is_default = null;
|
||||
$this->ean_code = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
@@ -29,6 +29,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
|
||||
* @method ChildProductSaleElementsQuery orderByNewness($order = Criteria::ASC) Order by the newness column
|
||||
* @method ChildProductSaleElementsQuery orderByWeight($order = Criteria::ASC) Order by the weight column
|
||||
* @method ChildProductSaleElementsQuery orderByIsDefault($order = Criteria::ASC) Order by the is_default column
|
||||
* @method ChildProductSaleElementsQuery orderByEanCode($order = Criteria::ASC) Order by the ean_code column
|
||||
* @method ChildProductSaleElementsQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildProductSaleElementsQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
@@ -40,6 +41,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
|
||||
* @method ChildProductSaleElementsQuery groupByNewness() Group by the newness column
|
||||
* @method ChildProductSaleElementsQuery groupByWeight() Group by the weight column
|
||||
* @method ChildProductSaleElementsQuery groupByIsDefault() Group by the is_default column
|
||||
* @method ChildProductSaleElementsQuery groupByEanCode() Group by the ean_code column
|
||||
* @method ChildProductSaleElementsQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildProductSaleElementsQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
@@ -74,6 +76,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
|
||||
* @method ChildProductSaleElements findOneByNewness(int $newness) Return the first ChildProductSaleElements filtered by the newness column
|
||||
* @method ChildProductSaleElements findOneByWeight(double $weight) Return the first ChildProductSaleElements filtered by the weight column
|
||||
* @method ChildProductSaleElements findOneByIsDefault(boolean $is_default) Return the first ChildProductSaleElements filtered by the is_default column
|
||||
* @method ChildProductSaleElements findOneByEanCode(string $ean_code) Return the first ChildProductSaleElements filtered by the ean_code column
|
||||
* @method ChildProductSaleElements findOneByCreatedAt(string $created_at) Return the first ChildProductSaleElements filtered by the created_at column
|
||||
* @method ChildProductSaleElements findOneByUpdatedAt(string $updated_at) Return the first ChildProductSaleElements filtered by the updated_at column
|
||||
*
|
||||
@@ -85,6 +88,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
|
||||
* @method array findByNewness(int $newness) Return ChildProductSaleElements objects filtered by the newness column
|
||||
* @method array findByWeight(double $weight) Return ChildProductSaleElements objects filtered by the weight column
|
||||
* @method array findByIsDefault(boolean $is_default) Return ChildProductSaleElements objects filtered by the is_default column
|
||||
* @method array findByEanCode(string $ean_code) Return ChildProductSaleElements objects filtered by the ean_code column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildProductSaleElements objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildProductSaleElements objects filtered by the updated_at column
|
||||
*
|
||||
@@ -175,7 +179,7 @@ abstract class ProductSaleElementsQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, PRODUCT_ID, REF, QUANTITY, PROMO, NEWNESS, WEIGHT, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM product_sale_elements WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, PRODUCT_ID, REF, QUANTITY, PROMO, NEWNESS, WEIGHT, IS_DEFAULT, EAN_CODE, CREATED_AT, UPDATED_AT FROM product_sale_elements WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -568,6 +572,35 @@ abstract class ProductSaleElementsQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(ProductSaleElementsTableMap::IS_DEFAULT, $isDefault, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the ean_code column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByEanCode('fooValue'); // WHERE ean_code = 'fooValue'
|
||||
* $query->filterByEanCode('%fooValue%'); // WHERE ean_code LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $eanCode The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildProductSaleElementsQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByEanCode($eanCode = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($eanCode)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $eanCode)) {
|
||||
$eanCode = str_replace('*', '%', $eanCode);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ProductSaleElementsTableMap::EAN_CODE, $eanCode, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
|
||||
@@ -17,10 +17,10 @@ use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Parser\AbstractParser;
|
||||
use Propel\Runtime\Util\PropelDateTime;
|
||||
use Thelia\Model\Group as ChildGroup;
|
||||
use Thelia\Model\GroupQuery as ChildGroupQuery;
|
||||
use Thelia\Model\GroupResource as ChildGroupResource;
|
||||
use Thelia\Model\GroupResourceQuery as ChildGroupResourceQuery;
|
||||
use Thelia\Model\Profile as ChildProfile;
|
||||
use Thelia\Model\ProfileQuery as ChildProfileQuery;
|
||||
use Thelia\Model\ProfileResource as ChildProfileResource;
|
||||
use Thelia\Model\ProfileResourceQuery as ChildProfileResourceQuery;
|
||||
use Thelia\Model\Resource as ChildResource;
|
||||
use Thelia\Model\ResourceI18n as ChildResourceI18n;
|
||||
use Thelia\Model\ResourceI18nQuery as ChildResourceI18nQuery;
|
||||
@@ -86,10 +86,10 @@ abstract class Resource implements ActiveRecordInterface
|
||||
protected $updated_at;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildGroupResource[] Collection to store aggregation of ChildGroupResource objects.
|
||||
* @var ObjectCollection|ChildProfileResource[] Collection to store aggregation of ChildProfileResource objects.
|
||||
*/
|
||||
protected $collGroupResources;
|
||||
protected $collGroupResourcesPartial;
|
||||
protected $collProfileResources;
|
||||
protected $collProfileResourcesPartial;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildResourceI18n[] Collection to store aggregation of ChildResourceI18n objects.
|
||||
@@ -98,9 +98,9 @@ abstract class Resource implements ActiveRecordInterface
|
||||
protected $collResourceI18nsPartial;
|
||||
|
||||
/**
|
||||
* @var ChildGroup[] Collection to store aggregation of ChildGroup objects.
|
||||
* @var ChildProfile[] Collection to store aggregation of ChildProfile objects.
|
||||
*/
|
||||
protected $collGroups;
|
||||
protected $collProfiles;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
@@ -128,13 +128,13 @@ abstract class Resource implements ActiveRecordInterface
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $groupsScheduledForDeletion = null;
|
||||
protected $profilesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $groupResourcesScheduledForDeletion = null;
|
||||
protected $profileResourcesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
@@ -669,11 +669,11 @@ abstract class Resource implements ActiveRecordInterface
|
||||
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->collGroupResources = null;
|
||||
$this->collProfileResources = null;
|
||||
|
||||
$this->collResourceI18ns = null;
|
||||
|
||||
$this->collGroups = null;
|
||||
$this->collProfiles = null;
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -807,44 +807,44 @@ abstract class Resource implements ActiveRecordInterface
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->groupsScheduledForDeletion !== null) {
|
||||
if (!$this->groupsScheduledForDeletion->isEmpty()) {
|
||||
if ($this->profilesScheduledForDeletion !== null) {
|
||||
if (!$this->profilesScheduledForDeletion->isEmpty()) {
|
||||
$pks = array();
|
||||
$pk = $this->getPrimaryKey();
|
||||
foreach ($this->groupsScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
|
||||
foreach ($this->profilesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
|
||||
$pks[] = array($remotePk, $pk);
|
||||
}
|
||||
|
||||
GroupResourceQuery::create()
|
||||
ProfileResourceQuery::create()
|
||||
->filterByPrimaryKeys($pks)
|
||||
->delete($con);
|
||||
$this->groupsScheduledForDeletion = null;
|
||||
$this->profilesScheduledForDeletion = null;
|
||||
}
|
||||
|
||||
foreach ($this->getGroups() as $group) {
|
||||
if ($group->isModified()) {
|
||||
$group->save($con);
|
||||
foreach ($this->getProfiles() as $profile) {
|
||||
if ($profile->isModified()) {
|
||||
$profile->save($con);
|
||||
}
|
||||
}
|
||||
} elseif ($this->collGroups) {
|
||||
foreach ($this->collGroups as $group) {
|
||||
if ($group->isModified()) {
|
||||
$group->save($con);
|
||||
} elseif ($this->collProfiles) {
|
||||
foreach ($this->collProfiles as $profile) {
|
||||
if ($profile->isModified()) {
|
||||
$profile->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->groupResourcesScheduledForDeletion !== null) {
|
||||
if (!$this->groupResourcesScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\GroupResourceQuery::create()
|
||||
->filterByPrimaryKeys($this->groupResourcesScheduledForDeletion->getPrimaryKeys(false))
|
||||
if ($this->profileResourcesScheduledForDeletion !== null) {
|
||||
if (!$this->profileResourcesScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\ProfileResourceQuery::create()
|
||||
->filterByPrimaryKeys($this->profileResourcesScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->groupResourcesScheduledForDeletion = null;
|
||||
$this->profileResourcesScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collGroupResources !== null) {
|
||||
foreach ($this->collGroupResources as $referrerFK) {
|
||||
if ($this->collProfileResources !== null) {
|
||||
foreach ($this->collProfileResources as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
@@ -1043,8 +1043,8 @@ abstract class Resource implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->collGroupResources) {
|
||||
$result['GroupResources'] = $this->collGroupResources->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
if (null !== $this->collProfileResources) {
|
||||
$result['ProfileResources'] = $this->collProfileResources->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->collResourceI18ns) {
|
||||
$result['ResourceI18ns'] = $this->collResourceI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
@@ -1210,9 +1210,9 @@ abstract class Resource implements ActiveRecordInterface
|
||||
// the getter/setter methods for fkey referrer objects.
|
||||
$copyObj->setNew(false);
|
||||
|
||||
foreach ($this->getGroupResources() as $relObj) {
|
||||
foreach ($this->getProfileResources() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addGroupResource($relObj->copy($deepCopy));
|
||||
$copyObj->addProfileResource($relObj->copy($deepCopy));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1263,8 +1263,8 @@ abstract class Resource implements ActiveRecordInterface
|
||||
*/
|
||||
public function initRelation($relationName)
|
||||
{
|
||||
if ('GroupResource' == $relationName) {
|
||||
return $this->initGroupResources();
|
||||
if ('ProfileResource' == $relationName) {
|
||||
return $this->initProfileResources();
|
||||
}
|
||||
if ('ResourceI18n' == $relationName) {
|
||||
return $this->initResourceI18ns();
|
||||
@@ -1272,31 +1272,31 @@ abstract class Resource implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collGroupResources collection
|
||||
* Clears out the collProfileResources 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 addGroupResources()
|
||||
* @see addProfileResources()
|
||||
*/
|
||||
public function clearGroupResources()
|
||||
public function clearProfileResources()
|
||||
{
|
||||
$this->collGroupResources = null; // important to set this to NULL since that means it is uninitialized
|
||||
$this->collProfileResources = null; // important to set this to NULL since that means it is uninitialized
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset is the collGroupResources collection loaded partially.
|
||||
* Reset is the collProfileResources collection loaded partially.
|
||||
*/
|
||||
public function resetPartialGroupResources($v = true)
|
||||
public function resetPartialProfileResources($v = true)
|
||||
{
|
||||
$this->collGroupResourcesPartial = $v;
|
||||
$this->collProfileResourcesPartial = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collGroupResources collection.
|
||||
* Initializes the collProfileResources collection.
|
||||
*
|
||||
* By default this just sets the collGroupResources collection to an empty array (like clearcollGroupResources());
|
||||
* By default this just sets the collProfileResources collection to an empty array (like clearcollProfileResources());
|
||||
* 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.
|
||||
*
|
||||
@@ -1305,17 +1305,17 @@ abstract class Resource implements ActiveRecordInterface
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initGroupResources($overrideExisting = true)
|
||||
public function initProfileResources($overrideExisting = true)
|
||||
{
|
||||
if (null !== $this->collGroupResources && !$overrideExisting) {
|
||||
if (null !== $this->collProfileResources && !$overrideExisting) {
|
||||
return;
|
||||
}
|
||||
$this->collGroupResources = new ObjectCollection();
|
||||
$this->collGroupResources->setModel('\Thelia\Model\GroupResource');
|
||||
$this->collProfileResources = new ObjectCollection();
|
||||
$this->collProfileResources->setModel('\Thelia\Model\ProfileResource');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of ChildGroupResource objects which contain a foreign key that references this object.
|
||||
* Gets an array of ChildProfileResource 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.
|
||||
@@ -1325,112 +1325,112 @@ abstract class Resource implements ActiveRecordInterface
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @return Collection|ChildGroupResource[] List of ChildGroupResource objects
|
||||
* @return Collection|ChildProfileResource[] List of ChildProfileResource objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getGroupResources($criteria = null, ConnectionInterface $con = null)
|
||||
public function getProfileResources($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collGroupResourcesPartial && !$this->isNew();
|
||||
if (null === $this->collGroupResources || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collGroupResources) {
|
||||
$partial = $this->collProfileResourcesPartial && !$this->isNew();
|
||||
if (null === $this->collProfileResources || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collProfileResources) {
|
||||
// return empty collection
|
||||
$this->initGroupResources();
|
||||
$this->initProfileResources();
|
||||
} else {
|
||||
$collGroupResources = ChildGroupResourceQuery::create(null, $criteria)
|
||||
$collProfileResources = ChildProfileResourceQuery::create(null, $criteria)
|
||||
->filterByResource($this)
|
||||
->find($con);
|
||||
|
||||
if (null !== $criteria) {
|
||||
if (false !== $this->collGroupResourcesPartial && count($collGroupResources)) {
|
||||
$this->initGroupResources(false);
|
||||
if (false !== $this->collProfileResourcesPartial && count($collProfileResources)) {
|
||||
$this->initProfileResources(false);
|
||||
|
||||
foreach ($collGroupResources as $obj) {
|
||||
if (false == $this->collGroupResources->contains($obj)) {
|
||||
$this->collGroupResources->append($obj);
|
||||
foreach ($collProfileResources as $obj) {
|
||||
if (false == $this->collProfileResources->contains($obj)) {
|
||||
$this->collProfileResources->append($obj);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collGroupResourcesPartial = true;
|
||||
$this->collProfileResourcesPartial = true;
|
||||
}
|
||||
|
||||
$collGroupResources->getInternalIterator()->rewind();
|
||||
$collProfileResources->getInternalIterator()->rewind();
|
||||
|
||||
return $collGroupResources;
|
||||
return $collProfileResources;
|
||||
}
|
||||
|
||||
if ($partial && $this->collGroupResources) {
|
||||
foreach ($this->collGroupResources as $obj) {
|
||||
if ($partial && $this->collProfileResources) {
|
||||
foreach ($this->collProfileResources as $obj) {
|
||||
if ($obj->isNew()) {
|
||||
$collGroupResources[] = $obj;
|
||||
$collProfileResources[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->collGroupResources = $collGroupResources;
|
||||
$this->collGroupResourcesPartial = false;
|
||||
$this->collProfileResources = $collProfileResources;
|
||||
$this->collProfileResourcesPartial = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collGroupResources;
|
||||
return $this->collProfileResources;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of GroupResource objects related by a one-to-many relationship
|
||||
* Sets a collection of ProfileResource 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 $groupResources A Propel collection.
|
||||
* @param Collection $profileResources A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildResource The current object (for fluent API support)
|
||||
*/
|
||||
public function setGroupResources(Collection $groupResources, ConnectionInterface $con = null)
|
||||
public function setProfileResources(Collection $profileResources, ConnectionInterface $con = null)
|
||||
{
|
||||
$groupResourcesToDelete = $this->getGroupResources(new Criteria(), $con)->diff($groupResources);
|
||||
$profileResourcesToDelete = $this->getProfileResources(new Criteria(), $con)->diff($profileResources);
|
||||
|
||||
|
||||
//since at least one column in the foreign key is at the same time a PK
|
||||
//we can not just set a PK to NULL in the lines below. We have to store
|
||||
//a backup of all values, so we are able to manipulate these items based on the onDelete value later.
|
||||
$this->groupResourcesScheduledForDeletion = clone $groupResourcesToDelete;
|
||||
$this->profileResourcesScheduledForDeletion = clone $profileResourcesToDelete;
|
||||
|
||||
foreach ($groupResourcesToDelete as $groupResourceRemoved) {
|
||||
$groupResourceRemoved->setResource(null);
|
||||
foreach ($profileResourcesToDelete as $profileResourceRemoved) {
|
||||
$profileResourceRemoved->setResource(null);
|
||||
}
|
||||
|
||||
$this->collGroupResources = null;
|
||||
foreach ($groupResources as $groupResource) {
|
||||
$this->addGroupResource($groupResource);
|
||||
$this->collProfileResources = null;
|
||||
foreach ($profileResources as $profileResource) {
|
||||
$this->addProfileResource($profileResource);
|
||||
}
|
||||
|
||||
$this->collGroupResources = $groupResources;
|
||||
$this->collGroupResourcesPartial = false;
|
||||
$this->collProfileResources = $profileResources;
|
||||
$this->collProfileResourcesPartial = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related GroupResource objects.
|
||||
* Returns the number of related ProfileResource objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param ConnectionInterface $con
|
||||
* @return int Count of related GroupResource objects.
|
||||
* @return int Count of related ProfileResource objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countGroupResources(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
public function countProfileResources(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collGroupResourcesPartial && !$this->isNew();
|
||||
if (null === $this->collGroupResources || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collGroupResources) {
|
||||
$partial = $this->collProfileResourcesPartial && !$this->isNew();
|
||||
if (null === $this->collProfileResources || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collProfileResources) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($partial && !$criteria) {
|
||||
return count($this->getGroupResources());
|
||||
return count($this->getProfileResources());
|
||||
}
|
||||
|
||||
$query = ChildGroupResourceQuery::create(null, $criteria);
|
||||
$query = ChildProfileResourceQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
@@ -1440,53 +1440,53 @@ abstract class Resource implements ActiveRecordInterface
|
||||
->count($con);
|
||||
}
|
||||
|
||||
return count($this->collGroupResources);
|
||||
return count($this->collProfileResources);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called to associate a ChildGroupResource object to this object
|
||||
* through the ChildGroupResource foreign key attribute.
|
||||
* Method called to associate a ChildProfileResource object to this object
|
||||
* through the ChildProfileResource foreign key attribute.
|
||||
*
|
||||
* @param ChildGroupResource $l ChildGroupResource
|
||||
* @param ChildProfileResource $l ChildProfileResource
|
||||
* @return \Thelia\Model\Resource The current object (for fluent API support)
|
||||
*/
|
||||
public function addGroupResource(ChildGroupResource $l)
|
||||
public function addProfileResource(ChildProfileResource $l)
|
||||
{
|
||||
if ($this->collGroupResources === null) {
|
||||
$this->initGroupResources();
|
||||
$this->collGroupResourcesPartial = true;
|
||||
if ($this->collProfileResources === null) {
|
||||
$this->initProfileResources();
|
||||
$this->collProfileResourcesPartial = true;
|
||||
}
|
||||
|
||||
if (!in_array($l, $this->collGroupResources->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddGroupResource($l);
|
||||
if (!in_array($l, $this->collProfileResources->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddProfileResource($l);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param GroupResource $groupResource The groupResource object to add.
|
||||
* @param ProfileResource $profileResource The profileResource object to add.
|
||||
*/
|
||||
protected function doAddGroupResource($groupResource)
|
||||
protected function doAddProfileResource($profileResource)
|
||||
{
|
||||
$this->collGroupResources[]= $groupResource;
|
||||
$groupResource->setResource($this);
|
||||
$this->collProfileResources[]= $profileResource;
|
||||
$profileResource->setResource($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param GroupResource $groupResource The groupResource object to remove.
|
||||
* @param ProfileResource $profileResource The profileResource object to remove.
|
||||
* @return ChildResource The current object (for fluent API support)
|
||||
*/
|
||||
public function removeGroupResource($groupResource)
|
||||
public function removeProfileResource($profileResource)
|
||||
{
|
||||
if ($this->getGroupResources()->contains($groupResource)) {
|
||||
$this->collGroupResources->remove($this->collGroupResources->search($groupResource));
|
||||
if (null === $this->groupResourcesScheduledForDeletion) {
|
||||
$this->groupResourcesScheduledForDeletion = clone $this->collGroupResources;
|
||||
$this->groupResourcesScheduledForDeletion->clear();
|
||||
if ($this->getProfileResources()->contains($profileResource)) {
|
||||
$this->collProfileResources->remove($this->collProfileResources->search($profileResource));
|
||||
if (null === $this->profileResourcesScheduledForDeletion) {
|
||||
$this->profileResourcesScheduledForDeletion = clone $this->collProfileResources;
|
||||
$this->profileResourcesScheduledForDeletion->clear();
|
||||
}
|
||||
$this->groupResourcesScheduledForDeletion[]= clone $groupResource;
|
||||
$groupResource->setResource(null);
|
||||
$this->profileResourcesScheduledForDeletion[]= clone $profileResource;
|
||||
$profileResource->setResource(null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -1498,7 +1498,7 @@ abstract class Resource implements ActiveRecordInterface
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this Resource is new, it will return
|
||||
* an empty collection; or if this Resource has previously
|
||||
* been saved, it will retrieve related GroupResources from storage.
|
||||
* been saved, it will retrieve related ProfileResources from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
@@ -1507,14 +1507,14 @@ abstract class Resource implements ActiveRecordInterface
|
||||
* @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|ChildGroupResource[] List of ChildGroupResource objects
|
||||
* @return Collection|ChildProfileResource[] List of ChildProfileResource objects
|
||||
*/
|
||||
public function getGroupResourcesJoinGroup($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
public function getProfileResourcesJoinProfile($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = ChildGroupResourceQuery::create(null, $criteria);
|
||||
$query->joinWith('Group', $joinBehavior);
|
||||
$query = ChildProfileResourceQuery::create(null, $criteria);
|
||||
$query->joinWith('Profile', $joinBehavior);
|
||||
|
||||
return $this->getGroupResources($query, $con);
|
||||
return $this->getProfileResources($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1743,38 +1743,38 @@ abstract class Resource implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collGroups collection
|
||||
* Clears out the collProfiles 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 addGroups()
|
||||
* @see addProfiles()
|
||||
*/
|
||||
public function clearGroups()
|
||||
public function clearProfiles()
|
||||
{
|
||||
$this->collGroups = null; // important to set this to NULL since that means it is uninitialized
|
||||
$this->collGroupsPartial = null;
|
||||
$this->collProfiles = null; // important to set this to NULL since that means it is uninitialized
|
||||
$this->collProfilesPartial = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collGroups collection.
|
||||
* Initializes the collProfiles collection.
|
||||
*
|
||||
* By default this just sets the collGroups collection to an empty collection (like clearGroups());
|
||||
* By default this just sets the collProfiles collection to an empty collection (like clearProfiles());
|
||||
* 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.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initGroups()
|
||||
public function initProfiles()
|
||||
{
|
||||
$this->collGroups = new ObjectCollection();
|
||||
$this->collGroups->setModel('\Thelia\Model\Group');
|
||||
$this->collProfiles = new ObjectCollection();
|
||||
$this->collProfiles->setModel('\Thelia\Model\Profile');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a collection of ChildGroup objects related by a many-to-many relationship
|
||||
* to the current object by way of the group_resource cross-reference table.
|
||||
* Gets a collection of ChildProfile objects related by a many-to-many relationship
|
||||
* to the current object by way of the profile_resource cross-reference table.
|
||||
*
|
||||
* 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.
|
||||
@@ -1785,73 +1785,73 @@ abstract class Resource implements ActiveRecordInterface
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return ObjectCollection|ChildGroup[] List of ChildGroup objects
|
||||
* @return ObjectCollection|ChildProfile[] List of ChildProfile objects
|
||||
*/
|
||||
public function getGroups($criteria = null, ConnectionInterface $con = null)
|
||||
public function getProfiles($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collGroups || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collGroups) {
|
||||
if (null === $this->collProfiles || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collProfiles) {
|
||||
// return empty collection
|
||||
$this->initGroups();
|
||||
$this->initProfiles();
|
||||
} else {
|
||||
$collGroups = ChildGroupQuery::create(null, $criteria)
|
||||
$collProfiles = ChildProfileQuery::create(null, $criteria)
|
||||
->filterByResource($this)
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
return $collGroups;
|
||||
return $collProfiles;
|
||||
}
|
||||
$this->collGroups = $collGroups;
|
||||
$this->collProfiles = $collProfiles;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collGroups;
|
||||
return $this->collProfiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of Group objects related by a many-to-many relationship
|
||||
* to the current object by way of the group_resource cross-reference table.
|
||||
* Sets a collection of Profile objects related by a many-to-many relationship
|
||||
* to the current object by way of the profile_resource cross-reference table.
|
||||
* 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 $groups A Propel collection.
|
||||
* @param Collection $profiles A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildResource The current object (for fluent API support)
|
||||
*/
|
||||
public function setGroups(Collection $groups, ConnectionInterface $con = null)
|
||||
public function setProfiles(Collection $profiles, ConnectionInterface $con = null)
|
||||
{
|
||||
$this->clearGroups();
|
||||
$currentGroups = $this->getGroups();
|
||||
$this->clearProfiles();
|
||||
$currentProfiles = $this->getProfiles();
|
||||
|
||||
$this->groupsScheduledForDeletion = $currentGroups->diff($groups);
|
||||
$this->profilesScheduledForDeletion = $currentProfiles->diff($profiles);
|
||||
|
||||
foreach ($groups as $group) {
|
||||
if (!$currentGroups->contains($group)) {
|
||||
$this->doAddGroup($group);
|
||||
foreach ($profiles as $profile) {
|
||||
if (!$currentProfiles->contains($profile)) {
|
||||
$this->doAddProfile($profile);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collGroups = $groups;
|
||||
$this->collProfiles = $profiles;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of ChildGroup objects related by a many-to-many relationship
|
||||
* to the current object by way of the group_resource cross-reference table.
|
||||
* Gets the number of ChildProfile objects related by a many-to-many relationship
|
||||
* to the current object by way of the profile_resource cross-reference table.
|
||||
*
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param boolean $distinct Set to true to force count distinct
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return int the number of related ChildGroup objects
|
||||
* @return int the number of related ChildProfile objects
|
||||
*/
|
||||
public function countGroups($criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
public function countProfiles($criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collGroups || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collGroups) {
|
||||
if (null === $this->collProfiles || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collProfiles) {
|
||||
return 0;
|
||||
} else {
|
||||
$query = ChildGroupQuery::create(null, $criteria);
|
||||
$query = ChildProfileQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
@@ -1861,65 +1861,65 @@ abstract class Resource implements ActiveRecordInterface
|
||||
->count($con);
|
||||
}
|
||||
} else {
|
||||
return count($this->collGroups);
|
||||
return count($this->collProfiles);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate a ChildGroup object to this object
|
||||
* through the group_resource cross reference table.
|
||||
* Associate a ChildProfile object to this object
|
||||
* through the profile_resource cross reference table.
|
||||
*
|
||||
* @param ChildGroup $group The ChildGroupResource object to relate
|
||||
* @param ChildProfile $profile The ChildProfileResource object to relate
|
||||
* @return ChildResource The current object (for fluent API support)
|
||||
*/
|
||||
public function addGroup(ChildGroup $group)
|
||||
public function addProfile(ChildProfile $profile)
|
||||
{
|
||||
if ($this->collGroups === null) {
|
||||
$this->initGroups();
|
||||
if ($this->collProfiles === null) {
|
||||
$this->initProfiles();
|
||||
}
|
||||
|
||||
if (!$this->collGroups->contains($group)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddGroup($group);
|
||||
$this->collGroups[] = $group;
|
||||
if (!$this->collProfiles->contains($profile)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddProfile($profile);
|
||||
$this->collProfiles[] = $profile;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Group $group The group object to add.
|
||||
* @param Profile $profile The profile object to add.
|
||||
*/
|
||||
protected function doAddGroup($group)
|
||||
protected function doAddProfile($profile)
|
||||
{
|
||||
$groupResource = new ChildGroupResource();
|
||||
$groupResource->setGroup($group);
|
||||
$this->addGroupResource($groupResource);
|
||||
$profileResource = new ChildProfileResource();
|
||||
$profileResource->setProfile($profile);
|
||||
$this->addProfileResource($profileResource);
|
||||
// set the back reference to this object directly as using provided method either results
|
||||
// in endless loop or in multiple relations
|
||||
if (!$group->getResources()->contains($this)) {
|
||||
$foreignCollection = $group->getResources();
|
||||
if (!$profile->getResources()->contains($this)) {
|
||||
$foreignCollection = $profile->getResources();
|
||||
$foreignCollection[] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a ChildGroup object to this object
|
||||
* through the group_resource cross reference table.
|
||||
* Remove a ChildProfile object to this object
|
||||
* through the profile_resource cross reference table.
|
||||
*
|
||||
* @param ChildGroup $group The ChildGroupResource object to relate
|
||||
* @param ChildProfile $profile The ChildProfileResource object to relate
|
||||
* @return ChildResource The current object (for fluent API support)
|
||||
*/
|
||||
public function removeGroup(ChildGroup $group)
|
||||
public function removeProfile(ChildProfile $profile)
|
||||
{
|
||||
if ($this->getGroups()->contains($group)) {
|
||||
$this->collGroups->remove($this->collGroups->search($group));
|
||||
if ($this->getProfiles()->contains($profile)) {
|
||||
$this->collProfiles->remove($this->collProfiles->search($profile));
|
||||
|
||||
if (null === $this->groupsScheduledForDeletion) {
|
||||
$this->groupsScheduledForDeletion = clone $this->collGroups;
|
||||
$this->groupsScheduledForDeletion->clear();
|
||||
if (null === $this->profilesScheduledForDeletion) {
|
||||
$this->profilesScheduledForDeletion = clone $this->collProfiles;
|
||||
$this->profilesScheduledForDeletion->clear();
|
||||
}
|
||||
|
||||
$this->groupsScheduledForDeletion[] = $group;
|
||||
$this->profilesScheduledForDeletion[] = $profile;
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -1953,8 +1953,8 @@ abstract class Resource implements ActiveRecordInterface
|
||||
public function clearAllReferences($deep = false)
|
||||
{
|
||||
if ($deep) {
|
||||
if ($this->collGroupResources) {
|
||||
foreach ($this->collGroupResources as $o) {
|
||||
if ($this->collProfileResources) {
|
||||
foreach ($this->collProfileResources as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
@@ -1963,8 +1963,8 @@ abstract class Resource implements ActiveRecordInterface
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collGroups) {
|
||||
foreach ($this->collGroups as $o) {
|
||||
if ($this->collProfiles) {
|
||||
foreach ($this->collProfiles as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
@@ -1974,18 +1974,18 @@ abstract class Resource implements ActiveRecordInterface
|
||||
$this->currentLocale = 'en_US';
|
||||
$this->currentTranslations = null;
|
||||
|
||||
if ($this->collGroupResources instanceof Collection) {
|
||||
$this->collGroupResources->clearIterator();
|
||||
if ($this->collProfileResources instanceof Collection) {
|
||||
$this->collProfileResources->clearIterator();
|
||||
}
|
||||
$this->collGroupResources = null;
|
||||
$this->collProfileResources = null;
|
||||
if ($this->collResourceI18ns instanceof Collection) {
|
||||
$this->collResourceI18ns->clearIterator();
|
||||
}
|
||||
$this->collResourceI18ns = null;
|
||||
if ($this->collGroups instanceof Collection) {
|
||||
$this->collGroups->clearIterator();
|
||||
if ($this->collProfiles instanceof Collection) {
|
||||
$this->collProfiles->clearIterator();
|
||||
}
|
||||
$this->collGroups = null;
|
||||
$this->collProfiles = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,9 +36,9 @@ use Thelia\Model\Map\ResourceTableMap;
|
||||
* @method ChildResourceQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildResourceQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildResourceQuery leftJoinGroupResource($relationAlias = null) Adds a LEFT JOIN clause to the query using the GroupResource relation
|
||||
* @method ChildResourceQuery rightJoinGroupResource($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GroupResource relation
|
||||
* @method ChildResourceQuery innerJoinGroupResource($relationAlias = null) Adds a INNER JOIN clause to the query using the GroupResource relation
|
||||
* @method ChildResourceQuery leftJoinProfileResource($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProfileResource relation
|
||||
* @method ChildResourceQuery rightJoinProfileResource($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProfileResource relation
|
||||
* @method ChildResourceQuery innerJoinProfileResource($relationAlias = null) Adds a INNER JOIN clause to the query using the ProfileResource relation
|
||||
*
|
||||
* @method ChildResourceQuery leftJoinResourceI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ResourceI18n relation
|
||||
* @method ChildResourceQuery rightJoinResourceI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ResourceI18n relation
|
||||
@@ -390,40 +390,40 @@ abstract class ResourceQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\GroupResource object
|
||||
* Filter the query by a related \Thelia\Model\ProfileResource object
|
||||
*
|
||||
* @param \Thelia\Model\GroupResource|ObjectCollection $groupResource the related object to use as filter
|
||||
* @param \Thelia\Model\ProfileResource|ObjectCollection $profileResource the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildResourceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByGroupResource($groupResource, $comparison = null)
|
||||
public function filterByProfileResource($profileResource, $comparison = null)
|
||||
{
|
||||
if ($groupResource instanceof \Thelia\Model\GroupResource) {
|
||||
if ($profileResource instanceof \Thelia\Model\ProfileResource) {
|
||||
return $this
|
||||
->addUsingAlias(ResourceTableMap::ID, $groupResource->getResourceId(), $comparison);
|
||||
} elseif ($groupResource instanceof ObjectCollection) {
|
||||
->addUsingAlias(ResourceTableMap::ID, $profileResource->getResourceId(), $comparison);
|
||||
} elseif ($profileResource instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useGroupResourceQuery()
|
||||
->filterByPrimaryKeys($groupResource->getPrimaryKeys())
|
||||
->useProfileResourceQuery()
|
||||
->filterByPrimaryKeys($profileResource->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByGroupResource() only accepts arguments of type \Thelia\Model\GroupResource or Collection');
|
||||
throw new PropelException('filterByProfileResource() only accepts arguments of type \Thelia\Model\ProfileResource or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the GroupResource relation
|
||||
* Adds a JOIN clause to the query using the ProfileResource relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildResourceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinGroupResource($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinProfileResource($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('GroupResource');
|
||||
$relationMap = $tableMap->getRelation('ProfileResource');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
@@ -438,14 +438,14 @@ abstract class ResourceQuery extends ModelCriteria
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'GroupResource');
|
||||
$this->addJoinObject($join, 'ProfileResource');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the GroupResource relation GroupResource object
|
||||
* Use the ProfileResource relation ProfileResource object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
@@ -453,13 +453,13 @@ abstract class ResourceQuery extends ModelCriteria
|
||||
* 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\GroupResourceQuery A secondary query class using the current class as primary query
|
||||
* @return \Thelia\Model\ProfileResourceQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useGroupResourceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useProfileResourceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinGroupResource($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'GroupResource', '\Thelia\Model\GroupResourceQuery');
|
||||
->joinProfileResource($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'ProfileResource', '\Thelia\Model\ProfileResourceQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -536,19 +536,19 @@ abstract class ResourceQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Group object
|
||||
* using the group_resource table as cross reference
|
||||
* Filter the query by a related Profile object
|
||||
* using the profile_resource table as cross reference
|
||||
*
|
||||
* @param Group $group the related object to use as filter
|
||||
* @param Profile $profile the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildResourceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByGroup($group, $comparison = Criteria::EQUAL)
|
||||
public function filterByProfile($profile, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useGroupResourceQuery()
|
||||
->filterByGroup($group, $comparison)
|
||||
->useProfileResourceQuery()
|
||||
->filterByProfile($profile, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,35 @@
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\Country as BaseCountry;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class Country extends BaseCountry {
|
||||
|
||||
/**
|
||||
* Return the default country
|
||||
*
|
||||
* @throws LogicException if no default country is defined
|
||||
*/
|
||||
public static function getDefaultCountry() {
|
||||
$dc = CountryQuery::create()->findOneByByDefault(true);
|
||||
|
||||
if ($dc == null)
|
||||
throw new \LogicException(Translator::getInstance()->trans("Cannot find a default country. Please define one."));
|
||||
|
||||
return $dc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the shop country
|
||||
*
|
||||
* @throws LogicException if no shop country is defined
|
||||
*/
|
||||
public static function getShopLocation() {
|
||||
$dc = CountryQuery::create()->findOneByShopCountry(true);
|
||||
|
||||
if ($dc == null)
|
||||
throw new \LogicException(Translator::getInstance()->trans("Cannot find the shop country. Please select a shop country."));
|
||||
|
||||
return $dc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class AdminTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 11;
|
||||
const NUM_COLUMNS = 12;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,13 +67,18 @@ class AdminTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 11;
|
||||
const NUM_HYDRATE_COLUMNS = 12;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'admin.ID';
|
||||
|
||||
/**
|
||||
* the column name for the PROFILE_ID field
|
||||
*/
|
||||
const PROFILE_ID = 'admin.PROFILE_ID';
|
||||
|
||||
/**
|
||||
* the column name for the FIRSTNAME field
|
||||
*/
|
||||
@@ -136,12 +141,12 @@ class AdminTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Firstname', 'Lastname', 'Login', 'Password', 'Algo', 'Salt', 'RememberMeToken', 'RememberMeSerial', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'rememberMeToken', 'rememberMeSerial', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(AdminTableMap::ID, AdminTableMap::FIRSTNAME, AdminTableMap::LASTNAME, AdminTableMap::LOGIN, AdminTableMap::PASSWORD, AdminTableMap::ALGO, AdminTableMap::SALT, AdminTableMap::REMEMBER_ME_TOKEN, AdminTableMap::REMEMBER_ME_SERIAL, AdminTableMap::CREATED_AT, AdminTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'FIRSTNAME', 'LASTNAME', 'LOGIN', 'PASSWORD', 'ALGO', 'SALT', 'REMEMBER_ME_TOKEN', 'REMEMBER_ME_SERIAL', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'remember_me_token', 'remember_me_serial', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
self::TYPE_PHPNAME => array('Id', 'ProfileId', 'Firstname', 'Lastname', 'Login', 'Password', 'Algo', 'Salt', 'RememberMeToken', 'RememberMeSerial', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'profileId', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'rememberMeToken', 'rememberMeSerial', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(AdminTableMap::ID, AdminTableMap::PROFILE_ID, AdminTableMap::FIRSTNAME, AdminTableMap::LASTNAME, AdminTableMap::LOGIN, AdminTableMap::PASSWORD, AdminTableMap::ALGO, AdminTableMap::SALT, AdminTableMap::REMEMBER_ME_TOKEN, AdminTableMap::REMEMBER_ME_SERIAL, AdminTableMap::CREATED_AT, AdminTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'PROFILE_ID', 'FIRSTNAME', 'LASTNAME', 'LOGIN', 'PASSWORD', 'ALGO', 'SALT', 'REMEMBER_ME_TOKEN', 'REMEMBER_ME_SERIAL', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'profile_id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'remember_me_token', 'remember_me_serial', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -151,12 +156,12 @@ class AdminTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Firstname' => 1, 'Lastname' => 2, 'Login' => 3, 'Password' => 4, 'Algo' => 5, 'Salt' => 6, 'RememberMeToken' => 7, 'RememberMeSerial' => 8, 'CreatedAt' => 9, 'UpdatedAt' => 10, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'rememberMeToken' => 7, 'rememberMeSerial' => 8, 'createdAt' => 9, 'updatedAt' => 10, ),
|
||||
self::TYPE_COLNAME => array(AdminTableMap::ID => 0, AdminTableMap::FIRSTNAME => 1, AdminTableMap::LASTNAME => 2, AdminTableMap::LOGIN => 3, AdminTableMap::PASSWORD => 4, AdminTableMap::ALGO => 5, AdminTableMap::SALT => 6, AdminTableMap::REMEMBER_ME_TOKEN => 7, AdminTableMap::REMEMBER_ME_SERIAL => 8, AdminTableMap::CREATED_AT => 9, AdminTableMap::UPDATED_AT => 10, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'FIRSTNAME' => 1, 'LASTNAME' => 2, 'LOGIN' => 3, 'PASSWORD' => 4, 'ALGO' => 5, 'SALT' => 6, 'REMEMBER_ME_TOKEN' => 7, 'REMEMBER_ME_SERIAL' => 8, 'CREATED_AT' => 9, 'UPDATED_AT' => 10, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'remember_me_token' => 7, 'remember_me_serial' => 8, 'created_at' => 9, 'updated_at' => 10, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'ProfileId' => 1, 'Firstname' => 2, 'Lastname' => 3, 'Login' => 4, 'Password' => 5, 'Algo' => 6, 'Salt' => 7, 'RememberMeToken' => 8, 'RememberMeSerial' => 9, 'CreatedAt' => 10, 'UpdatedAt' => 11, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'profileId' => 1, 'firstname' => 2, 'lastname' => 3, 'login' => 4, 'password' => 5, 'algo' => 6, 'salt' => 7, 'rememberMeToken' => 8, 'rememberMeSerial' => 9, 'createdAt' => 10, 'updatedAt' => 11, ),
|
||||
self::TYPE_COLNAME => array(AdminTableMap::ID => 0, AdminTableMap::PROFILE_ID => 1, AdminTableMap::FIRSTNAME => 2, AdminTableMap::LASTNAME => 3, AdminTableMap::LOGIN => 4, AdminTableMap::PASSWORD => 5, AdminTableMap::ALGO => 6, AdminTableMap::SALT => 7, AdminTableMap::REMEMBER_ME_TOKEN => 8, AdminTableMap::REMEMBER_ME_SERIAL => 9, AdminTableMap::CREATED_AT => 10, AdminTableMap::UPDATED_AT => 11, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PROFILE_ID' => 1, 'FIRSTNAME' => 2, 'LASTNAME' => 3, 'LOGIN' => 4, 'PASSWORD' => 5, 'ALGO' => 6, 'SALT' => 7, 'REMEMBER_ME_TOKEN' => 8, 'REMEMBER_ME_SERIAL' => 9, 'CREATED_AT' => 10, 'UPDATED_AT' => 11, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'profile_id' => 1, 'firstname' => 2, 'lastname' => 3, 'login' => 4, 'password' => 5, 'algo' => 6, 'salt' => 7, 'remember_me_token' => 8, 'remember_me_serial' => 9, 'created_at' => 10, 'updated_at' => 11, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -176,6 +181,7 @@ class AdminTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('PROFILE_ID', 'ProfileId', 'INTEGER', 'profile', 'ID', false, null, null);
|
||||
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', true, 100, null);
|
||||
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', true, 100, null);
|
||||
$this->addColumn('LOGIN', 'Login', 'VARCHAR', true, 100, null);
|
||||
@@ -193,8 +199,7 @@ class AdminTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('AdminGroup', '\\Thelia\\Model\\AdminGroup', RelationMap::ONE_TO_MANY, array('id' => 'admin_id', ), 'CASCADE', 'RESTRICT', 'AdminGroups');
|
||||
$this->addRelation('Group', '\\Thelia\\Model\\Group', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Groups');
|
||||
$this->addRelation('Profile', '\\Thelia\\Model\\Profile', RelationMap::MANY_TO_ONE, array('profile_id' => 'id', ), 'RESTRICT', 'RESTRICT');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
@@ -209,15 +214,6 @@ class AdminTableMap extends TableMap
|
||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
|
||||
);
|
||||
} // getBehaviors()
|
||||
/**
|
||||
* Method to invalidate the instance pool of all tables related to admin * by a foreign key with ON DELETE CASCADE
|
||||
*/
|
||||
public static function clearRelatedInstancePool()
|
||||
{
|
||||
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
AdminGroupTableMap::clearInstancePool();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
@@ -358,6 +354,7 @@ class AdminTableMap extends TableMap
|
||||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(AdminTableMap::ID);
|
||||
$criteria->addSelectColumn(AdminTableMap::PROFILE_ID);
|
||||
$criteria->addSelectColumn(AdminTableMap::FIRSTNAME);
|
||||
$criteria->addSelectColumn(AdminTableMap::LASTNAME);
|
||||
$criteria->addSelectColumn(AdminTableMap::LOGIN);
|
||||
@@ -370,6 +367,7 @@ class AdminTableMap extends TableMap
|
||||
$criteria->addSelectColumn(AdminTableMap::UPDATED_AT);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.PROFILE_ID');
|
||||
$criteria->addSelectColumn($alias . '.FIRSTNAME');
|
||||
$criteria->addSelectColumn($alias . '.LASTNAME');
|
||||
$criteria->addSelectColumn($alias . '.LOGIN');
|
||||
|
||||
@@ -57,7 +57,7 @@ class CountryTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 8;
|
||||
const NUM_COLUMNS = 9;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class CountryTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 8;
|
||||
const NUM_HYDRATE_COLUMNS = 9;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -99,6 +99,11 @@ class CountryTableMap extends TableMap
|
||||
*/
|
||||
const BY_DEFAULT = 'country.BY_DEFAULT';
|
||||
|
||||
/**
|
||||
* the column name for the SHOP_COUNTRY field
|
||||
*/
|
||||
const SHOP_COUNTRY = 'country.SHOP_COUNTRY';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
@@ -130,12 +135,12 @@ class CountryTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'AreaId', 'Isocode', 'Isoalpha2', 'Isoalpha3', 'ByDefault', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'isocode', 'isoalpha2', 'isoalpha3', 'byDefault', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(CountryTableMap::ID, CountryTableMap::AREA_ID, CountryTableMap::ISOCODE, CountryTableMap::ISOALPHA2, CountryTableMap::ISOALPHA3, CountryTableMap::BY_DEFAULT, CountryTableMap::CREATED_AT, CountryTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'ISOCODE', 'ISOALPHA2', 'ISOALPHA3', 'BY_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'area_id', 'isocode', 'isoalpha2', 'isoalpha3', 'by_default', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
|
||||
self::TYPE_PHPNAME => array('Id', 'AreaId', 'Isocode', 'Isoalpha2', 'Isoalpha3', 'ByDefault', 'ShopCountry', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'isocode', 'isoalpha2', 'isoalpha3', 'byDefault', 'shopCountry', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(CountryTableMap::ID, CountryTableMap::AREA_ID, CountryTableMap::ISOCODE, CountryTableMap::ISOALPHA2, CountryTableMap::ISOALPHA3, CountryTableMap::BY_DEFAULT, CountryTableMap::SHOP_COUNTRY, CountryTableMap::CREATED_AT, CountryTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'ISOCODE', 'ISOALPHA2', 'ISOALPHA3', 'BY_DEFAULT', 'SHOP_COUNTRY', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'area_id', 'isocode', 'isoalpha2', 'isoalpha3', 'by_default', 'shop_country', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -145,12 +150,12 @@ class CountryTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'AreaId' => 1, 'Isocode' => 2, 'Isoalpha2' => 3, 'Isoalpha3' => 4, 'ByDefault' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'isocode' => 2, 'isoalpha2' => 3, 'isoalpha3' => 4, 'byDefault' => 5, 'createdAt' => 6, 'updatedAt' => 7, ),
|
||||
self::TYPE_COLNAME => array(CountryTableMap::ID => 0, CountryTableMap::AREA_ID => 1, CountryTableMap::ISOCODE => 2, CountryTableMap::ISOALPHA2 => 3, CountryTableMap::ISOALPHA3 => 4, CountryTableMap::BY_DEFAULT => 5, CountryTableMap::CREATED_AT => 6, CountryTableMap::UPDATED_AT => 7, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'ISOCODE' => 2, 'ISOALPHA2' => 3, 'ISOALPHA3' => 4, 'BY_DEFAULT' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'isocode' => 2, 'isoalpha2' => 3, 'isoalpha3' => 4, 'by_default' => 5, 'created_at' => 6, 'updated_at' => 7, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'AreaId' => 1, 'Isocode' => 2, 'Isoalpha2' => 3, 'Isoalpha3' => 4, 'ByDefault' => 5, 'ShopCountry' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'isocode' => 2, 'isoalpha2' => 3, 'isoalpha3' => 4, 'byDefault' => 5, 'shopCountry' => 6, 'createdAt' => 7, 'updatedAt' => 8, ),
|
||||
self::TYPE_COLNAME => array(CountryTableMap::ID => 0, CountryTableMap::AREA_ID => 1, CountryTableMap::ISOCODE => 2, CountryTableMap::ISOALPHA2 => 3, CountryTableMap::ISOALPHA3 => 4, CountryTableMap::BY_DEFAULT => 5, CountryTableMap::SHOP_COUNTRY => 6, CountryTableMap::CREATED_AT => 7, CountryTableMap::UPDATED_AT => 8, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'ISOCODE' => 2, 'ISOALPHA2' => 3, 'ISOALPHA3' => 4, 'BY_DEFAULT' => 5, 'SHOP_COUNTRY' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'isocode' => 2, 'isoalpha2' => 3, 'isoalpha3' => 4, 'by_default' => 5, 'shop_country' => 6, 'created_at' => 7, 'updated_at' => 8, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -167,14 +172,15 @@ class CountryTableMap extends TableMap
|
||||
$this->setPhpName('Country');
|
||||
$this->setClassName('\\Thelia\\Model\\Country');
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(false);
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', false, null, null);
|
||||
$this->addColumn('ISOCODE', 'Isocode', 'VARCHAR', true, 4, null);
|
||||
$this->addColumn('ISOALPHA2', 'Isoalpha2', 'VARCHAR', false, 2, null);
|
||||
$this->addColumn('ISOALPHA3', 'Isoalpha3', 'VARCHAR', false, 4, null);
|
||||
$this->addColumn('BY_DEFAULT', 'ByDefault', 'TINYINT', false, null, null);
|
||||
$this->addColumn('BY_DEFAULT', 'ByDefault', 'TINYINT', false, null, 0);
|
||||
$this->addColumn('SHOP_COUNTRY', 'ShopCountry', 'BOOLEAN', true, 1, false);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
@@ -358,6 +364,7 @@ class CountryTableMap extends TableMap
|
||||
$criteria->addSelectColumn(CountryTableMap::ISOALPHA2);
|
||||
$criteria->addSelectColumn(CountryTableMap::ISOALPHA3);
|
||||
$criteria->addSelectColumn(CountryTableMap::BY_DEFAULT);
|
||||
$criteria->addSelectColumn(CountryTableMap::SHOP_COUNTRY);
|
||||
$criteria->addSelectColumn(CountryTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(CountryTableMap::UPDATED_AT);
|
||||
} else {
|
||||
@@ -367,6 +374,7 @@ class CountryTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.ISOALPHA2');
|
||||
$criteria->addSelectColumn($alias . '.ISOALPHA3');
|
||||
$criteria->addSelectColumn($alias . '.BY_DEFAULT');
|
||||
$criteria->addSelectColumn($alias . '.SHOP_COUNTRY');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
@@ -466,6 +474,10 @@ class CountryTableMap extends TableMap
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from Country object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(CountryTableMap::ID) && $criteria->keyContainsValue(CountryTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CountryTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = CountryQuery::create()->mergeWith($criteria);
|
||||
|
||||
@@ -205,7 +205,7 @@ class CustomerTableMap extends TableMap
|
||||
$this->addForeignKey('TITLE_ID', 'TitleId', 'INTEGER', 'customer_title', 'ID', true, null, null);
|
||||
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('EMAIL', 'Email', 'VARCHAR', false, 50, null);
|
||||
$this->addColumn('EMAIL', 'Email', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('PASSWORD', 'Password', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('ALGO', 'Algo', 'VARCHAR', false, 128, null);
|
||||
$this->addColumn('RESELLER', 'Reseller', 'TINYINT', false, null, null);
|
||||
|
||||
@@ -187,7 +187,7 @@ class ModuleTableMap extends TableMap
|
||||
$this->addRelation('OrderRelatedByPaymentModuleId', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'payment_module_id', ), 'RESTRICT', 'RESTRICT', 'OrdersRelatedByPaymentModuleId');
|
||||
$this->addRelation('OrderRelatedByDeliveryModuleId', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'delivery_module_id', ), 'RESTRICT', 'RESTRICT', 'OrdersRelatedByDeliveryModuleId');
|
||||
$this->addRelation('AreaDeliveryModule', '\\Thelia\\Model\\AreaDeliveryModule', RelationMap::ONE_TO_MANY, array('id' => 'delivery_module_id', ), 'CASCADE', 'RESTRICT', 'AreaDeliveryModules');
|
||||
$this->addRelation('GroupModule', '\\Thelia\\Model\\GroupModule', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', 'RESTRICT', 'GroupModules');
|
||||
$this->addRelation('ProfileModule', '\\Thelia\\Model\\ProfileModule', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', 'RESTRICT', 'ProfileModules');
|
||||
$this->addRelation('ModuleImage', '\\Thelia\\Model\\ModuleImage', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', 'RESTRICT', 'ModuleImages');
|
||||
$this->addRelation('ModuleI18n', '\\Thelia\\Model\\ModuleI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ModuleI18ns');
|
||||
} // buildRelations()
|
||||
@@ -213,7 +213,7 @@ class ModuleTableMap extends TableMap
|
||||
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
AreaDeliveryModuleTableMap::clearInstancePool();
|
||||
GroupModuleTableMap::clearInstancePool();
|
||||
ProfileModuleTableMap::clearInstancePool();
|
||||
ModuleImageTableMap::clearInstancePool();
|
||||
ModuleI18nTableMap::clearInstancePool();
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class OrderProductTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 19;
|
||||
const NUM_COLUMNS = 20;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class OrderProductTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 19;
|
||||
const NUM_HYDRATE_COLUMNS = 20;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -139,6 +139,11 @@ class OrderProductTableMap extends TableMap
|
||||
*/
|
||||
const WEIGHT = 'order_product.WEIGHT';
|
||||
|
||||
/**
|
||||
* the column name for the EAN_CODE field
|
||||
*/
|
||||
const EAN_CODE = 'order_product.EAN_CODE';
|
||||
|
||||
/**
|
||||
* the column name for the TAX_RULE_TITLE field
|
||||
*/
|
||||
@@ -176,12 +181,12 @@ class OrderProductTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'OrderId', 'ProductRef', 'ProductSaleElementsRef', 'Title', 'Chapo', 'Description', 'Postscriptum', 'Quantity', 'Price', 'PromoPrice', 'WasNew', 'WasInPromo', 'Weight', 'TaxRuleTitle', 'TaxRuleDescription', 'Parent', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'productRef', 'productSaleElementsRef', 'title', 'chapo', 'description', 'postscriptum', 'quantity', 'price', 'promoPrice', 'wasNew', 'wasInPromo', 'weight', 'taxRuleTitle', 'taxRuleDescription', 'parent', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(OrderProductTableMap::ID, OrderProductTableMap::ORDER_ID, OrderProductTableMap::PRODUCT_REF, OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF, OrderProductTableMap::TITLE, OrderProductTableMap::CHAPO, OrderProductTableMap::DESCRIPTION, OrderProductTableMap::POSTSCRIPTUM, OrderProductTableMap::QUANTITY, OrderProductTableMap::PRICE, OrderProductTableMap::PROMO_PRICE, OrderProductTableMap::WAS_NEW, OrderProductTableMap::WAS_IN_PROMO, OrderProductTableMap::WEIGHT, OrderProductTableMap::TAX_RULE_TITLE, OrderProductTableMap::TAX_RULE_DESCRIPTION, OrderProductTableMap::PARENT, OrderProductTableMap::CREATED_AT, OrderProductTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'PRODUCT_REF', 'PRODUCT_SALE_ELEMENTS_REF', 'TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'QUANTITY', 'PRICE', 'PROMO_PRICE', 'WAS_NEW', 'WAS_IN_PROMO', 'WEIGHT', 'TAX_RULE_TITLE', 'TAX_RULE_DESCRIPTION', 'PARENT', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'order_id', 'product_ref', 'product_sale_elements_ref', 'title', 'chapo', 'description', 'postscriptum', 'quantity', 'price', 'promo_price', 'was_new', 'was_in_promo', 'weight', 'tax_rule_title', 'tax_rule_description', 'parent', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, )
|
||||
self::TYPE_PHPNAME => array('Id', 'OrderId', 'ProductRef', 'ProductSaleElementsRef', 'Title', 'Chapo', 'Description', 'Postscriptum', 'Quantity', 'Price', 'PromoPrice', 'WasNew', 'WasInPromo', 'Weight', 'EanCode', 'TaxRuleTitle', 'TaxRuleDescription', 'Parent', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'productRef', 'productSaleElementsRef', 'title', 'chapo', 'description', 'postscriptum', 'quantity', 'price', 'promoPrice', 'wasNew', 'wasInPromo', 'weight', 'eanCode', 'taxRuleTitle', 'taxRuleDescription', 'parent', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(OrderProductTableMap::ID, OrderProductTableMap::ORDER_ID, OrderProductTableMap::PRODUCT_REF, OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF, OrderProductTableMap::TITLE, OrderProductTableMap::CHAPO, OrderProductTableMap::DESCRIPTION, OrderProductTableMap::POSTSCRIPTUM, OrderProductTableMap::QUANTITY, OrderProductTableMap::PRICE, OrderProductTableMap::PROMO_PRICE, OrderProductTableMap::WAS_NEW, OrderProductTableMap::WAS_IN_PROMO, OrderProductTableMap::WEIGHT, OrderProductTableMap::EAN_CODE, OrderProductTableMap::TAX_RULE_TITLE, OrderProductTableMap::TAX_RULE_DESCRIPTION, OrderProductTableMap::PARENT, OrderProductTableMap::CREATED_AT, OrderProductTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'PRODUCT_REF', 'PRODUCT_SALE_ELEMENTS_REF', 'TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'QUANTITY', 'PRICE', 'PROMO_PRICE', 'WAS_NEW', 'WAS_IN_PROMO', 'WEIGHT', 'EAN_CODE', 'TAX_RULE_TITLE', 'TAX_RULE_DESCRIPTION', 'PARENT', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'order_id', 'product_ref', 'product_sale_elements_ref', 'title', 'chapo', 'description', 'postscriptum', 'quantity', 'price', 'promo_price', 'was_new', 'was_in_promo', 'weight', 'ean_code', 'tax_rule_title', 'tax_rule_description', 'parent', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -191,12 +196,12 @@ class OrderProductTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'ProductRef' => 2, 'ProductSaleElementsRef' => 3, 'Title' => 4, 'Chapo' => 5, 'Description' => 6, 'Postscriptum' => 7, 'Quantity' => 8, 'Price' => 9, 'PromoPrice' => 10, 'WasNew' => 11, 'WasInPromo' => 12, 'Weight' => 13, 'TaxRuleTitle' => 14, 'TaxRuleDescription' => 15, 'Parent' => 16, 'CreatedAt' => 17, 'UpdatedAt' => 18, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'productRef' => 2, 'productSaleElementsRef' => 3, 'title' => 4, 'chapo' => 5, 'description' => 6, 'postscriptum' => 7, 'quantity' => 8, 'price' => 9, 'promoPrice' => 10, 'wasNew' => 11, 'wasInPromo' => 12, 'weight' => 13, 'taxRuleTitle' => 14, 'taxRuleDescription' => 15, 'parent' => 16, 'createdAt' => 17, 'updatedAt' => 18, ),
|
||||
self::TYPE_COLNAME => array(OrderProductTableMap::ID => 0, OrderProductTableMap::ORDER_ID => 1, OrderProductTableMap::PRODUCT_REF => 2, OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF => 3, OrderProductTableMap::TITLE => 4, OrderProductTableMap::CHAPO => 5, OrderProductTableMap::DESCRIPTION => 6, OrderProductTableMap::POSTSCRIPTUM => 7, OrderProductTableMap::QUANTITY => 8, OrderProductTableMap::PRICE => 9, OrderProductTableMap::PROMO_PRICE => 10, OrderProductTableMap::WAS_NEW => 11, OrderProductTableMap::WAS_IN_PROMO => 12, OrderProductTableMap::WEIGHT => 13, OrderProductTableMap::TAX_RULE_TITLE => 14, OrderProductTableMap::TAX_RULE_DESCRIPTION => 15, OrderProductTableMap::PARENT => 16, OrderProductTableMap::CREATED_AT => 17, OrderProductTableMap::UPDATED_AT => 18, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'PRODUCT_REF' => 2, 'PRODUCT_SALE_ELEMENTS_REF' => 3, 'TITLE' => 4, 'CHAPO' => 5, 'DESCRIPTION' => 6, 'POSTSCRIPTUM' => 7, 'QUANTITY' => 8, 'PRICE' => 9, 'PROMO_PRICE' => 10, 'WAS_NEW' => 11, 'WAS_IN_PROMO' => 12, 'WEIGHT' => 13, 'TAX_RULE_TITLE' => 14, 'TAX_RULE_DESCRIPTION' => 15, 'PARENT' => 16, 'CREATED_AT' => 17, 'UPDATED_AT' => 18, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'product_ref' => 2, 'product_sale_elements_ref' => 3, 'title' => 4, 'chapo' => 5, 'description' => 6, 'postscriptum' => 7, 'quantity' => 8, 'price' => 9, 'promo_price' => 10, 'was_new' => 11, 'was_in_promo' => 12, 'weight' => 13, 'tax_rule_title' => 14, 'tax_rule_description' => 15, 'parent' => 16, 'created_at' => 17, 'updated_at' => 18, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'ProductRef' => 2, 'ProductSaleElementsRef' => 3, 'Title' => 4, 'Chapo' => 5, 'Description' => 6, 'Postscriptum' => 7, 'Quantity' => 8, 'Price' => 9, 'PromoPrice' => 10, 'WasNew' => 11, 'WasInPromo' => 12, 'Weight' => 13, 'EanCode' => 14, 'TaxRuleTitle' => 15, 'TaxRuleDescription' => 16, 'Parent' => 17, 'CreatedAt' => 18, 'UpdatedAt' => 19, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'productRef' => 2, 'productSaleElementsRef' => 3, 'title' => 4, 'chapo' => 5, 'description' => 6, 'postscriptum' => 7, 'quantity' => 8, 'price' => 9, 'promoPrice' => 10, 'wasNew' => 11, 'wasInPromo' => 12, 'weight' => 13, 'eanCode' => 14, 'taxRuleTitle' => 15, 'taxRuleDescription' => 16, 'parent' => 17, 'createdAt' => 18, 'updatedAt' => 19, ),
|
||||
self::TYPE_COLNAME => array(OrderProductTableMap::ID => 0, OrderProductTableMap::ORDER_ID => 1, OrderProductTableMap::PRODUCT_REF => 2, OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF => 3, OrderProductTableMap::TITLE => 4, OrderProductTableMap::CHAPO => 5, OrderProductTableMap::DESCRIPTION => 6, OrderProductTableMap::POSTSCRIPTUM => 7, OrderProductTableMap::QUANTITY => 8, OrderProductTableMap::PRICE => 9, OrderProductTableMap::PROMO_PRICE => 10, OrderProductTableMap::WAS_NEW => 11, OrderProductTableMap::WAS_IN_PROMO => 12, OrderProductTableMap::WEIGHT => 13, OrderProductTableMap::EAN_CODE => 14, OrderProductTableMap::TAX_RULE_TITLE => 15, OrderProductTableMap::TAX_RULE_DESCRIPTION => 16, OrderProductTableMap::PARENT => 17, OrderProductTableMap::CREATED_AT => 18, OrderProductTableMap::UPDATED_AT => 19, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'PRODUCT_REF' => 2, 'PRODUCT_SALE_ELEMENTS_REF' => 3, 'TITLE' => 4, 'CHAPO' => 5, 'DESCRIPTION' => 6, 'POSTSCRIPTUM' => 7, 'QUANTITY' => 8, 'PRICE' => 9, 'PROMO_PRICE' => 10, 'WAS_NEW' => 11, 'WAS_IN_PROMO' => 12, 'WEIGHT' => 13, 'EAN_CODE' => 14, 'TAX_RULE_TITLE' => 15, 'TAX_RULE_DESCRIPTION' => 16, 'PARENT' => 17, 'CREATED_AT' => 18, 'UPDATED_AT' => 19, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'product_ref' => 2, 'product_sale_elements_ref' => 3, 'title' => 4, 'chapo' => 5, 'description' => 6, 'postscriptum' => 7, 'quantity' => 8, 'price' => 9, 'promo_price' => 10, 'was_new' => 11, 'was_in_promo' => 12, 'weight' => 13, 'ean_code' => 14, 'tax_rule_title' => 15, 'tax_rule_description' => 16, 'parent' => 17, 'created_at' => 18, 'updated_at' => 19, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -229,6 +234,7 @@ class OrderProductTableMap extends TableMap
|
||||
$this->addColumn('WAS_NEW', 'WasNew', 'TINYINT', true, null, null);
|
||||
$this->addColumn('WAS_IN_PROMO', 'WasInPromo', 'TINYINT', true, null, null);
|
||||
$this->addColumn('WEIGHT', 'Weight', 'VARCHAR', false, 45, null);
|
||||
$this->addColumn('EAN_CODE', 'EanCode', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('TAX_RULE_TITLE', 'TaxRuleTitle', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('TAX_RULE_DESCRIPTION', 'TaxRuleDescription', 'CLOB', false, null, null);
|
||||
$this->addColumn('PARENT', 'Parent', 'INTEGER', false, null, null);
|
||||
@@ -421,6 +427,7 @@ class OrderProductTableMap extends TableMap
|
||||
$criteria->addSelectColumn(OrderProductTableMap::WAS_NEW);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::WAS_IN_PROMO);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::WEIGHT);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::EAN_CODE);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::TAX_RULE_TITLE);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::TAX_RULE_DESCRIPTION);
|
||||
$criteria->addSelectColumn(OrderProductTableMap::PARENT);
|
||||
@@ -441,6 +448,7 @@ class OrderProductTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.WAS_NEW');
|
||||
$criteria->addSelectColumn($alias . '.WAS_IN_PROMO');
|
||||
$criteria->addSelectColumn($alias . '.WEIGHT');
|
||||
$criteria->addSelectColumn($alias . '.EAN_CODE');
|
||||
$criteria->addSelectColumn($alias . '.TAX_RULE_TITLE');
|
||||
$criteria->addSelectColumn($alias . '.TAX_RULE_DESCRIPTION');
|
||||
$criteria->addSelectColumn($alias . '.PARENT');
|
||||
|
||||
@@ -57,7 +57,7 @@ class ProductPriceTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 6;
|
||||
const NUM_COLUMNS = 7;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class ProductPriceTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 6;
|
||||
const NUM_HYDRATE_COLUMNS = 7;
|
||||
|
||||
/**
|
||||
* the column name for the PRODUCT_SALE_ELEMENTS_ID field
|
||||
@@ -89,6 +89,11 @@ class ProductPriceTableMap extends TableMap
|
||||
*/
|
||||
const PROMO_PRICE = 'product_price.PROMO_PRICE';
|
||||
|
||||
/**
|
||||
* the column name for the FROM_DEFAULT_CURRENCY field
|
||||
*/
|
||||
const FROM_DEFAULT_CURRENCY = 'product_price.FROM_DEFAULT_CURRENCY';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
@@ -111,12 +116,12 @@ class ProductPriceTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('ProductSaleElementsId', 'CurrencyId', 'Price', 'PromoPrice', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('productSaleElementsId', 'currencyId', 'price', 'promoPrice', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID, ProductPriceTableMap::CURRENCY_ID, ProductPriceTableMap::PRICE, ProductPriceTableMap::PROMO_PRICE, ProductPriceTableMap::CREATED_AT, ProductPriceTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('PRODUCT_SALE_ELEMENTS_ID', 'CURRENCY_ID', 'PRICE', 'PROMO_PRICE', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('product_sale_elements_id', 'currency_id', 'price', 'promo_price', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||
self::TYPE_PHPNAME => array('ProductSaleElementsId', 'CurrencyId', 'Price', 'PromoPrice', 'FromDefaultCurrency', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('productSaleElementsId', 'currencyId', 'price', 'promoPrice', 'fromDefaultCurrency', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID, ProductPriceTableMap::CURRENCY_ID, ProductPriceTableMap::PRICE, ProductPriceTableMap::PROMO_PRICE, ProductPriceTableMap::FROM_DEFAULT_CURRENCY, ProductPriceTableMap::CREATED_AT, ProductPriceTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('PRODUCT_SALE_ELEMENTS_ID', 'CURRENCY_ID', 'PRICE', 'PROMO_PRICE', 'FROM_DEFAULT_CURRENCY', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('product_sale_elements_id', 'currency_id', 'price', 'promo_price', 'from_default_currency', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -126,12 +131,12 @@ class ProductPriceTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('ProductSaleElementsId' => 0, 'CurrencyId' => 1, 'Price' => 2, 'PromoPrice' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('productSaleElementsId' => 0, 'currencyId' => 1, 'price' => 2, 'promoPrice' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
|
||||
self::TYPE_COLNAME => array(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID => 0, ProductPriceTableMap::CURRENCY_ID => 1, ProductPriceTableMap::PRICE => 2, ProductPriceTableMap::PROMO_PRICE => 3, ProductPriceTableMap::CREATED_AT => 4, ProductPriceTableMap::UPDATED_AT => 5, ),
|
||||
self::TYPE_RAW_COLNAME => array('PRODUCT_SALE_ELEMENTS_ID' => 0, 'CURRENCY_ID' => 1, 'PRICE' => 2, 'PROMO_PRICE' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
|
||||
self::TYPE_FIELDNAME => array('product_sale_elements_id' => 0, 'currency_id' => 1, 'price' => 2, 'promo_price' => 3, 'created_at' => 4, 'updated_at' => 5, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||
self::TYPE_PHPNAME => array('ProductSaleElementsId' => 0, 'CurrencyId' => 1, 'Price' => 2, 'PromoPrice' => 3, 'FromDefaultCurrency' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('productSaleElementsId' => 0, 'currencyId' => 1, 'price' => 2, 'promoPrice' => 3, 'fromDefaultCurrency' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
|
||||
self::TYPE_COLNAME => array(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID => 0, ProductPriceTableMap::CURRENCY_ID => 1, ProductPriceTableMap::PRICE => 2, ProductPriceTableMap::PROMO_PRICE => 3, ProductPriceTableMap::FROM_DEFAULT_CURRENCY => 4, ProductPriceTableMap::CREATED_AT => 5, ProductPriceTableMap::UPDATED_AT => 6, ),
|
||||
self::TYPE_RAW_COLNAME => array('PRODUCT_SALE_ELEMENTS_ID' => 0, 'CURRENCY_ID' => 1, 'PRICE' => 2, 'PROMO_PRICE' => 3, 'FROM_DEFAULT_CURRENCY' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
|
||||
self::TYPE_FIELDNAME => array('product_sale_elements_id' => 0, 'currency_id' => 1, 'price' => 2, 'promo_price' => 3, 'from_default_currency' => 4, 'created_at' => 5, 'updated_at' => 6, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -154,6 +159,7 @@ class ProductPriceTableMap extends TableMap
|
||||
$this->addForeignPrimaryKey('CURRENCY_ID', 'CurrencyId', 'INTEGER' , 'currency', 'ID', true, null, null);
|
||||
$this->addColumn('PRICE', 'Price', 'FLOAT', true, null, null);
|
||||
$this->addColumn('PROMO_PRICE', 'PromoPrice', 'FLOAT', false, null, null);
|
||||
$this->addColumn('FROM_DEFAULT_CURRENCY', 'FromDefaultCurrency', 'BOOLEAN', true, 1, false);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
@@ -371,6 +377,7 @@ class ProductPriceTableMap extends TableMap
|
||||
$criteria->addSelectColumn(ProductPriceTableMap::CURRENCY_ID);
|
||||
$criteria->addSelectColumn(ProductPriceTableMap::PRICE);
|
||||
$criteria->addSelectColumn(ProductPriceTableMap::PROMO_PRICE);
|
||||
$criteria->addSelectColumn(ProductPriceTableMap::FROM_DEFAULT_CURRENCY);
|
||||
$criteria->addSelectColumn(ProductPriceTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(ProductPriceTableMap::UPDATED_AT);
|
||||
} else {
|
||||
@@ -378,6 +385,7 @@ class ProductPriceTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.CURRENCY_ID');
|
||||
$criteria->addSelectColumn($alias . '.PRICE');
|
||||
$criteria->addSelectColumn($alias . '.PROMO_PRICE');
|
||||
$criteria->addSelectColumn($alias . '.FROM_DEFAULT_CURRENCY');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class ProductSaleElementsTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 10;
|
||||
const NUM_COLUMNS = 11;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class ProductSaleElementsTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 10;
|
||||
const NUM_HYDRATE_COLUMNS = 11;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -109,6 +109,11 @@ class ProductSaleElementsTableMap extends TableMap
|
||||
*/
|
||||
const IS_DEFAULT = 'product_sale_elements.IS_DEFAULT';
|
||||
|
||||
/**
|
||||
* the column name for the EAN_CODE field
|
||||
*/
|
||||
const EAN_CODE = 'product_sale_elements.EAN_CODE';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
@@ -131,12 +136,12 @@ class ProductSaleElementsTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'ProductId', 'Ref', 'Quantity', 'Promo', 'Newness', 'Weight', 'IsDefault', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'productId', 'ref', 'quantity', 'promo', 'newness', 'weight', 'isDefault', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(ProductSaleElementsTableMap::ID, ProductSaleElementsTableMap::PRODUCT_ID, ProductSaleElementsTableMap::REF, ProductSaleElementsTableMap::QUANTITY, ProductSaleElementsTableMap::PROMO, ProductSaleElementsTableMap::NEWNESS, ProductSaleElementsTableMap::WEIGHT, ProductSaleElementsTableMap::IS_DEFAULT, ProductSaleElementsTableMap::CREATED_AT, ProductSaleElementsTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'PRODUCT_ID', 'REF', 'QUANTITY', 'PROMO', 'NEWNESS', 'WEIGHT', 'IS_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'product_id', 'ref', 'quantity', 'promo', 'newness', 'weight', 'is_default', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||
self::TYPE_PHPNAME => array('Id', 'ProductId', 'Ref', 'Quantity', 'Promo', 'Newness', 'Weight', 'IsDefault', 'EanCode', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'productId', 'ref', 'quantity', 'promo', 'newness', 'weight', 'isDefault', 'eanCode', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(ProductSaleElementsTableMap::ID, ProductSaleElementsTableMap::PRODUCT_ID, ProductSaleElementsTableMap::REF, ProductSaleElementsTableMap::QUANTITY, ProductSaleElementsTableMap::PROMO, ProductSaleElementsTableMap::NEWNESS, ProductSaleElementsTableMap::WEIGHT, ProductSaleElementsTableMap::IS_DEFAULT, ProductSaleElementsTableMap::EAN_CODE, ProductSaleElementsTableMap::CREATED_AT, ProductSaleElementsTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'PRODUCT_ID', 'REF', 'QUANTITY', 'PROMO', 'NEWNESS', 'WEIGHT', 'IS_DEFAULT', 'EAN_CODE', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'product_id', 'ref', 'quantity', 'promo', 'newness', 'weight', 'is_default', 'ean_code', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -146,12 +151,12 @@ class ProductSaleElementsTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'ProductId' => 1, 'Ref' => 2, 'Quantity' => 3, 'Promo' => 4, 'Newness' => 5, 'Weight' => 6, 'IsDefault' => 7, 'CreatedAt' => 8, 'UpdatedAt' => 9, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'productId' => 1, 'ref' => 2, 'quantity' => 3, 'promo' => 4, 'newness' => 5, 'weight' => 6, 'isDefault' => 7, 'createdAt' => 8, 'updatedAt' => 9, ),
|
||||
self::TYPE_COLNAME => array(ProductSaleElementsTableMap::ID => 0, ProductSaleElementsTableMap::PRODUCT_ID => 1, ProductSaleElementsTableMap::REF => 2, ProductSaleElementsTableMap::QUANTITY => 3, ProductSaleElementsTableMap::PROMO => 4, ProductSaleElementsTableMap::NEWNESS => 5, ProductSaleElementsTableMap::WEIGHT => 6, ProductSaleElementsTableMap::IS_DEFAULT => 7, ProductSaleElementsTableMap::CREATED_AT => 8, ProductSaleElementsTableMap::UPDATED_AT => 9, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PRODUCT_ID' => 1, 'REF' => 2, 'QUANTITY' => 3, 'PROMO' => 4, 'NEWNESS' => 5, 'WEIGHT' => 6, 'IS_DEFAULT' => 7, 'CREATED_AT' => 8, 'UPDATED_AT' => 9, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'product_id' => 1, 'ref' => 2, 'quantity' => 3, 'promo' => 4, 'newness' => 5, 'weight' => 6, 'is_default' => 7, 'created_at' => 8, 'updated_at' => 9, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'ProductId' => 1, 'Ref' => 2, 'Quantity' => 3, 'Promo' => 4, 'Newness' => 5, 'Weight' => 6, 'IsDefault' => 7, 'EanCode' => 8, 'CreatedAt' => 9, 'UpdatedAt' => 10, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'productId' => 1, 'ref' => 2, 'quantity' => 3, 'promo' => 4, 'newness' => 5, 'weight' => 6, 'isDefault' => 7, 'eanCode' => 8, 'createdAt' => 9, 'updatedAt' => 10, ),
|
||||
self::TYPE_COLNAME => array(ProductSaleElementsTableMap::ID => 0, ProductSaleElementsTableMap::PRODUCT_ID => 1, ProductSaleElementsTableMap::REF => 2, ProductSaleElementsTableMap::QUANTITY => 3, ProductSaleElementsTableMap::PROMO => 4, ProductSaleElementsTableMap::NEWNESS => 5, ProductSaleElementsTableMap::WEIGHT => 6, ProductSaleElementsTableMap::IS_DEFAULT => 7, ProductSaleElementsTableMap::EAN_CODE => 8, ProductSaleElementsTableMap::CREATED_AT => 9, ProductSaleElementsTableMap::UPDATED_AT => 10, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PRODUCT_ID' => 1, 'REF' => 2, 'QUANTITY' => 3, 'PROMO' => 4, 'NEWNESS' => 5, 'WEIGHT' => 6, 'IS_DEFAULT' => 7, 'EAN_CODE' => 8, 'CREATED_AT' => 9, 'UPDATED_AT' => 10, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'product_id' => 1, 'ref' => 2, 'quantity' => 3, 'promo' => 4, 'newness' => 5, 'weight' => 6, 'is_default' => 7, 'ean_code' => 8, 'created_at' => 9, 'updated_at' => 10, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -178,6 +183,7 @@ class ProductSaleElementsTableMap extends TableMap
|
||||
$this->addColumn('NEWNESS', 'Newness', 'TINYINT', false, null, 0);
|
||||
$this->addColumn('WEIGHT', 'Weight', 'FLOAT', false, null, 0);
|
||||
$this->addColumn('IS_DEFAULT', 'IsDefault', 'BOOLEAN', false, 1, false);
|
||||
$this->addColumn('EAN_CODE', 'EanCode', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
@@ -362,6 +368,7 @@ class ProductSaleElementsTableMap extends TableMap
|
||||
$criteria->addSelectColumn(ProductSaleElementsTableMap::NEWNESS);
|
||||
$criteria->addSelectColumn(ProductSaleElementsTableMap::WEIGHT);
|
||||
$criteria->addSelectColumn(ProductSaleElementsTableMap::IS_DEFAULT);
|
||||
$criteria->addSelectColumn(ProductSaleElementsTableMap::EAN_CODE);
|
||||
$criteria->addSelectColumn(ProductSaleElementsTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(ProductSaleElementsTableMap::UPDATED_AT);
|
||||
} else {
|
||||
@@ -373,6 +380,7 @@ class ProductSaleElementsTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.NEWNESS');
|
||||
$criteria->addSelectColumn($alias . '.WEIGHT');
|
||||
$criteria->addSelectColumn($alias . '.IS_DEFAULT');
|
||||
$criteria->addSelectColumn($alias . '.EAN_CODE');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ class ProductTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('TaxRule', '\\Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('tax_rule_id' => 'id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('TaxRule', '\\Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('tax_rule_id' => 'id', ), 'RESTRICT', 'RESTRICT');
|
||||
$this->addRelation('Template', '\\Thelia\\Model\\Template', RelationMap::MANY_TO_ONE, array('template_id' => 'id', ), null, null);
|
||||
$this->addRelation('ProductCategory', '\\Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductCategories');
|
||||
$this->addRelation('FeatureProduct', '\\Thelia\\Model\\FeatureProduct', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'FeatureProducts');
|
||||
|
||||
@@ -150,7 +150,7 @@ class ResourceTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 30, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
@@ -160,9 +160,9 @@ class ResourceTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('GroupResource', '\\Thelia\\Model\\GroupResource', RelationMap::ONE_TO_MANY, array('id' => 'resource_id', ), 'CASCADE', 'RESTRICT', 'GroupResources');
|
||||
$this->addRelation('ProfileResource', '\\Thelia\\Model\\ProfileResource', RelationMap::ONE_TO_MANY, array('id' => 'resource_id', ), 'CASCADE', 'RESTRICT', 'ProfileResources');
|
||||
$this->addRelation('ResourceI18n', '\\Thelia\\Model\\ResourceI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ResourceI18ns');
|
||||
$this->addRelation('Group', '\\Thelia\\Model\\Group', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Groups');
|
||||
$this->addRelation('Profile', '\\Thelia\\Model\\Profile', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Profiles');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
@@ -185,7 +185,7 @@ class ResourceTableMap extends TableMap
|
||||
{
|
||||
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
GroupResourceTableMap::clearInstancePool();
|
||||
ProfileResourceTableMap::clearInstancePool();
|
||||
ResourceI18nTableMap::clearInstancePool();
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ class TaxRuleTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::ONE_TO_MANY, array('id' => 'tax_rule_id', ), 'SET NULL', 'RESTRICT', 'Products');
|
||||
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::ONE_TO_MANY, array('id' => 'tax_rule_id', ), 'RESTRICT', 'RESTRICT', 'Products');
|
||||
$this->addRelation('TaxRuleCountry', '\\Thelia\\Model\\TaxRuleCountry', RelationMap::ONE_TO_MANY, array('id' => 'tax_rule_id', ), 'CASCADE', 'RESTRICT', 'TaxRuleCountries');
|
||||
$this->addRelation('TaxRuleI18n', '\\Thelia\\Model\\TaxRuleI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'TaxRuleI18ns');
|
||||
} // buildRelations()
|
||||
@@ -185,7 +185,6 @@ class TaxRuleTableMap extends TableMap
|
||||
{
|
||||
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
ProductTableMap::clearInstancePool();
|
||||
TaxRuleCountryTableMap::clearInstancePool();
|
||||
TaxRuleI18nTableMap::clearInstancePool();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ use Thelia\Core\Event\Product\ProductEvent;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\Propel;
|
||||
use Thelia\Model\Map\ProductTableMap;
|
||||
use Thelia\Model\ProductSaleElementsQuery;
|
||||
|
||||
class Product extends BaseProduct
|
||||
{
|
||||
@@ -47,6 +48,20 @@ class Product extends BaseProduct
|
||||
return $taxCalculator->load($this, $country)->getTaxedPrice($this->getRealLowestPrice());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default PSE for this product.
|
||||
*/
|
||||
public function getDefaultSaleElements() {
|
||||
return ProductSaleElementsQuery::create()->filterByProductId($this->id)->filterByIsDefault(true)->find();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return PSE count fir this product.
|
||||
*/
|
||||
public function countSaleElements() {
|
||||
return ProductSaleElementsQuery::create()->filterByProductId($this->id)->filterByIsDefault(true)->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the current default category ID for this product
|
||||
*/
|
||||
@@ -100,7 +115,7 @@ class Product extends BaseProduct
|
||||
;
|
||||
|
||||
if ($productCategory == null || $productCategory->getCategoryId() != $defaultCategoryId) {
|
||||
exit;
|
||||
|
||||
// Delete the old default category
|
||||
if ($productCategory !== null) $productCategory->delete();
|
||||
|
||||
@@ -131,10 +146,10 @@ class Product extends BaseProduct
|
||||
$con = Propel::getWriteConnection(ProductTableMap::DATABASE_NAME);
|
||||
|
||||
$con->beginTransaction();
|
||||
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_CREATEPRODUCT, new ProductEvent($this));
|
||||
|
||||
try {
|
||||
|
||||
// Create the product
|
||||
$this->save($con);
|
||||
|
||||
@@ -146,29 +161,8 @@ class Product extends BaseProduct
|
||||
|
||||
$this->setTaxRuleId($taxRuleId);
|
||||
|
||||
// Create an empty product sale element
|
||||
$sale_elements = new ProductSaleElements();
|
||||
|
||||
$sale_elements
|
||||
->setProduct($this)
|
||||
->setRef($this->getRef())
|
||||
->setPromo(0)
|
||||
->setNewness(0)
|
||||
->setWeight($baseWeight)
|
||||
->setIsDefault(true)
|
||||
->save($con)
|
||||
;
|
||||
|
||||
// Create an empty product price in the default currency
|
||||
$product_price = new ProductPrice();
|
||||
|
||||
$product_price
|
||||
->setProductSaleElements($sale_elements)
|
||||
->setPromoPrice($basePrice)
|
||||
->setPrice($basePrice)
|
||||
->setCurrencyId($priceCurrencyId)
|
||||
->save($con)
|
||||
;
|
||||
// Create the default product sale element of this product
|
||||
$sale_elements = $this->createDefaultProductSaleElement($con, $baseWeight, $basePrice, $priceCurrencyId, true);
|
||||
|
||||
// Store all the stuff !
|
||||
$con->commit();
|
||||
@@ -183,6 +177,38 @@ class Product extends BaseProduct
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a basic product sale element attached to this product.
|
||||
*/
|
||||
public function createDefaultProductSaleElement(ConnectionInterface $con, $weight, $basePrice, $currencyId, $isDefault) {
|
||||
|
||||
// Create an empty product sale element
|
||||
$sale_elements = new ProductSaleElements();
|
||||
|
||||
$sale_elements
|
||||
->setProduct($this)
|
||||
->setRef($this->getRef())
|
||||
->setPromo(0)
|
||||
->setNewness(0)
|
||||
->setWeight($weight)
|
||||
->setIsDefault($isDefault)
|
||||
->save($con)
|
||||
;
|
||||
|
||||
// Create an empty product price in the default currency
|
||||
$product_price = new ProductPrice();
|
||||
|
||||
$product_price
|
||||
->setProductSaleElements($sale_elements)
|
||||
->setPromoPrice($basePrice)
|
||||
->setPrice($basePrice)
|
||||
->setCurrencyId($currencyId)
|
||||
->save($con)
|
||||
;
|
||||
|
||||
return $sale_elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate next position relative to our default category
|
||||
*/
|
||||
|
||||
@@ -86,271 +86,271 @@ INSERT INTO `area` (`id`, `name`, `postage`, `created_at`, `updated_at`) VALUES
|
||||
INSERT INTO `area_delivery_module` (`id`, `area_id`, `delivery_module_id`, `created_at`, `updated_at`) VALUES
|
||||
(1, 1, 2, NOW(), NOW());
|
||||
|
||||
INSERT INTO `country` (`id`, `area_id`, `isocode`, `isoalpha2`, `isoalpha3`, `by_default`, `created_at`, `updated_at`) VALUES
|
||||
(1, NULL, '4', 'AF', 'AFG', 0, NOW(), NOW()),
|
||||
(2, NULL, '710', 'ZA', 'ZAF', 0, NOW(), NOW()),
|
||||
(3, NULL, '8', 'AL', 'ALB', 0, NOW(), NOW()),
|
||||
(4, NULL, '12', 'DZ', 'DZA', 0, NOW(), NOW()),
|
||||
(5, NULL, '276', 'DE', 'DEU', 0, NOW(), NOW()),
|
||||
(6, NULL, '20', 'AD', 'AND', 0, NOW(), NOW()),
|
||||
(7, NULL, '24', 'AO', 'AGO', 0, NOW(), NOW()),
|
||||
(8, NULL, '28', 'AG', 'ATG', 0, NOW(), NOW()),
|
||||
(9, NULL, '682', 'SA', 'SAU', 0, NOW(), NOW()),
|
||||
(10, NULL, '32', 'AR', 'ARG', 0, NOW(), NOW()),
|
||||
(11, NULL, '51', 'AM', 'ARM', 0, NOW(), NOW()),
|
||||
(12, NULL, '36', 'AU', 'AUS', 0, NOW(), NOW()),
|
||||
(13, NULL, '40', 'AT', 'AUT', 0, NOW(), NOW()),
|
||||
(14, NULL, '31', 'AZ', 'AZE', 0, NOW(), NOW()),
|
||||
(15, NULL, '44', 'BS', 'BHS', 0, NOW(), NOW()),
|
||||
(16, NULL, '48', 'BR', 'BHR', 0, NOW(), NOW()),
|
||||
(17, NULL, '50', 'BD', 'BGD', 0, NOW(), NOW()),
|
||||
(18, NULL, '52', 'BB', 'BRB', 0, NOW(), NOW()),
|
||||
(19, NULL, '585', 'PW', 'PLW', 0, NOW(), NOW()),
|
||||
(20, NULL, '56', 'BE', 'BEL', 0, NOW(), NOW()),
|
||||
(21, NULL, '84', 'BL', 'BLZ', 0, NOW(), NOW()),
|
||||
(22, NULL, '204', 'BJ', 'BEN', 0, NOW(), NOW()),
|
||||
(23, NULL, '64', 'BT', 'BTN', 0, NOW(), NOW()),
|
||||
(24, NULL, '112', 'BY', 'BLR', 0, NOW(), NOW()),
|
||||
(25, NULL, '104', 'MM', 'MMR', 0, NOW(), NOW()),
|
||||
(26, NULL, '68', 'BO', 'BOL', 0, NOW(), NOW()),
|
||||
(27, NULL, '70', 'BA', 'BIH', 0, NOW(), NOW()),
|
||||
(28, NULL, '72', 'BW', 'BWA', 0, NOW(), NOW()),
|
||||
(29, NULL, '76', 'BR', 'BRA', 0, NOW(), NOW()),
|
||||
(30, NULL, '96', 'BN', 'BRN', 0, NOW(), NOW()),
|
||||
(31, NULL, '100', 'BG', 'BGR', 0, NOW(), NOW()),
|
||||
(32, NULL, '854', 'BF', 'BFA', 0, NOW(), NOW()),
|
||||
(33, NULL, '108', 'BI', 'BDI', 0, NOW(), NOW()),
|
||||
(34, NULL, '116', 'KH', 'KHM', 0, NOW(), NOW()),
|
||||
(35, NULL, '120', 'CM', 'CMR', 0, NOW(), NOW()),
|
||||
(37, NULL, '132', 'CV', 'CPV', 0, NOW(), NOW()),
|
||||
(38, NULL, '152', 'CL', 'CHL', 0, NOW(), NOW()),
|
||||
(39, NULL, '156', 'CN', 'CHN', 0, NOW(), NOW()),
|
||||
(40, NULL, '196', 'CY', 'CYP', 0, NOW(), NOW()),
|
||||
(41, NULL, '170', 'CO', 'COL', 0, NOW(), NOW()),
|
||||
(42, NULL, '174', 'KM', 'COM', 0, NOW(), NOW()),
|
||||
(43, NULL, '178', 'CG', 'COG', 0, NOW(), NOW()),
|
||||
(44, NULL, '184', 'CK', 'COK', 0, NOW(), NOW()),
|
||||
(45, NULL, '408', 'KP', 'PRK', 0, NOW(), NOW()),
|
||||
(46, NULL, '410', 'KR', 'KOR', 0, NOW(), NOW()),
|
||||
(47, NULL, '188', 'CR', 'CRI', 0, NOW(), NOW()),
|
||||
(48, NULL, '384', 'CI', 'CIV', 0, NOW(), NOW()),
|
||||
(49, NULL, '191', 'HR', 'HRV', 0, NOW(), NOW()),
|
||||
(50, NULL, '192', 'CU', 'CUB', 0, NOW(), NOW()),
|
||||
(51, NULL, '208', 'DK', 'DNK', 0, NOW(), NOW()),
|
||||
(52, NULL, '262', 'DJ', 'DJI', 0, NOW(), NOW()),
|
||||
(53, NULL, '212', 'DM', 'DMA', 0, NOW(), NOW()),
|
||||
(54, NULL, '818', 'EG', 'EGY', 0, NOW(), NOW()),
|
||||
(55, NULL, '784', 'AE', 'ARE', 0, NOW(), NOW()),
|
||||
(56, NULL, '218', 'EC', 'ECU', 0, NOW(), NOW()),
|
||||
(57, NULL, '232', 'ER', 'ERI', 0, NOW(), NOW()),
|
||||
(58, NULL, '724', 'ES', 'ESP', 0, NOW(), NOW()),
|
||||
(59, NULL, '233', 'EE', 'EST', 0, NOW(), NOW()),
|
||||
(61, NULL, '231', 'ET', 'ETH', 0, NOW(), NOW()),
|
||||
(62, NULL, '242', 'FJ', 'FJI', 0, NOW(), NOW()),
|
||||
(63, NULL, '246', 'FI', 'FIN', 0, NOW(), NOW()),
|
||||
(64, 1, '250', 'FR', 'FRA', 1, NOW(), NOW()),
|
||||
(65, NULL, '266', 'GA', 'GAB', 0, NOW(), NOW()),
|
||||
(66, NULL, '270', 'GM', 'GMB', 0, NOW(), NOW()),
|
||||
(67, NULL, '268', 'GE', 'GEO', 0, NOW(), NOW()),
|
||||
(68, NULL, '288', 'GH', 'GHA', 0, NOW(), NOW()),
|
||||
(69, NULL, '300', 'GR', 'GRC', 0, NOW(), NOW()),
|
||||
(70, NULL, '308', 'GD', 'GRD', 0, NOW(), NOW()),
|
||||
(71, NULL, '320', 'GT', 'GTM', 0, NOW(), NOW()),
|
||||
(72, NULL, '324', 'GN', 'GIN', 0, NOW(), NOW()),
|
||||
(73, NULL, '624', 'GW', 'GNB', 0, NOW(), NOW()),
|
||||
(74, NULL, '226', 'GQ', 'GNQ', 0, NOW(), NOW()),
|
||||
(75, NULL, '328', 'GY', 'GUY', 0, NOW(), NOW()),
|
||||
(76, NULL, '332', 'HT', 'HTI', 0, NOW(), NOW()),
|
||||
(77, NULL, '340', 'HN', 'HND', 0, NOW(), NOW()),
|
||||
(78, NULL, '348', 'HU', 'HUN', 0, NOW(), NOW()),
|
||||
(79, NULL, '356', 'IN', 'IND', 0, NOW(), NOW()),
|
||||
(80, NULL, '360', 'ID', 'IDN', 0, NOW(), NOW()),
|
||||
(81, NULL, '364', 'IR', 'IRN', 0, NOW(), NOW()),
|
||||
(82, NULL, '368', 'IQ', 'IRQ', 0, NOW(), NOW()),
|
||||
(83, NULL, '372', 'IE', 'IRL', 0, NOW(), NOW()),
|
||||
(84, NULL, '352', 'IS', 'ISL', 0, NOW(), NOW()),
|
||||
(85, NULL, '376', 'IL', 'ISR', 0, NOW(), NOW()),
|
||||
(86, NULL, '380', 'IT', 'ITA', 0, NOW(), NOW()),
|
||||
(87, NULL, '388', 'JM', 'JAM', 0, NOW(), NOW()),
|
||||
(88, NULL, '392', 'JP', 'JPN', 0, NOW(), NOW()),
|
||||
(89, NULL, '400', 'JO', 'JOR', 0, NOW(), NOW()),
|
||||
(90, NULL, '398', 'KZ', 'KAZ', 0, NOW(), NOW()),
|
||||
(91, NULL, '404', 'KE', 'KEN', 0, NOW(), NOW()),
|
||||
(92, NULL, '417', 'KG', 'KGZ', 0, NOW(), NOW()),
|
||||
(93, NULL, '296', 'KI', 'KIR', 0, NOW(), NOW()),
|
||||
(94, NULL, '414', 'KW', 'KWT', 0, NOW(), NOW()),
|
||||
(95, NULL, '418', 'LA', 'LAO', 0, NOW(), NOW()),
|
||||
(96, NULL, '426', 'LS', 'LSO', 0, NOW(), NOW()),
|
||||
(97, NULL, '428', 'LV', 'LVA', 0, NOW(), NOW()),
|
||||
(98, NULL, '422', 'LB', 'LBN', 0, NOW(), NOW()),
|
||||
(99, NULL, '430', 'LR', 'LBR', 0, NOW(), NOW()),
|
||||
(100, NULL, '343', 'LY', 'LBY', 0, NOW(), NOW()),
|
||||
(101, NULL, '438', 'LI', 'LIE', 0, NOW(), NOW()),
|
||||
(102, NULL, '440', 'LT', 'LTU', 0, NOW(), NOW()),
|
||||
(103, NULL, '442', 'LU', 'LUX', 0, NOW(), NOW()),
|
||||
(104, NULL, '807', 'MK', 'MKD', 0, NOW(), NOW()),
|
||||
(105, NULL, '450', 'MD', 'MDG', 0, NOW(), NOW()),
|
||||
(106, NULL, '458', 'MY', 'MYS', 0, NOW(), NOW()),
|
||||
(107, NULL, '454', 'MW', 'MWI', 0, NOW(), NOW()),
|
||||
(108, NULL, '462', 'MV', 'MDV', 0, NOW(), NOW()),
|
||||
(109, NULL, '466', 'ML', 'MLI', 0, NOW(), NOW()),
|
||||
(110, NULL, '470', 'MT', 'MLT', 0, NOW(), NOW()),
|
||||
(111, NULL, '504', 'MA', 'MAR', 0, NOW(), NOW()),
|
||||
(112, NULL, '584', 'MH', 'MHL', 0, NOW(), NOW()),
|
||||
(113, NULL, '480', 'MU', 'MUS', 0, NOW(), NOW()),
|
||||
(114, NULL, '478', 'MR', 'MRT', 0, NOW(), NOW()),
|
||||
(115, NULL, '484', 'MX', 'MEX', 0, NOW(), NOW()),
|
||||
(116, NULL, '583', 'FM', 'FSM', 0, NOW(), NOW()),
|
||||
(117, NULL, '498', 'MD', 'MDA', 0, NOW(), NOW()),
|
||||
(118, NULL, '492', 'MC', 'MCO', 0, NOW(), NOW()),
|
||||
(119, NULL, '496', 'MN', 'MNG', 0, NOW(), NOW()),
|
||||
(120, NULL, '508', 'MZ', 'MOZ', 0, NOW(), NOW()),
|
||||
(121, NULL, '516', 'NA', 'NAM', 0, NOW(), NOW()),
|
||||
(122, NULL, '520', 'NR', 'NRU', 0, NOW(), NOW()),
|
||||
(123, NULL, '524', 'NP', 'NPL', 0, NOW(), NOW()),
|
||||
(124, NULL, '558', 'NI', 'NIC', 0, NOW(), NOW()),
|
||||
(125, NULL, '562', 'NE', 'NER', 0, NOW(), NOW()),
|
||||
(126, NULL, '566', 'NG', 'NGA', 0, NOW(), NOW()),
|
||||
(127, NULL, '570', 'NU', 'NIU', 0, NOW(), NOW()),
|
||||
(128, NULL, '578', 'NO', 'NOR', 0, NOW(), NOW()),
|
||||
(129, NULL, '554', 'NZ', 'NZL', 0, NOW(), NOW()),
|
||||
(130, NULL, '512', 'OM', 'OMN', 0, NOW(), NOW()),
|
||||
(131, NULL, '800', 'UG', 'UGA', 0, NOW(), NOW()),
|
||||
(132, NULL, '860', 'UZ', 'UZB', 0, NOW(), NOW()),
|
||||
(133, NULL, '586', 'PK', 'PAK', 0, NOW(), NOW()),
|
||||
(134, NULL, '591', 'PA', 'PAN', 0, NOW(), NOW()),
|
||||
(135, NULL, '598', 'PG', 'PNG', 0, NOW(), NOW()),
|
||||
(136, NULL, '600', 'PY', 'PRY', 0, NOW(), NOW()),
|
||||
(137, NULL, '528', 'NL', 'NLD', 0, NOW(), NOW()),
|
||||
(138, NULL, '604', 'PE', 'PER', 0, NOW(), NOW()),
|
||||
(139, NULL, '608', 'PH', 'PHL', 0, NOW(), NOW()),
|
||||
(140, NULL, '616', 'PL', 'POL', 0, NOW(), NOW()),
|
||||
(141, NULL, '620', 'PT', 'PRT', 0, NOW(), NOW()),
|
||||
(142, NULL, '634', 'QA', 'QAT', 0, NOW(), NOW()),
|
||||
(143, NULL, '140', 'CF', 'CAF', 0, NOW(), NOW()),
|
||||
(144, NULL, '214', 'DO', 'DOM', 0, NOW(), NOW()),
|
||||
(145, NULL, '203', 'CZ', 'CZE', 0, NOW(), NOW()),
|
||||
(146, NULL, '642', 'RO', 'ROU', 0, NOW(), NOW()),
|
||||
(147, NULL, '826', 'GB', 'GBR', 0, NOW(), NOW()),
|
||||
(148, NULL, '643', 'RU', 'RUS', 0, NOW(), NOW()),
|
||||
(149, NULL, '646', 'RW', 'RWA', 0, NOW(), NOW()),
|
||||
(150, NULL, '659', 'KN', 'KNA', 0, NOW(), NOW()),
|
||||
(151, NULL, '662', 'LC', 'LCA', 0, NOW(), NOW()),
|
||||
(152, NULL, '674', 'SM', 'SMR', 0, NOW(), NOW()),
|
||||
(153, NULL, '670', 'VC', 'VCT', 0, NOW(), NOW()),
|
||||
(154, NULL, '90', 'SB', 'SLB', 0, NOW(), NOW()),
|
||||
(155, NULL, '222', 'SV', 'SLV', 0, NOW(), NOW()),
|
||||
(156, NULL, '882', 'WS', 'WSM', 0, NOW(), NOW()),
|
||||
(157, NULL, '678', 'ST', 'STP', 0, NOW(), NOW()),
|
||||
(158, NULL, '686', 'SN', 'SEN', 0, NOW(), NOW()),
|
||||
(159, NULL, '690', 'SC', 'SYC', 0, NOW(), NOW()),
|
||||
(160, NULL, '694', 'SL', 'SLE', 0, NOW(), NOW()),
|
||||
(161, NULL, '702', 'SG', 'SGP', 0, NOW(), NOW()),
|
||||
(162, NULL, '703', 'SK', 'SVK', 0, NOW(), NOW()),
|
||||
(163, NULL, '705', 'SI', 'SVN', 0, NOW(), NOW()),
|
||||
(164, NULL, '706', 'SO', 'SOM', 0, NOW(), NOW()),
|
||||
(165, NULL, '729', 'SD', 'SDN', 0, NOW(), NOW()),
|
||||
(166, NULL, '144', 'LK', 'LKA', 0, NOW(), NOW()),
|
||||
(167, NULL, '752', 'SE', 'SWE', 0, NOW(), NOW()),
|
||||
(168, NULL, '756', 'CH', 'CHE', 0, NOW(), NOW()),
|
||||
(169, NULL, '740', 'SR', 'SUR', 0, NOW(), NOW()),
|
||||
(170, NULL, '748', 'SZ', 'SWZ', 0, NOW(), NOW()),
|
||||
(171, NULL, '760', 'SY', 'SYR', 0, NOW(), NOW()),
|
||||
(172, NULL, '762', 'TJ', 'TJK', 0, NOW(), NOW()),
|
||||
(173, NULL, '834', 'TZ', 'TZA', 0, NOW(), NOW()),
|
||||
(174, NULL, '148', 'TD', 'TCD', 0, NOW(), NOW()),
|
||||
(175, NULL, '764', 'TH', 'THA', 0, NOW(), NOW()),
|
||||
(176, NULL, '768', 'TG', 'TGO', 0, NOW(), NOW()),
|
||||
(177, NULL, '776', 'TO', 'TON', 0, NOW(), NOW()),
|
||||
(178, NULL, '780', 'TT', 'TTO', 0, NOW(), NOW()),
|
||||
(179, NULL, '788', 'TN', 'TUN', 0, NOW(), NOW()),
|
||||
(180, NULL, '795', 'TM', 'TKM', 0, NOW(), NOW()),
|
||||
(181, NULL, '792', 'TR', 'TUR', 0, NOW(), NOW()),
|
||||
(182, NULL, '798', 'TV', 'TUV', 0, NOW(), NOW()),
|
||||
(183, NULL, '804', 'UA', 'UKR', 0, NOW(), NOW()),
|
||||
(184, NULL, '858', 'UY', 'URY', 0, NOW(), NOW()),
|
||||
(185, NULL, '336', 'VA', 'VAT', 0, NOW(), NOW()),
|
||||
(186, NULL, '548', 'VU', 'VUT', 0, NOW(), NOW()),
|
||||
(187, NULL, '862', 'VE', 'VEN', 0, NOW(), NOW()),
|
||||
(188, NULL, '704', 'VN', 'VNM', 0, NOW(), NOW()),
|
||||
(189, NULL, '887', 'YE', 'YEM', 0, NOW(), NOW()),
|
||||
(190, NULL, '807', 'MK', 'MKD', 0, NOW(), NOW()),
|
||||
(191, NULL, '180', 'CD', 'COD', 0, NOW(), NOW()),
|
||||
(192, NULL, '894', 'ZM', 'ZMB', 0, NOW(), NOW()),
|
||||
(193, NULL, '716', 'ZW', 'ZWE', 0, NOW(), NOW()),
|
||||
(196, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(197, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(198, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(199, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(200, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(201, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(202, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(203, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(204, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(205, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(206, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(207, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(208, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(209, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(210, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(211, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(212, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(213, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(214, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(215, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(216, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(217, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(218, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(219, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(220, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(221, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(222, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(223, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(224, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(225, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(226, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(227, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(228, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(229, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(230, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(231, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(232, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(233, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(234, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(235, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(236, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(237, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(238, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(239, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(240, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(241, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(242, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(243, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(244, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(245, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
|
||||
(246, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
|
||||
(247, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
|
||||
(248, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
|
||||
(249, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
|
||||
(250, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
|
||||
(251, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
|
||||
(252, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
|
||||
(253, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
|
||||
(254, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
|
||||
(255, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
|
||||
(256, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
|
||||
(257, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
|
||||
(258, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
|
||||
(259, NULL, '312', 'GP', 'GLP', 0, NOW(), NOW()),
|
||||
(260, NULL, '254', 'GF', 'GUF', 0, NOW(), NOW()),
|
||||
(261, NULL, '474', 'MQ', 'MTQ', 0, NOW(), NOW()),
|
||||
(262, NULL, '175', 'YT', 'MYT', 0, NOW(), NOW()),
|
||||
(263, NULL, '638', 'RE', 'REU', 0, NOW(), NOW()),
|
||||
(264, NULL, '666', 'PM', 'SPM', 0, NOW(), NOW()),
|
||||
(265, NULL, '540', 'NC', 'NCL', 0, NOW(), NOW()),
|
||||
(266, NULL, '258', 'PF', 'PYF', 0, NOW(), NOW()),
|
||||
(267, NULL, '876', 'WF', 'WLF', 0, NOW(), NOW()),
|
||||
(268, NULL, '840', 'US', 'USA', 0, NOW(), NOW());
|
||||
INSERT INTO `country` (`id`, `area_id`, `isocode`, `isoalpha2`, `isoalpha3`, `by_default`, `shop_country`, `created_at`, `updated_at`) VALUES
|
||||
(1, NULL, '4', 'AF', 'AFG', 0, 0, NOW(), NOW()),
|
||||
(2, NULL, '710', 'ZA', 'ZAF', 0, 0, NOW(), NOW()),
|
||||
(3, NULL, '8', 'AL', 'ALB', 0, 0, NOW(), NOW()),
|
||||
(4, NULL, '12', 'DZ', 'DZA', 0, 0, NOW(), NOW()),
|
||||
(5, NULL, '276', 'DE', 'DEU', 0, 0, NOW(), NOW()),
|
||||
(6, NULL, '20', 'AD', 'AND', 0, 0, NOW(), NOW()),
|
||||
(7, NULL, '24', 'AO', 'AGO', 0, 0, NOW(), NOW()),
|
||||
(8, NULL, '28', 'AG', 'ATG', 0, 0, NOW(), NOW()),
|
||||
(9, NULL, '682', 'SA', 'SAU', 0, 0, NOW(), NOW()),
|
||||
(10, NULL, '32', 'AR', 'ARG', 0, 0, NOW(), NOW()),
|
||||
(11, NULL, '51', 'AM', 'ARM', 0, 0, NOW(), NOW()),
|
||||
(12, NULL, '36', 'AU', 'AUS', 0, 0, NOW(), NOW()),
|
||||
(13, NULL, '40', 'AT', 'AUT', 0, 0, NOW(), NOW()),
|
||||
(14, NULL, '31', 'AZ', 'AZE', 0, 0, NOW(), NOW()),
|
||||
(15, NULL, '44', 'BS', 'BHS', 0, 0, NOW(), NOW()),
|
||||
(16, NULL, '48', 'BR', 'BHR', 0, 0, NOW(), NOW()),
|
||||
(17, NULL, '50', 'BD', 'BGD', 0, 0, NOW(), NOW()),
|
||||
(18, NULL, '52', 'BB', 'BRB', 0, 0, NOW(), NOW()),
|
||||
(19, NULL, '585', 'PW', 'PLW', 0, 0, NOW(), NOW()),
|
||||
(20, NULL, '56', 'BE', 'BEL', 0, 0, NOW(), NOW()),
|
||||
(21, NULL, '84', 'BL', 'BLZ', 0, 0, NOW(), NOW()),
|
||||
(22, NULL, '204', 'BJ', 'BEN', 0, 0, NOW(), NOW()),
|
||||
(23, NULL, '64', 'BT', 'BTN', 0, 0, NOW(), NOW()),
|
||||
(24, NULL, '112', 'BY', 'BLR', 0, 0, NOW(), NOW()),
|
||||
(25, NULL, '104', 'MM', 'MMR', 0, 0, NOW(), NOW()),
|
||||
(26, NULL, '68', 'BO', 'BOL', 0, 0, NOW(), NOW()),
|
||||
(27, NULL, '70', 'BA', 'BIH', 0, 0, NOW(), NOW()),
|
||||
(28, NULL, '72', 'BW', 'BWA', 0, 0, NOW(), NOW()),
|
||||
(29, NULL, '76', 'BR', 'BRA', 0, 0, NOW(), NOW()),
|
||||
(30, NULL, '96', 'BN', 'BRN', 0, 0, NOW(), NOW()),
|
||||
(31, NULL, '100', 'BG', 'BGR', 0, 0, NOW(), NOW()),
|
||||
(32, NULL, '854', 'BF', 'BFA', 0, 0, NOW(), NOW()),
|
||||
(33, NULL, '108', 'BI', 'BDI', 0, 0, NOW(), NOW()),
|
||||
(34, NULL, '116', 'KH', 'KHM', 0, 0, NOW(), NOW()),
|
||||
(35, NULL, '120', 'CM', 'CMR', 0, 0, NOW(), NOW()),
|
||||
(37, NULL, '132', 'CV', 'CPV', 0, 0, NOW(), NOW()),
|
||||
(38, NULL, '152', 'CL', 'CHL', 0, 0, NOW(), NOW()),
|
||||
(39, NULL, '156', 'CN', 'CHN', 0, 0, NOW(), NOW()),
|
||||
(40, NULL, '196', 'CY', 'CYP', 0, 0, NOW(), NOW()),
|
||||
(41, NULL, '170', 'CO', 'COL', 0, 0, NOW(), NOW()),
|
||||
(42, NULL, '174', 'KM', 'COM', 0, 0, NOW(), NOW()),
|
||||
(43, NULL, '178', 'CG', 'COG', 0, 0, NOW(), NOW()),
|
||||
(44, NULL, '184', 'CK', 'COK', 0, 0, NOW(), NOW()),
|
||||
(45, NULL, '408', 'KP', 'PRK', 0, 0, NOW(), NOW()),
|
||||
(46, NULL, '410', 'KR', 'KOR', 0, 0, NOW(), NOW()),
|
||||
(47, NULL, '188', 'CR', 'CRI', 0, 0, NOW(), NOW()),
|
||||
(48, NULL, '384', 'CI', 'CIV', 0, 0, NOW(), NOW()),
|
||||
(49, NULL, '191', 'HR', 'HRV', 0, 0, NOW(), NOW()),
|
||||
(50, NULL, '192', 'CU', 'CUB', 0, 0, NOW(), NOW()),
|
||||
(51, NULL, '208', 'DK', 'DNK', 0, 0, NOW(), NOW()),
|
||||
(52, NULL, '262', 'DJ', 'DJI', 0, 0, NOW(), NOW()),
|
||||
(53, NULL, '212', 'DM', 'DMA', 0, 0, NOW(), NOW()),
|
||||
(54, NULL, '818', 'EG', 'EGY', 0, 0, NOW(), NOW()),
|
||||
(55, NULL, '784', 'AE', 'ARE', 0, 0, NOW(), NOW()),
|
||||
(56, NULL, '218', 'EC', 'ECU', 0, 0, NOW(), NOW()),
|
||||
(57, NULL, '232', 'ER', 'ERI', 0, 0, NOW(), NOW()),
|
||||
(58, NULL, '724', 'ES', 'ESP', 0, 0, NOW(), NOW()),
|
||||
(59, NULL, '233', 'EE', 'EST', 0, 0, NOW(), NOW()),
|
||||
(61, NULL, '231', 'ET', 'ETH', 0, 0, NOW(), NOW()),
|
||||
(62, NULL, '242', 'FJ', 'FJI', 0, 0, NOW(), NOW()),
|
||||
(63, NULL, '246', 'FI', 'FIN', 0, 0, NOW(), NOW()),
|
||||
(64, 1, '250', 'FR', 'FRA', 1, 1, NOW(), NOW()),
|
||||
(65, NULL, '266', 'GA', 'GAB', 0, 0, NOW(), NOW()),
|
||||
(66, NULL, '270', 'GM', 'GMB', 0, 0, NOW(), NOW()),
|
||||
(67, NULL, '268', 'GE', 'GEO', 0, 0, NOW(), NOW()),
|
||||
(68, NULL, '288', 'GH', 'GHA', 0, 0, NOW(), NOW()),
|
||||
(69, NULL, '300', 'GR', 'GRC', 0, 0, NOW(), NOW()),
|
||||
(70, NULL, '308', 'GD', 'GRD', 0, 0, NOW(), NOW()),
|
||||
(71, NULL, '320', 'GT', 'GTM', 0, 0, NOW(), NOW()),
|
||||
(72, NULL, '324', 'GN', 'GIN', 0, 0, NOW(), NOW()),
|
||||
(73, NULL, '624', 'GW', 'GNB', 0, 0, NOW(), NOW()),
|
||||
(74, NULL, '226', 'GQ', 'GNQ', 0, 0, NOW(), NOW()),
|
||||
(75, NULL, '328', 'GY', 'GUY', 0, 0, NOW(), NOW()),
|
||||
(76, NULL, '332', 'HT', 'HTI', 0, 0, NOW(), NOW()),
|
||||
(77, NULL, '340', 'HN', 'HND', 0, 0, NOW(), NOW()),
|
||||
(78, NULL, '348', 'HU', 'HUN', 0, 0, NOW(), NOW()),
|
||||
(79, NULL, '356', 'IN', 'IND', 0, 0, NOW(), NOW()),
|
||||
(80, NULL, '360', 'ID', 'IDN', 0, 0, NOW(), NOW()),
|
||||
(81, NULL, '364', 'IR', 'IRN', 0, 0, NOW(), NOW()),
|
||||
(82, NULL, '368', 'IQ', 'IRQ', 0, 0, NOW(), NOW()),
|
||||
(83, NULL, '372', 'IE', 'IRL', 0, 0, NOW(), NOW()),
|
||||
(84, NULL, '352', 'IS', 'ISL', 0, 0, NOW(), NOW()),
|
||||
(85, NULL, '376', 'IL', 'ISR', 0, 0, NOW(), NOW()),
|
||||
(86, NULL, '380', 'IT', 'ITA', 0, 0, NOW(), NOW()),
|
||||
(87, NULL, '388', 'JM', 'JAM', 0, 0, NOW(), NOW()),
|
||||
(88, NULL, '392', 'JP', 'JPN', 0, 0, NOW(), NOW()),
|
||||
(89, NULL, '400', 'JO', 'JOR', 0, 0, NOW(), NOW()),
|
||||
(90, NULL, '398', 'KZ', 'KAZ', 0, 0, NOW(), NOW()),
|
||||
(91, NULL, '404', 'KE', 'KEN', 0, 0, NOW(), NOW()),
|
||||
(92, NULL, '417', 'KG', 'KGZ', 0, 0, NOW(), NOW()),
|
||||
(93, NULL, '296', 'KI', 'KIR', 0, 0, NOW(), NOW()),
|
||||
(94, NULL, '414', 'KW', 'KWT', 0, 0, NOW(), NOW()),
|
||||
(95, NULL, '418', 'LA', 'LAO', 0, 0, NOW(), NOW()),
|
||||
(96, NULL, '426', 'LS', 'LSO', 0, 0, NOW(), NOW()),
|
||||
(97, NULL, '428', 'LV', 'LVA', 0, 0, NOW(), NOW()),
|
||||
(98, NULL, '422', 'LB', 'LBN', 0, 0, NOW(), NOW()),
|
||||
(99, NULL, '430', 'LR', 'LBR', 0, 0, NOW(), NOW()),
|
||||
(100, NULL, '343', 'LY', 'LBY', 0, 0, NOW(), NOW()),
|
||||
(101, NULL, '438', 'LI', 'LIE', 0, 0, NOW(), NOW()),
|
||||
(102, NULL, '440', 'LT', 'LTU', 0, 0, NOW(), NOW()),
|
||||
(103, NULL, '442', 'LU', 'LUX', 0, 0, NOW(), NOW()),
|
||||
(104, NULL, '807', 'MK', 'MKD', 0, 0, NOW(), NOW()),
|
||||
(105, NULL, '450', 'MD', 'MDG', 0, 0, NOW(), NOW()),
|
||||
(106, NULL, '458', 'MY', 'MYS', 0, 0, NOW(), NOW()),
|
||||
(107, NULL, '454', 'MW', 'MWI', 0, 0, NOW(), NOW()),
|
||||
(108, NULL, '462', 'MV', 'MDV', 0, 0, NOW(), NOW()),
|
||||
(109, NULL, '466', 'ML', 'MLI', 0, 0, NOW(), NOW()),
|
||||
(110, NULL, '470', 'MT', 'MLT', 0, 0, NOW(), NOW()),
|
||||
(111, NULL, '504', 'MA', 'MAR', 0, 0, NOW(), NOW()),
|
||||
(112, NULL, '584', 'MH', 'MHL', 0, 0, NOW(), NOW()),
|
||||
(113, NULL, '480', 'MU', 'MUS', 0, 0, NOW(), NOW()),
|
||||
(114, NULL, '478', 'MR', 'MRT', 0, 0, NOW(), NOW()),
|
||||
(115, NULL, '484', 'MX', 'MEX', 0, 0, NOW(), NOW()),
|
||||
(116, NULL, '583', 'FM', 'FSM', 0, 0, NOW(), NOW()),
|
||||
(117, NULL, '498', 'MD', 'MDA', 0, 0, NOW(), NOW()),
|
||||
(118, NULL, '492', 'MC', 'MCO', 0, 0, NOW(), NOW()),
|
||||
(119, NULL, '496', 'MN', 'MNG', 0, 0, NOW(), NOW()),
|
||||
(120, NULL, '508', 'MZ', 'MOZ', 0, 0, NOW(), NOW()),
|
||||
(121, NULL, '516', 'NA', 'NAM', 0, 0, NOW(), NOW()),
|
||||
(122, NULL, '520', 'NR', 'NRU', 0, 0, NOW(), NOW()),
|
||||
(123, NULL, '524', 'NP', 'NPL', 0, 0, NOW(), NOW()),
|
||||
(124, NULL, '558', 'NI', 'NIC', 0, 0, NOW(), NOW()),
|
||||
(125, NULL, '562', 'NE', 'NER', 0, 0, NOW(), NOW()),
|
||||
(126, NULL, '566', 'NG', 'NGA', 0, 0, NOW(), NOW()),
|
||||
(127, NULL, '570', 'NU', 'NIU', 0, 0, NOW(), NOW()),
|
||||
(128, NULL, '578', 'NO', 'NOR', 0, 0, NOW(), NOW()),
|
||||
(129, NULL, '554', 'NZ', 'NZL', 0, 0, NOW(), NOW()),
|
||||
(130, NULL, '512', 'OM', 'OMN', 0, 0, NOW(), NOW()),
|
||||
(131, NULL, '800', 'UG', 'UGA', 0, 0, NOW(), NOW()),
|
||||
(132, NULL, '860', 'UZ', 'UZB', 0, 0, NOW(), NOW()),
|
||||
(133, NULL, '586', 'PK', 'PAK', 0, 0, NOW(), NOW()),
|
||||
(134, NULL, '591', 'PA', 'PAN', 0, 0, NOW(), NOW()),
|
||||
(135, NULL, '598', 'PG', 'PNG', 0, 0, NOW(), NOW()),
|
||||
(136, NULL, '600', 'PY', 'PRY', 0, 0, NOW(), NOW()),
|
||||
(137, NULL, '528', 'NL', 'NLD', 0, 0, NOW(), NOW()),
|
||||
(138, NULL, '604', 'PE', 'PER', 0, 0, NOW(), NOW()),
|
||||
(139, NULL, '608', 'PH', 'PHL', 0, 0, NOW(), NOW()),
|
||||
(140, NULL, '616', 'PL', 'POL', 0, 0, NOW(), NOW()),
|
||||
(141, NULL, '620', 'PT', 'PRT', 0, 0, NOW(), NOW()),
|
||||
(142, NULL, '634', 'QA', 'QAT', 0, 0, NOW(), NOW()),
|
||||
(143, NULL, '140', 'CF', 'CAF', 0, 0, NOW(), NOW()),
|
||||
(144, NULL, '214', 'DO', 'DOM', 0, 0, NOW(), NOW()),
|
||||
(145, NULL, '203', 'CZ', 'CZE', 0, 0, NOW(), NOW()),
|
||||
(146, NULL, '642', 'RO', 'ROU', 0, 0, NOW(), NOW()),
|
||||
(147, NULL, '826', 'GB', 'GBR', 0, 0, NOW(), NOW()),
|
||||
(148, NULL, '643', 'RU', 'RUS', 0, 0, NOW(), NOW()),
|
||||
(149, NULL, '646', 'RW', 'RWA', 0, 0, NOW(), NOW()),
|
||||
(150, NULL, '659', 'KN', 'KNA', 0, 0, NOW(), NOW()),
|
||||
(151, NULL, '662', 'LC', 'LCA', 0, 0, NOW(), NOW()),
|
||||
(152, NULL, '674', 'SM', 'SMR', 0, 0, NOW(), NOW()),
|
||||
(153, NULL, '670', 'VC', 'VCT', 0, 0, NOW(), NOW()),
|
||||
(154, NULL, '90', 'SB', 'SLB', 0, 0, NOW(), NOW()),
|
||||
(155, NULL, '222', 'SV', 'SLV', 0, 0, NOW(), NOW()),
|
||||
(156, NULL, '882', 'WS', 'WSM', 0, 0, NOW(), NOW()),
|
||||
(157, NULL, '678', 'ST', 'STP', 0, 0, NOW(), NOW()),
|
||||
(158, NULL, '686', 'SN', 'SEN', 0, 0, NOW(), NOW()),
|
||||
(159, NULL, '690', 'SC', 'SYC', 0, 0, NOW(), NOW()),
|
||||
(160, NULL, '694', 'SL', 'SLE', 0, 0, NOW(), NOW()),
|
||||
(161, NULL, '702', 'SG', 'SGP', 0, 0, NOW(), NOW()),
|
||||
(162, NULL, '703', 'SK', 'SVK', 0, 0, NOW(), NOW()),
|
||||
(163, NULL, '705', 'SI', 'SVN', 0, 0, NOW(), NOW()),
|
||||
(164, NULL, '706', 'SO', 'SOM', 0, 0, NOW(), NOW()),
|
||||
(165, NULL, '729', 'SD', 'SDN', 0, 0, NOW(), NOW()),
|
||||
(166, NULL, '144', 'LK', 'LKA', 0, 0, NOW(), NOW()),
|
||||
(167, NULL, '752', 'SE', 'SWE', 0, 0, NOW(), NOW()),
|
||||
(168, NULL, '756', 'CH', 'CHE', 0, 0, NOW(), NOW()),
|
||||
(169, NULL, '740', 'SR', 'SUR', 0, 0, NOW(), NOW()),
|
||||
(170, NULL, '748', 'SZ', 'SWZ', 0, 0, NOW(), NOW()),
|
||||
(171, NULL, '760', 'SY', 'SYR', 0, 0, NOW(), NOW()),
|
||||
(172, NULL, '762', 'TJ', 'TJK', 0, 0, NOW(), NOW()),
|
||||
(173, NULL, '834', 'TZ', 'TZA', 0, 0, NOW(), NOW()),
|
||||
(174, NULL, '148', 'TD', 'TCD', 0, 0, NOW(), NOW()),
|
||||
(175, NULL, '764', 'TH', 'THA', 0, 0, NOW(), NOW()),
|
||||
(176, NULL, '768', 'TG', 'TGO', 0, 0, NOW(), NOW()),
|
||||
(177, NULL, '776', 'TO', 'TON', 0, 0, NOW(), NOW()),
|
||||
(178, NULL, '780', 'TT', 'TTO', 0, 0, NOW(), NOW()),
|
||||
(179, NULL, '788', 'TN', 'TUN', 0, 0, NOW(), NOW()),
|
||||
(180, NULL, '795', 'TM', 'TKM', 0, 0, NOW(), NOW()),
|
||||
(181, NULL, '792', 'TR', 'TUR', 0, 0, NOW(), NOW()),
|
||||
(182, NULL, '798', 'TV', 'TUV', 0, 0, NOW(), NOW()),
|
||||
(183, NULL, '804', 'UA', 'UKR', 0, 0, NOW(), NOW()),
|
||||
(184, NULL, '858', 'UY', 'URY', 0, 0, NOW(), NOW()),
|
||||
(185, NULL, '336', 'VA', 'VAT', 0, 0, NOW(), NOW()),
|
||||
(186, NULL, '548', 'VU', 'VUT', 0, 0, NOW(), NOW()),
|
||||
(187, NULL, '862', 'VE', 'VEN', 0, 0, NOW(), NOW()),
|
||||
(188, NULL, '704', 'VN', 'VNM', 0, 0, NOW(), NOW()),
|
||||
(189, NULL, '887', 'YE', 'YEM', 0, 0, NOW(), NOW()),
|
||||
(190, NULL, '807', 'MK', 'MKD', 0, 0, NOW(), NOW()),
|
||||
(191, NULL, '180', 'CD', 'COD', 0, 0, NOW(), NOW()),
|
||||
(192, NULL, '894', 'ZM', 'ZMB', 0, 0, NOW(), NOW()),
|
||||
(193, NULL, '716', 'ZW', 'ZWE', 0, 0, NOW(), NOW()),
|
||||
(196, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(197, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(198, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(199, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(200, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(201, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(202, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(203, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(204, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(205, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(206, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(207, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(208, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(209, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(210, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(211, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(212, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(213, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(214, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(215, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(216, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(217, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(218, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(219, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(220, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(221, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(222, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(223, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(224, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(225, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(226, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(227, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(228, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(229, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(230, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(231, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(232, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(233, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(234, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(235, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(236, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(237, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(238, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(239, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(240, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(241, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(242, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(243, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(244, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(245, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
|
||||
(246, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
|
||||
(247, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
|
||||
(248, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
|
||||
(249, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
|
||||
(250, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
|
||||
(251, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
|
||||
(252, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
|
||||
(253, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
|
||||
(254, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
|
||||
(255, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
|
||||
(256, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
|
||||
(257, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
|
||||
(258, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
|
||||
(259, NULL, '312', 'GP', 'GLP', 0, 0, NOW(), NOW()),
|
||||
(260, NULL, '254', 'GF', 'GUF', 0, 0, NOW(), NOW()),
|
||||
(261, NULL, '474', 'MQ', 'MTQ', 0, 0, NOW(), NOW()),
|
||||
(262, NULL, '175', 'YT', 'MYT', 0, 0, NOW(), NOW()),
|
||||
(263, NULL, '638', 'RE', 'REU', 0, 0, NOW(), NOW()),
|
||||
(264, NULL, '666', 'PM', 'SPM', 0, 0, NOW(), NOW()),
|
||||
(265, NULL, '540', 'NC', 'NCL', 0, 0, NOW(), NOW()),
|
||||
(266, NULL, '258', 'PF', 'PYF', 0, 0, NOW(), NOW()),
|
||||
(267, NULL, '876', 'WF', 'WLF', 0, 0, NOW(), NOW()),
|
||||
(268, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW());
|
||||
|
||||
INSERT INTO `country_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
|
||||
(1, 'en_US', 'Afghanistan', '', '', ''),
|
||||
|
||||
@@ -50,7 +50,7 @@ CREATE TABLE `product`
|
||||
FOREIGN KEY (`tax_rule_id`)
|
||||
REFERENCES `tax_rule` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE SET NULL,
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `fk_product_template`
|
||||
FOREIGN KEY (`template_id`)
|
||||
REFERENCES `template` (`id`)
|
||||
@@ -93,12 +93,13 @@ DROP TABLE IF EXISTS `country`;
|
||||
|
||||
CREATE TABLE `country`
|
||||
(
|
||||
`id` INTEGER NOT NULL,
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`area_id` INTEGER,
|
||||
`isocode` VARCHAR(4) NOT NULL,
|
||||
`isoalpha2` VARCHAR(2),
|
||||
`isoalpha3` VARCHAR(4),
|
||||
`by_default` TINYINT,
|
||||
`by_default` TINYINT DEFAULT 0,
|
||||
`shop_country` TINYINT(1) DEFAULT 0 NOT NULL,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
@@ -365,11 +366,12 @@ CREATE TABLE `product_sale_elements`
|
||||
`newness` TINYINT DEFAULT 0,
|
||||
`weight` FLOAT DEFAULT 0,
|
||||
`is_default` TINYINT(1) DEFAULT 0,
|
||||
`ean_code` VARCHAR(255),
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `ref_UNIQUE` (`ref`),
|
||||
INDEX `idx_product_sale_element_product_id` (`product_id`),
|
||||
INDEX `ref` (`ref`),
|
||||
CONSTRAINT `fk_product_sale_element_product_id`
|
||||
FOREIGN KEY (`product_id`)
|
||||
REFERENCES `product` (`id`)
|
||||
@@ -436,7 +438,7 @@ CREATE TABLE `customer`
|
||||
`title_id` INTEGER NOT NULL,
|
||||
`firstname` VARCHAR(255) NOT NULL,
|
||||
`lastname` VARCHAR(255) NOT NULL,
|
||||
`email` VARCHAR(50),
|
||||
`email` VARCHAR(255),
|
||||
`password` VARCHAR(255),
|
||||
`algo` VARCHAR(128),
|
||||
`reseller` TINYINT,
|
||||
@@ -775,6 +777,7 @@ CREATE TABLE `order_product`
|
||||
`was_new` TINYINT NOT NULL,
|
||||
`was_in_promo` TINYINT NOT NULL,
|
||||
`weight` VARCHAR(45),
|
||||
`ean_code` VARCHAR(255),
|
||||
`tax_rule_title` VARCHAR(255),
|
||||
`tax_rule_description` LONGTEXT,
|
||||
`parent` INTEGER COMMENT 'not managed yet',
|
||||
@@ -929,12 +932,12 @@ CREATE TABLE `area_delivery_module`
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- group
|
||||
-- profile
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `group`;
|
||||
DROP TABLE IF EXISTS `profile`;
|
||||
|
||||
CREATE TABLE `group`
|
||||
CREATE TABLE `profile`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`code` VARCHAR(30) NOT NULL,
|
||||
@@ -953,7 +956,7 @@ DROP TABLE IF EXISTS `resource`;
|
||||
CREATE TABLE `resource`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`code` VARCHAR(30) NOT NULL,
|
||||
`code` VARCHAR(255) NOT NULL,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
@@ -969,6 +972,7 @@ DROP TABLE IF EXISTS `admin`;
|
||||
CREATE TABLE `admin`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`profile_id` INTEGER,
|
||||
`firstname` VARCHAR(100) NOT NULL,
|
||||
`lastname` VARCHAR(100) NOT NULL,
|
||||
`login` VARCHAR(100) NOT NULL,
|
||||
@@ -979,61 +983,37 @@ CREATE TABLE `admin`
|
||||
`remember_me_serial` VARCHAR(255),
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`)
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_admin_profile_id` (`profile_id`),
|
||||
CONSTRAINT `fk_admin_profile_id`
|
||||
FOREIGN KEY (`profile_id`)
|
||||
REFERENCES `profile` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- admin_group
|
||||
-- profile_resource
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `admin_group`;
|
||||
DROP TABLE IF EXISTS `profile_resource`;
|
||||
|
||||
CREATE TABLE `admin_group`
|
||||
CREATE TABLE `profile_resource`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`group_id` INTEGER NOT NULL,
|
||||
`admin_id` INTEGER NOT NULL,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`,`group_id`,`admin_id`),
|
||||
INDEX `idx_admin_group_group_id` (`group_id`),
|
||||
INDEX `idx_admin_group_admin_id` (`admin_id`),
|
||||
CONSTRAINT `fk_admin_group_group_id`
|
||||
FOREIGN KEY (`group_id`)
|
||||
REFERENCES `group` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_admin_group_admin_id`
|
||||
FOREIGN KEY (`admin_id`)
|
||||
REFERENCES `admin` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- group_resource
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `group_resource`;
|
||||
|
||||
CREATE TABLE `group_resource`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`group_id` INTEGER NOT NULL,
|
||||
`profile_id` INTEGER NOT NULL,
|
||||
`resource_id` INTEGER NOT NULL,
|
||||
`read` TINYINT DEFAULT 0,
|
||||
`write` TINYINT DEFAULT 0,
|
||||
`access` INTEGER DEFAULT 0 NOT NULL,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`,`group_id`,`resource_id`),
|
||||
INDEX `id_group_resource_group_id` (`group_id`),
|
||||
INDEX `idx_group_resource_resource_id` (`resource_id`),
|
||||
CONSTRAINT `fk_group_resource_group_id`
|
||||
FOREIGN KEY (`group_id`)
|
||||
REFERENCES `group` (`id`)
|
||||
PRIMARY KEY (`profile_id`,`resource_id`),
|
||||
INDEX `idx_profile_resource_profile_id` (`profile_id`),
|
||||
INDEX `idx_profile_resource_resource_id` (`resource_id`),
|
||||
CONSTRAINT `fk_profile_resource_profile_id`
|
||||
FOREIGN KEY (`profile_id`)
|
||||
REFERENCES `profile` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_group_resource_resource_id`
|
||||
CONSTRAINT `fk_profile_resource_resource_id`
|
||||
FOREIGN KEY (`resource_id`)
|
||||
REFERENCES `resource` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
@@ -1041,28 +1021,27 @@ CREATE TABLE `group_resource`
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- group_module
|
||||
-- profile_module
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `group_module`;
|
||||
DROP TABLE IF EXISTS `profile_module`;
|
||||
|
||||
CREATE TABLE `group_module`
|
||||
CREATE TABLE `profile_module`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`group_id` INTEGER NOT NULL,
|
||||
`module_id` INTEGER,
|
||||
`profile_id` INTEGER NOT NULL,
|
||||
`module_id` INTEGER NOT NULL,
|
||||
`access` TINYINT DEFAULT 0,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_group_module_group_id` (`group_id`),
|
||||
INDEX `idx_group_module_module_id` (`module_id`),
|
||||
CONSTRAINT `fk_group_module_group_id`
|
||||
FOREIGN KEY (`group_id`)
|
||||
REFERENCES `group` (`id`)
|
||||
PRIMARY KEY (`profile_id`,`module_id`),
|
||||
INDEX `idx_profile_module_profile_id` (`profile_id`),
|
||||
INDEX `idx_profile_module_module_id` (`module_id`),
|
||||
CONSTRAINT `fk_profile_module_profile_id`
|
||||
FOREIGN KEY (`profile_id`)
|
||||
REFERENCES `profile` (`id`)
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_group_module_module_id`
|
||||
CONSTRAINT `fk_profile_module_module_id`
|
||||
FOREIGN KEY (`module_id`)
|
||||
REFERENCES `module` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
@@ -1279,6 +1258,7 @@ CREATE TABLE `product_price`
|
||||
`currency_id` INTEGER NOT NULL,
|
||||
`price` FLOAT NOT NULL,
|
||||
`promo_price` FLOAT,
|
||||
`from_default_currency` TINYINT(1) DEFAULT 0 NOT NULL,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`product_sale_elements_id`,`currency_id`),
|
||||
@@ -1601,6 +1581,21 @@ CREATE TABLE `order_product_tax`
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- newsletter
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `newsletter`;
|
||||
|
||||
CREATE TABLE `newsletter`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`email` VARCHAR(255) NOT NULL,
|
||||
`firstname` VARCHAR(255),
|
||||
`lastname` VARCHAR(255),
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- category_i18n
|
||||
-- ---------------------------------------------------------------------
|
||||
@@ -1971,12 +1966,12 @@ CREATE TABLE `module_i18n`
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- group_i18n
|
||||
-- profile_i18n
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `group_i18n`;
|
||||
DROP TABLE IF EXISTS `profile_i18n`;
|
||||
|
||||
CREATE TABLE `group_i18n`
|
||||
CREATE TABLE `profile_i18n`
|
||||
(
|
||||
`id` INTEGER NOT NULL,
|
||||
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
|
||||
@@ -1985,9 +1980,9 @@ CREATE TABLE `group_i18n`
|
||||
`chapo` TEXT,
|
||||
`postscriptum` TEXT,
|
||||
PRIMARY KEY (`id`,`locale`),
|
||||
CONSTRAINT `group_i18n_FK_1`
|
||||
CONSTRAINT `profile_i18n_FK_1`
|
||||
FOREIGN KEY (`id`)
|
||||
REFERENCES `group` (`id`)
|
||||
REFERENCES `profile` (`id`)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,20 @@
|
||||
<div class="form-container">
|
||||
|
||||
{$has_at_least_one_combination = false}
|
||||
{$default_product_sale_element_id = 0}
|
||||
|
||||
{loop name="product.sales.elements.test" type="product_sale_elements" product=$product_id currency=$edit_currency_id backend_context="1"}
|
||||
{loop name="product.combinations" type="attribute_combination" product_sale_elements="$ID"}
|
||||
{$has_at_least_one_combination = true}
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="product.combinations"}
|
||||
{$default_product_sale_element_id = $ID}
|
||||
{/elseloop}
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="product.sales.elements.test"}
|
||||
{form name="thelia.admin.product.details.modification"}
|
||||
{if $has_at_least_one_combination == false}
|
||||
{form name="thelia.admin.product_default_sale_element.update"}
|
||||
<form method="POST" action="{url path='/admin/product/default-price/update'}" {form_enctype form=$form} class="clearfix">
|
||||
|
||||
{include
|
||||
@@ -17,15 +27,27 @@
|
||||
}
|
||||
|
||||
{* Be sure to get the product ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="product_id" value="{$product_id}" />
|
||||
<input type="hidden" name="product_id" value="{$product_id}" />
|
||||
|
||||
<input type="hidden" name="current_tab" value="details" />
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='id'}
|
||||
<input type="hidden" name="{$name}" value="{$value}" />
|
||||
{/form_field}
|
||||
{form_field form=$form field='product_id'}
|
||||
<input type="hidden" name="{$name}" value="{$value}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='product_sale_element_id'}
|
||||
<input type="hidden" name="{$name}" value="{$default_product_sale_element_id}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='isdefault'}
|
||||
<input type="hidden" name="{$name}" value="{$value}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='reference'}
|
||||
<input type="hidden" name="{$name}" value="{$value}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/categories' category_id=$DEFAULT_CATEGORY}" />
|
||||
@@ -39,11 +61,41 @@
|
||||
{form_field form=$form field='currency'}
|
||||
<input type="hidden" name="{$name}" value="{$ID}" />
|
||||
{/form_field}
|
||||
|
||||
{$current_currency_is_default = $IS_DEFAULT}
|
||||
{/loop}
|
||||
|
||||
<p class="title title-without-tabs">{intl l='Default pricing'}</p>
|
||||
|
||||
<p>{intl l="The default pricing is used with product that do not have any combinations. It is also used for product with combinations which share the same pricing information"}</p>
|
||||
{if $form_error}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-danger">{$form_error_message}</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
{form_field form=$form field='tax_rule'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="tax_rule_field" class="control-label">{$label} : </label>
|
||||
<div class="form-group">
|
||||
<select id="tax_rule_field" required="required" name="{$name}" class="form-control">
|
||||
<option value="">{intl l="Select a tax tule"}</option>
|
||||
{loop name="tax" type="tax-rule" backend_context="1"}
|
||||
<option value="{$ID}" {if $IS_DEFAULT}selected="selected"{/if}>{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="title title-without-tabs">{intl l='Pricing'}</p>
|
||||
|
||||
<p>{intl l="The default pricing is used when no combination is defined."}</p>
|
||||
|
||||
<div class="row">
|
||||
|
||||
@@ -53,49 +105,93 @@
|
||||
<div class="well well-sm">
|
||||
<p class="title title-without-tabs">{intl l='Pricing'}</p>
|
||||
|
||||
<p></p> <!-- LAME !!! FIXME -->
|
||||
<p></p> <!-- LAME !!! FIXME -->
|
||||
|
||||
{form_field form=$form field='use_exchange_rate'}
|
||||
{if $current_currency_is_default}
|
||||
<input type="hidden" name="{$name}" value="0">
|
||||
{$show_pricing_fields = true}
|
||||
{else}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" id="use_exchange_rate_box" name="{$name}" value="1" {if $value != 0}checked="checked"{/if}>
|
||||
{$label}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{$show_pricing_fields = ($value == 0)}
|
||||
{/if}
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='price'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<label for="price_without_tax" class="control-label">{$label} : </label>
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Product price'}">
|
||||
<input {if !$show_pricing_fields}readonly{/if} data-price-type="without-tax" data-rel-price="price_with_tax" type="text" id="price_without_tax" required="required" name="{$name}" class="automatic_price_field form-control" value="{$value}" title="{$label}" placeholder="{intl l='Price excl. taxes'}">
|
||||
<span class="input-group-addon">{$currency_symbol}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='tax_rule'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<div class="form-group">
|
||||
<select id="{$label_attr.for}" required="required" name="{$name}" class="form-control">
|
||||
<option value="">{intl l="Select a tax tule"}</option>
|
||||
{loop name="tax" type="tax-rule" backend_context="1"}
|
||||
<option value="{$ID}" {if $IS_DEFAULT}selected="selected"{/if}>{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='price_with_tax'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Product price'}">
|
||||
<span class="input-group-addon">{$currency_symbol}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
<div class="form-group">
|
||||
<label for="price_with_tax" class="control-label">{intl l="Product price including taxes"} : </label>
|
||||
<div class="input-group">
|
||||
<input {if !$show_pricing_fields}readonly{/if} data-price-type="with-tax" data-rel-price="price_without_tax" type="text" id="price_with_tax" name="price_with_tax" class="automatic_price_field form-control" value="" title="{intl l='Product price including taxes'}" placeholder="{intl l='Price incl. taxes'}">
|
||||
<span class="input-group-addon">{$currency_symbol}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='product_details_pricing_form'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{* -- Details -------------------------------------------------- *}
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="well well-sm">
|
||||
<p class="title title-without-tabs">{intl l='Details'}</p>
|
||||
|
||||
{form_field form=$form field='ean_code'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Product EAN Code'}">
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='weight'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Product weight'}">
|
||||
<span class="input-group-addon">{intl l="Kg"}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='product_details_shipping_form'}
|
||||
|
||||
{form_field form=$form field='quantity'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Current quantity'}">
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='product_details_quantity_form'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{* -- Promotion ------------------------------------------------- *}
|
||||
|
||||
<div class="col-md-4">
|
||||
@@ -104,15 +200,23 @@
|
||||
|
||||
{form_field form=$form field='sale_price'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<label for="sale_price_without_tax" class="control-label">{$label} : </label>
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Product price'}">
|
||||
<input {if !$show_pricing_fields}readonly{/if} data-price-type="without-tax" data-rel-price="sale_price_with_tax" type="text" id="sale_price_without_tax" required="required" name="{$name}" class="automatic_price_field form-control" value="{$value}" title="{$label}" placeholder="{intl l='Product price'}">
|
||||
<span class="input-group-addon">{$currency_symbol}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<div class="form-group">
|
||||
<label for="sale_price_with_tax" class="control-label">{intl l="Sale price including taxes"} : </label>
|
||||
<div class="input-group">
|
||||
<input {if !$show_pricing_fields}readonly{/if} data-price-type="with-tax" data-rel-price="sale_price_without_tax" type="text" id="sale_price_with_tax" name="sale_price_with_tax" class="automatic_price_field form-control" value="" title="{intl l='Sale price including taxes'}" placeholder="{intl l='Sale price incl. taxes'}">
|
||||
<span class="input-group-addon">{$currency_symbol}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{form_field form=$form field='onsale'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<div class="checkbox">
|
||||
@@ -138,54 +242,20 @@
|
||||
{module_include location='product_details_promotion_form'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{* -- Shipping -------------------------------------------------- *}
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="well well-sm">
|
||||
<p class="title title-without-tabs">{intl l='Shipping'}</p>
|
||||
|
||||
{form_field form=$form field='weight'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Product weight'}">
|
||||
<span class="input-group-addon">{intl l="Kg"}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='product_details_shipping_form'}
|
||||
|
||||
<p class="title title-without-tabs">{intl l='Quantity'}</p>
|
||||
|
||||
{form_field form=$form field='quantity'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Current quantity'}">
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='product_details_quantity_form'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{/form}
|
||||
{/elseloop}
|
||||
{/if}
|
||||
|
||||
{* -- Attribute combinations -------------------------------------------- *}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{if $has_at_least_one_combination}
|
||||
|
||||
{ifloop rel="product.sales.elements"}
|
||||
<form method="POST" action="{url path='/admin/product/combinations/update'}">
|
||||
{form name="thelia.admin.product_sale_element.update"}
|
||||
<form method="POST" action="{url path='/admin/product/combinations/update'}" {form_enctype form=$form}>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
{include
|
||||
file = "includes/inner-form-toolbar.html"
|
||||
@@ -195,6 +265,26 @@
|
||||
close_url = "{url path='/admin/categories' category_id=$DEFAULT_CATEGORY}"
|
||||
}
|
||||
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
{form_field form=$form field='tax_rule'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="tax_rule_field" class="control-label">{$label} : </label>
|
||||
<div class="form-group">
|
||||
<select id="tax_rule_field" required="required" name="{$name}" class="form-control">
|
||||
<option value="">{intl l="Select a tax tule"}</option>
|
||||
{loop name="tax" type="tax-rule" backend_context="1"}
|
||||
<option value="{$ID}" {if $IS_DEFAULT}selected="selected"{/if}>{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='product_before_combinations'}
|
||||
|
||||
<table class="table table-striped table-condensed" id="category_list">
|
||||
@@ -212,33 +302,38 @@
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l='Attributes'}</th>
|
||||
<th class="text-center">{intl l='Quantity'}</th>
|
||||
<th class="text-center">{intl l='Reference'}</th>
|
||||
<th class="text-center">{intl l='EAN Code'}</th>
|
||||
<th class="text-center">{intl l='Quantity'}</th>
|
||||
<th class="text-center">{intl l='Price<br />w/o taxes (%currency)' currency=$currency_symbol}</th>
|
||||
<th class="text-center">{intl l='Price<br />w/ taxes (%currency)' currency=$currency_symbol}</th>
|
||||
<th class="text-center">{intl l='Weight (Kg)'}</th>
|
||||
<th class="text-center">{intl l='Weight<br />(Kg)'}</th>
|
||||
<th class="text-center">{intl l='Default'}</th>
|
||||
<th class="text-center">{intl l='Is new'}</th>
|
||||
<th class="text-center">{intl l='On sale'}</th>
|
||||
<th class="text-center">{intl l='New'}</th>
|
||||
<th class="text-center">{intl l='Sale'}</th>
|
||||
<th class="text-center">{intl l='Sale price<br />w/o taxes (%currency)' currency=$currency_symbol}</th>
|
||||
<th class="text-center">{intl l='Sale price<br />w/ taxes (%currency)' currency=$currency_symbol}</th>
|
||||
<th class="actions">{intl l='Actions'}</th>
|
||||
<th class="actions"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="product.sales.elements" type="product_sale_elements" product=$product_id currency=$edit_currency_id backend_context="1"}
|
||||
<tr>
|
||||
<td colspan="12">
|
||||
{$ID}: {loop name="product.sales.elements.combinations" type="attribute_combination" product_sale_elements=$ID backend_context="1"}
|
||||
{if $LOOP_COUNT > 1} - {/if}{$ATTRIBUTE_TITLE}
|
||||
{/loop}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{loop name="product.sales.elements.combinations" type="attribute_combination" product_sale_elements=$ID backend_context="1"}
|
||||
{$ATTRIBUTE_TITLE}
|
||||
{/loop}
|
||||
</td>
|
||||
|
||||
<td><input class="form-control text-right" type="text" name="quantity[{$ID}]" value="{$QUANTITY}" /></td>
|
||||
<td><input class="form-control text-right" type="text" name="quantity[{$ID}]" value="{$REF}" /></td>
|
||||
<td><input class="form-control text-right" type="text" name="quantity[{$ID}]" value="{$EAN_CODE}" /></td>
|
||||
<td><input class="form-control text-right" type="text" name="quantity[{$ID}]" value="{$QUANTITY}" /></td>
|
||||
<td><input class="form-control text-right" type="text" name="price_wo_taxes[{$ID}]" value="{format_number number=$PRICE}" /></td>
|
||||
<td><input class="form-control text-right" type="text" name="price_w_taxes[{$ID}]" value="{format_number number=$TAXED_PRICE}" /></td>
|
||||
<td><input class="form-control text-right" type="text" name="weight[{$ID}]" value="{$WEIGHT}" /></td>
|
||||
<td><input class="form-control text-right col-lg-1" type="text" name="weight[{$ID}]" value="{$WEIGHT}" /></td>
|
||||
|
||||
<td class="text-center">
|
||||
<input class="form-control" type="radio" name="default" value="{$ID}" {if $IS_DEFAULT}checked="checked"{/if}/>
|
||||
@@ -263,26 +358,30 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{module_include location='product_after_combinations'}
|
||||
</form>
|
||||
{module_include location='product_after_combinations'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/ifloop}
|
||||
</form>
|
||||
{/form}
|
||||
{/if}
|
||||
|
||||
{elseloop rel="product.sales.elements"}
|
||||
<p class="title title-without-tabs">{intl l='Attribute Combinations'}</p>
|
||||
{if $has_at_least_one_combination == false}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<p class="title title-without-tabs">{intl l='Attribute Combinations'}</p>
|
||||
|
||||
<div class="alert alert-info">
|
||||
{intl
|
||||
l='This product has no combination. The default price is used. <a data-toggle="modal" href="%url">Click here to create a new combination</a>'
|
||||
url='#combination_creation_dialog'
|
||||
}
|
||||
</div>
|
||||
{/elseloop}
|
||||
<div class="alert alert-info">
|
||||
{intl
|
||||
l='This product has no combination. The default price is used. <a data-toggle="modal" href="%url">Click here to create a new combination</a>'
|
||||
url='#combination_creation_dialog'
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{module_include location='product_after_combinations'}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{module_include location='product_after_combinations'}
|
||||
</div>
|
||||
|
||||
{* -- Adding a new combination ------------------------------------------------- *}
|
||||
@@ -310,7 +409,7 @@
|
||||
<div class="input-group">
|
||||
{* <label class="control-label">{intl l="Attribute values"} : </label> *}
|
||||
|
||||
<select rname="attribute_value_id" id="attribute_value_id" class="form-control">
|
||||
<select name="attribute_value_id" id="attribute_value_id" class="form-control">
|
||||
<option value="">{intl l='Select an attribute value...'}</option>
|
||||
</select>
|
||||
|
||||
@@ -381,7 +480,7 @@
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "combination_delete_dialog"
|
||||
dialog_title = {intl l="Delete a combunation"}
|
||||
dialog_title = {intl l="Delete a combination"}
|
||||
dialog_message = {intl l="Do you really want to delete this combination ?"}
|
||||
|
||||
form_action = {url path='/admin/product/combination/delete'}
|
||||
|
||||
@@ -135,12 +135,16 @@
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
{javascripts file='assets/js/jquery.typewatch.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
<script src="{url file='/tinymce/tinymce.min.js'}"></script>
|
||||
|
||||
<script>
|
||||
tinymce.init({
|
||||
selector: ".wysiwyg",
|
||||
@@ -269,6 +273,49 @@ $(function() {
|
||||
$('#combination_attributes option').prop('selected', 'selected');
|
||||
});
|
||||
|
||||
// In details tab, process exchange rate usage checkbox changes
|
||||
$('use_exchange_rate_box').change(function(ev) {
|
||||
$('.')
|
||||
});
|
||||
|
||||
// Automatic update of price fields: any change in the taxed (resp. untaxed) price
|
||||
// will update the untaxed (resp. taxed) one
|
||||
$('.automatic_price_field').typeWatch({
|
||||
captureLength: 1,
|
||||
callback: function () {
|
||||
|
||||
var tax_rule_id = $('#tax_rule_field').val();
|
||||
|
||||
if (tax_rule_id != "") {
|
||||
var priceType = $(this).data('price-type');
|
||||
var dest_field_id = $(this).data('rel-price');
|
||||
|
||||
var operation;
|
||||
|
||||
if (priceType == 'with-tax')
|
||||
operation = 'from_tax';
|
||||
else if (priceType == 'without-tax')
|
||||
operation = 'to_tax';
|
||||
else
|
||||
operation = '';
|
||||
|
||||
$.ajax({
|
||||
url : '{url path="/admin/product/calculate-price"}',
|
||||
data : {
|
||||
price : $(this).val(),
|
||||
action : operation,
|
||||
tax_rule_id : $('#tax_rule_field').val()
|
||||
},
|
||||
type : 'get',
|
||||
dataType : 'json',
|
||||
success : function(json) {
|
||||
$('#' + dest_field_id).val(json.result);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user