Update DriverFactory.php #196

Closed
wants to merge 3 commits into from

2 participants

@ossinkine

Don't add a driver with null-name.
Allows to remove the driver by overriding the config.

@ossinkine ossinkine Update DriverFactory.php
Don't add a driver with null-name
04f421d
@Ocramius Ocramius commented on an outdated diff Mar 18, 2013
src/DoctrineModule/Service/DriverFactory.php
@@ -125,8 +125,10 @@ protected function createDriver(ServiceLocatorInterface $sl, DriverOptions $opti
}
foreach ($drivers as $namespace => $driverName) {
- $options = $this->getOptions($sl, 'driver', $driverName);
- $driver->addDriver($this->createDriver($sl, $options), $namespace);
+ if (null !== $driverName) {
@Ocramius
Doctrine member

Here's a cleaner (imo) version of it:

if (null === $driverName) {
    continue;
}

$options = $this->getOptions($sl, 'driver', $driverName);
$driver->addDriver($this->createDriver($sl, $options), $namespace); 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Ocramius
Doctrine member

No tests? :(

@Ocramius
Doctrine member

Looks good! Will merge in 0.8.

@Ocramius Ocramius added a commit that closed this pull request Apr 1, 2013
@Ocramius Ocramius CS fixes - merges and fixes #196 a10c572
@Ocramius Ocramius closed this in a10c572 Apr 1, 2013
@texdc texdc added a commit that referenced this pull request May 15, 2013
@Ocramius Ocramius CS fixes - merges and fixes #196 669325f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment