AppKernel.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 JMS\AopBundle\JMSAopBundle(),
  21. new JMS\DiExtraBundle\JMSDiExtraBundle($this),
  22. new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
  23. new FOS\UserBundle\FOSUserBundle(),
  24. new Snc\RedisBundle\SncRedisBundle(),
  25. new Packagist\WebBundle\PackagistWebBundle(),
  26. new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
  27. new Nelmio\SolariumBundle\NelmioSolariumBundle(),
  28. );
  29. if (in_array($this->getEnvironment(), array('dev', 'test'))) {
  30. $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
  31. $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
  32. }
  33. return $bundles;
  34. }
  35. public function init()
  36. {
  37. if ($this->debug) {
  38. ini_set('display_errors', 1);
  39. error_reporting(-1);
  40. DebugUniversalClassLoader::enable();
  41. ErrorHandler::register();
  42. if ('cli' !== php_sapi_name()) {
  43. ExceptionHandler::register();
  44. }
  45. } else {
  46. ini_set('display_errors', 0);
  47. }
  48. }
  49. public function registerContainerConfiguration(LoaderInterface $loader)
  50. {
  51. $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
  52. }
  53. }