Search code examples
cakephpdependency-injectioncakephp-2.x

How can I make sure that every controller sees DboSource?


There were issues that some controllers are using DboSource methods and I added the

App::uses('DboSource', 'Model/DboSource');

line to the class file of some base controllers from which other controllers are inherited. However, I wonder whether there is a way in Cake to make sure that a class is loaded by every controller. My current solution works, I just intend to improve it. Is this possible? Thanks!


Solution

  • You can add this to your app/Config/bootstrap.php file and it will be loaded on every request.