Example #1
0
 protected function beforeDelete()
 {
     if (empty($this->__options['skip_listeners'])) {
         $eventNameSuffix = $this->inputFilter()->clean(get_class($this), 'ALNUM');
         $event = (new \Dsc\Event\Event('beforeDelete' . $eventNameSuffix))->addArgument('model', $this);
         $event = \Dsc\System::instance()->getDispatcher()->triggerEvent($event);
         if ($event->isStopped()) {
             $this->setError($event->getArgument('error'));
         }
     }
     if (empty($this->getErrors())) {
         \Dsc\Mongo\Collections\Trash::trash($this);
     }
     return $this->checkErrors();
 }
Example #2
0
 /**
  * enables trash
  */
 protected function beforeDelete()
 {
     if (!empty($this->__enable_trash)) {
         \Dsc\Mongo\Collections\Trash::trash($this);
     }
     parent::beforeDelete();
 }