/** * Returns path to the right directory to dump and save config.yml file. * * @param string $baseDir config base directory * * @return string */ private function getConfigDumpRightDirectory($baseDir) { $configDumpDir = $this->app->getRepository(); if (ApplicationInterface::DEFAULT_CONTEXT !== $this->app->getContext()) { $configDumpDir .= DIRECTORY_SEPARATOR . $this->app->getContext(); } $configDumpDir .= DIRECTORY_SEPARATOR . 'Config'; if (ApplicationInterface::DEFAULT_ENVIRONMENT !== $this->app->getEnvironment()) { $configDumpDir .= DIRECTORY_SEPARATOR . $this->app->getEnvironment(); } $key = $this->app->getContainer()->get('bundle.loader')->getBundleIdByBaseDir($baseDir); if (null !== $key) { $configDumpDir .= DIRECTORY_SEPARATOR . 'bundle' . DIRECTORY_SEPARATOR . $key; } if (!is_dir($configDumpDir) && false === @mkdir($configDumpDir, 0755, true)) { throw new \Exception('Unable to create config dump directory'); } return $configDumpDir; }
/** * Hydrates container with application core parameters (like bbapp.context, bbapp.environement, etc.). */ private function hydrateContainerWithApplicationParameters() { $this->container->setParameter('bbapp.context', $this->context); $this->container->setParameter('bbapp.environment', $this->environment); $this->container->setParameter('environment', $this->environment); // set default backbee base directory, config directory and repository directory $this->container->setParameter('bbapp.base.dir', $this->application->getBBDir()); $this->container->setParameter('bbapp.config.dir', $this->application->getConfigDir()); $this->container->setParameter('bbapp.repository.dir', $this->application->getRepository()); // set default cache directory and cache autogenerate value $cache_directory = $this->application->getBaseDir() . DIRECTORY_SEPARATOR . self::CACHE_FOLDER_NAME; if (ApplicationInterface::DEFAULT_ENVIRONMENT !== $this->environment) { $cache_directory .= DIRECTORY_SEPARATOR . $this->environment; } $this->container->setParameter('bbapp.cache.dir', $cache_directory); $this->container->setParameter('bbapp.cache.autogenerate', '%container.autogenerate%'); // define log directory $this->container->setParameter('bbapp.log.dir', $this->application->getBaseDir() . DIRECTORY_SEPARATOR . self::LOG_FOLDER_NAME); // define data directory $this->container->setParameter('bbapp.data.dir', $this->application->getRepository() . DIRECTORY_SEPARATOR . self::DATA_FOLDER_NAME); // define media directory $this->container->setParameter('bbapp.media.dir', $this->container->getParameter('bbapp.data.dir') . DIRECTORY_SEPARATOR . self::MEDIA_FOLDER_NAME); }