更改Zend Framework中Database Adapter类的路径
我编写了一个扩展 Mysql 适配器(Zend_Db_Adapter_Mysqli)的自定义数据库适配器,我的 application.ini 如下所示:-(
resources.multidb.master.adapter = PDO_MYSQLCUSTOMIZED
resources.multidb.master.host = HOSTNAME
resources.multidb.master.username = USER
resources.multidb.master.password = PASS
resources.multidb.master.dbname = DB
这样做的原因是 这个?)
现在我的问题是我必须将 Zend_Db_Adapter_Pdo_Mysqlcustomized 保存在默认路径中,即 /library/Zend/Db/Adapter/Pdo/Mysqlcustomized.php。
我不想在库中保存Zend_Db_Adapter_Pdo_Mysqlndtv
类。
我应该怎么办?
I have written a customized Database Adapter extending Mysql Adapter (Zend_Db_Adapter_Mysqli) and my application.ini looks as under :-
resources.multidb.master.adapter = PDO_MYSQLCUSTOMIZED
resources.multidb.master.host = HOSTNAME
resources.multidb.master.username = USER
resources.multidb.master.password = PASS
resources.multidb.master.dbname = DB
(Reason why it did so is this?)
Now my problem is I have to save Zend_Db_Adapter_Pdo_Mysqlcustomized in default path i.e. /library/Zend/Db/Adapter/Pdo/Mysqlcustomized.php.
I dont want to saveZend_Db_Adapter_Pdo_Mysqlndtv
class in library.
What should I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能最简单的方法是将您的类重命名为 My_Db_Adapter_Pdo_Mysql 之类的名称,将其存储在library/My/Db/Adapter/Pdo/Mysql.php 中并添加/设置这些在你的配置文件中...
Probably the easiest thing to do is rename your class to something like
My_Db_Adapter_Pdo_Mysql
, store it inlibrary/My/Db/Adapter/Pdo/Mysql.php
and add / set these in your config file...您还可以使用常规适配器 ini 设置:
然后定义前缀/命名空间以强制它在本地库中查找(假设您有 YourLibs/Db/Adapter/Pdo/Mysql.php)
You could also use the regular adapter ini setting:
and then define the prefix/namespace to force it look in your local library (assuming you have YourLibs/Db/Adapter/Pdo/Mysql.php)