Re: how to call Model1->find("all") from Model2 Controller
RTFA? 4-6% decrease in speed for each model in $uses. The reason is that you almost never need to instanciate more then one model for an entire controller. If you need a model in only one action, and add it to your $uses array, then you are needlessly loading the models for all your other actions in that controller. The only real reason that I've managed to find (In my 2+ years of using Cake) for using $uses is if your controller doesn't follow the standard conventions. On Jan 20, 1:00 pm, djogo wrote: > Yes, but, why is "uses" evil? The post simply says "dont use it", and > not explains why, or when it's adviseable to. > > I presume,by the post title, that that's because it's slow. How slow? > > dfcp > > On 19 jan, 04:47, Walther wrote: > > > Never use $uses unless you really really really have too. See > > here:http://www.pseudocoder.com/archives/2009/04/16/one-more-tip-for-speed... > > > Rather use $this->loadModel or ClassRegistry::init > > > On Jan 18, 12:34 pm, djogo wrote: > > > > Class usercontroller extends appcontroller > > > { > > > Var $uses=array( 'Users','Projects'); > > > > } > > > > Then you can use > > > > $this->Project->find() > > > > On 17 jan, 08:10, codef0rmer wrote: > > > > > thx guys. Finally, it worked :) 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: how to call Model1->find("all") from Model2 Controller
Yes, but, why is "uses" evil? The post simply says "dont use it", and not explains why, or when it's adviseable to. I presume,by the post title, that that's because it's slow. How slow? dfcp On 19 jan, 04:47, Walther wrote: > Never use $uses unless you really really really have too. See > here:http://www.pseudocoder.com/archives/2009/04/16/one-more-tip-for-speed... > > Rather use $this->loadModel or ClassRegistry::init > > On Jan 18, 12:34 pm, djogo wrote: > > > Class usercontroller extends appcontroller > > { > > Var $uses=array( 'Users','Projects'); > > > } > > > Then you can use > > > $this->Project->find() > > > On 17 jan, 08:10, codef0rmer wrote: > > > > thx guys. Finally, it worked :) 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: how to call Model1->find("all") from Model2 Controller
Never use $uses unless you really really really have too. See here: http://www.pseudocoder.com/archives/2009/04/16/one-more-tip-for-speeding-up-cakephp-apps/ Rather use $this->loadModel or ClassRegistry::init On Jan 18, 12:34 pm, djogo wrote: > Class usercontroller extends appcontroller > { > Var $uses=array( 'Users','Projects'); > > } > > Then you can use > > $this->Project->find() > > On 17 jan, 08:10, codef0rmer wrote: > > > thx guys. Finally, it worked :) 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: how to call Model1->find("all") from Model2 Controller
Class usercontroller extends appcontroller { Var $uses=array( 'Users','Projects'); } Then you can use $this->Project->find() On 17 jan, 08:10, codef0rmer wrote: > thx guys. Finally, it worked :) 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: how to call Model1->find("all") from Model2 Controller
thx guys. Finally, it worked :) 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: how to call Model1->find("all") from Model2 Controller
$this->loadModel('Project'); $this->Project->find('all'); On Jan 16, 2:13 am, codef0rmer wrote: > I want to call Project->find("all") from UserController. I tried with > $this->Product->find("all") as well as Product::find("all"). but no > luck > > Is there any other option? 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