Thanks, that works, but this totally messes up auth etc... because i have to rename the tables to epicms_users and epicms_groups.
I tried using the usemodel from auth etc... but still it won't work as it should. The documentation states that i don't have to change the name of the controller and the views, and cake finds my data just fine as long as i dont use an association, so there must be another explanation as to why it won't find the association. When i use debug 2 i can see with the code that you suggested, that cake makes a query including the groupstable, but when i revert back to the old code, such a call isn't made. P.S. thanks for the help so far guys, you've been great :) On Sep 8, 7:54 pm, Jamie <[email protected]> wrote: > In the EpicmsUser class, this: > > var $name = 'Epicmsuser'; > > Needs to be this: > > var $name = 'EpicmsUser'; > > Notice the camel casing with User. > > Then, in UsersController, you need to change this: > > var $uses = array('Epicms.User'); > > To this: > > var $uses = array('Epicms.EpicmsUser'); > > Because "EpicmsUser" is the name of the class, not "User". The format > for referencing a class from a plugin is "PluginName.FullClassName", > so your code ("Epicms.User") would only be valid if the class looked > like this: > > class User extends EpicmsAppModel > > But it doesn't - it looks like this: > > class EpicmsUser extends EpicmsAppModel > > Thus, 'Epicms.EpicmsUser'. > > - Jamie > > On Sep 8, 6:54 am, Shackadoodl <[email protected]> wrote: > > > The plugin is called epicms, and no, i just renamed it in the posted > > code but wasn't consistent, apologies for that. > > > it still won't work, here is my current code, without editing: > > > //epicms_user.php > > class EpicmsUser extends EpicmsAppModel > > { > > var $name = 'Epicmsuser'; > > > var $belongsTo = array('Epicms.Group'); > > > //users_controller.php > > > class UsersController extends EpicmsAppController > > { > > var $name = 'Users'; > > > var $uses = array('Epicms.User'); > > > //end of code > > > The weird thing is that no matter what i change ( even after deleting > > the cache after every change ), is that cake can still find the normal > > data, but not the associations, could it be that my model is > > unrecognized and that cake is using it's automodel feature? > > > If needed i can upload the whole project. > > > On Sep 8, 3:12 pm, [email protected] wrote: > > > > Is your plugin name "Cms" or "Epicms"? It looks like you have an issue > > > with that part of your association. Once you get the plugin name fixed, > > > it _should_ work... > > > Schreck > > > > -----Original Message----- > > > From: Shackadoodl <[email protected]> > > > > Date: Tue, 8 Sep 2009 04:47:37 > > > To: CakePHP<[email protected]> > > > Subject: Plugins and associations > > > > Hi, > > > > I am currently trying to build a cms plugin with cakephp > > > > i have the following tables: > > > users and groups > > > > the associations are in place and are fully working when they are not > > > in the plugin > > > > once i move the files to the plugin, and rename them accordingly > > > according to the > > > manual, cakephp will still load the table that is connected to the > > > model, but not > > > the associations. > > > > e.g. cakephp will load a user record, but not the user's group > > > > //code from cms_user.php > > > class EpicmsUser extends EpicmsAppModel > > > { > > > > var $name = 'User'; > > > > var $belongsTo = array('Cms.Group'); > > > > //code from users_controller.php > > > > class UsersController extends EpicmsAppController > > > { > > > var $name = 'Users'; > > > > var $uses = array('Epicms.User'); > > > > //end of code > > > > if needed i can provide more code. > > > > I have already tried the app:import suggestion, as well as rewriting > > > all the > > > associations to the long notation, but none will work. > > > > I hope that somebody can provide me with some ( hidden? ) insight as > > > to > > > why the plugin associations won't work. > > > > Best regards > > > Gregory --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
