[symfony-users] Re: Custom error page for Integrity constraint violation

2010-03-29 Thread skr
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

[symfony-users] Re: Custom error page for Integrity constraint violation

2010-03-29 Thread Campezzi
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

[symfony-users] Re: Custom error page for Integrity constraint violation

2010-03-29 Thread bretth
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