Esempio n. 1
0
 /**
  * Change a category
  *
  * @param \Thelia\Core\Event\Category\CategoryUpdateEvent $event
  */
 public function update(CategoryUpdateEvent $event)
 {
     if (null !== ($category = CategoryQuery::create()->findPk($event->getCategoryId()))) {
         $category->setDispatcher($event->getDispatcher())->setLocale($event->getLocale())->setTitle($event->getTitle())->setDescription($event->getDescription())->setChapo($event->getChapo())->setPostscriptum($event->getPostscriptum())->setParent($event->getParent())->setVisible($event->getVisible())->save();
         $event->setCategory($category);
     }
 }
Esempio n. 2
0
 /**
  * Change a category
  *
  * @param \Thelia\Core\Event\Category\CategoryUpdateEvent $event
  * @param $eventName
  * @param EventDispatcherInterface $dispatcher
  */
 public function update(CategoryUpdateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
 {
     if (null !== ($category = CategoryQuery::create()->findPk($event->getCategoryId()))) {
         $category->setDispatcher($dispatcher)->setDefaultTemplateId($event->getDefaultTemplateId() == 0 ? null : $event->getDefaultTemplateId())->setLocale($event->getLocale())->setTitle($event->getTitle())->setDescription($event->getDescription())->setChapo($event->getChapo())->setPostscriptum($event->getPostscriptum())->setParent($event->getParent())->setVisible($event->getVisible())->save();
         $event->setCategory($category);
     }
 }