From a8dcc2acf3f10dd5a56170867267928ce2f4564b Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Tue, 13 Jan 2015 14:05:27 +0100 Subject: [PATCH] #1246 DDC-3487 - removing possible undefined value path for `$newValId` for clarity --- lib/Doctrine/ORM/Persisters/BasicEntityPersister.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php index 1e6374319..e289d540d 100644 --- a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php @@ -655,6 +655,8 @@ class BasicEntityPersister implements EntityPersister } } + $newValId = null; + if ($newVal !== null) { $newValId = $uow->getEntityIdentifier($newVal); } @@ -667,14 +669,11 @@ class BasicEntityPersister implements EntityPersister $targetColumn = $joinColumn['referencedColumnName']; $quotedColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); - $this->quotedColumns[$sourceColumn] = $quotedColumn; - $this->columnTypes[$sourceColumn] = $targetClass->getTypeOfColumn($targetColumn); - - $value = ($newVal !== null) + $this->quotedColumns[$sourceColumn] = $quotedColumn; + $this->columnTypes[$sourceColumn] = $targetClass->getTypeOfColumn($targetColumn); + $result[$owningTable][$sourceColumn] = $newValId ? $newValId[$targetClass->getFieldForColumn($targetColumn)] : null; - - $result[$owningTable][$sourceColumn] = $value; } }