Created
October 19, 2012 20:12
-
-
Save marcw/3920410 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\HttpKernel\Kernel; | |
use Symfony\Component\Config\Loader\LoaderInterface; | |
class AppKernel extends Kernel | |
{ | |
static protected $databaseDefaultConnection; | |
public function registerBundles() | |
{ | |
// ... | |
} | |
public function boot() | |
{ | |
parent::boot(); | |
if ('test' === $this->getEnvironment()) { | |
if (null === static::$databaseDefaultConnection) { | |
static::$databaseDefaultConnection = $this->getContainer()->get('doctrine.dbal.default_connection'); | |
} else { | |
$this->getContainer()->set('doctrine.dbal.default_connection', static::$databaseDefaultConnection); | |
} | |
} | |
} | |
public function registerContainerConfiguration(LoaderInterface $loader) | |
{ | |
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment