How can you/Is it feasible to override Doctrine_Co

2019-08-31 16:57发布

问题:

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