/** * {@inheritdoc} */ protected function _setDataValues(array $data) { if (array_key_exists(AppliedTax::KEY_RATES, $data)) { $rates = []; foreach ($data[AppliedTax::KEY_RATES] as $rateArray) { $rates[] = $this->appliedTaxRateBuilder->populateWithArray($rateArray)->create(); } $data[AppliedTax::KEY_RATES] = $rates; } return parent::_setDataValues($data); }
/** * @param array $dataArray * @return AppliedTax */ protected function generateDataObjectWithSetters($dataArray) { $this->builder->populateWithArray([]); if (array_key_exists(AppliedTax::KEY_TAX_RATE_KEY, $dataArray)) { $this->builder->setTaxRateKey($dataArray[AppliedTax::KEY_TAX_RATE_KEY]); } if (array_key_exists(AppliedTax::KEY_PERCENT, $dataArray)) { $this->builder->setPercent($dataArray[AppliedTax::KEY_PERCENT]); } if (array_key_exists(AppliedTax::KEY_AMOUNT, $dataArray)) { $this->builder->setAmount($dataArray[AppliedTax::KEY_AMOUNT]); } if (array_key_exists(AppliedTax::KEY_RATES, $dataArray)) { $rates = []; foreach ($dataArray[AppliedTax::KEY_RATES] as $rateArray) { $rates[] = $this->appliedTaxRateBuilder->populateWithArray($rateArray)->create(); } $this->builder->setRates($rates); } return $this->builder->create(); }