AppKernel.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 Skamander\BenchmarkBundle\SkamanderBenchmarkBundle(),
  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. if ('dev' === $this->getEnvironment()) {
  23. $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
  24. $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
  25. }
  26. }
  27. return $bundles;
  28. }
  29. public function getRootDir()
  30. {
  31. return __DIR__;
  32. }
  33. public function getCacheDir()
  34. {
  35. return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
  36. }
  37. public function getLogDir()
  38. {
  39. return dirname(__DIR__).'/var/logs';
  40. }
  41. public function registerContainerConfiguration(LoaderInterface $loader)
  42. {
  43. $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
  44. }
  45. }