Skip to content

Instantly share code, notes, and snippets.

@marcw
Created February 15, 2012 08:17
Show Gist options
  • Save marcw/1834387 to your computer and use it in GitHub Desktop.
Save marcw/1834387 to your computer and use it in GitHub Desktop.
<?php
use Symfony\Component\ClassLoader\DebugUniversalClassLoader;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Debug\ErrorHandler;
use Symfony\Component\HttpKernel\Debug\ExceptionHandler;
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel
{
static protected $databaseConnection;
static protected $rabbitmqConnection;
// bla bla register bundles
public function boot()
{
parent::boot();
if ('test' === $this->getEnvironment()) {
if (null === static::$databaseConnection) {
static::$databaseConnection = $this->getContainer()->get('doctrine.dbal.default_connection');
} else {
$this->getContainer()->set('doctrine.dbal.default_connection', static::$databaseConnection);
}
if (null === static::$rabbitmqConnection) {
static::$rabbitmqConnection = $this->getContainer()->get('old_sound_rabbit_mq.connection.default');
} else {
$this->getContainer()->set('old_sound_rabbit_mq.connection.default', static::$rabbitmqConnection);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment