1
0
mirror of synced 2025-02-09 00:39:25 +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;
}
$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(<params>)
$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(<params>)
*
* @return string|null
*/
protected function getNullableField(array $fieldMapping)
private function nullableFieldExpression(array $fieldMapping)
{
if (isset($fieldMapping['nullable']) && true === $fieldMapping['nullable']) {
return 'null';
}
return null;
}
/**