I have a plugin with user model, profile model and an user controller, in this user model is associated with profile model. In my main model folder (under app), I have user mode
I've had trouble with this as well. Basically it comes down to the fact that Cake doesn't support controllers with the same class name. So a controller named UsersController
on plugin and app level will cause trouble with caching and some components (the Auth
component, for example).
Support for identical classnames in various levels of a Cake application will come in Cake 3.0 which will require PHP 5.3, which in turn supports namespaces, a feature needed for correctly handling duplicate class names.
With no word on when Cake 3.0 will be released as the 2.0 branch is just out of beta, I refactored my plugin by prepending the plugin name to my controllers, views and models.
So UserModel
became PluginUserModel
and UsersController
became PluginUsersController
. It's a bit of a hassle, because you have to update all the views and variables which use the model's name.
My original question contains some links to the Cake bug tracker where similar questions were raised, should you be interested in some background,