I have the following setup: Users hasAndBelongsToMany Albums Albums belongsTo Artists
It's easy enough to retrieve all the users albums with: $user = $this->User->read(null, $id); This populates $user['Album']. But what is the best practice for getting the artist info associated with the album? This seems like a fairly common occurrence so I figure I'm missing something obvious here, hopefully it's not too vague. Here's the query it's executing: SELECT `Album`.`id`, `Album`.`artist_id`, `Album`.`name`, `Album`.`created`, `Album`.`modified`, `AlbumsUser`.`id`, `AlbumsUser`.`album_id`, `AlbumsUser`.`user_id` FROM `albums` AS `Album` JOIN `albums_users` AS `AlbumsUser` ON (`AlbumsUser`.`user_id` = 2 AND `AlbumsUser`.`album_id` = `Album`.`id`) WHERE 1 = 1 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
