In my case I had a model class "MusicDetails" which in turn had an
association with Composers. When I had
class Music extends Item {
var $name = 'Music';
var $belongsTo = array(
'Details' => // not 'MusicDetails'
array('className' => 'MusicDetails',
'dependent' => true,
'foreignKey' => 'DetailRef'),
);
}
class MusicDetails extends AppModel {
var $name = 'MusicDetails';
var $useTable = 'tblMusic';
var $hasAndBelongsToMany = array(
'Conductors' =>
array('className' => 'Person',
'joinTable' => 'joinMusicPersonConductor',
'foreignKey' => 'MusicIDref',
'associationForeignKey' => 'PersonIDref'),
}
then the MusicDetails data came in fine to my view, but the Conductors
data that was one association further was not found because Cake was
unable to come up with an ID of the MusicDetails to which it was
linked. It was querying with 'MusicIDref = NULL' instead of = 2 or
whatever.
Once I changed the name of the key to "MusicDetails", thus duplicating
the name in both places, the more-nested association started working.
That seems to contradict "you can call the association name whatever
you want." So what am I misunderstanding?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---