diff --git a/recipes/symfony/console/bin/console b/recipes/symfony/console/bin/console index 2c8e774d..bdb6a2a7 100755 --- a/recipes/symfony/console/bin/console +++ b/recipes/symfony/console/bin/console @@ -1,6 +1,7 @@ #!/usr/bin/env php run($input); diff --git a/recipes/symfony/framework-bundle/manifest.json b/recipes/symfony/framework-bundle/manifest.json index 65dca67d..1219e1ce 100644 --- a/recipes/symfony/framework-bundle/manifest.json +++ b/recipes/symfony/framework-bundle/manifest.json @@ -4,6 +4,7 @@ }, "copy-from-recipe": { "etc/": "%ETC_DIR%/", + "src/": "%SRC_DIR%/", "web/": "%WEB_DIR%/" }, "composer-scripts": { diff --git a/recipes/symfony/framework-bundle/src/Kernel.php b/recipes/symfony/framework-bundle/src/Kernel.php new file mode 100644 index 00000000..da939589 --- /dev/null +++ b/recipes/symfony/framework-bundle/src/Kernel.php @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace App; + +use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; +use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\HttpKernel\Kernel as BaseKernel; +use Symfony\Component\Routing\RouteCollectionBuilder; + +/** + * @author Fabien Potencier + */ +class Kernel extends BaseKernel +{ + use MicroKernelTrait; + + const CONFIG_EXTS = '.{php,xml,yaml,yml}'; + + public function getCacheDir() + { + return dirname(dirname(__DIR__)).'/var/cache/'.$this->environment; + } + + public function getLogDir() + { + return dirname(dirname(__DIR__)).'/var/logs'; + } + + public function registerBundles() + { + $contents = require dirname($this->getRootDir()).'/etc/bundles.php'; + foreach ($contents as $class => $envs) { + if (isset($envs['all']) || isset($envs[$this->getEnvironment()])) { + yield new $class(); + } + } + } + + protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader) + { + $confDir = dirname($this->getRootDir()).'/etc'; + $loader->import($confDir.'/packages/*'.self::CONFIG_EXTS, 'glob'); + if (is_dir($confDir.'/packages/'.$this->getEnvironment())) { + $loader->import($confDir.'/packages/'.$this->getEnvironment().'/**/*'.self::CONFIG_EXTS, 'glob'); + } + $loader->import($confDir.'/container'.self::CONFIG_EXTS, 'glob'); + } + + protected function configureRoutes(RouteCollectionBuilder $routes) + { + $confDir = dirname($this->getRootDir()).'/etc'; + $routes->import($confDir.'/routing/*'.self::CONFIG_EXTS, '/', 'glob'); + if (is_dir($confDir.'/routing/'.$this->getEnvironment())) { + $routes->import($confDir.'/routing/'.$this->getEnvironment().'/**/*'.self::CONFIG_EXTS, '/', 'glob'); + } + $routes->import($confDir.'/routing'.self::CONFIG_EXTS, '/', 'glob'); + } +} diff --git a/recipes/symfony/framework-bundle/web/index.php b/recipes/symfony/framework-bundle/web/index.php index b073dc04..18e41f41 100644 --- a/recipes/symfony/framework-bundle/web/index.php +++ b/recipes/symfony/framework-bundle/web/index.php @@ -1,5 +1,6 @@ handle($request); $response->send();