minor #23594 [Bridge\Doctrine] Fix BC with DI v3.4 (nicolas-grekas)

This PR was merged into the 4.0-dev branch.

Discussion
----------

[Bridge\Doctrine] Fix BC with DI v3.4

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

As allowed by composer.json.
Code borrowed from branch 3.4

Commits
-------

b03f0bdb06 [Bridge\Doctrine] Fix BC with DI v3.4
This commit is contained in:
Fabien Potencier 2017-07-20 21:30:51 +02:00
commit 19ba63125d
1 changed files with 4 additions and 1 deletions

View File

@ -49,10 +49,13 @@ abstract class ManagerRegistry extends AbstractManagerRegistry implements Contai
}
$manager->setProxyInitializer(\Closure::bind(
function (&$wrappedInstance, LazyLoadingInterface $manager) use ($name) {
if (isset($this->normalizedIds[$normalizedId = strtolower($name)])) { // BC with DI v3.4
$name = $this->normalizedIds[$normalizedId];
}
if (isset($this->aliases[$name])) {
$name = $this->aliases[$name];
}
$method = $this->methodMap[$name] ?? 'get'.$name.'Service';
$method = $this->methodMap[$name] ?? 'get'.strtr($name, $this->underscoreMap).'Service'; // BC with DI v3.4
$wrappedInstance = $this->{$method}(false);
$manager->setProxyInitializer(null);