public function createConfig(Application $app)
    {
        $config = new Pimple;

        foreach ($app['ems.options'] as $name => $options) {
            $config[$name] = $config->share(
                function () use ($app, $name, $options) {
                    $config = new Configuration;

                    $config->setAutoGenerateProxyClasses(
                        $options['proxy_auto_generate']
                    );

                    $config->setMetadataCacheImpl($app['ems.cache'][$name]);
                    $config->setMetadataDriverImpl($app['ems.mapping'][$name]);
                    $config->setQueryCacheImpl($app['ems.cache'][$name]);
                    $config->setProxyDir($options['proxy_dir']);
                    $config->setProxyNamespace($options['proxy_namespace']);

                    return $config;
                }
            );
        }

        return $config;
    }