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(); }
/** * enables trash */ protected function beforeDelete() { if (!empty($this->__enable_trash)) { \Dsc\Mongo\Collections\Trash::trash($this); } parent::beforeDelete(); }