public function _billing($from, $to, $action)
{
switch ($action) {
case static::ACT_CONVERT_TO_OBJECT:
/* @var $from Entity\CloudCredentials */
if ($this->controller->getContainer()->analytics->enabled && $from->properties[Entity\CloudCredentialsProperty::AWS_DETAILED_BILLING_ENABLED]) {
$to->billing = new $this->dataClass();
$this->controller->adapter('awsDetailedBilling')->toData($from, $to->billing);
}
break;
case static::ACT_CONVERT_TO_ENTITY:
/* @var $to Entity\CloudCredentials */
if ($this->controller->getContainer()->analytics->enabled) {
if ($from->billing === false) {
$to->properties[Entity\CloudCredentialsProperty::AWS_DETAILED_BILLING_ENABLED] = false;
} else {
$to->properties[Entity\CloudCredentialsProperty::AWS_DETAILED_BILLING_ENABLED] = true;
$adapter = $this->controller->adapter('awsDetailedBilling');
$adapter->toEntity($from->billing, $to);
}
}
break;
case static::ACT_GET_FILTER_CRITERIA:
return [[]];
}
}