Jatin Dhoot
Jatin Dhoot

Reputation: 4364

Change the path of Database Adapter class in Zend Framework

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?

Upvotes: 2

Views: 1134

Answers (2)

voncox
voncox

Reputation: 1201

You could also use the regular adapter ini setting:

resources.db.adapter = "Pdo_Mysql"

and then define the prefix/namespace to force it look in your local library (assuming you have YourLibs/Db/Adapter/Pdo/Mysql.php)

resources.db.params.adapterNamespace = "YourLibs_Db_Adapter"

Upvotes: 3

Phil
Phil

Reputation: 164881

Probably the easiest thing to do is rename your class to something like My_Db_Adapter_Pdo_Mysql, store it in library/My/Db/Adapter/Pdo/Mysql.php and add / set these in your config file...

autoloaderNamespaces.My = "My_"
resources.multidb.master.adapter = "My_Db_Adapter_Pdo_Mysql"

Upvotes: 5

Related Questions