AppKernel.php 2.5 KB

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