I have extended classes from core in Magento before, but am uncertain how to extend this class:

//located in lib/Varien/Db/Adappter/Pdo/Mysql.php

How would I do this?


If by extending you mean override them, then the answer is: you can't. There is no way to do a rewrite in your own extension for a lib class. Well, there is one way to do that. You can make a copy of the file in the app/code folder.

So for this file: lib/Varien/Db/Adappter/Pdo/Mysql.php, you could make a copy of that file in app/code/local/Varien/Db/Adappter/Pdo/Mysql.php to override the class.

| improve this answer | |

For this problem, I create a class in lib/Exemple/Db/Adapter/Pdo/Mysql.php with extend Magento_Db_Adapter_Pdo_Mysql

class Exemple_Db_Adapter_Pdo_Mysql extends Magento_Db_Adapter_Pdo_Mysql

And I changed the adapter in config file



Because you have in lib


class Varien_Db_Adapter_Pdo_Mysql extends Zend_Db_Adapter_Pdo_Mysql implements Varien_Db_Adapter_Interface

and in lib/Magento/Db/Adapter/Pdo/Mysql.php

class Magento_Db_Adapter_Pdo_Mysql extends Varien_Db_Adapter_Pdo_Mysql
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.