enough to see how to do this. Anyway, if I may ask how I'd do this the
CakePHP way:
Category hasAndBelongsToMany Post
Post hasAndBelongsToMany Category
I am in the Category Controller and I'd like to view Posts that are in
the Category Controller with a certain slug, eg. 'health'.
On 11/26/2010 1:40 PM, cricket wrote:
> On Thu, Nov 25, 2010 at 10:25 PM, Thorpe Obazee<teejay@pinoytech.org> wrote:
>> It didn't seem to work. The SQL statement shows this:
>>
>> SHOW FULL COLUMNS FROM `categories_posts`
>>
>> SELECT `Category`.`id`, `Category`.`name`, `Category`.`uri`,
>> `Category`.`created`, `Category`.`modified` FROM `categories` AS `Category`
>> WHERE `Category`.`uri` = 'meta' LIMIT 1
>>
>> SELECT `Post`.`id`, `Post`.`title`, `Post`.`uri`, `Post`.`body`,
>> `Post`.`created`, `Post`.`modified`, `CategoriesPost`.`category_id`,
>> `CategoriesPost`.`post_id` FROM `posts` AS `Post` JOIN `categories_posts` AS
>> `CategoriesPost` ON (`CategoriesPost`.`category_id` = 2 AND
>> `CategoriesPost`.`post_id` = `Post`.`id`)
>>
>> It doesn't show the SQL statement I need.
> But does it provide the data you need? Containable, though a great
> tool, unfortunately does not create joins and fetch everything in one
> go.
>
> 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment