diff --git a/composer.json b/composer.json index c14bb48..bf585dc 100644 --- a/composer.json +++ b/composer.json @@ -29,6 +29,7 @@ "ext-pdo_sqlite": "*", "ext-simplexml": "*", "doctrine/dbal": "^2.5", + "doctrine/doctrine-bundle": "^1.3|^2.0", "phpstan/phpstan": "^0.12.26", "phpunit/phpunit": "^7.5|^8.0", "squizlabs/php_codesniffer": "^3.4", diff --git a/lib/FSi/DoctrineExtensions/Mapping/ExtendedMetadataFactory.php b/lib/FSi/DoctrineExtensions/Mapping/ExtendedMetadataFactory.php index 73de651..247f402 100644 --- a/lib/FSi/DoctrineExtensions/Mapping/ExtendedMetadataFactory.php +++ b/lib/FSi/DoctrineExtensions/Mapping/ExtendedMetadataFactory.php @@ -11,6 +11,7 @@ namespace FSi\DoctrineExtensions\Mapping; +use Doctrine\Bundle\DoctrineBundle\Mapping\MappingDriver as DoctrineBundleMappingDriver; use Doctrine\Common\Annotations\Reader; use Doctrine\Common\Cache\Cache; use Doctrine\ORM\EntityManagerInterface; @@ -169,6 +170,9 @@ private function getDriver(MappingDriver $omDriver): DriverInterface { $className = get_class($omDriver); $driverName = substr($className, strrpos($className, '\\') + 1); + if (class_exists(DoctrineBundleMappingDriver::class) && $omDriver instanceof DoctrineBundleMappingDriver) { + $omDriver = $omDriver->getDriver(); + } if ($omDriver instanceof MappingDriverChain) { $driver = new DriverChain(); foreach ($omDriver->getDrivers() as $namespace => $nestedOmDriver) {