I'm creating a new ServiceManager instance and a abstract_factory instance
is failing to load.

Found out the root of the issue is $services->has('Config')  fails within
Zend\Db\Adapter\AdapterAbstractServiceFactory::getConfig() line number 71.

My code:

 ---
use Zend\ServiceManager\Config;
use Zend\ServiceManager\ServiceManager;
/// ....
        $this->sm = new ServiceManager(new
Config(require('../config/app.php')));
 ---

app.php has:
 --
    'db' => [
        'adapters' => [
            'trackingDb' => [
                'driver' => 'pdo',
                'dsn' =>
'cassandra:host=127.0.0.1,host=192.168.10.214;version=3.0.0',
                'username' => null,
                'password' => null,
                'dbname' => 'overload',
                'options' => array(1012 /* PDO::CASSANDRA_ATTR_THRIFT_DEBUG
*/ => true),
            ],
            // ... More DBs
        ],
    ],
    'abstract_factories' => array(
        'Zend\Db\Adapter\AdapterAbstractServiceFactory',
    ),
 --

$this->sm->get('trackingDb'); fails because $services->has('Config'); fails.

I would have assumed new ServiceManager(new Config()); would have
automatically set the Config service to the Config I passed in ...
apparently, it does not.

One solution is to add this line, within
Zend\ServiceManager\Config::configureServiceManager():
--
        $serviceManager->setService('Config', $this->config);
--

However, I'm unaware of the implications to that. 'Config' is obviously
being set somewhere else for abstract_factory to pass unit tests. But
where? I'm running a very slim-down, component-by-component, based app; I
only import zend-servicemanager, zend-db, and zend-http.



---
Philip
g...@gpcentre.net
http://www.gpcentre.net/

Reply via email to