cake-php@googlegroups.com
[Top] [All Lists]

Re: Need help: Plugin model issue

Subject: Re: Need help: Plugin model issue
From: Abhimanyu Grover
Date: Tue, 8 Jun 2010 18:21:39 -0700 PDT
This shall fix your problem:

Change:

class Account extends AppModel {
        var $name = 'Account';
        var $belongsTo = 'Myplugin.Client';

}

to:

class Account extends AppModel {
        var $name = 'Account';
        var $belongsTo = array('Client' => array('className' =>
'Myplugin.Client'));

}

On Jun 9, 5:45 am, trav <johnstont...@xxxxxxxxx> wrote:
> my bad,  i just realised that the doco has this!!!!!  Im sorry to
> waste the time of the group.
>
> On Jun 9, 10:38 am, trav <johnstont...@xxxxxxxxx> wrote:
>
> > Solution:
>
> > I needed to add the plugin prefix to the Model declare in the
> > controller.
>
> > Eg.
>
> > var $uses = array("Myplugin.Account","Myplugin.Client");
>
> > I think the doco should point this out to save time and frustration.
>
> > Thanks for your help John.
>
> > -t
>
> > On Jun 9, 10:11 am, trav <johnstont...@xxxxxxxxx> wrote:
>
> > > More information...
>
> > > if i just output the model from the controller, like this:
>
> > > pr($this->Account);die;
>
> > > returns this:
>
> > > --snip
> > > [logTransactions] =>
> > >     [cacheQueries] =>
> > >     [belongsTo] => Array
> > >         (
> > >         )
>
> > >     [hasOne] => Array
> > >         (
> > >         )
>
> > >     [hasMany] => Array
> > >         (
> > >         )
>
> > >     [hasAndBelongsToMany] => Array
> > >         (
> > >         )
>
> > >     [actsAs] =>
> > > --snip
>
> > > On Jun 9, 9:21 am, trav <johnstont...@xxxxxxxxx> wrote:
>
> > > > Hi John,
>
> > > > I have tried your suggestion and it still does not function
> > > > correctly.  Can anyone get these plugin models to work with version
> > > > 1.3.2?
>
> > > > -t
>
> > > > On Jun 8, 5:41 pm, John Andersen <j.andersen...@xxxxxxxxx> wrote:
>
> > > > > Hmm, just saw that your Client model is based on AppModel, which
> > > > > according to my knowledge (the CakePHP book) it shouldn't be. The
> > > > > Client model should be based on the MyPluginAppModel! (Please correct
> > > > > me if I am wrong!!)
>
> > > > > Are debug turned on? Is the Client model used in the query at all?
> > > > > Enjoy,
> > > > >    John
>
> > > > > On Jun 8, 10:10 am, trav <johnstont...@xxxxxxxxx> wrote:> Hi John,
>
> > > > > > I have tried setting recursive to 1 and 2 and still no joy.
>
> > > > > > any other suggestions?
>
> > > > > > -t
>
> > > > > [snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
cake-php+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

<Prev in Thread] Current Thread [Next in Thread>