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

Commit

Permalink
Profiling adapter default factory
Browse files Browse the repository at this point in the history
  • Loading branch information
inditel authored and Ben Youngblood committed Jul 25, 2013
1 parent 46e48fd commit a9c8cca
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/BjyProfiler/Db/Adapter/ProfilingAdapterFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* Created by Inditel Meedia OÜ
* User: Oliver
* Date: 19.06.13 10:01
*/

namespace Helpers\Db\Adapter;


use BjyProfiler\Db\Adapter\ProfilingAdapter;
use BjyProfiler\Db\Profiler\Profiler;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

class ProfilingAdapterFactory implements FactoryInterface
{

/**
* @param ServiceLocatorInterface $serviceLocator
* @return mixed
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
$config = $serviceLocator->get('Configuration');
$dbParams = $config['db'];
$adapter = new ProfilingAdapter($dbParams);

$adapter->setProfiler(new Profiler);
if (isset($dbParams['options']) && is_array($dbParams['options'])) {
$options = $dbParams['options'];
} else {
$options = array();
}
$adapter->injectProfilingStatementPrototype($options);
return $adapter;
}
}

0 comments on commit a9c8cca

Please sign in to comment.