Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function delete()
 {
     if ($this->model->isReadOnly()) {
         throw new ReadOnlyRecordException(vsprintf("%s(): Attempted to delete a read-only record.", [__METHOD__]));
     }
     // Execute "beforeDelete" hooks
     foreach ($this->model->getHooks('beforeDelete') as $hook) {
         $hook($this);
     }
     $deleted = parent::delete();
     // Execute "afterDelete" hooks
     foreach ($this->model->getHooks('afterDelete') as $hook) {
         $hook($deleted);
     }
     return $deleted;
 }