From e3c8d812ab6e1abcd9f3ff85fa6e5ad3a740f42c Mon Sep 17 00:00:00 2001 From: "Abdessamad (Almo) Idrissi" Date: Mon, 10 Mar 2025 20:08:16 +0100 Subject: [PATCH] Fixes deprecation warning for ArrayAccess on JoinColumnMapping Using ArrayAccess on Doctrine\ORM\Mapping\JoinColumnMapping is deprecated and will not be possible in Doctrine ORM 4.0. Use the corresponding property instead. (ArrayAccessImplementation.php:31 called by EagerLoadingExtension.php:184, https://github.com/doctrine/orm/pull/11211, package doctrine/orm) --- Extension/EagerLoadingExtension.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Extension/EagerLoadingExtension.php b/Extension/EagerLoadingExtension.php index 240c1ff..85f4d09 100644 --- a/Extension/EagerLoadingExtension.php +++ b/Extension/EagerLoadingExtension.php @@ -23,6 +23,7 @@ use ApiPlatform\Metadata\Property\Factory\PropertyMetadataFactoryInterface; use ApiPlatform\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface; use Doctrine\ORM\Mapping\ClassMetadata; +use Doctrine\ORM\Mapping\JoinColumnMapping; use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\Query\Expr\Select; use Doctrine\ORM\QueryBuilder; @@ -181,7 +182,7 @@ private function joinRelations(QueryBuilder $queryBuilder, QueryNameGeneratorInt $associationAlias = $existingJoin->getAlias(); $isLeftJoin = Join::LEFT_JOIN === $existingJoin->getJoinType(); } else { - $isNullable = $mapping['joinColumns'][0]?->nullable ?? true; + $isNullable = isset($mapping['joinColumns']) && isset($mapping['joinColumns'][0]) ? ($mapping['joinColumns'][0] instanceof JoinColumnMapping ? $mapping['joinColumns'][0]->nullable : $mapping['joinColumns'][0]['nullable']) : true; $isLeftJoin = false !== $wasLeftJoin || true === $isNullable; $method = $isLeftJoin ? 'leftJoin' : 'innerJoin';