Skip to content

Commit 54fff9b

Browse files
committed
check if association exists
1 parent a86d234 commit 54fff9b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/UnitOfWork.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3164,7 +3164,7 @@ public function createEntity($className, array $data, &$hints = [])
31643164

31653165
if ($hints['fetchMode'][$class->name][$field] === ClassMetadata::FETCH_EAGER) {
31663166
$isIteration = isset($hints[Query::HINT_INTERNAL_ITERATION]) && $hints[Query::HINT_INTERNAL_ITERATION];
3167-
$isForeignKeyComposite = count($targetClass->getAssociationMapping($assoc['mappedBy'])['joinColumns']) > 1;
3167+
$isForeignKeyComposite = $targetClass->hasAssociation($assoc['mappedBy']) && count($targetClass->getAssociationMapping($assoc['mappedBy'])['joinColumns']) > 1;
31683168

31693169
if ($assoc['type'] === ClassMetadata::ONE_TO_MANY && ! $isIteration && ! $isForeignKeyComposite && ! isset($assoc['indexBy'])) {
31703170
$this->scheduleCollectionForBatchLoading($pColl, $class);

0 commit comments

Comments
 (0)