Skip to content

Commit e3c8d81

Browse files
authored
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, doctrine/orm#11211, package doctrine/orm)
1 parent 89a4bac commit e3c8d81

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Extension/EagerLoadingExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use ApiPlatform\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
2424
use ApiPlatform\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
2525
use Doctrine\ORM\Mapping\ClassMetadata;
26+
use Doctrine\ORM\Mapping\JoinColumnMapping;
2627
use Doctrine\ORM\Query\Expr\Join;
2728
use Doctrine\ORM\Query\Expr\Select;
2829
use Doctrine\ORM\QueryBuilder;
@@ -181,7 +182,7 @@ private function joinRelations(QueryBuilder $queryBuilder, QueryNameGeneratorInt
181182
$associationAlias = $existingJoin->getAlias();
182183
$isLeftJoin = Join::LEFT_JOIN === $existingJoin->getJoinType();
183184
} else {
184-
$isNullable = $mapping['joinColumns'][0]?->nullable ?? true;
185+
$isNullable = isset($mapping['joinColumns']) && isset($mapping['joinColumns'][0]) ? ($mapping['joinColumns'][0] instanceof JoinColumnMapping ? $mapping['joinColumns'][0]->nullable : $mapping['joinColumns'][0]['nullable']) : true;
185186
$isLeftJoin = false !== $wasLeftJoin || true === $isNullable;
186187
$method = $isLeftJoin ? 'leftJoin' : 'innerJoin';
187188

0 commit comments

Comments
 (0)