AppKernel.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. use Symfony\Component\HttpKernel\Kernel;
  3. use Symfony\Component\Config\Loader\LoaderInterface;
  4. use Symfony\Component\ClassLoader\DebugUniversalClassLoader;
  5. use Symfony\Component\HttpKernel\Debug\ErrorHandler;
  6. use Symfony\Component\HttpKernel\Debug\ExceptionHandler;
  7. class AppKernel extends Kernel
  8. {
  9. public function registerBundles()
  10. {
  11. $bundles = array(
  12. new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
  13. new Symfony\Bundle\SecurityBundle\SecurityBundle(),
  14. new Symfony\Bundle\TwigBundle\TwigBundle(),
  15. new Symfony\Bundle\MonologBundle\MonologBundle(),
  16. new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
  17. new Symfony\Bundle\AsseticBundle\AsseticBundle(),
  18. new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
  19. new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
  20. new FOS\UserBundle\FOSUserBundle(),
  21. new Snc\RedisBundle\SncRedisBundle(),
  22. new Packagist\WebBundle\PackagistWebBundle(),
  23. new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
  24. new Nelmio\SolariumBundle\NelmioSolariumBundle(),
  25. );
  26. if (in_array($this->getEnvironment(), array('dev', 'test'))) {
  27. $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
  28. $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
  29. }
  30. return $bundles;
  31. }
  32. public function init()
  33. {
  34. if ($this->debug) {
  35. ini_set('display_errors', 1);
  36. error_reporting(-1);
  37. DebugUniversalClassLoader::enable();
  38. ErrorHandler::register();
  39. if ('cli' !== php_sapi_name()) {
  40. ExceptionHandler::register();
  41. }
  42. } else {
  43. ini_set('display_errors', 0);
  44. }
  45. }
  46. public function registerContainerConfiguration(LoaderInterface $loader)
  47. {
  48. $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
  49. }
  50. }