Re: Need help: Plugin model issue
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 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 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 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 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 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 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@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
Re: Need help: Plugin model issue
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 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 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 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 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 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@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
Re: Need help: Plugin model issue
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 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 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 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 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@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
Re: Need help: Plugin model issue
Plugin models in 1.3.2 work fine for me Have you cleared the files from tmp after changing the plugin model as directed by John (you might have some other such issues elsewhere - this is why I bake plugins) put debug to 2 and comment out the die. Then you should see the sql output you have this in your layout element('sql_dump'); ?> - S On 9 June 2010 01:11, trav 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 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 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 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@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > 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@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
Re: Need help: Plugin model issue
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 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 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 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@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
Re: Need help: Plugin model issue
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 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 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@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
Re: Need help: Plugin model issue
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 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@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
Re: Need help: Plugin model issue
Hi John, I have tried setting recursive to 1 and 2 and still no joy. any other suggestions? -t On Jun 8, 5:03 pm, John Andersen wrote: > What is recursive set to? Should be set to 1 in order to retrieve > second level related information (Client)! > Enjoy, > John > > On Jun 8, 7:59 am, trav wrote: > > > Hi, > > > I hope someone can give me some assistance with Plugin models. > > > Cake Version: 1.3.2 > > == > > Problem: Query result does not build model joins when using a plugin > > == > > Location: Model files are in app/plugin/Myplugin/models > > Plugin Name: Myplugin > > > Model A: > > -- > > class Client extends AppModel { > > var $name = 'Client'; > > > } > > > Model B: > > --- > > class Account extends AppModel { > > var $name = 'Account'; > > var $belongsTo = 'Myplugin.Client'; > > > } > > > Call: > > --- > > $data = $this->Account->find('all'); > > > Query output from cake/libs/models/model.php (line 2086): > > > > Array > > ( > > [conditions] => Array > > ( > > ) > > > [fields] => > > [joins] => Array > > ( > > ) > > > [limit] => > > [offset] => > > [order] => Array > > ( > > [0] => > > ) > > > [page] => 1 > > [group] => > > [callbacks] => 1 > > ) > > > Result: > > - > > Array > > ( > > [0] => Array > > ( > > [Account] => Array > > ( > > [id] => 85 > > [client_id] => 1 > > ) > > > ) > > > [1] => Array > > ( > > [Account] => Array > > ( > > [id] => 86 > > [client_id] => 2 > > ) > > > ) > > ) 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@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
Re: Need help: Plugin model issue
What is recursive set to? Should be set to 1 in order to retrieve second level related information (Client)! Enjoy, John On Jun 8, 7:59 am, trav wrote: > Hi, > > I hope someone can give me some assistance with Plugin models. > > Cake Version: 1.3.2 > == > Problem: Query result does not build model joins when using a plugin > == > Location: Model files are in app/plugin/Myplugin/models > Plugin Name: Myplugin > > Model A: > -- > class Client extends AppModel { > var $name = 'Client'; > > } > > Model B: > --- > class Account extends AppModel { > var $name = 'Account'; > var $belongsTo = 'Myplugin.Client'; > > } > > Call: > --- > $data = $this->Account->find('all'); > > Query output from cake/libs/models/model.php (line 2086): > > Array > ( > [conditions] => Array > ( > ) > > [fields] => > [joins] => Array > ( > ) > > [limit] => > [offset] => > [order] => Array > ( > [0] => > ) > > [page] => 1 > [group] => > [callbacks] => 1 > ) > > Result: > - > Array > ( > [0] => Array > ( > [Account] => Array > ( > [id] => 85 > [client_id] => 1 > ) > > ) > > [1] => Array > ( > [Account] => Array > ( > [id] => 86 > [client_id] => 2 > ) > > ) > ) 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@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
Need help: Plugin model issue
Hi, I hope someone can give me some assistance with Plugin models. Cake Version: 1.3.2 == Problem: Query result does not build model joins when using a plugin == Location: Model files are in app/plugin/Myplugin/models Plugin Name: Myplugin Model A: -- class Client extends AppModel { var $name = 'Client'; } Model B: --- class Account extends AppModel { var $name = 'Account'; var $belongsTo = 'Myplugin.Client'; } Call: --- $data = $this->Account->find('all'); Query output from cake/libs/models/model.php (line 2086): Array ( [conditions] => Array ( ) [fields] => [joins] => Array ( ) [limit] => [offset] => [order] => Array ( [0] => ) [page] => 1 [group] => [callbacks] => 1 ) Result: - Array ( [0] => Array ( [Account] => Array ( [id] => 85 [client_id] => 1 ) ) [1] => Array ( [Account] => Array ( [id] => 86 [client_id] => 2 ) ) ) 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@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