/**
* @param string $field
* @return string
*/
private function getField($field)
{
if ($this->fields === null) {
$dm = $this->repository->getDocumentManager();
/** @todo Investigate if produces performance problems */
$entityMeta = $dm->getClassMetadata($this->repository->getDocumentName());
foreach ($entityMeta->fieldMappings as $fieldName => $fieldMapping) {
$this->fields[$fieldMapping['name']] = $fieldName;
}
}
return isset($this->fields[$field]) ? $this->fields[$field] : $field;
}