From 64904c77c1dd5af1d132df7c78b82cb4c15e3a7d Mon Sep 17 00:00:00 2001 From: Bart van den Burg Date: Mon, 2 Jul 2012 15:33:20 +0200 Subject: [PATCH] fixed DDC-1895 --- .../ORM/Persisters/BasicEntityPersister.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php index 7ccc7e663..9feae1ec1 100644 --- a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php @@ -384,7 +384,19 @@ class BasicEntityPersister $targetMapping = $this->_em->getClassMetadata($this->_class->associationMappings[$idField]['targetEntity']); $where[] = $this->_class->associationMappings[$idField]['joinColumns'][0]['name']; $params[] = $id[$idField]; - $types[] = $targetMapping->fieldMappings[$targetMapping->identifier[0]]['type']; + + switch (true) { + case (isset($targetMapping->fieldMappings[$targetMapping->identifier[0]])): + $types[] = $targetMapping->fieldMappings[$targetMapping->identifier[0]]['type']; + break; + + case (isset($targetMapping->associationMappings[$targetMapping->identifier[0]])): + $types[] = $targetMapping->associationMappings[$targetMapping->identifier[0]]['type']; + break; + + default: + throw ORMException::unrecognizedField($targetMapping->identifier[0]); + } } else { $where[] = $this->quoteStrategy->getColumnName($idField, $this->_class, $this->_platform); $params[] = $id[$idField];