public function create(ViewEvent $event)
 {
     if (null === ($view = ViewQuery::create()->filterBySourceId($event->getSourceId())->findOneBySource($event->getSource()))) {
         $view = new View();
     }
     if ($event->hasDefinedViews()) {
         $view->setView($event->getViewName())->setSource($event->getSource())->setSourceId($event->getSourceId())->setSubtreeView($event->getSubtreeView())->setChildrenView($event->getChildrenView())->save();
     } else {
         $view->delete();
     }
 }
Пример #2
0
 /**
  * Exclude object from result
  *
  * @param   ChildView $view Object to remove from the list of results
  *
  * @return ChildViewQuery The current query, for fluid interface
  */
 public function prune($view = null)
 {
     if ($view) {
         $this->addUsingAlias(ViewTableMap::ID, $view->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }