Newscoop\NewscoopBundle\DependencyInjection\NewscoopNewscoopExtension::mergeParameters PHP Method

mergeParameters() public method

Merge parameters for env's.
public mergeParameters ( $container )
    public function mergeParameters($container)
    {
        $container->setParameter('application_path', APPLICATION_PATH);
        /**
         * Allways load config for env
         */
        $this->loader = new YamlFileLoader($container, new FileLocator(APPLICATION_PATH . '/configs/'));
        $this->loader->load(APPLICATION_PATH . '/configs/parameters/parameters.yml');
        if (APPLICATION_ENV !== 'production') {
            $tempContainer = new ContainerBuilder();
            $tempLoader = new YamlFileLoader($tempContainer, new FileLocator(APPLICATION_PATH . '/configs/'));
            if (file_exists($file = APPLICATION_PATH . '/configs/parameters/parameters_' . APPLICATION_ENV . '.yml')) {
                $tempLoader->load($file);
            }
            $containerParameters = $container->getParameterBag()->all();
            $tempContainerParameters = $tempContainer->getParameterBag()->all();
            $parameters = $this->array_merge_recursive_distinct($containerParameters, $tempContainerParameters);
            foreach ($parameters as $key => $value) {
                $container->setParameter($key, $value);
            }
        }
        $container->setParameter('storage', array(\Zend_Cloud_StorageService_Adapter_FileSystem::LOCAL_DIRECTORY => APPLICATION_PATH . '/..'));
        // load custom instalation parameter
        if (file_exists($file = APPLICATION_PATH . '/configs/parameters/custom_parameters.yml')) {
            $this->loader->load($file);
        }
        /**
         * Load all configs from services directory.
         */
        $services = glob(APPLICATION_PATH . '/configs/services/*.yml');
        foreach ($services as $service) {
            $this->loader->load($service);
        }
    }