How can you/Is it feasible to override Doctrine_Connection in Symfony?

徘徊边缘 提交于 2019-12-12 04:33:49

问题


The university servers I'm currently working on lack PDO drivers, hence I've had to re-implement PDO & it's respective MySQL class to allow doctrine to connect to a MySQL database.

This is all well and good (or as well as a PHP implementation of PDO can go) and obviously if uni didn't have PDO at all this would all just work.

However, since they have PDO but no drivers, this means I can't re-instantiate PDO and have therefore called it _PDO. This change means that Doctrine_Connection has to be updated in order to implement the correct PDO (and run the correct static checkAvailableDrivers() method) whilst obviously I've changed the core class for testing this is less than ideal.

Does anyone know which classes to override in order to get to the instantiation of Doctrine_Connection? and or can provide examples?

I'm thinking it's something along the lines of going through:

sfDoctrineDatabase (in database.yml) -> Doctrine_Manager -> Doctrine_Connection

But I can't be sure?


回答1:


I think that writing a custom connection is what you're looking for: http://www.doctrine-project.org/projects/orm/1.2/docs/manual/connections/en#writing-custom-connections



来源:https://stackoverflow.com/questions/4064750/how-can-you-is-it-feasible-to-override-doctrine-connection-in-symfony

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!