Saturday, October 4, 2008

Extend running blog example: user makes posts with custom set of tags

Hi all,

I ran in a HABTM problem which I'll try to translate to the running
blog example used in the CakePHP documentation.

Imagine a blog with multiple authors (users) who can post articles and
add tags to posts. Now assume that each author has its own set of
tags, this would result in the following relationships:
User HasMany Posts
User HasMany Tags
Posts HABTM Tags (and vice versa).

Now, when a user creates a post I want to only show his collection of
tags, how would I do that?
Can I access the userId stored in the session from the model and
include it in the HABTM conditional field? Or is there another (neat)
trick necessary?

Any help is appreciated!

GrandiJoos
--~--~---------~--~----~------------~-------~--~----~
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: