你如何/在Symfony中覆盖Doctrine_Connection是否可行? [英] How can you/Is it feasible to override Doctrine_Connection in Symfony?

查看:175
本文介绍了你如何/在Symfony中覆盖Doctrine_Connection是否可行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在从事的大学服务器缺少PDO驱动程序,因此我不得不重新实施PDO&它是各自的MySQL类,允许教义连接到MySQL数据库。

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.

这一切都很好(或者是PDO的PHP实现可以 go),显然如果uni没有PDO,这一切都会工作。

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.

但是,由于他们有PDO但没有驱动程序,这意味着我不能重新实例化PDO,因此称之为_PDO。这种改变意味着Doctrine_Connection必须被更新才能实现正确的PDO(并运行正确的static checkAvailableDrivers()方法),而显然我已经改变了核心类进行测试,这不太理想。

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.

有没有人知道要覆盖哪些类以获得Doctrine_Connection的实例化?和/或可以提供示例?

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 (在database.yml中) - > Doctrine_Manager - > Doctrine_Connection

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

但我无法确定?

推荐答案

我认为编写自定义连接是您要查找的: http://www.doctrine-project.org/projects/orm/1.2/docs/manual/connections/en#writing-custom-connections

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

这篇关于你如何/在Symfony中覆盖Doctrine_Connection是否可行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆