1
0
mirror of synced 2025-02-10 17:29:27 +03:00

#6068 corrected nullable field expression generator, made it private to avoid misuse

This commit is contained in:
Marco Pivetta 2016-11-26 06:26:53 +01:00
parent 1d2baedfd5
commit a4f76bda34

View File

@ -1168,7 +1168,8 @@ public function __construct(<params>)
continue; continue;
} }
$nullableField = $this->getNullableField($fieldMapping); $nullableField = $this->nullableFieldExpression($fieldMapping);
if (( ! isset($fieldMapping['id']) || if (( ! isset($fieldMapping['id']) ||
! $fieldMapping['id'] || ! $fieldMapping['id'] ||
$metadata->generatorType == ClassMetadataInfo::GENERATOR_TYPE_NONE $metadata->generatorType == ClassMetadataInfo::GENERATOR_TYPE_NONE
@ -1629,7 +1630,7 @@ public function __construct(<params>)
$lines[] = $this->spaces . '/**'; $lines[] = $this->spaces . '/**';
$lines[] = $this->spaces . ' * @var ' $lines[] = $this->spaces . ' * @var '
. $this->getType($fieldMapping['type']) . $this->getType($fieldMapping['type'])
. ($this->getNullableField($fieldMapping) ? '|null' : ''); . ($this->nullableFieldExpression($fieldMapping) ? '|null' : '');
if ($this->generateAnnotations) { if ($this->generateAnnotations) {
$lines[] = $this->spaces . ' *'; $lines[] = $this->spaces . ' *';
@ -1816,11 +1817,13 @@ public function __construct(<params>)
* *
* @return string|null * @return string|null
*/ */
protected function getNullableField(array $fieldMapping) private function nullableFieldExpression(array $fieldMapping)
{ {
if (isset($fieldMapping['nullable']) && true === $fieldMapping['nullable']) { if (isset($fieldMapping['nullable']) && true === $fieldMapping['nullable']) {
return 'null'; return 'null';
} }
return null;
} }
/** /**