Excuse my handwriting, I'm typing this from my phone. I've done it like this https://github.com/robertbasic/perfi/blob/master/config/autoload/global.php
now, the only problem I see with this is if I never call the dbAdapter service from the SM in the request, but I do need the static adapter, it won't be set, because the dbAdapter factory was never called. But I still have to come to a situation like this, so i can live with this. cheers, Robert On 15 Mar 2013 17:21, "Brad Waite" <[email protected]> wrote: > Where's the best place to initialize the database adapter? I'm using the > GlobalAdapterFeature of Db\TableGateway and it > doesn't make sense to me to have the following lines in each table's > factory config: > > $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter'); > Feature\GlobalAdapterFeature::setStaticAdapter($dbAdapter); > > Since the database config lives "outside" any modules, in > /config/autoload/(global|local).php, should the initialization > happen outside, too? Is there a way to do this with the Service Manager > outside of a module, or should I just add > onBootstrap() to Application/Module.php? > > Thanks, > > -Brad > > -- > List: [email protected] > Info: http://framework.zend.com/archives > Unsubscribe: [email protected] > > >
