getProjectDir().'/var/cache/'.$this->environment; } /** * @return string */ public function getLogDir() { return $this->getProjectDir().'/var/log'; } /** * @return \Generator|\Symfony\Component\HttpKernel\Bundle\BundleInterface[] */ public function registerBundles() { $contents = require $this->getProjectDir().'/config/bundles.php'; foreach ($contents as $class => $envs) { if (isset($envs['all']) || isset($envs[$this->environment])) { yield new $class(); } } } /** * @return string */ public function getRootDir() { if (null === $this->rootDir) { $r = new \ReflectionObject($this); $this->rootDir = str_replace('\\', '/', dirname($r->getFileName())); } return $this->rootDir; } /** * Returns the real root path. * * @return string */ public function getRealRootDir() { return realpath($this->getRootDir().'/../').'/'; } /** * Returns the data path. * * @return string */ public function getDataDir() { return $this->getRealRootDir().'data/'; } /** * @return string */ public function getConfigurationFile() { return $this->getRealRootDir().'config/configuration.php'; } public function setApi(array $configuration) { new ChamiloApi($configuration); } /** * Check if system is installed * Checks the APP_INSTALLED env value. * * @return bool */ public function isInstalled() { return !empty($this->getContainer()->getParameter('installed')); } /** * @return string */ public function getUrlAppend() { return $this->getContainer()->getParameter('url_append'); } protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void { $container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php')); $container->setParameter('container.dumper.inline_class_loader', true); $confDir = $this->getProjectDir().'/config'; $loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob'); $loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob'); $loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob'); $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob'); } protected function configureRoutes(RouteCollectionBuilder $routes): void { $confDir = $this->getProjectDir().'/config'; $routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob'); $routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob'); $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob'); } }