After updating Phalcon from 1.2.6 to 1.3.0, it keeps saying:
Usage of Phalcon\DI to store non-objects is deprecated, please use Phalcon\Registry
The thing is, we didn't use the Dependency Injector only as Iversion of Control container. We stored some helper functions, that use the $di, as "services" in it too.
As an example (very dumb one):
$di->set('add', function($num1, $num2) use ($di) {
return $di->get('calculator')->add($num1, $num2);
});
Phalcon suggests to use Registry for it as it does not return an object. But in this context it doesn't work.
I know the best approach is to extract these helper (anonymous) functions to a class and then inject it in the container. But what would be the best approach to get this woking by now (without refactoring)?