private function generateDocumentStubMethod(ClassMetadataInfo $metadata, $type, $fieldName, $typeHint = null) { $methodName = $type . Inflector::classify($fieldName); if ($this->hasMethod($methodName, $metadata)) { return; } $var = sprintf('%sMethodTemplate', $type); $template = self::${$var}; $variableType = $typeHint ? $typeHint . ' ' : null; $types = \Doctrine\ODM\MongoDB\Mapping\Types\Type::getTypesMap(); $methodTypeHint = $typeHint && !isset($types[$typeHint]) ? '\\' . $typeHint . ' ' : null; $replacements = array('<description>' => ucfirst($type) . ' ' . $fieldName, '<methodTypeHint>' => $methodTypeHint, '<variableType>' => $variableType, '<variableName>' => Inflector::camelize($fieldName), '<methodName>' => $methodName, '<fieldName>' => $fieldName); $method = str_replace(array_keys($replacements), array_values($replacements), $template); return $this->prefixCodeWithSpaces($method); }