public function delete(BrandDeleteEvent $event, $eventName, EventDispatcherInterface $dispatcher) { if (null !== ($brand = BrandQuery::create()->findPk($event->getBrandId()))) { $brand->setDispatcher($dispatcher)->delete(); $event->setBrand($brand); } }
public function delete(BrandDeleteEvent $event) { if (null !== ($brand = BrandQuery::create()->findPk($event->getBrandId()))) { $brand->setDispatcher($event->getDispatcher())->delete(); $event->setBrand($brand); } }
public function testDeleteBrand() { $brand = $this->getRandomBrand(); $event = new BrandDeleteEvent($brand->getId()); $event->setDispatcher($this->dispatcher); $brandAction = new Brand($this->getContainer()); $brandAction->delete($event); $deletedBrand = $event->getBrand(); $this->assertInstanceOf('Thelia\\Model\\Brand', $deletedBrand); $this->assertTrue($deletedBrand->isDeleted()); }