Hey everybody

class MetaTag extends AppModel {
        var $name = 'MetaTag';
        var $displayField = 'name';

        function allowsAdd(&$user, $options) {
                $this->find('count', array('joins' => array('Post'),
'conditions' => array('MetaTag.id' => $this->id())));
        }
}

This simple JOIN gives me a wrong SQL command:

SELECT COUNT(*) AS `count` FROM `meta_tags` AS `MetaTag` Post LEFT
JOIN `posts` AS `Post` ON (`MetaTag`.`post_id` = `Post`.`id`)  WHERE
`MetaTag`.`id` = 1601

...while the correct one would look like this:

SELECT COUNT(*) AS `count` FROM `meta_tags` AS `MetaTag` LEFT JOIN
`posts` AS `Post` ON (`MetaTag`.`post_id` = `Post`.`id`)  WHERE
`MetaTag`.`id` = 1601

Where does this "Post" word come from?? Do I do anything wrong?

Thanks for help,
Josh

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to