MVC\Collection manager shared connection

Is there any reason for hardcoded $di->getShared instead of $di->get in Collection\Manager::getConnection method? Wanna change it to allow choose connection type myself in dependency injector service declaration (set or setShared).

Yes - to use every time the same connection.

edited Apr '16

To use same connection we can simply declare shared connection in DI, why to hardcode it in manager? So question is open. Why i can't recreate connection if i want?

Beacause this will slow application. If you want to recreate connection then just setConnection for this model. You can set connection yourself for certain models and then it can be recreated after each time which i don't recommend. It's not really hardcoded, you can change it by doing what i wrote.


There is no setConnection method in phalcon Phalcon\Mvc\Collection, only getter. And setConnectionService also can't recreate connection. Once connection was establishedm i have no ways to recreate it, it's not good. And i still don't see reasons why not allow users to choose what connection service to use, shared or not


setConnectionService can't recreate connection, just change to other di by service name

So if you need such a behaviour to recreate connection then just extends phalcon manager and override method getConnection ? I don't know what's a problem. Phalcon is using same connection for performance reasons.