Wednesday, March 18, 2015

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+unsubscribe@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.

No comments: