/** * @param int $id * * @throws \Spryker\Zed\Tax\Business\Model\Exception\ResourceNotFoundException * * @return \Generated\Shared\Transfer\TaxSetTransfer */ public function getTaxSet($id) { $taxSetEntity = $this->queryContainer->queryTaxSet($id)->findOne(); if ($taxSetEntity === null) { throw new ResourceNotFoundException(); } $taxSetTransfer = new TaxSetTransfer(); $taxSetTransfer->fromArray($taxSetEntity->toArray()); foreach ($taxSetEntity->getSpyTaxRates() as $taxRateEntity) { $taxRateTransfer = new TaxRateTransfer(); $taxRateTransfer->fromArray($taxRateEntity->toArray()); if ($taxRateEntity->getCountry()) { $countryTransfer = new CountryTransfer(); $countryTransfer->fromArray($taxRateEntity->getCountry()->toArray(), true); $taxRateTransfer->setCountry($countryTransfer); } $taxSetTransfer->addTaxRate($taxRateTransfer); } return $taxSetTransfer; }