Example #1
0
 public function deleteModuleHook(ModuleHookDeleteEvent $event)
 {
     if (null !== ($moduleHook = ModuleHookQuery::create()->findPk($event->getModuleHookId()))) {
         $moduleHook->delete();
         $event->setModuleHook($moduleHook);
         $this->cacheClear($event->getDispatcher());
     }
 }
Example #2
0
 /**
  * @params ModuleHookModel $hook
  * @depends testUpdate
  */
 public function testDelete(ModuleHookModel $moduleHook)
 {
     $event = new ModuleHookDeleteEvent($moduleHook->getId());
     $event->setDispatcher($this->dispatcher);
     $this->action->deleteModuleHook($event);
     $deletedModuleHook = $event->getModuleHook();
     $this->assertInstanceOf('Thelia\\Model\\ModuleHook', $deletedModuleHook);
     $this->assertTrue($deletedModuleHook->isDeleted());
 }
Example #3
0
 public function deleteModuleHook(ModuleHookDeleteEvent $event, $eventName, EventDispatcherInterface $dispatcher)
 {
     if (null !== ($moduleHook = ModuleHookQuery::create()->findPk($event->getModuleHookId()))) {
         $moduleHook->delete();
         $event->setModuleHook($moduleHook);
         // Prevent hook recreation by RegisterListenersPass::registerHook()
         // We store the method here to be able to retreive it when
         // we need to get all hook declared by a module
         $imh = new IgnoredModuleHook();
         $imh->setModuleId($moduleHook->getModuleId())->setHookId($moduleHook->getHookId())->setMethod($moduleHook->getMethod())->setClassname($moduleHook->getClassname())->save();
         $this->cacheClear($dispatcher);
     }
 }