public static function behaviorsToEntity(array $behaviors, $onlySupported = true)
{
$unsupported = array_diff($behaviors, array_keys(static::$supportedBehaviors));
if ($onlySupported && !empty($unsupported)) {
throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_VALUE, sprintf("Unknown automations: ['%s']", implode("', '", $unsupported)));
}
$converted = array_values(array_intersect_key(static::$supportedBehaviors, array_flip($behaviors)));
return $onlySupported ? $converted : array_merge($converted, $unsupported);
}