/** * Custom actions before deleting a record * @return boolean */ protected function beforeDelete() { if (parent::beforeDelete()) { if ($childs = $this->childs) { foreach ($childs as $child) { $child->delete(); } } return true; } return false; }