Skip to content

Instantly share code, notes, and snippets.

@max3uc3
Created May 19, 2017 08:16
Show Gist options
  • Save max3uc3/95cf03ad02edce4d9a30d468f318e74b to your computer and use it in GitHub Desktop.
Save max3uc3/95cf03ad02edce4d9a30d468f318e74b to your computer and use it in GitHub Desktop.
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
new FOS\RestBundle\FOSRestBundle(),
new Snc\RedisBundle\SncRedisBundle(),
new Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle(),
new FOS\UserBundle\FOSUserBundle(),
new Gos\Bundle\WebSocketBundle\GosWebSocketBundle(),
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Taxi\TaxiBundle\AppBundle(),
new Nelmio\CorsBundle\NelmioCorsBundle(),
];
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function getRootDir()
{
return __DIR__;
}
public function getCacheDir()
{
if(in_array($this->getEnvironment(), ['test', 'dev']) === true){
return '/dev/shm/app/cache/'.$this->getEnvironment();
}
return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
}
public function getLogDir()
{
if(in_array($this->getEnvironment(), ['test', 'dev']) === true){
return '/dev/shm/app/logs/'.$this->getEnvironment();
}
return dirname(__DIR__).'/var/logs';
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment