Lazy loading components
Hi there! Is there a way to enable lazy loading of components? As far as i can tell (i'm using 2.6.3) all components listed in $components variable are loaded and initialized when the controller is loaded. Shouldn't it use the same logic as models in which models are only loaded and initialized when used? Am i doing something wrong? As an example, if i have a controller that uses the Paginator component in one action but has ten actions, in all nine other actions the component is created without need. Maybe micro-optimizing but still Thanks in advance. Gonçalo. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Lazy loading components
Thanks for your answer! Keep up the great work! Atentamente, Gonçalo Marrafa On 18 March 2015 at 12:12, euromark dereurom...@gmail.com wrote: They need to be able to run initialize() and startup() before any action, so thats hard to do. And yes, micro-opt. without a real value IMO :) Mark Am Mittwoch, 18. März 2015 11:53:14 UTC+1 schrieb Gonçalo Marrafa: Hi there! Is there a way to enable lazy loading of components? As far as i can tell (i'm using 2.6.3) all components listed in $components variable are loaded and initialized when the controller is loaded. Shouldn't it use the same logic as models in which models are only loaded and initialized when used? Am i doing something wrong? As an example, if i have a controller that uses the Paginator component in one action but has ten actions, in all nine other actions the component is created without need. Maybe micro-optimizing but still Thanks in advance. Gonçalo. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to a topic in the Google Groups CakePHP group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/cake-php/Zx-uECAHoBo/unsubscribe. To unsubscribe from this group and all its topics, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Lazy loading components
They need to be able to run initialize() and startup() before any action, so thats hard to do. And yes, micro-opt. without a real value IMO :) Mark Am Mittwoch, 18. März 2015 11:53:14 UTC+1 schrieb Gonçalo Marrafa: Hi there! Is there a way to enable lazy loading of components? As far as i can tell (i'm using 2.6.3) all components listed in $components variable are loaded and initialized when the controller is loaded. Shouldn't it use the same logic as models in which models are only loaded and initialized when used? Am i doing something wrong? As an example, if i have a controller that uses the Paginator component in one action but has ten actions, in all nine other actions the component is created without need. Maybe micro-optimizing but still Thanks in advance. Gonçalo. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
3.0 - routing bug?
Tell me if i'm wrong but i thought that Router::parse was the inverse of Router::url. In other words, I thought that $url == Router::url(Router::parse($url))would always be true. Just found out this was not the case. If $url = /users/view/123 then Router::url(Router::parse($url)) = /users/view?pass%5B0%5D=123 This leads to the following bug in my App: // In UsersController function login() { if ($this-request-is('post')) { $user = $this-Auth-identify(); if ($user) { $this-Auth-setUser($user); $url = $this-Auth-redirectUrl(); // let's say redirect url is /en/users/view/123 $url = Router::parse($url); // now url is ['controller' = 'users', 'action' = 'view', 'locale' = 'en', 'pass' = ['123']] $url['locale'] = $user['locale']; // my user is french $url = Router::url($url); // now url is /fr/users/view?pass%5B0%5D=123 instead of /fr/users/view/123 return $this-redirect($url); } } } -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.