Create and return the datasource service.

@param ServiceLocatorInterface $serviceLocator

@return \PPI\Framework\DataSource\DataSource;
773616
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config         = $serviceLocator->get('ApplicationConfig');
        $allConnections = $libraryToConnMap = $configMap = array();

        // Early return
        if (!isset($config['datasource']['connections'])) {
            return new ConnectionManager($allConnections, $this->connectionClassMap);
        }

        foreach ($config['datasource']['connections'] as $name => $config) {
            $allConnections[$name]                = $config;
            $configMap[$config['library']][$name] = $config;
        }

        return new ConnectionManager($allConnections, $this->connectionClassMap);
    }
52291
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $pluginManagerClass = static::PLUGIN_MANAGER_CLASS;
        /* @var $plugins \Zend\ServiceManager\AbstractPluginManager */
        $plugins = new $pluginManagerClass();
        $plugins->setServiceLocator($serviceLocator);

        return $plugins;
    }
1142248
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('config')['mongoObjectMapper'];
        $client = self::constructMongoClient(@$config['uri'], @$config['options']);

        $mapperClass = 'MongoObject\Mapper';
        if (isset($config['mapperClass'])) {
            $mapperClass = $config['mapperClass'];
        }

        return new $mapperClass($client->selectDb($config['database']), @$config['modelsNamespace']);
    }
1166811
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var HelperPluginManager $serviceLocator */
        $mainServiceManager = $serviceLocator->getServiceLocator();

        $helper = new EnvironmentSelect();

        /** @var EnvironmentRepositoryInterface $environmentRepository */
        $environmentRepository = $mainServiceManager->get('EnvironmentRepository');
        $helper->setEnvironmentRepository($environmentRepository);

        /** @var Application $application */
        $application = $mainServiceManager->get('Application');
        $helper->setRouteMatch($application->getMvcEvent()->getRouteMatch());

        return $helper;
    }
1326494
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config     = $serviceLocator->get('Config');
        $appRootDir = $config['parameters']['app.root_dir'];

        return new FileLocator($serviceLocator->get('ModuleManager'), $appRootDir);
    }
1103901
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $services = $serviceLocator->getServiceLocator();
        /* @var $translator \Zend\Mvc\I18n\Translator */
        $translator = $services->get('MvcTranslator');

        return new Translate($translator);
    }
1186677
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('Config');
        $navigationConfig = $config['navigation'];
        $navigation = new Navigation($navigationConfig);
        return $navigation;
    }
465558
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        if ($serviceLocator instanceof AbstractPluginManager) {
            $serviceLocator = $serviceLocator->getServiceLocator() ?: $serviceLocator;
        }
        return $this($serviceLocator, Asset::class);
    }
1223596
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var array $config */
        $config = $serviceLocator->get('Config')['eye4web_abac']['assertion_manager'];

        $pluginManager = new AssertionPluginManager(new Config($config));
        $pluginManager->setServiceLocator($serviceLocator);

        return $pluginManager;
    }
872787
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var \Eye4web\Zf2Board\Options\ModuleOptions $options */
        $options = $serviceLocator->get('Eye4web\Zf2Board\Options\ModuleOptions');

        /** @var \Eye4web\Zf2Board\Mapper\PostMapperInterface $mapper */
        $mapper = $serviceLocator->get($options->getPostMapper());

        /** @var Form $postCreateForm */
        $postCreateForm = $serviceLocator->get('Eye4web\Zf2Board\Form\Post\CreateForm');

        /** @var Form $postEditForm */
        $postEditForm = $serviceLocator->get('Eye4web\Zf2Board\Form\Post\EditForm');

        $service = new PostService($mapper, $postCreateForm, $postEditForm);

        return $service;
    }
696840
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $appServiceLocator = $serviceLocator;
        if ($serviceLocator instanceof AbstractPluginManager) {
            $appServiceLocator = $serviceLocator->getServiceLocator();
        }

        /** @var DoctrineObjectManager $doctrineObjectManager */
        $doctrineObjectManager = $appServiceLocator->get(DoctrineObjectManager::class);

        /** @var EntityMapCacheInterface $entityMapCache */
        $entityMapCache = $appServiceLocator->get(EntityMapCacheInterface::class);

        return new EntityMapBuilderController($doctrineObjectManager, $entityMapCache);
    }
1250380
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var \Eye4web\Zf2Board\Options\ModuleOptions $moduleOptions */
        $moduleOptions = $serviceLocator->get('Eye4web\Zf2Board\Options\ModuleOptions');

        $entityName = $moduleOptions->getTopicEntity();
        $object = new $entityName;

        $form = new CreateForm($object);

        return $form;
    }
849145
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $taskResource = new Task();
        $taskResource->setTaskFinder($serviceLocator->getServiceLocator()->get(TaskFinder::class));
        return $taskResource;
    }
1215953
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('Config');

        $client = new Client();
        if (!empty($config[$this->configKey])) {

            $clientOptions = $config[$this->configKey];

            if (isset($clientOptions['uri'])) {
                $client->setUri($clientOptions['uri']);
                unset($clientOptions['uri']);
            }

            if (isset($clientOptions['auth'])) {
                $auth = $clientOptions['auth'];
                $client->setAuth(
                    isset($auth['user'])     ? $auth['user']     : '',
                    isset($auth['password']) ? $auth['password'] : '',
                    isset($auth['type'])     ? $auth['type']     : $client::AUTH_BASIC
                );
                unset($clientOptions['auth']);
            }

            $client->setOptions($config[$this->configKey]);
        }

        return $client;
    }
128212
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('config');

        if (!is_array($config)) {
            throw new \RuntimeException("Expected application config to be an array. Got " . gettype($config));
        }

        if (! isset($config['system_data_dir'])) {
            throw new \RuntimeException("Missing system_data_dir key in application configuration. Please add the key to your config and point it to the data directory of your application!");
        }

        return DataLocation::fromPath($serviceLocator->get('config')['system_data_dir']);
    }
308800
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var ObjectManagerAutoDetectorInterface $objectManagerAutoDetector */
        $objectManagerAutoDetector = $serviceLocator->get(ObjectManagerAutoDetectorInterface::class);

        /** @var EntityManagerInterface $entityManager */
        $entityManager = $serviceLocator->get(EntityManagerInterface::class);

        return new ObjectManagerService($objectManagerAutoDetector, $entityManager);
    }
1307839
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var EntityManagerInterface $objectManager */
        $objectManager = $serviceLocator->get('Doctrine\ORM\EntityManager');

        /** @var ValidatorPluginManager $validatorPluginManager */
        $validatorPluginManager = $serviceLocator->get('ValidatorManager');

        return new DoctrineORMProvider($objectManager, $validatorPluginManager);
    }