Make sure your model associations are set up correctly. Your example will only
work if there is a association between Album and Music ($hasOne, $hasMany,
$belongsTo or $hasAndBelongsToMany). If the models aren't directly related or
there are models in between, you can daisy chain the models until you get where
you want to be.
Here's a made up example:
$musics = $this->Album->Artist->Singer->Music->find('list');
On 20 Jun 2011, at 12:29, madusanka hettiarachchi wrote:
> Hi CRUSH, or other guys,
>
> I want to know can I call a model from another model, like this!
>
> $musics = $this->Album->Music->find('list');
>
> It cause to error!
>
> when execute a without giving Music model, it gives list of album ids.
> $musics = $this->Album->Music->find('list');
>
> what are the other thing i should do to call one model from another??
>
> Ganganath Hettiarachchi
>
>
> --
> 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