Actually, after some more digging I think my original question was a
bit short-sighted and possibly entirely irrelevant.

Here's the situation:

One of our clients wants a "what's new" section of their website, in
which basically anything new or modified in the database gets
reported. So, a new club gets added via the clubs plugin, that's
reported. A new link gets added in the links plugin, that gets
reported. The content of a page is changed via the pages controller,
that's reported.. and so on. To accomplish this, I made a plugin
called "automated news announcements". It's pretty simple - really
just a table (automated_news_announcements) and a behavior
(AutomatedNews). The behavior is attached to all models at runtime via
AppModel, though certain models are excluded from the 'reporting' via
a config option (so, for example, new permissions aren't announced).

Now, this would all be well and good except that the client wants each
"what's new" item to link to the item that was added or modified. So,
for example, if the club with ID 78 is modified then the what's new
link should link to club ID 78. The problem with this is that not all
the routing is perfectly regular in that way. Clubs, for example, use
a slug: /clubs/lawn-bowling (for example). That's a pretty simple one.
The document repository plugin, for example, is a bit more complex,
since documents have categories. So a sample URL would be: /documents/
strata-info/rental-agreement (where strata-info is the category slug
and rental-agreement is the document slug).

So my real issue is that I can't figure out a way to record the proper
link... I'm not sure there IS a way, really, that wouldn't involve
some sort of horrible hack.

- Jamie



On Sep 9, 9:16 am, Miles J <mileswjohn...@gmail.com> wrote:
> Well in what circumstances would you need to know if its from a plugin
> or not? You should know right off the bat when you are calling the
> model, like Plugin.ModelName.
>
> On Sep 9, 9:08 am, Jamie <jamie....@gmail.com> wrote:
>
> > OK - I can't figure out if I'm missing something really obvious (quite
> > possibly), or if the functionality just isn't there. Basically, my
> > issue is figuring out whether a model belongs to a plugin at runtime.
> > I've got some common functionality in a behavior that is attached to
> > almost every model in my application. Most of these models are in
> > plugins. For example, I've got a "clubs" plugin with a "club" model. I
> > can't seem to see any model property (via the Model class, debug
> > ($this) in a callback, etc.) that says that "Club" belongs to the
> > "clubs" plugin. I would've thought that, since the core goes plugin-by-
> > plugin initializing models, it would record somewhere in each model
> > whether that model belongs to a plugin. But...
>
> > - Jamie
--~--~---------~--~----~------------~-------~--~----~
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