public function delete() { if ($this->_mapper->hasActiveLinks($this) && trim($this->name) != 'Введите название') { $result = M('Base')->result(); $result->error('has_active_links'); throw new RM_Validator_Exception($result); } foreach ($this->receipts() as $obReceipt) { $obReceipt->delete(); } $this->_mapper->removeAssortiment($this); $this->_mapper->removeLinks($this); return parent::delete(); }