public function modifyAction($farmRoleId)
{
$object = $this->request->getJsonBody();
/* @var $farmRole FarmRoleAdapter */
$farmRole = $this->adapter('farmRole');
//Pre validates the request object
$farmRole->validateObject($object, Request::METHOD_PATCH);
$role = $this->getFarmRole($farmRoleId, null, true);
//Copies all alterable properties to fetched Role Entity
$farmRole->copyAlterableProperties($object, $role);
//Re-validates an Entity
$farmRole->validateEntity($role);
//Saves verified results
try {
$role->save();
} catch (InvalidEntityConfigurationException $e) {
throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_VALUE, $e->getMessage(), $e->getCode(), $e);
}
return $this->result($farmRole->toData($role));
}