AppKernel.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. use Symfony\Component\HttpKernel\Kernel;
  3. use Symfony\Component\Config\Loader\LoaderInterface;
  4. class AppKernel extends Kernel
  5. {
  6. public function registerBundles()
  7. {
  8. $bundles = [
  9. new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
  10. new Symfony\Bundle\SecurityBundle\SecurityBundle(),
  11. new Symfony\Bundle\TwigBundle\TwigBundle(),
  12. new Symfony\Bundle\MonologBundle\MonologBundle(),
  13. new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
  14. new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
  15. new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
  16. new AppBundle\AppBundle(),
  17. ];
  18. if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
  19. $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
  20. $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
  21. $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
  22. $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
  23. }
  24. return $bundles;
  25. }
  26. public function getRootDir()
  27. {
  28. return __DIR__;
  29. }
  30. public function getCacheDir()
  31. {
  32. return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
  33. }
  34. public function getLogDir()
  35. {
  36. return dirname(__DIR__).'/var/logs';
  37. }
  38. public function registerContainerConfiguration(LoaderInterface $loader)
  39. {
  40. $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
  41. }
  42. }