View Issue Details

IDProjectCategoryView StatusLast Update
0006878OXID eShop (all versions)4.01. Database handlingpublic2024-07-24 12:13
Reporterthorsten.schneider Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionno change required 
Product Version6.0.2 
Summary0006878: \OxidEsales\Eshop\Core\Database\Adapter\Doctrine\Database cannot be overriden
DescriptionI 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 ReproduceCreate 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 InformationIn 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.
TagsDatabase
ThemeAll
BrowserNot defined
PHP VersionAll
Database VersionAll

Activities

SvenBrunk

2024-07-24 12:13

administrator   ~0017296

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.