Skip to content

Commit d2b699e

Browse files
committed
fix: Convert BackedEnum to scalar value when binding a parameter
1 parent 0338d69 commit d2b699e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Persisters/Entity/BasicEntityPersister.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -693,11 +693,11 @@ protected function prepareUpdateData(object $entity, bool $isInsert = false): ar
693693
$targetColumn = $joinColumn->referencedColumnName;
694694
$quotedColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform);
695695

696-
$this->quotedColumns[$sourceColumn] = $quotedColumn;
697-
$this->columnTypes[$sourceColumn] = PersisterHelper::getTypeOfColumn($targetColumn, $targetClass, $this->em);
698-
$result[$owningTable][$sourceColumn] = $newValId
699-
? $newValId[$targetClass->getFieldForColumn($targetColumn)]
700-
: null;
696+
$this->quotedColumns[$sourceColumn] = $quotedColumn;
697+
$this->columnTypes[$sourceColumn] = PersisterHelper::getTypeOfColumn($targetColumn, $targetClass, $this->em);
698+
699+
$newValue = $newValId ? $newValId[$targetClass->getFieldForColumn($targetColumn)] : null;
700+
$result[$owningTable][$sourceColumn] = $newValue instanceof BackedEnum ? $newValue->value : $newValue;
701701
}
702702
}
703703

0 commit comments

Comments
 (0)