View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006878 | OXID eShop (all versions) | 4.01. Database handling | public | 2018-08-08 12:18 | 2024-07-24 12:13 |
Reporter | thorsten.schneider | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | always |
Status | resolved | Resolution | no change required | ||
Product Version | 6.0.2 | ||||
Summary | 0006878: \OxidEsales\Eshop\Core\Database\Adapter\Doctrine\Database cannot be overriden | ||||
Description | I wanted to add a connection option in addDriverOptions() in \OxidEsales\Eshop\Core\Database\Adapter\Doctrine\Database. It seems that this (and overwriting other Methods in this class) is not possible as the object is generated in \OxidEsales\EshopCommunity\Core\DatabaseProvider::createDatabase() (Line 196) with "new" instead of "oxNew". | ||||
Steps To Reproduce | Create a module that extends the class: \OxidEsales\Eshop\Core\Database\Adapter\Doctrine\Database::class => Vendor\Module\Core\Database\Adapter\Doctrine\Database::class, Overwrite a function, e.g.: protected function addDriverOptions(array &$existingParameters) { die("Actually we do something"); } This will never be called, although the database connection is set up correctly. Means our addition is not added to the chain (although you can see the addition in backend's loaded modules) | ||||
Additional Information | In some cases it is essential to extend functions here. In my case i need to set a special Option for the database connection: PDO::MYSQL_ATTR_LOCAL_INFILE => true This is not possible in this implementation. I would guess that it is not very often the case, but if it is you are stuck with a database connection that is not configurable with special PDO Options. | ||||
Tags | Database | ||||
Theme | All | ||||
Browser | Not defined | ||||
PHP Version | All | ||||
Database Version | All | ||||
|
I checked back with the team, and this is definitely something we do not want to allow to be overridden. Although, there is a solution for your issue: You can add your own connection parameters via setConnectionParameters For things like driver options, you can also do this via config.inc.php In case I am missing some point or this is not working, please re-open the ticket. |