Get access to DI inside static methods

What is the best way to get static methods to access the dependency injector?



81.2k

You can use the method Phalcon\DI::getDefault() to get the latest DI created in an static way.

http://docs.phalconphp.com/en/latest/reference/di.html#accessing-the-di-in-a-static-way

Sorry! Missed it while reading the docs!