From d4059b88ca8048d655015682262c3b9b9976b5a1 Mon Sep 17 00:00:00 2001 From: Asmir Mustafic Date: Fri, 21 Oct 2011 15:30:21 +0200 Subject: [PATCH] Nullable relations, fixing join condition --- lib/Doctrine/ORM/Tools/EntityGenerator.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index bbde24346..c135ecac4 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -634,7 +634,7 @@ public function () foreach ($metadata->associationMappings as $associationMapping) { if ($associationMapping['type'] & ClassMetadataInfo::TO_ONE) { - $nullable = $this->_associationIsNullable($associationMapping); + $nullable = $this->_isAssociationIsNullable($associationMapping); if ($code = $this->_generateEntityStubMethod($metadata, 'set', $associationMapping['fieldName'], $associationMapping['targetEntity'], ($nullable?'null':null))) { $methods[] = $code; } @@ -654,7 +654,7 @@ public function () return implode("\n\n", $methods); } - private function _associationIsNullable($associationMapping) + private function _isAssociationIsNullable($associationMapping) { if(isset($associationMapping['joinColumns'])){ $joinColumns = $associationMapping['joinColumns']; @@ -665,7 +665,7 @@ public function () $joinColumns = array(); } foreach ($joinColumns as $joinColumn) { - if(!isset($joinColumn['nullable']) || !$joinColumn['nullable']){ + if(isset($joinColumn['nullable']) && !$joinColumn['nullable']){ return false; } }