public function validateEntity($entity)
{
parent::validateEntity($entity);
$direction = $entity->settings[FarmRoleScalingMetric::TYPE];
if (empty($direction)) {
throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_STRUCTURE, 'Missed property direction');
}
if (!in_array($direction, static::$directions)) {
throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_VALUE, sprintf('Invalid value. The allowed direction values are %s', implode(' or ', static::$directions)));
}
}