Hi Richard,
thanks for your post. Now I realize that it may be more user friendly
to not display that button and it will avoid all that stuff.

Thanks Tomas

On Jun 22, 3:04 pm, Richard <[email protected]> wrote:
> Hi - IMO, the best approach is to check for child records before you attempt
> to delete the parent data. I would even go as far as doing this before even
> rendering the delete link, preventing your end user trying to do something
> they can't in the first place.
>
> For what its worth, I personally preferring to validate actions before they
> happen, rather than responding to errors as I've generally found this
> approach saves me time in the long run. I do however, still use constraints
> like this as a last-line of defense to protect against database corruption,
> just in case :)
>
> Hope this helps,
> Richard
>
> On Mon, Jun 22, 2009 at 1:35 PM, [email protected] <[email protected]>wrote:
>
>
>
> > Hi, I am wondering how to handle and recognize MySQL type of
> > errors...in cake.
>
> > For EXAMPLE.. I have integrity checks (ON DELETE) designed on DB
> > server - when I do delete on some item who has its childs...it is not
> > allowed by DB....so in debug mode in cake i get following..
>
> >  SQL Error: 1451: Cannot delete or update a parent row: a foreign key
> > constraint fails
>
> > if i turn off debug mode, i get only 404 Not Found page.
>
> > is cake able to recognize that error and display nice message like
> > using setFlash??  I would rather tell user than he cannot delete item
> > because it has childs connected to it instead of showing 404 page...
> > which is more confusing...
>
> > Thanks for help.
> > Tomas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to