AppKernel.php 2.1 KB

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