Source of file RouterResourcePass.php
Size: 1,504 Bytes - Last Modified: 2013-05-16T07:32:23+02:00
/home/theseer/Downloads/Symfony/vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/RouterResourcePass.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 | <?php /* * This file is part of the Symfony framework. * * (c) Fabien Potencier <fabien@symfony.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Yaml\Yaml; /** * This pass adds Assetic routes when use_controller is true. * * @author Kris Wallsmith <kris@symfony.com> */ class RouterResourcePass implements CompilerPassInterface { public function process(ContainerBuilder $container) { $useController = $container->getParameterBag()->resolveValue($container->getParameter('assetic.use_controller')); $routerResource = $container->getParameterBag()->resolveValue($container->getParameter('router.resource')); if (!$useController || !$routerResource) { return; } $file = $container->getParameter('kernel.cache_dir').'/assetic/routing.yml'; if (!is_dir($dir = dirname($file))) { mkdir($dir, 0777, true); } file_put_contents($file, Yaml::dump(array( '_assetic' => array('resource' => '.', 'type' => 'assetic'), '_app' => array('resource' => $container->getParameter('router.resource')), ))); $container->setParameter('router.resource', $file); } } |