AppKernel.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 Sonata\CoreBundle\SonataCoreBundle(),
  17. new Sonata\BlockBundle\SonataBlockBundle(),
  18. new Knp\Bundle\MenuBundle\KnpMenuBundle(),
  19. new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
  20. new Sonata\AdminBundle\SonataAdminBundle(),
  21. new FTTHBundle\FTTHBundle(),
  22. new WebserviceBundle\WebserviceBundle(),
  23. new Voryx\RESTGeneratorBundle\VoryxRESTGeneratorBundle(),
  24. new FOS\RestBundle\FOSRestBundle(),
  25. new JMS\SerializerBundle\JMSSerializerBundle($this),
  26. new Nelmio\CorsBundle\NelmioCorsBundle(),
  27. ];
  28. if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
  29. $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
  30. $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
  31. $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
  32. $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
  33. }
  34. return $bundles;
  35. }
  36. public function getRootDir()
  37. {
  38. return __DIR__;
  39. }
  40. public function getCacheDir()
  41. {
  42. return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
  43. }
  44. public function getLogDir()
  45. {
  46. return dirname(__DIR__).'/var/logs';
  47. }
  48. public function registerContainerConfiguration(LoaderInterface $loader)
  49. {
  50. $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
  51. }
  52. }