for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Adlogix package.
*
* (c) Allan Segebarth <[email protected]>
* (c) Jean-Jacques Courtens <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Adlogix\Zf2Rollout\Service\Factory;
use Adlogix\Zf2Rollout\Storage\ZendDbAdapterStorage;
use Interop\Container\ContainerInterface;
use Zend\Db\Adapter\Adapter;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
class RolloutZendDbAdapterStorageFactory implements FactoryInterface
{
/**
* {@inheritdoc}
public function createService(ServiceLocatorInterface $serviceLocator)
return $this($serviceLocator, null);
}
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
$rolloutConfig = $container->get('zf2_rollout_config');
if (!isset($rolloutConfig['zend_db_storage']['table_name'])) {
throw new \RuntimeException('Missing table_name config when using zend db storage!');
/** @var Adapter $adapter */
$adapter = $container->get('Zend\Db\Adapter\Adapter');
return new ZendDbAdapterStorage($adapter, $rolloutConfig['zend_db_storage']['table_name']);