예제 #1
0
 /**
  * Delete a product attribute entry
  *
  * @param AttributeDeleteEvent $event
  */
 public function delete(AttributeDeleteEvent $event)
 {
     if (null !== ($attribute = AttributeQuery::create()->findPk($event->getAttributeId()))) {
         $attribute->setDispatcher($event->getDispatcher())->delete();
         $event->setAttribute($attribute);
     }
 }
예제 #2
0
 /**
  * Delete a product attribute entry
  *
  * @param AttributeDeleteEvent $event
  * @param $eventName
  * @param EventDispatcherInterface $dispatcher
  */
 public function delete(AttributeDeleteEvent $event, $eventName, EventDispatcherInterface $dispatcher)
 {
     if (null !== ($attribute = AttributeQuery::create()->findPk($event->getAttributeId()))) {
         $attribute->setDispatcher($dispatcher)->delete();
         $event->setAttribute($attribute);
     }
 }
예제 #3
0
 /**
  * @depends testUpdate
  */
 public function testDelete(AttributeModel $attribute)
 {
     $event = new AttributeDeleteEvent($attribute->getId());
     $event->setDispatcher($this->getMock("Symfony\\Component\\EventDispatcher\\EventDispatcherInterface"));
     $action = new Attribute();
     $action->delete($event);
     $deletedAttribute = $event->getAttribute();
     $this->assertInstanceOf('Thelia\\Model\\Attribute', $deletedAttribute);
     $this->assertTrue($deletedAttribute->isDeleted());
 }