HI all,

On 10 mayo, 10:49, "Mariano Iglesias" <[EMAIL PROTECTED]>
wrote:
> Fromhttp://manual.cakephp.org/chapter/plugins:
>
> "While it isn't required, it is recommended that you name your plugin
> controllers something relatively unique in order to avoid namespace
> conflicts with parent applications. Its not a stretch to think that a parent
> application might have a UsersController, OrderController, or
> ProductController: so you might want to be creative with controller names,
> or prepend the name of the plugin to the classname"

I don't feel that advice is appropriate.

The only means of normally generating a pseudo-conflict is if you have
an app controller with the same name as a plugin - in that case in the
absence of a specific route the app controller will be used for the
url /plugin_name/. but that's not really a problem - just a side
effect of bad (user) design.

> If in my application I have a UsersController, and need to do a
> requestAction() to a plugin's UsersController, then hell breaks loose.

Why would you want to do that? Because something is a technical
possibility, I don't feel that should be the basis for giving Plugin
controllers 'unique' names. having inbuilt namespaces for plugins
would completely avoid the issue though (which of course would involve
cake expecting plugin controllers to be named differently).

A plugin is supposed to be a self contained mini (although in reality
it doesn't have to be mini at all) application, in principle there
shouldn't be any intereractions such as the above between a plugin and
the app/another plugin.

If you have a controller with the same name in a plugin and in your
app, unless you
1) explicitly use loadControllers in the plugin
2) explicitly load and try to use the plugin xyz controller from the
app xyz controller
3) requestAction from app xyz controller to plugin xzy controller (why
would anyone want to do that?)
4) requestAction from plugin xyz controller to app xzy controller (why
would anyone want to do that?)
5) requestAction from one plugin xyz controller to a different plugin
xyz controller (why would anyone want to do that?)

You won't come across any issues at all.

I feel that only the misuse of requestAction can cause issues, and
that's the basis for my disagreeing with the manual page on plugin
controller name uniqueness.

I should perhaps add that I don't think any plugin should contain
things which are app wide like, for example, user management or access
control. However a shop plugin shouldn't, for example, need to care /
at all/ about having a products controller since as a user who has
just installed the 'shop' plugin why would you then either a) butcher
the plugin to look at your app controllers or b) start using request
action in your app xyz controller to look at the plugin xyz controller
or c) something else a bit wacky?

If someones app controller makes a requestAction call for all requests
that could indeed make this sort of problem apparent; But again: I'd
file that under misuse of requestAction.

All IMO of course. If I've made a mistake (i.e. not just a difference
of opinion) of any kind in my post please let me know.

To finish on a q: Has anyone had a specific problem of the type being
discussed?

Cheers,

AD
PS. Is there a consensus on top posting? I don't like it :D! (Lamby
where are you and your informative footer :))


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to