Skip to content

Commit

Permalink
chore(deps): Allow doctrine/orm 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Czarnecki committed Nov 2, 2023
1 parent 81f596c commit f3be6f0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -72,5 +72,6 @@
"branch-alias": {
"dev-master": "3.x-dev"
}
}
},
"minimum-stability": "dev"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping">
<embeddable name="JMS\Serializer\Tests\Fixtures\Doctrine\Embeddable\BlogPostSeo">
<field name="metaTitle" column="meta_title" type="string" nullable="false"/>
</embeddable>
Expand Down
1 change: 1 addition & 0 deletions tests/Serializer/Doctrine/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 4 additions & 2 deletions tests/Serializer/Doctrine/ObjectConstructorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Check failure on line 40 in tests/Serializer/Doctrine/ObjectConstructorTest.php

View workflow job for this annotation

GitHub Actions / Coding Standards (7.2)

Type JMS\Serializer\Metadata\Driver\AttributeDriver\AttributeReader is not used in this file.
use JMS\Serializer\Metadata\Driver\DoctrineTypeDriver;
use JMS\Serializer\Metadata\PropertyMetadata;
use JMS\Serializer\Naming\IdenticalPropertyNamingStrategy;
Expand Down Expand Up @@ -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);

Expand All @@ -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());
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit f3be6f0

Please sign in to comment.