Inital commit
This commit is contained in:
@@ -12,13 +12,11 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
use Thelia\Model\AttributeQuery;
|
||||
use Thelia\Model\Attribute as AttributeModel;
|
||||
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
|
||||
use Thelia\Core\Event\Attribute\AttributeUpdateEvent;
|
||||
use Thelia\Core\Event\Attribute\AttributeCreateEvent;
|
||||
use Thelia\Core\Event\Attribute\AttributeDeleteEvent;
|
||||
@@ -34,17 +32,17 @@ class Attribute extends BaseAction implements EventSubscriberInterface
|
||||
* Create a new attribute entry
|
||||
*
|
||||
* @param AttributeCreateEvent $event
|
||||
* @param $eventName
|
||||
* @param EventDispatcherInterface $dispatcher
|
||||
*/
|
||||
public function create(AttributeCreateEvent $event)
|
||||
public function create(AttributeCreateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$attribute = new AttributeModel();
|
||||
|
||||
$attribute
|
||||
->setDispatcher($event->getDispatcher())
|
||||
|
||||
->setDispatcher($dispatcher)
|
||||
->setLocale($event->getLocale())
|
||||
->setTitle($event->getTitle())
|
||||
|
||||
->save()
|
||||
;
|
||||
|
||||
@@ -60,14 +58,14 @@ class Attribute extends BaseAction implements EventSubscriberInterface
|
||||
* Change a product attribute
|
||||
*
|
||||
* @param AttributeUpdateEvent $event
|
||||
* @param $eventName
|
||||
* @param EventDispatcherInterface $dispatcher
|
||||
*/
|
||||
public function update(AttributeUpdateEvent $event)
|
||||
public function update(AttributeUpdateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
|
||||
if (null !== $attribute = AttributeQuery::create()->findPk($event->getAttributeId())) {
|
||||
|
||||
$attribute
|
||||
->setDispatcher($event->getDispatcher())
|
||||
->setDispatcher($dispatcher)
|
||||
|
||||
->setLocale($event->getLocale())
|
||||
->setTitle($event->getTitle())
|
||||
@@ -85,14 +83,14 @@ class Attribute extends BaseAction implements EventSubscriberInterface
|
||||
* Delete a product attribute entry
|
||||
*
|
||||
* @param AttributeDeleteEvent $event
|
||||
* @param $eventName
|
||||
* @param EventDispatcherInterface $dispatcher
|
||||
*/
|
||||
public function delete(AttributeDeleteEvent $event)
|
||||
public function delete(AttributeDeleteEvent $event, $eventName, EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
|
||||
if (null !== ($attribute = AttributeQuery::create()->findPk($event->getAttributeId()))) {
|
||||
|
||||
$attribute
|
||||
->setDispatcher($event->getDispatcher())
|
||||
->setDispatcher($dispatcher)
|
||||
->delete()
|
||||
;
|
||||
|
||||
@@ -103,11 +101,13 @@ class Attribute extends BaseAction implements EventSubscriberInterface
|
||||
/**
|
||||
* Changes position, selecting absolute ou relative change.
|
||||
*
|
||||
* @param CategoryChangePositionEvent $event
|
||||
* @param UpdatePositionEvent $event
|
||||
* @param $eventName
|
||||
* @param EventDispatcherInterface $dispatcher
|
||||
*/
|
||||
public function updatePosition(UpdatePositionEvent $event)
|
||||
public function updatePosition(UpdatePositionEvent $event, $eventName, EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$this->genericUpdatePosition(AttributeQuery::create(), $event);
|
||||
$this->genericUpdatePosition(AttributeQuery::create(), $event, $dispatcher);
|
||||
}
|
||||
|
||||
protected function doAddToAllTemplates(AttributeModel $attribute)
|
||||
@@ -115,7 +115,6 @@ class Attribute extends BaseAction implements EventSubscriberInterface
|
||||
$templates = TemplateQuery::create()->find();
|
||||
|
||||
foreach ($templates as $template) {
|
||||
|
||||
$attribute_template = new AttributeTemplate();
|
||||
|
||||
if (null === AttributeTemplateQuery::create()->filterByAttribute($attribute)->filterByTemplate($template)->findOne()) {
|
||||
@@ -140,7 +139,7 @@ class Attribute extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user