protected function _architecture($from, $to, $action)
{
switch ($action) {
case self::ACT_CONVERT_TO_OBJECT:
$to->architecture = $from->architecture ? $from->architecture : self::DEFAULT_TYPE_ARCHITECTURE;
break;
case self::ACT_CONVERT_TO_ENTITY:
if (!in_array($from->architecture, ['i386', 'x86_64'])) {
throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_VALUE, "Invalid architecture value");
}
$to->architecture = $from->architecture;
break;
case self::ACT_GET_FILTER_CRITERIA:
if (!in_array($from->architecture, ['i386', 'x86_64'])) {
throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_VALUE, "Invalid architecture value");
}
return [['architecture' => $from->architecture]];
}
}