Monday, May 28, 2012

error code from delete or beforeDelete?

This has got to be a newbie question. I have searched, but can't seem to find an answer.

Is there a way to get an error code for why the delete or beforeDelete failed and have this passed back to the Controller instead of just false?

using the example from the documentation
  1. function beforeDelete()
  2. {
  3. $count = $this->Product->find("count", array(
  4. "conditions" => array("product_category_id" => $this->id)
  5. ));
  6. if ($count == 0) {
  7. return true;
  8. } else {
  9. return false;
  10. }
  11. }

in this example if there are products left in the category ($count >0) it will return false.  But how does the controller know that this was reason?  What if before delete checked for products AND subcategories?  The controller/view would want to send a message to user as to why the delete failed.

What am I missing?

Thanks,
bill




View this message in context: error code from delete or beforeDelete?
Sent from the CakePHP mailing list archive at Nabble.com.

--
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: