protected function _launchedBy($from, $to, $action)
{
switch ($action) {
case static::ACT_CONVERT_TO_OBJECT:
/* @var $from Server */
$to->launchedBy = ['id' => $from->properties[Server::LAUNCHED_BY_ID]];
break;
case static::ACT_CONVERT_TO_ENTITY:
/* @var $to Server */
$launchedBy = ApiController::getBareId($from, 'launchedBy');
if (!isset($launchedBy)) {
throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_STRUCTURE, "Missed launchedBy.id property");
}
$to->properties[Server::LAUNCHED_BY_ID] = $launchedBy;
break;
case static::ACT_GET_FILTER_CRITERIA:
$entity = new Server();
return $entity->getSettingCriteria(Server::LAUNCHED_BY_ID, ApiController::getBareId($from, 'launchedBy'));
}
}