Tuesday, March 5, 2013

Re: unbind field

Yup, Bind/Unbind models.

More specifically, from the book:
public function some_action() {      // This fetches Leaders, and their associated Followers      $this->Leader->find('all');        // Let's remove the hasMany...      $this->Leader->unbindModel(          array('hasMany' => array('Follower'))      );        // Now using a find function will return      // Leaders, with no Followers      $this->Leader->find('all');        // NOTE: unbindModel only affects the very next      // find function. An additional find call will use      // the configured association information.        // We've already used find('all') after unbindModel(),      // so this will fetch Leaders with associated      // Followers once again...      $this->Leader->find('all');  }

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate