Skip to content


CakePHP – Use recursive instead of unbind to unbind all associations

You can use recursive or unbind whenever you want to unbind associations from models. This is very useful because there are cases when you want to execute a simple query and you do not want to join other tables. Here comes unbind. Unbind allows us to unbind all but some model associations. On the other hand if you want to unbind all associations you can use recursive like this:

PHP:
  1. $this->Model->recursive = -1;

CakePHP is beautiful. I love it!

Posted in cakephp, php.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.