Ok, so I got it working now with this in my controller ....
$this->paginate['conditions'] = array(
'Job.name IS NOT NULL'
);
Would be cool if you can setup your model like this:
var $belongsTo = array(
'Job' => array('className' => 'Job',
'foreignKey' => 'job_id',
'conditions' => array('Job.active = 1'),
'fields' => '',
'order' => '',
'join' => 'INNER JOIN',
),
);
Deon Heunis wrote:
> [EMAIL PROTECTED] wrote:
>
>> Is there anyway to dynamically override cake to use a JOIN instead of
>> LEFT JOIN ?
>>
>>
>
> I added a condition in my model to only return Job.active, but with the
> LEFT JOIN, it will always be return a record, but with the Job empty. So
> to exclude the row, I need to select by a JOIN, not a LEFT JOIN.
>
> SELECT `JobsTeamMember`.*, `Job`.*, `TeamMember`.* FROM
> `jobs_team_members` AS `JobsTeamMember`
> LEFT JOIN `jobs` AS `Job` ON (`Job`.`active` = 1 AND
> `JobsTeamMember`.`job_id` = `Job`.`id`)
> LEFT JOIN `team_members` AS `TeamMember` ON
> (`JobsTeamMember`.`team_member_id` = `TeamMember`.`id`)
> WHERE `JobsTeamMember`.`team_member_id` = 5 ORDER BY `Job`.`active` asc
>
>
> SELECT `JobsTeamMember`.*, `Job`.*, `TeamMember`.* FROM
> `jobs_team_members` AS `JobsTeamMember`
> JOIN `jobs` AS `Job` ON (`Job`.`active` = 1 AND
> `JobsTeamMember`.`job_id` = `Job`.`id`)
> LEFT JOIN `team_members` AS `TeamMember` ON
> (`JobsTeamMember`.`team_member_id` = `TeamMember`.`id`)
> WHERE `JobsTeamMember`.`team_member_id` = 5 ORDER BY `Job`.`active` asc
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---