Last active
October 5, 2015 14:32
-
-
Save weaverryan/25351e929a5a0d04c1e6 to your computer and use it in GitHub Desktop.
AppKernel with new loading
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\HttpKernel\Kernel; | |
use Symfony\Component\Config\Loader\LoaderInterface; | |
class AppKernel extends Kernel | |
{ | |
public function registerBundles() | |
{ | |
$bundles = array( | |
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), | |
new Symfony\Bundle\SecurityBundle\SecurityBundle(), | |
new Symfony\Bundle\TwigBundle\TwigBundle(), | |
new Symfony\Bundle\MonologBundle\MonologBundle(), | |
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), | |
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), | |
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), | |
new AppBundle\AppBundle(), | |
); | |
if (in_array($this->getEnvironment(), array('dev', 'test'))) { | |
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); | |
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); | |
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); | |
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); | |
} | |
return $bundles; | |
} | |
protected function configureServices(ContainerBuilder $c, LoaderInterface $loader) | |
{ | |
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml'); | |
} | |
protected function configureRoutes(RouteCollectionBuilder $routes) | |
{ | |
// (this would remove routing_dev.yml) | |
if (isset($this->bundles['WebProfilerBundle'])) { | |
$routes->import( | |
'@WebProfilerBundle/Resources/config/routing/wdt.xml', | |
'/_wdt' | |
); | |
$routes->import( | |
'@WebProfilerBundle/Resources/config/routing/profiler.xml', | |
'_profile' | |
); | |
} | |
$routes->import(__DIR__.'/config/routing.yml'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment