My fellow bakers, After reading Tom's tutorial on how to keep your unbindModel() calls out of your controllers (http://bakery.cakephp.org/articles/view/179) I've decided to change it so one wouldn't need to modify the way model associations are defined on CakePHP.
For those of you who didn't read Tom's tutorial, he presented a way to allow one to define what associated models you are interested in when querying a model. Therefore, I've produced a tutorial called "An improvement to unbindModel on model side" which is available at: http://bakery.cakephp.org/articles/view/185 To give you a quick glimpse, let's say you have a Post model, that: * hasAndBelongsToMany Category. * belongsTo User. * hasMany Comment. And User: * hasAndBelongsToMany Category. * hasOne Profile. Let's say you want to fetch all posts, and for each post only fetch the associated User, no profile information. You would do the following on your controller: $this->Post->User->expects(); $this->Post->expects(array('User')); $result = $this->Post->findAll(); The first line tells that we don't want any associated models when fetching User, and the second that we are only interested in the associated User for each Post. If you don't use expects(), you get CakePHP's normal response. -MI --------------------------------------------------------------------------- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---