php - zf3 Custom database factory doesn't want to apply -


i have strange behavior database custom factory.

for example want use bjyprofiler , create 1 config this:

'db' => array(     'driver' => 'pdo',     'dsn' => 'mysql:dbname=framework;host=localhost',     'username' => 'root',     'password' => '',     'driver_options' => array(         pdo::mysql_attr_init_command => 'set names \'utf8\''     ), ), 'service_manager' => array(     'factories' => array(         'zend\db\adapter\adapter' => 'database\adapter\mainadapterfactory',     ), ), 

so use zend\db added module in modules.config.php "zend\db"(otherwise exceptions). problem when want "zend\db\adapter\adapter", never go through "database\adapter\mainadapterfactory" , don't know why... use default adapter. triend put factory declaration in global.php, local.php , doesn't work. why happening? in zf2 code ok...

i use composer if matters.

update: in final config have:

'service_manager' =>      array (size=5)       'aliases' =>             array (size=11)              ...              'zend\db\adapter\adapter' => string 'zend\db\adapter\adapterinterface' (length=32)              ...       'factories' =>             array (size=19)              ...              'zend\db\adapter\adapterinterface' => string 'zend\db\adapter\adapterservicefactory' (length=37)              ...           'zend\db\adapter\adapter' => string 'database\adapter\factory\mainadapterfactory' (length=43)       'abstract_factories' =>             array (size=3)              ...              1 => string 'zend\db\adapter\adapterabstractservicefactory' (length=45)              ...    ... 

i don't know comes alias 'zend\db\adapter\adapter' => 'zend\db\adapter\adapterinterface' think problem.

the 'zend\db\adapter\adapter' => 'zend\db\adapter\adapterinterface' come framework.

i suggested extends original 'zend\db\adapter\adapter' own adapter (let's call myadapter), , use custom adapter:

'service_manager' => array(     'factories' => array(         'zend\db\adapter\myadapter' => 'database\adapter\mainadapterfactory',     ), ), 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -