From a4f76bda34ed50c8743834a60b1a214d8cb752c0 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Sat, 26 Nov 2016 06:26:53 +0100 Subject: [PATCH] #6068 corrected nullable field expression generator, made it private to avoid misuse --- lib/Doctrine/ORM/Tools/EntityGenerator.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index 1fe26e79e..3c0f9264f 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -1168,7 +1168,8 @@ public function __construct() continue; } - $nullableField = $this->getNullableField($fieldMapping); + $nullableField = $this->nullableFieldExpression($fieldMapping); + if (( ! isset($fieldMapping['id']) || ! $fieldMapping['id'] || $metadata->generatorType == ClassMetadataInfo::GENERATOR_TYPE_NONE @@ -1629,7 +1630,7 @@ public function __construct() $lines[] = $this->spaces . '/**'; $lines[] = $this->spaces . ' * @var ' . $this->getType($fieldMapping['type']) - . ($this->getNullableField($fieldMapping) ? '|null' : ''); + . ($this->nullableFieldExpression($fieldMapping) ? '|null' : ''); if ($this->generateAnnotations) { $lines[] = $this->spaces . ' *'; @@ -1816,11 +1817,13 @@ public function __construct() * * @return string|null */ - protected function getNullableField(array $fieldMapping) + private function nullableFieldExpression(array $fieldMapping) { if (isset($fieldMapping['nullable']) && true === $fieldMapping['nullable']) { return 'null'; } + + return null; } /**