Wednesday, May 30, 2012

Re: error code from delete or beforeDelete?


In your example the Category model delete function should not be called unless that category is empty

Exactly. There should not be any "delete this category" links rendered in views, if category is not "empty", or - they have to be "disabled" - this is work for views/helpers.
But:
- this is not enough protection against malicious users or browser history or whatever
- controllers should be slim
- model can be used from other parts of an application too
- nobody wants to copy/paste code from controller to console shell/task or another associated model, when it comes to situation "you shouldn't want this model to do this"

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
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

No comments: