Exemple #1
0
 /**
  * Toggle visibility for an object
  *
  * @param ModelCriteria               $query
  * @param UpdateToggleVisibilityEvent $event
  *
  * @return mixed
  */
 public function genericToggleVisibility(ModelCriteria $query, ToggleVisibilityEvent $event)
 {
     if (null !== ($object = $query->findPk($event->getObjectId()))) {
         $newVisibility = !$object->getVisible();
         $object->setDispatcher($event->getDispatcher())->setVisible($newVisibility)->save();
         $event->setObject($object);
     }
     return $object;
 }
 /**
  * @param ModelCriteria $query
  * @param               $object_id
  */
 public function __construct(ModelCriteria $query, $object_id)
 {
     parent::__construct($object_id);
     $this->setQuery($query);
 }