public function getFieldValue($entity, $fieldName)
{
if ($this->fieldMappings[$fieldName]['direct']) {
return $this->reflFields[$fieldName]->getValue($entity);
} else {
if (!array_key_exists('getMethod', $this->fieldMappings[$fieldName])) {
$this->fieldMappings[$fieldName]['getMethod'] = $this->inferGetter($fieldName);
}
$getter = $this->fieldMappings[$fieldName]['getMethod'];
if ($this->reflClass->hasMethod($getter)) {
return call_user_func(array($entity, $getter));
} else {
throw MappingException::fieldGetMethodDoesNotExist($this->name, $fieldName, $getter);
}
}
}