private function generateDocumentConstructor(ClassMetadataInfo $metadata)
{
if ($this->hasMethod('__construct', $metadata)) {
return '';
}
$collections = array();
foreach ($metadata->fieldMappings as $mapping) {
if ($mapping['type'] === ClassMetadataInfo::MANY) {
$collections[] = '$this->' . $mapping['fieldName'] . ' = new \\Doctrine\\Common\\Collections\\ArrayCollection();';
}
}
if ($collections) {
return $this->prefixCodeWithSpaces(str_replace('<collections>', $this->spaces . implode("\n" . $this->spaces, $collections), self::$constructorMethodTemplate));
}
return '';
}