Skip to content

Commit

Permalink
Merge branch '1.4'
Browse files Browse the repository at this point in the history
* 1.4:
  Ensure forward compatibility with ResolveTargetEntityListener
  • Loading branch information
pamil committed Jun 7, 2019
2 parents e2ccb73 + 5cf9ef9 commit a9f5aec
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler;

use Doctrine\Common\EventSubscriber;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
Expand Down Expand Up @@ -44,7 +45,12 @@ public function process(ContainerBuilder $container): void
]);
}

if (!$resolveTargetEntityListener->hasTag('doctrine.event_listener')) {
$resolveTargetEntityListenerClass = $container->getParameterBag()->resolveValue($resolveTargetEntityListener->getClass());
if (is_a($resolveTargetEntityListenerClass, EventSubscriber::class, true)) {
if (!$resolveTargetEntityListener->hasTag('doctrine.event_subscriber')) {
$resolveTargetEntityListener->addTag('doctrine.event_subscriber');
}
} elseif (!$resolveTargetEntityListener->hasTag('doctrine.event_listener')) {
$resolveTargetEntityListener->addTag('doctrine.event_listener', ['event' => 'loadClassMetadata']);
}
}
Expand Down

0 comments on commit a9f5aec

Please sign in to comment.