diff --git a/src/Bundle/Doctrine/ResourceMappingDriver.php b/src/Bundle/Doctrine/ResourceMappingDriverChain.php similarity index 75% rename from src/Bundle/Doctrine/ResourceMappingDriver.php rename to src/Bundle/Doctrine/ResourceMappingDriverChain.php index 716c6d5cf..b0d5de268 100644 --- a/src/Bundle/Doctrine/ResourceMappingDriver.php +++ b/src/Bundle/Doctrine/ResourceMappingDriverChain.php @@ -15,39 +15,28 @@ use Doctrine\Common\Persistence\Mapping\ClassMetadata; use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver; +use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain; use Sylius\Component\Resource\Metadata\RegistryInterface; -final class ResourceMappingDriver implements MappingDriver +final class ResourceMappingDriverChain extends MappingDriverChain { - /** @var MappingDriver */ - private $mappingDriver; - /** @var RegistryInterface */ private $resourceRegistry; public function __construct(MappingDriver $mappingDriver, RegistryInterface $resourceRegistry) { - $this->mappingDriver = $mappingDriver; $this->resourceRegistry = $resourceRegistry; + + $this->setDefaultDriver($mappingDriver); } public function loadMetadataForClass($className, ClassMetadata $metadata): void { - $this->mappingDriver->loadMetadataForClass($className, $metadata); + parent::loadMetadataForClass($className, $metadata); $this->convertResourceMappedSuperclass($metadata); } - public function getAllClassNames(): iterable - { - return $this->mappingDriver->getAllClassNames(); - } - - public function isTransient($className): bool - { - return $this->mappingDriver->isTransient($className); - } - private function convertResourceMappedSuperclass(ClassMetadata $metadata): void { if (!isset($metadata->isMappedSuperclass)) { diff --git a/src/Bundle/Resources/config/services/integrations/doctrine.xml b/src/Bundle/Resources/config/services/integrations/doctrine.xml index d4d7225f4..9838e57eb 100644 --- a/src/Bundle/Resources/config/services/integrations/doctrine.xml +++ b/src/Bundle/Resources/config/services/integrations/doctrine.xml @@ -15,10 +15,10 @@ - - +