I'm working with a library in the vendor/ directory and designating it as a service within Symonfy2. The library has a dependency on a PDO connection -- how do I set up my service definition to pass that to the constructor?
I'm trying something like this:
services:
timers.mysql.service
class : Fmp\Timers\Record
factory_service : doctrine.orm.default_entity_manager
factory_method : getConnection
Which is giving me errors. Any help appreciated. Note, the library I can't modify - it needs a PDO connection, not a doctrine entity manager
services:
timers.mysql.service
class : Fmp\Timers\Record
factory_service : database_connection
factory_method : getWrappedConnection
That should give you an object extended from PDO.
Otherwise, you might just need to define your very own pdo object. The database session handler used to have an example. BTW, factory_service and method are depreciated. Might look at using the factory item.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句