Sunday, February 10, 2013

HABTM round trip query

Hi all,

If this topic is covered, sorry, but I don't really know what to search under and all my searches resulted in nothing.

Background:
Developing a site for a voice over company.

Requirement:
Voice artists can have several different languages and languages can have several different voice artists, each artist can have a playable recording for each language.

What am I doing:
Searching for all artists that can speak a given language, but want to know what languages they also speak.

Basic search:
$this->Language->find('all');

Result
Language->Artist->ArtistsLanguage<-- Only the record to the language is resulting.

Desire
Language->Artist->Language->array(record 1->ArtistsLanguage, record 2->ArtistsLanguage, etc...)

Comments:
Basically, I am looking to find all artists for a given language. This part works, but the result for the list of languages that the artists speaks only results in the HABTM model record belonging to the artist. 

How can a do a round trip in a HABTM relationship?

Thanks for all the help,
Jay
Result:

--
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.
 
 

No comments: