Exemplo n.º 1
0
 /**
  * Delete a configuration entry
  *
  * @param \Thelia\Core\Event\Config\ConfigDeleteEvent $event
  * @param $eventName
  * @param EventDispatcherInterface $dispatcher
  */
 public function delete(ConfigDeleteEvent $event, $eventName, EventDispatcherInterface $dispatcher)
 {
     if (null !== ($config = ConfigQuery::create()->findPk($event->getConfigId()))) {
         if (!$config->getSecured()) {
             $config->setDispatcher($dispatcher)->delete();
             $event->setConfig($config);
         }
     }
 }
Exemplo n.º 2
0
 /**
  * @param ConfigModel $config
  * @depends testModify
  */
 public function testDelete(ConfigModel $config)
 {
     $event = new ConfigDeleteEvent($config->getId());
     $event->setDispatcher($this->dispatcher);
     $action = new Config();
     $action->delete($event);
     $deletedConfig = $event->getConfig();
     $this->assertInstanceOf('Thelia\\Model\\Config', $deletedConfig);
     $this->assertTrue($deletedConfig->isDeleted());
 }