indeed. Thanks for the pointer.
Regarding the broken MVC architecture, you're absolutely right. My
solution was a bit quick and dirty, and I probably shouldn't have
posted it as a good example.
But I will definitly keep getting the error message from the database,
translating it in the Model layer and putting it in the
validationErrors variable. It allows to prevent writing a function for
each potential error case, such as hasDependentRecords() or whatever.
nIcO
On 3 nov, 09:27, AD7six <andydawso...@gmail.com> wrote:
> On Nov 3, 9:02 am, alaxos <ala...@gmail.com> wrote:
>
> > Yes, but the point for me is that this solution needs really less
> > code. Once you have modified the AppModel and the layout, it works for
> > every controller and every action, without adding code in controllers.
>
> and you can't turn it off.
>
> Btw there's an onError callback which is in part for handling this
> sort of thing.
>
>
>
> > But it is a matter of choice... :-)
>
> If you want something like that where's the hardship in using your app
> controller beforeRender to look for the errors and set flash messages
> appropriately or whatever display logic you choose. Mixing MVC to save
> a line of code isn't going to save you anything the first time
> someone, probably someone else, looks at your code and can't see
> where or how these db errors they want to hide/modify/whatever are
> coming from.
>
> On the plus side, at least you used validation errors which is
> contextually more relevant than creating a new variable for storing
> your delete-only errors IMO.
>
> AD
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment