0

there is identical question about this Cakephp: Load components in components posted about 3 years ago, which should be for 1.3 version.

I have a big component, (about 3-4 thousand lines), lets call it BigComponent.php. I am using it a couple of times in my UsersController.php, and also in a few other controllers, so, in each of those controllers I include it by public $uses. And I am using also AnotherComponent in those controllers, so it is included as well. Now, consider I need to use BigComponent inside AnotherComponent, how this is handled in cake, specifically in v. 2.5.3, Will my BigComponent be loaded once(so second time by reference) or twice ?

Thanks

Community
  • 1
  • 1
dav
  • 8,931
  • 15
  • 76
  • 140

1 Answers1

1

Yes, all components are loaded only once into another object that is called ComponentCollection. This collection helps keeping the instances unique, no matter how many times they are referenced from other components.