/** * process update content * * @param ContentUpdateEvent $event */ public function update(ContentUpdateEvent $event) { if (null !== ($content = ContentQuery::create()->findPk($event->getContentId()))) { $content->setDispatcher($event->getDispatcher()); $content->setVisible($event->getVisible())->setLocale($event->getLocale())->setTitle($event->getTitle())->setDescription($event->getDescription())->setChapo($event->getChapo())->setPostscriptum($event->getPostscriptum())->save(); $content->updateDefaultFolder($event->getDefaultFolder()); $event->setContent($content); } }
/** * process update content * * @param ContentUpdateEvent $event * @param $eventName * @param EventDispatcherInterface $dispatcher * @throws PropelException * @throws \Exception */ public function update(ContentUpdateEvent $event, $eventName, EventDispatcherInterface $dispatcher) { if (null !== ($content = ContentQuery::create()->findPk($event->getContentId()))) { $con = Propel::getWriteConnection(ContentTableMap::DATABASE_NAME); $con->beginTransaction(); $content->setDispatcher($dispatcher); try { $content->setVisible($event->getVisible())->setLocale($event->getLocale())->setTitle($event->getTitle())->setDescription($event->getDescription())->setChapo($event->getChapo())->setPostscriptum($event->getPostscriptum())->save($con); $content->setDefaultFolder($event->getDefaultFolder()); $event->setContent($content); $con->commit(); } catch (PropelException $e) { $con->rollBack(); throw $e; } } }