src/ProophEventStoreModule/Factory/EventStoreFactory.php
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get("configuration");

        if (! isset($config['prooph.event_store'])) {
            throw ConfigurationException::configurationError("Missing key prooph.event_store in application configuration");
        }

        $config = $config['prooph.event_store'];

        if (! isset($config['adapter'])) {
            throw ConfigurationException::configurationError("Missing adapter configuration in prooph.event_store configuration");
        }

        $adapterConfig = $config['adapter'];

        $configReader = new ArrayReader($adapterConfig);

        $adapterType    = $configReader->stringValue("type");
        $adapterOptions = $configReader->arrayValue("options");

        if ( $adapterType == 'Prooph\EventStore\Adapter\Zf2\Zf2EventStoreAdapter'
            && isset($adapterOptions['zend_db_adapter'])
            && is_string($adapterOptions['zend_db_adapter'])) {
            $config['adapter']['options']['zend_db_adapter'] = $serviceLocator->get($adapterOptions['zend_db_adapter']);
        }

        $featureManagerConfig = null;

        if (isset($config['feature_manager'])) {
            $featureManagerConfig = new Config($config['feature_manager']);
            unset($config['feature_manager']);
        }

        $esConfiguration = new Configuration($config);

        $featureManager = new FeatureManager($featureManagerConfig);

        $featureManager->setServiceLocator($serviceLocator);

        $esConfiguration->setFeatureManager($featureManager);

        return new EventStore($esConfiguration);
    }
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get("configuration");

        if (! isset($config['prooph.event_store'])) {
            throw ConfigurationException::configurationError("Missing key prooph.event_store in application configuration");
        }

        $config = $config['prooph.event_store'];

        if (! isset($config['adapter'])) {
            throw ConfigurationException::configurationError("Missing adapter configuration in prooph.event_store configuration");
        }

        $adapterConfig = $config['adapter'];

        $configReader = new ArrayReader($adapterConfig);

        $adapterType    = $configReader->stringValue("type");
        $adapterOptions = $configReader->arrayValue("options");

        if ( $adapterType == 'Prooph\EventStore\Adapter\Zf2\Zf2EventStoreAdapter'
            && isset($adapterOptions['zend_db_adapter'])
            && is_string($adapterOptions['zend_db_adapter'])) {
            $config['adapter']['options']['zend_db_adapter'] = $serviceLocator->get($adapterOptions['zend_db_adapter']);
        }

        $featureManagerConfig = null;

        if (isset($config['feature_manager'])) {
            $featureManagerConfig = new Config($config['feature_manager']);
            unset($config['feature_manager']);
        }

        $esConfiguration = new Configuration($config);

        $featureManager = new FeatureManager($featureManagerConfig);

        $featureManager->setServiceLocator($serviceLocator);

        $esConfiguration->setFeatureManager($featureManager);

        return new EventStore($esConfiguration);
    }
Create service

@param ServiceLocatorInterface $serviceLocator
@throws \Prooph\EventStore\Configuration\Exception\ConfigurationException
@return EventStore