fix cs
This commit is contained in:
@@ -86,14 +86,14 @@ class Address extends BaseAction implements EventSubscriberInterface
|
||||
->save()
|
||||
;
|
||||
|
||||
if($event->getIsDefault()) {
|
||||
if ($event->getIsDefault()) {
|
||||
$addressModel->makeItDefault();
|
||||
}
|
||||
|
||||
$event->setAddress($addressModel);
|
||||
$con->commit();
|
||||
|
||||
} catch(PropelException $e) {
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
@@ -33,11 +33,7 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Attribute\AttributeUpdateEvent;
|
||||
use Thelia\Core\Event\Attribute\AttributeCreateEvent;
|
||||
use Thelia\Core\Event\Attribute\AttributeDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\AttributeAv;
|
||||
use Thelia\Model\AttributeAvQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Core\Event\Category\CategoryEvent;
|
||||
use Thelia\Core\Event\Attribute\AttributeEvent;
|
||||
use Thelia\Model\AttributeTemplate;
|
||||
use Thelia\Model\AttributeTemplateQuery;
|
||||
@@ -130,7 +126,7 @@ class Attribute extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
$templates = TemplateQuery::create()->find();
|
||||
|
||||
foreach($templates as $template) {
|
||||
foreach ($templates as $template) {
|
||||
|
||||
$attribute_template = new AttributeTemplate();
|
||||
|
||||
@@ -171,4 +167,4 @@ class Attribute extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Attribute\AttributeAvUpdateEvent;
|
||||
use Thelia\Core\Event\Attribute\AttributeAvCreateEvent;
|
||||
use Thelia\Core\Event\Attribute\AttributeAvDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
|
||||
class AttributeAv extends BaseAction implements EventSubscriberInterface
|
||||
@@ -115,7 +114,6 @@ class AttributeAv extends BaseAction implements EventSubscriberInterface
|
||||
return $this->genericUpdatePosition(AttributeAvQuery::create(), $event);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -128,4 +126,4 @@ class AttributeAv extends BaseAction implements EventSubscriberInterface
|
||||
TheliaEvents::ATTRIBUTE_AV_UPDATE_POSITION => array("updatePosition", 128),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace Thelia\Action;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Thelia\Model\AdminLog;
|
||||
use Propel\Runtime\ActiveQuery\PropelQuery;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
|
||||
@@ -50,7 +49,6 @@ class BaseAction
|
||||
return $this->container->get('event_dispatcher');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Changes object position, selecting absolute ou relative change.
|
||||
*
|
||||
|
||||
@@ -23,10 +23,7 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
use Thelia\Core\Event\CachedFileEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
@@ -50,7 +47,7 @@ abstract class BaseCachedFile extends BaseAction
|
||||
/**
|
||||
* @return string root of the file cache directory in web space
|
||||
*/
|
||||
protected abstract function getCacheDirFromWebRoot();
|
||||
abstract protected function getCacheDirFromWebRoot();
|
||||
|
||||
/**
|
||||
* Clear the file cache. Is a subdirectory is specified, only this directory is cleared.
|
||||
@@ -104,9 +101,9 @@ abstract class BaseCachedFile extends BaseAction
|
||||
/**
|
||||
* Return the full path of the cached file
|
||||
*
|
||||
* @param string $subdir the subdirectory related to cache base
|
||||
* @param string $filename the filename
|
||||
* @param string $hashed_options a hash of transformation options, or null if no transformations have been applied
|
||||
* @param string $subdir the subdirectory related to cache base
|
||||
* @param string $filename the filename
|
||||
* @param string $hashed_options a hash of transformation options, or null if no transformations have been applied
|
||||
* @param boolean $forceOriginalDocument if true, the original file path in the cache dir is returned.
|
||||
* @return string the cache directory path relative to Web Root
|
||||
*/
|
||||
@@ -175,4 +172,4 @@ abstract class BaseCachedFile extends BaseAction
|
||||
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Category\CategoryUpdateEvent;
|
||||
use Thelia\Core\Event\Category\CategoryCreateEvent;
|
||||
use Thelia\Core\Event\Category\CategoryDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Core\Event\Category\CategoryToggleVisibilityEvent;
|
||||
use Thelia\Core\Event\Category\CategoryAddContentEvent;
|
||||
@@ -139,8 +138,8 @@ class Category extends BaseAction implements EventSubscriberInterface
|
||||
return $this->genericUpdatePosition(CategoryQuery::create(), $event);
|
||||
}
|
||||
|
||||
public function addContent(CategoryAddContentEvent $event) {
|
||||
|
||||
public function addContent(CategoryAddContentEvent $event)
|
||||
{
|
||||
if (CategoryAssociatedContentQuery::create()
|
||||
->filterByContentId($event->getContentId())
|
||||
->filterByCategory($event->getCategory())->count() <= 0) {
|
||||
@@ -156,8 +155,8 @@ class Category extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function removeContent(CategoryDeleteContentEvent $event) {
|
||||
|
||||
public function removeContent(CategoryDeleteContentEvent $event)
|
||||
{
|
||||
$content = CategoryAssociatedContentQuery::create()
|
||||
->filterByContentId($event->getContentId())
|
||||
->filterByCategory($event->getCategory())->findOne()
|
||||
@@ -170,7 +169,6 @@ class Category extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
||||
@@ -31,8 +31,6 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Model\ContentQuery;
|
||||
use Thelia\Model\Content as ContentModel;
|
||||
use Thelia\Model\FolderQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Class Content
|
||||
@@ -82,11 +80,10 @@ class Content extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
public function updatePosition(UpdatePositionEvent $event)
|
||||
{
|
||||
if(null !== $content = ContentQuery::create()->findPk($event->getObjectId())) {
|
||||
if (null !== $content = ContentQuery::create()->findPk($event->getObjectId())) {
|
||||
$content->setDispatcher($this->getDispatcher());
|
||||
|
||||
switch($event->getMode())
|
||||
{
|
||||
switch ($event->getMode()) {
|
||||
case UpdatePositionEvent::POSITION_ABSOLUTE:
|
||||
$content->changeAbsolutePosition($event->getPosition());
|
||||
break;
|
||||
@@ -124,7 +121,6 @@ class Content extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of event names this subscriber wants to listen to.
|
||||
*
|
||||
@@ -157,4 +153,4 @@ class Content extends BaseAction implements EventSubscriberInterface
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,11 +33,7 @@ use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Tools\FileManager;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
use Imagine\Document\ImagineInterface;
|
||||
use Imagine\Document\DocumentInterface;
|
||||
use Imagine\Document\Box;
|
||||
use Imagine\Document\Color;
|
||||
use Imagine\Document\Point;
|
||||
use Thelia\Exception\DocumentException;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
|
||||
@@ -80,7 +76,8 @@ class Document extends BaseCachedFile implements EventSubscriberInterface
|
||||
/**
|
||||
* @return string root of the document cache directory in web space
|
||||
*/
|
||||
protected function getCacheDirFromWebRoot() {
|
||||
protected function getCacheDirFromWebRoot()
|
||||
{
|
||||
return ConfigQuery::read('document_cache_dir_from_web_root', 'cache');
|
||||
}
|
||||
|
||||
@@ -95,7 +92,7 @@ class Document extends BaseCachedFile implements EventSubscriberInterface
|
||||
* @param DocumentEvent $event Event
|
||||
*
|
||||
* @throws \Thelia\Exception\DocumentException
|
||||
* @throws \InvalidArgumentException , DocumentException
|
||||
* @throws \InvalidArgumentException , DocumentException
|
||||
*/
|
||||
public function processDocument(DocumentEvent $event)
|
||||
{
|
||||
@@ -247,7 +244,7 @@ class Document extends BaseCachedFile implements EventSubscriberInterface
|
||||
'document'
|
||||
)
|
||||
);
|
||||
} catch(\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->adminLogAppend(
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Fail to delete document for %id% with parent id %parentId% (Exception : %e%)',
|
||||
|
||||
@@ -33,11 +33,7 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Feature\FeatureUpdateEvent;
|
||||
use Thelia\Core\Event\Feature\FeatureCreateEvent;
|
||||
use Thelia\Core\Event\Feature\FeatureDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\FeatureAv;
|
||||
use Thelia\Model\FeatureAvQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Core\Event\Category\CategoryEvent;
|
||||
use Thelia\Core\Event\Feature\FeatureEvent;
|
||||
use Thelia\Model\FeatureTemplate;
|
||||
use Thelia\Model\FeatureTemplateQuery;
|
||||
@@ -130,7 +126,7 @@ class Feature extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
$templates = TemplateQuery::create()->find();
|
||||
|
||||
foreach($templates as $template) {
|
||||
foreach ($templates as $template) {
|
||||
|
||||
$feature_template = new FeatureTemplate();
|
||||
|
||||
@@ -171,4 +167,4 @@ class Feature extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Feature\FeatureAvUpdateEvent;
|
||||
use Thelia\Core\Event\Feature\FeatureAvCreateEvent;
|
||||
use Thelia\Core\Event\Feature\FeatureAvDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
|
||||
class FeatureAv extends BaseAction implements EventSubscriberInterface
|
||||
@@ -115,7 +114,6 @@ class FeatureAv extends BaseAction implements EventSubscriberInterface
|
||||
return $this->genericUpdatePosition(FeatureAvQuery::create(), $event);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -128,4 +126,4 @@ class FeatureAv extends BaseAction implements EventSubscriberInterface
|
||||
TheliaEvents::FEATURE_AV_UPDATE_POSITION => array("updatePosition", 128),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,15 +32,13 @@ use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Model\FolderQuery;
|
||||
use Thelia\Model\Folder as FolderModel;
|
||||
|
||||
|
||||
/**
|
||||
* Class Folder
|
||||
* @package Thelia\Action
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class Folder extends BaseAction implements EventSubscriberInterface {
|
||||
|
||||
|
||||
class Folder extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
public function update(FolderUpdateEvent $event)
|
||||
{
|
||||
|
||||
@@ -103,11 +101,10 @@ class Folder extends BaseAction implements EventSubscriberInterface {
|
||||
|
||||
public function updatePosition(UpdatePositionEvent $event)
|
||||
{
|
||||
if(null !== $folder = FolderQuery::create()->findPk($event->getObjectId())) {
|
||||
if (null !== $folder = FolderQuery::create()->findPk($event->getObjectId())) {
|
||||
$folder->setDispatcher($this->getDispatcher());
|
||||
|
||||
switch($event->getMode())
|
||||
{
|
||||
switch ($event->getMode()) {
|
||||
case UpdatePositionEvent::POSITION_ABSOLUTE:
|
||||
$folder->changeAbsolutePosition($event->getPosition());
|
||||
break;
|
||||
@@ -152,4 +149,4 @@ class Folder extends BaseAction implements EventSubscriberInterface {
|
||||
TheliaEvents::FOLDER_UPDATE_POSITION => array("updatePosition", 128),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class HttpException extends BaseAction implements EventSubscriberInterface
|
||||
$this->display404($event);
|
||||
}
|
||||
|
||||
if($event->getException() instanceof AccessDeniedHttpException) {
|
||||
if ($event->getException() instanceof AccessDeniedHttpException) {
|
||||
$this->display403($event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,19 +23,12 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
use Propel\Runtime\ActiveRecord\ActiveRecordInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Thelia\Core\Event\Image\ImageCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\ImagesCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Image\ImageDeleteEvent;
|
||||
use Thelia\Core\Event\Image\ImageEvent;
|
||||
use Thelia\Model\CategoryImage;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\ContentImage;
|
||||
use Thelia\Model\FolderImage;
|
||||
use Thelia\Model\ProductImage;
|
||||
use Thelia\Tools\FileManager;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
@@ -88,12 +81,11 @@ class Image extends BaseCachedFile implements EventSubscriberInterface
|
||||
const EXACT_RATIO_WITH_CROP = 2;
|
||||
const KEEP_IMAGE_RATIO = 3;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return string root of the image cache directory in web space
|
||||
*/
|
||||
protected function getCacheDirFromWebRoot() {
|
||||
protected function getCacheDirFromWebRoot()
|
||||
{
|
||||
return ConfigQuery::read('image_cache_dir_from_web_root', 'cache');
|
||||
}
|
||||
|
||||
@@ -106,8 +98,8 @@ class Image extends BaseCachedFile implements EventSubscriberInterface
|
||||
*
|
||||
* This method updates the cache_file_path and file_url attributes of the event
|
||||
*
|
||||
* @param \Thelia\Core\Event\Image\ImageEvent $event
|
||||
* @throws \InvalidArgumentException, ImageException
|
||||
* @param \Thelia\Core\Event\Image\ImageEvent $event
|
||||
* @throws \InvalidArgumentException, ImageException
|
||||
*/
|
||||
public function processImage(ImageEvent $event)
|
||||
{
|
||||
@@ -358,7 +350,7 @@ class Image extends BaseCachedFile implements EventSubscriberInterface
|
||||
'image'
|
||||
)
|
||||
);
|
||||
} catch(\Exception $e){
|
||||
} catch (\Exception $e) {
|
||||
$this->adminLogAppend(
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Fail to delete image for %id% with parent id %parentId% (Exception : %e%)',
|
||||
|
||||
@@ -23,13 +23,11 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\Order\OrderAddressEvent;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Exception\OrderException;
|
||||
use Thelia\Exception\TheliaProcessException;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\OrderProductAttributeCombination;
|
||||
@@ -39,7 +37,6 @@ use Thelia\Model\OrderStatus;
|
||||
use Thelia\Model\Map\OrderTableMap;
|
||||
use Thelia\Model\OrderAddress;
|
||||
use Thelia\Model\OrderStatusQuery;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Tools\I18n;
|
||||
|
||||
/**
|
||||
@@ -177,7 +174,7 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
/* fulfill order_products and decrease stock */
|
||||
|
||||
foreach($cartItems as $cartItem) {
|
||||
foreach ($cartItems as $cartItem) {
|
||||
$product = $cartItem->getProduct();
|
||||
|
||||
/* get translation */
|
||||
@@ -186,7 +183,7 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
$pse = $cartItem->getProductSaleElements();
|
||||
|
||||
/* check still in stock */
|
||||
if($cartItem->getQuantity() > $pse->getQuantity()) {
|
||||
if ($cartItem->getQuantity() > $pse->getQuantity()) {
|
||||
throw new TheliaProcessException("Not enough stock", TheliaProcessException::CART_ITEM_NOT_ENOUGH_STOCK, $cartItem);
|
||||
}
|
||||
|
||||
@@ -228,13 +225,13 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
$orderProduct->save($con);
|
||||
|
||||
/* fulfill order_product_tax */
|
||||
foreach($taxDetail as $tax) {
|
||||
foreach ($taxDetail as $tax) {
|
||||
$tax->setOrderProductId($orderProduct->getId());
|
||||
$tax->save($con);
|
||||
}
|
||||
|
||||
/* fulfill order_attribute_combination and decrease stock */
|
||||
foreach($pse->getAttributeCombinations() as $attributeCombination) {
|
||||
foreach ($pse->getAttributeCombinations() as $attributeCombination) {
|
||||
$attribute = I18n::forceI18nRetrieving($this->getSession()->getLang()->getLocale(), 'Attribute', $attributeCombination->getAttributeId());
|
||||
$attributeAv = I18n::forceI18nRetrieving($this->getSession()->getLang()->getLocale(), 'AttributeAv', $attributeCombination->getAttributeAvId());
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Product\ProductUpdateEvent;
|
||||
use Thelia\Core\Event\Product\ProductCreateEvent;
|
||||
use Thelia\Core\Event\Product\ProductDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Core\Event\Product\ProductToggleVisibilityEvent;
|
||||
use Thelia\Core\Event\Product\ProductAddContentEvent;
|
||||
@@ -41,21 +40,16 @@ use Thelia\Core\Event\Product\ProductDeleteContentEvent;
|
||||
use Thelia\Model\ProductAssociatedContent;
|
||||
use Thelia\Model\ProductAssociatedContentQuery;
|
||||
use Thelia\Model\ProductCategory;
|
||||
use Thelia\Model\TaxRule;
|
||||
use Thelia\Model\TaxRuleQuery;
|
||||
use Thelia\Model\TaxQuery;
|
||||
use Thelia\Model\AccessoryQuery;
|
||||
use Thelia\Model\Accessory;
|
||||
use Thelia\Core\Event\FeatureProduct\FeatureProductUpdateEvent;
|
||||
use Thelia\Model\FeatureProduct;
|
||||
use Thelia\Model\FeatureQuery;
|
||||
use Thelia\Core\Event\FeatureProduct\FeatureProductDeleteEvent;
|
||||
use Thelia\Model\FeatureProductQuery;
|
||||
use Thelia\Model\ProductCategoryQuery;
|
||||
use Thelia\Core\Event\Product\ProductSetTemplateEvent;
|
||||
use Thelia\Model\AttributeCombinationQuery;
|
||||
use Thelia\Model\ProductSaleElementsQuery;
|
||||
use Propel\Runtime\ActiveQuery\PropelQuery;
|
||||
use Thelia\Core\Event\Product\ProductDeleteCategoryEvent;
|
||||
use Thelia\Core\Event\Product\ProductAddCategoryEvent;
|
||||
use Thelia\Model\AttributeAvQuery;
|
||||
@@ -181,8 +175,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
return $this->genericUpdatePosition(ProductQuery::create(), $event);
|
||||
}
|
||||
|
||||
public function addContent(ProductAddContentEvent $event) {
|
||||
|
||||
public function addContent(ProductAddContentEvent $event)
|
||||
{
|
||||
if (ProductAssociatedContentQuery::create()
|
||||
->filterByContentId($event->getContentId())
|
||||
->filterByProduct($event->getProduct())->count() <= 0) {
|
||||
@@ -198,8 +192,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function removeContent(ProductDeleteContentEvent $event) {
|
||||
|
||||
public function removeContent(ProductDeleteContentEvent $event)
|
||||
{
|
||||
$content = ProductAssociatedContentQuery::create()
|
||||
->filterByContentId($event->getContentId())
|
||||
->filterByProduct($event->getProduct())->findOne()
|
||||
@@ -212,8 +206,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
;
|
||||
}
|
||||
|
||||
public function addCategory(ProductAddCategoryEvent $event) {
|
||||
|
||||
public function addCategory(ProductAddCategoryEvent $event)
|
||||
{
|
||||
if (ProductCategoryQuery::create()
|
||||
->filterByProduct($event->getProduct())
|
||||
->filterByCategoryId($event->getCategoryId())
|
||||
@@ -230,8 +224,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function removeCategory(ProductDeleteCategoryEvent $event) {
|
||||
|
||||
public function removeCategory(ProductDeleteCategoryEvent $event)
|
||||
{
|
||||
$productCategory = ProductCategoryQuery::create()
|
||||
->filterByProduct($event->getProduct())
|
||||
->filterByCategoryId($event->getCategoryId())
|
||||
@@ -240,8 +234,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
if ($productCategory != null) $productCategory->delete();
|
||||
}
|
||||
|
||||
public function addAccessory(ProductAddAccessoryEvent $event) {
|
||||
|
||||
public function addAccessory(ProductAddAccessoryEvent $event)
|
||||
{
|
||||
if (AccessoryQuery::create()
|
||||
->filterByAccessory($event->getAccessoryId())
|
||||
->filterByProductId($event->getProduct()->getId())->count() <= 0) {
|
||||
@@ -257,8 +251,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function removeAccessory(ProductDeleteAccessoryEvent $event) {
|
||||
|
||||
public function removeAccessory(ProductDeleteAccessoryEvent $event)
|
||||
{
|
||||
$accessory = AccessoryQuery::create()
|
||||
->filterByAccessory($event->getAccessoryId())
|
||||
->filterByProductId($event->getProduct()->getId())->findOne()
|
||||
@@ -271,8 +265,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
;
|
||||
}
|
||||
|
||||
public function setProductTemplate(ProductSetTemplateEvent $event) {
|
||||
|
||||
public function setProductTemplate(ProductSetTemplateEvent $event)
|
||||
{
|
||||
$product = $event->getProduct();
|
||||
|
||||
// Delete all product feature relations
|
||||
@@ -310,8 +304,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
return $this->genericUpdatePosition(ProductAssociatedContentQuery::create(), $event);
|
||||
}
|
||||
|
||||
public function updateFeatureProductValue(FeatureProductUpdateEvent $event) {
|
||||
|
||||
public function updateFeatureProductValue(FeatureProductUpdateEvent $event)
|
||||
{
|
||||
// If the feature is not free text, it may have one ore more values.
|
||||
// If the value exists, we do not change it
|
||||
// If the value does not exists, we create it.
|
||||
@@ -343,8 +337,7 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
if ($event->getIsTextValue() == true) {
|
||||
$featureProduct->setFreeTextValue($event->getFeatureValue());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$featureProduct->setFeatureAvId($event->getFeatureValue());
|
||||
}
|
||||
|
||||
@@ -353,8 +346,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
$event->setFeatureProduct($featureProduct);
|
||||
}
|
||||
|
||||
public function deleteFeatureProductValue(FeatureProductDeleteEvent $event) {
|
||||
|
||||
public function deleteFeatureProductValue(FeatureProductDeleteEvent $event)
|
||||
{
|
||||
$featureProduct = FeatureProductQuery::create()
|
||||
->filterByProductId($event->getProductId())
|
||||
->filterByFeatureId($event->getFeatureId())
|
||||
@@ -362,8 +355,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
;
|
||||
}
|
||||
|
||||
public function createProductCombination(ProductCreateCombinationEvent $event) {
|
||||
|
||||
public function createProductCombination(ProductCreateCombinationEvent $event)
|
||||
{
|
||||
$con = Propel::getWriteConnection(ProductTableMap::DATABASE_NAME);
|
||||
|
||||
$con->beginTransaction();
|
||||
@@ -399,7 +392,7 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
if (count($combinationAttributes) > 0) {
|
||||
|
||||
foreach($combinationAttributes as $attributeAvId) {
|
||||
foreach ($combinationAttributes as $attributeAvId) {
|
||||
|
||||
$attributeAv = AttributeAvQuery::create()->findPk($attributeAvId);
|
||||
|
||||
@@ -417,8 +410,7 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
// Store all the stuff !
|
||||
$con->commit();
|
||||
}
|
||||
catch(\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
|
||||
$con->rollback();
|
||||
|
||||
@@ -426,8 +418,8 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteProductCombination(ProductDeleteCombinationEvent $event) {
|
||||
|
||||
public function deleteProductCombination(ProductDeleteCombinationEvent $event)
|
||||
{
|
||||
if (null !== $pse = ProductSaleElementsQuery::create()->findPk($event->getProductSaleElementId())) {
|
||||
$pse->delete();
|
||||
}
|
||||
|
||||
@@ -33,14 +33,7 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Template\TemplateUpdateEvent;
|
||||
use Thelia\Core\Event\Template\TemplateCreateEvent;
|
||||
use Thelia\Core\Event\Template\TemplateDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\TemplateAv;
|
||||
use Thelia\Model\TemplateAvQuery;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Core\Event\Category\CategoryEvent;
|
||||
use Thelia\Core\Event\Template\TemplateEvent;
|
||||
use Thelia\Model\TemplateTemplate;
|
||||
use Thelia\Model\TemplateTemplateQuery;
|
||||
use Thelia\Model\ProductQuery;
|
||||
use Thelia\Core\Event\Template\TemplateAddAttributeEvent;
|
||||
use Thelia\Core\Event\Template\TemplateDeleteAttributeEvent;
|
||||
@@ -121,8 +114,8 @@ class Template extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function addAttribute(TemplateAddAttributeEvent $event) {
|
||||
|
||||
public function addAttribute(TemplateAddAttributeEvent $event)
|
||||
{
|
||||
if (null === AttributeTemplateQuery::create()->filterByAttributeId($event->getAttributeId())->filterByTemplate($event->getTemplate())->findOne()) {
|
||||
|
||||
$attribute_template = new AttributeTemplate();
|
||||
@@ -155,8 +148,8 @@ class Template extends BaseAction implements EventSubscriberInterface
|
||||
return $this->genericUpdatePosition(FeatureTemplateQuery::create(), $event);
|
||||
}
|
||||
|
||||
public function deleteAttribute(TemplateDeleteAttributeEvent $event) {
|
||||
|
||||
public function deleteAttribute(TemplateDeleteAttributeEvent $event)
|
||||
{
|
||||
$attribute_template = AttributeTemplateQuery::create()
|
||||
->filterByAttributeId($event->getAttributeId())
|
||||
->filterByTemplate($event->getTemplate())->findOne()
|
||||
@@ -165,8 +158,8 @@ class Template extends BaseAction implements EventSubscriberInterface
|
||||
if ($attribute_template !== null) $attribute_template->delete();
|
||||
}
|
||||
|
||||
public function addFeature(TemplateAddFeatureEvent $event) {
|
||||
|
||||
public function addFeature(TemplateAddFeatureEvent $event)
|
||||
{
|
||||
if (null === FeatureTemplateQuery::create()->filterByFeatureId($event->getFeatureId())->filterByTemplate($event->getTemplate())->findOne()) {
|
||||
|
||||
$feature_template = new FeatureTemplate();
|
||||
@@ -179,8 +172,8 @@ class Template extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteFeature(TemplateDeleteFeatureEvent $event) {
|
||||
|
||||
public function deleteFeature(TemplateDeleteFeatureEvent $event)
|
||||
{
|
||||
$feature_template = FeatureTemplateQuery::create()
|
||||
->filterByFeatureId($event->getFeatureId())
|
||||
->filterByTemplate($event->getTemplate())->findOne()
|
||||
@@ -210,4 +203,4 @@ class Template extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user