1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47:
<?php
namespace NetBazzlineZfLocatorGenerator\Controller\Console;
use Net\Bazzline\Component\ProcessPipe\PipeInterface;
use Zend\ServiceManager\Exception\InvalidArgumentException;
use Zend\ServiceManager\ServiceLocatorInterface;
use ZfConsoleHelper\Controller\Console\AbstractConsoleControllerFactory;
class IndexControllerFactory extends AbstractConsoleControllerFactory
{
public function createService(ServiceLocatorInterface $serviceLocator)
{
$controller = new IndexController();
$serviceLocator = $this->transformIntoServiceManager($serviceLocator);
$configuration = $serviceLocator->get('Config');
$key = 'net_bazzline_zf_locator_generator';
if (!isset($configuration[$key])) {
throw new InvalidArgumentException (
'expected configuration key "' . $key . '" not found'
);
}
$configuration = $configuration[$key];
$pipe = $serviceLocator->get('NetBazzlineLocatorGeneratorProcessPipe');
$controller->setConfiguration($configuration);
$controller->setProcessPipe($pipe);
return $controller;
}
}