tableName = '#__ak_profiles'; $this->idFieldName = 'id'; parent::__construct($container); $this->addBehaviour('filters'); } /** * Prevent the deletion of the default backup profile * * @param integer $id The profile ID which is about to be deleted * * @throws \RuntimeException When some wise guy tries to delete the default backup profile */ public function onBeforeDelete($id) { if ($id == 1) { throw new \RuntimeException(Text::_('TABLE_PROFILE_CANNOTDELETEDEFAULT'), 403); } } /** * Check the data for validity. * * @return DataModel Self, for chaining * * @throws \RuntimeException When the data bound to this record is invalid */ public function check() { if (!$this->description) { throw new \RuntimeException(Text::_('TABLE_PROFILE_NODESCRIPTION')); } return parent::check(); } }