Reputation: 610
I'd like to use a Cakephp 3 component inside a class located in, for example, /src/Classes/Customers.php. I don't know how to instanciate the compoent.
Upvotes: 0
Views: 130
Reputation: 60493
You are not supposed to do that, components are services for the controller layer, and that's where the story ends. It is strongly advised that you do not use framework components outside of their intended purpose, this will just cause trouble at some point!
If you want to share logic between components and other utilities unrelated to controllers, then you should put that logic into for example generic service classes that both your components as well as your other code can utilize.
Upvotes: 1