I was running Cake 1.2.0.7692 RC3 with a model that has a $belongsTo
from the PortfolioTag table to the Portfolio table. I could run this
Find statement.
$count = $this->$documentsTagsModel->find('count',array
('conditions'=>array('tag_id'=>$tagRecord
['id'],'published'=>1,'front_page'=>1),'recursive'=>2));
And it out generate this SQL statement.
SELECT COUNT(*) AS `count` FROM `portfolio_tags` AS `PortfolioTag`
LEFT JOIN `portfolio` AS `Portfolio` ON (`PortfolioTag`.`portfolio_id`
= `Portfolio`.`id`) LEFT JOIN `tags` AS `Tag` ON
(`PortfolioTag`.`tag_id` = `Tag`.`id`) WHERE `tag_id` = 1 AND
`published` = 1 AND `front_page` = 1
After upgrading to Cake 1.2.1 Stable the same Find generates this SQL
statement which missing the LEFT JOIN so it fails.
SELECT COUNT(*) AS `count` FROM `portfolio_tags` AS `PortfolioTag`
WHERE `tag_id` = 7 AND `published` = 1 AND `front_page` = 1
How do I fix this?
Changing the recursive value for the find doesn't seem to fix the
problem.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment