/** * Delete an entry and associated data * * @return boolean True on success, false on error */ public function delete() { // Remove all children foreach ($this->assetgroups() as $group) { if (!$group->delete()) { $this->setError($group->getError()); } } // Remove all assets foreach ($this->assets() as $asset) { if (!$asset->delete()) { $this->setError($asset->getError()); } } // Remove dates if ($this->get('section_id')) { $dt = new Tables\SectionDate($this->_db); $dt->load($this->get('id'), $this->_scope, $this->get('section_id')); if (!$dt->delete()) { $this->setError($dt->getError()); } } $this->importPlugin('courses')->trigger('onUnitDelete', array($this)); // Remove this record from the database and log the event return parent::delete(); }
/** * Delete an asset * Deleted asset_associations until there is only one * association left, then it deletes the association, * the asset record, and asset file(s) * * @return boolean True on success, false on error */ public function delete() { // Remove dates if ($this->get('section_id')) { $dt = new Tables\SectionDate($this->_db); $dt->load($this->get('id'), $this->_scope, $this->get('section_id')); if (!$dt->delete()) { $this->setError($dt->getError()); } } // Remove this record from the database and log the event return parent::delete(); }