If the models are associated you don't need to load them. You can access models by daisy chaining them, e.g.:
$this->User->Profile->Image->find(); Jeremy Burns Class Outfit [email protected] http://www.classoutfit.com On 28 Jan 2011, at 13:05, Stephen wrote: > I wouldn't want to load all models, all the time, for everything. > > But sometimes I find myself needing to load more than 1 model into my > controller, not always, but to make it easier I have something on the lines > of this > > #app_controller.php > function _loadMultipleModels($models=array()) { > foreach($models as $model) { > $this->loadModel($model); > } > } > > Then within your controller you would do something like: > > $this->_loadMultipleModels(array('User', 'Profile', 'Image')); > > Obviously they are example models, I would hope "User, Profile and Image" are > associated. > > > On 28 January 2011 03:16, euromark <[email protected]> wrote: > believe me, you don't wanna do that... > > what exactly is "I run to the model issue so many times" > > > On 28 Jan., 00:03, cake-learner <[email protected]> wrote: > > Is there any way to include all models by default. I run to the model > > issue so many times defining the relationship so i just want to join > > manually so i can cut some development time. > > -- > 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 > [email protected] For more options, visit this group at > http://groups.google.com/group/cake-php > > > > -- > Kind Regards > Stephen @ NinjaCoderMonkey > > www.ninjacodermonkey.co.uk > > > > -- > 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 > [email protected] For more options, visit this group at > http://groups.google.com/group/cake-php -- 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 [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
