public function setFieldValue($entity, $fieldName, $value)
{
if ($this->fieldMappings[$fieldName]['direct']) {
$this->reflFields[$fieldName]->setValue($entity, $value);
} else {
if (!array_key_exists('setMethod', $this->fieldMappings[$fieldName])) {
$this->fieldMappings[$fieldName]['setMethod'] = $this->inferSetter($fieldName);
}
$setter = $this->fieldMappings[$fieldName]['setMethod'];
if ($this->reflClass->hasMethod($setter)) {
return call_user_func(array($entity, $setter), $value);
} else {
throw MappingException::fieldSetMethodDoesNotExist($this->name, $fieldName, $setter);
}
}
}