Hi,
Conference model:
var $hasAndBelongsToMany = array('Sphere' =>
array('className' => 'Sphere',
'joinTable' =>
'conferences_spheres',
'foreignKey' =>
'conference_id',
'associationForeignKey'=> 'sphere_id',
),
'Institution'=>
array('className' => 'Institution',
'joinTable' =>
'conferences_institutions',
'foreignKey' =>
'conference_id',
'associationForeignKey'=> 'institution_id',
)
);
$this->Conference->find('all', array( 'recursive' => 1));
will create 3 sqls:
SELECT ... FROM `conferences` AS `Conference` WHERE 1 = 1
SELECT ... FROM `spheres` AS `Sphere` JOIN `conferences_spheres` AS
`ConferencesSphere` ON (`ConferencesSphere`.`conference_id` IN (1, 2,
3, 4, 7, 9, 10) AND `ConferencesSphere`.`sphere_id` = `Sphere`.`id`)
WHERE 1 = 1
SELECT ... FROM `institutions` AS `Institution` JOIN
`conferences_institutions` AS `ConferencesInstitution` ON
(`ConferencesInstitution`.`conference_id` IN (1, 2, 3, 4, 7, 9, 10)
AND `ConferencesInstitution`.`institution_id` = `Institution`.`id`)
WHERE 1 = 1
how to find Conference where Sphere.name="something" and
Institution.name="something" ??
such find:
$this->Conference->find('all', array('conditions' =>
array('Sphere.name' => 'AJAX'), 'recursive' => 1));
generates bad sql:
SELECT ... FROM `conferences` AS `Conference` WHERE `Sphere`.`name` =
'AJAX'
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---