Skip to content
This repository has been archived by the owner on Jan 8, 2021. It is now read-only.

Commit

Permalink
Use ProfilingAdapterFactory instead of closure in module config
Browse files Browse the repository at this point in the history
  • Loading branch information
Mickaël Zhu committed Oct 15, 2013
1 parent 1ad040a commit 6ab5fba
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,7 @@
return array(
'service_manager' => array(
'factories' => array(
'Zend\Db\Adapter\Adapter' => function ($sm) {
$config = $sm->get('Configuration');
if(!isset($config['db'])){
return false;
}
if(class_exists('BjyProfiler\Db\Adapter\ProfilingAdapter')){
$adapter = new BjyProfiler\Db\Adapter\ProfilingAdapter($config['db']);
$adapter->setProfiler(new BjyProfiler\Db\Profiler\Profiler);
if (isset($config['db']['options']) && is_array($config['db']['options'])) {
$options = $config['db']['options'];
} else {
$options = array();
}
$adapter->injectProfilingStatementPrototype($options);
} else {
$adapter = new Zend\Db\Adapter\Adapter($config['db']);
}
return $adapter;
},
'Zend\Db\Adapter\Adapter' => 'BjyProfiler\Db\Adapter\ProfilingAdapterFactory'
),
),
);

0 comments on commit 6ab5fba

Please sign in to comment.