Restrict deletion if relation exists
I have a question... is it possible with standard Fuel CMS features to use a validation to restrict data beeing deleted if there are open relations.
So if you want to delete a record which is used as foreign key in other modules.
For example a page has images defined, which are used in the layout. So via a module you can assign multiple images to the base page recordset. Now if this image should be deleted I don't want the relation to be deleted but instead give an error, that the record is not allowed to be deleted.
Is that possible?
Comments
public function on_before_delete($where)[ { if ($this->do_validation_check_method_for_relationships()) { $this->add_error('This record cannot be deleted because of associated relationships.'); } else { parent::on_before_delete($where); } }