In ZF1, logging database queries was easy. I just created a custom database adapter and then forced the usage of this adapter in the config like this:
resources.db.adapter = "pdo_mysql" resources.db.params.host = "localhost" resources.db.params.username = "user" resources.db.params.password = "pass" resources.db.params.dbname = "my_database" resources.db.params.adapterNamespace = "MyCystom_Db_Adapter" The import part is the MyCustom_Db_Adapter : this way the class MyCustom_Db_Adapter_Pdo_Mysql was used instead of Zend_Db_Adapter_Pdo_Mysql And in this class i would then implement logging, so all my database-queries were logged. In ZF2 i'm lost however. There's the 'db' configuration array in config/autoload/global.php which has the database configuration, however i can't find any documentation on possibilities of configuring this in a similar way. I know the database adapter is created in the getServiceConfig method in Module.php, when, for example, a tablegateway is created, but the config is - i guess - inserted by dependency injection somewhere, since it's not explicitly passed at that point. I would rather not break this logic. So my question is: is there a way - similar to the one in ZF1 - to use a custom adapter? Or is there a better way of logging the database queries? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/ZF2-How-to-use-custom-db-adpater-How-to-log-database-queries-tp4659302.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: [email protected] Info: http://framework.zend.com/archives Unsubscribe: [email protected]
