From f3be6f02248b23e79af76b36b89b80ea6822a932 Mon Sep 17 00:00:00 2001 From: Marcin Czarnecki Date: Sun, 29 Oct 2023 23:36:09 +0100 Subject: [PATCH] chore(deps): Allow doctrine/orm 3.0 --- composer.json | 5 +++-- ...r.Tests.Fixtures.Doctrine.Embeddable.BlogPostSeo.dcm.xml | 2 +- tests/Serializer/Doctrine/IntegrationTest.php | 1 + tests/Serializer/Doctrine/ObjectConstructorTest.php | 6 ++++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 647680c68..33c326caa 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "require-dev": { "ext-pdo_sqlite": "*", "doctrine/coding-standard": "^12.0", - "doctrine/orm": "^2.14", + "doctrine/orm": "^2.14 || ^3.0", "doctrine/persistence": "^2.5.2 || ^3.0", "doctrine/phpcr-odm": "^1.5.2 || ^2.0", "jackalope/jackalope-doctrine-dbal": "^1.3", @@ -72,5 +72,6 @@ "branch-alias": { "dev-master": "3.x-dev" } - } + }, + "minimum-stability": "dev" } diff --git a/tests/Fixtures/Doctrine/XmlMapping/JMS.Serializer.Tests.Fixtures.Doctrine.Embeddable.BlogPostSeo.dcm.xml b/tests/Fixtures/Doctrine/XmlMapping/JMS.Serializer.Tests.Fixtures.Doctrine.Embeddable.BlogPostSeo.dcm.xml index 87cce5a0d..4b13399d8 100644 --- a/tests/Fixtures/Doctrine/XmlMapping/JMS.Serializer.Tests.Fixtures.Doctrine.Embeddable.BlogPostSeo.dcm.xml +++ b/tests/Fixtures/Doctrine/XmlMapping/JMS.Serializer.Tests.Fixtures.Doctrine.Embeddable.BlogPostSeo.dcm.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/Serializer/Doctrine/IntegrationTest.php b/tests/Serializer/Doctrine/IntegrationTest.php index 4ce720acf..ca17e247d 100644 --- a/tests/Serializer/Doctrine/IntegrationTest.php +++ b/tests/Serializer/Doctrine/IntegrationTest.php @@ -141,6 +141,7 @@ private function createEntityManager(Connection $con) $cfg->setMetadataDriverImpl(new AttributeDriver([ __DIR__ . '/../../Fixtures/Doctrine/SingleTableInheritance', ])); + AnnotationReader::addGlobalIgnoredNamespace('Doctrine\ORM\Mapping'); } else { $cfg->setMetadataDriverImpl(new AnnotationDriver(new AnnotationReader(), [ __DIR__ . '/../../Fixtures/Doctrine/SingleTableInheritance', diff --git a/tests/Serializer/Doctrine/ObjectConstructorTest.php b/tests/Serializer/Doctrine/ObjectConstructorTest.php index f519f561f..b4ad43468 100644 --- a/tests/Serializer/Doctrine/ObjectConstructorTest.php +++ b/tests/Serializer/Doctrine/ObjectConstructorTest.php @@ -37,6 +37,7 @@ use JMS\Serializer\Handler\ArrayCollectionHandler; use JMS\Serializer\Handler\HandlerRegistryInterface; use JMS\Serializer\Metadata\ClassMetadata; +use JMS\Serializer\Metadata\Driver\AttributeDriver\AttributeReader; use JMS\Serializer\Metadata\Driver\DoctrineTypeDriver; use JMS\Serializer\Metadata\PropertyMetadata; use JMS\Serializer\Naming\IdenticalPropertyNamingStrategy; @@ -471,8 +472,7 @@ public function testArrayKeyExistsOnObject(): void protected function setUp(): void { $this->visitor = $this->getMockBuilder(DeserializationVisitorInterface::class)->getMock(); - $this->context = $this->getMockBuilder('JMS\Serializer\DeserializationContext')->getMock(); - + $this->context = $this->getMockBuilder(DeserializationContext::class)->getMock(); $connection = $this->createConnection(); $entityManager = $this->createEntityManager($connection); @@ -493,6 +493,7 @@ static function ($id) use ($connection, $entityManager) { $this->driver = &$driver; $this->serializer = SerializerBuilder::create() +// ->setAnnotationReader(new AttributeReader()) ->setMetadataDriverFactory(new CallbackDriverFactory( static function (array $metadataDirs, Reader $annotationReader) use ($registry, &$driver) { $defaultFactory = new DefaultDriverFactory(new IdenticalPropertyNamingStrategy()); @@ -528,6 +529,7 @@ private function createEntityManager(Connection $con, ?Configuration $cfg = null $cfg = new Configuration(); if (PHP_VERSION_ID >= 80000 && class_exists(AttributeDriver::class)) { + AnnotationReader::addGlobalIgnoredNamespace('Doctrine\ORM\Mapping'); $cfg->setMetadataDriverImpl(new AttributeDriver([ __DIR__ . '/../../Fixtures/Doctrine/Entity', __DIR__ . '/../../Fixtures/Doctrine/IdentityFields',