Reputation: 7740
I have 3 models.
Webcast
and Tag
are associated witha HABTMA association.
Webcast
and Host
are associated with a hasMany relationship (Webcast
has many Host
).
When I do a Tag->find
I get Tag
and Webcast
models, however I want to get all 3. How can I go about that?
Upvotes: 0
Views: 35
Reputation: 186
If your query is using $this->webcast->find then you'll get everything your looking for, except you can't search 'TAG' without joining the tables before the query. If you want to search 'TAG' which I recommend in this situation then your need to go into your Tag model and create relationships there too.
Tag HABTM Webcast
should do it. If you're not getting host then try 'recursive' => 2 in your query.
$this->Tag->find('all');
OR
$this->Tag->find('all', array('recursive' => 2));
Upvotes: 1
Reputation: 5767
From docs
The recursive property defines how deep CakePHP should go to fetch associated model data via find(), and read() methods.
http://book.cakephp.org/2.0/en/models/model-attributes.html#recursive
Upvotes: 0