On 29 Mrz., 14:01, bretth brett...@gmail.com wrote:
Hi,
I'm getting the error
SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or
update a parent row: a foreign key constraint fails
when I delete a parent row from my admin generator. That's fine; it's
doing what it
I don't know if there's an easier way to do this, but I think I would
override the delete method on the parent model to do a custom
integrity check before actually trying to delete the record from the
database and returning false if it detects there will be constraint
problems. You can then add
Thankyou both for that, I decided to override the delete() method on
my object; it now checks if there are any children associated and if
so, sets a user error flash and returns false. If not it calls
parent::delete($conn). Works perfectly.
cheers
Brett
On Mar 30, 12:26 am, Campezzi