* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\PrestaShop\Adapter\TaxRulesGroup\QueryHandler; use PrestaShop\PrestaShop\Adapter\TaxRulesGroup\AbstractTaxRulesGroupHandler; use PrestaShop\PrestaShop\Core\Domain\TaxRulesGroup\Exception\TaxRulesGroupNotFoundException; use PrestaShop\PrestaShop\Core\Domain\TaxRulesGroup\Query\GetTaxRulesGroupForEditing; use PrestaShop\PrestaShop\Core\Domain\TaxRulesGroup\QueryHandler\GetTaxRulesGroupForEditingHandlerInterface; use PrestaShop\PrestaShop\Core\Domain\TaxRulesGroup\QueryResult\EditableTaxRulesGroup; /** * Handles query which gets tax rules group for editing */ final class GetTaxRulesGroupForEditingHandler extends AbstractTaxRulesGroupHandler implements GetTaxRulesGroupForEditingHandlerInterface { /** * {@inheritdoc} * * @throws TaxRulesGroupNotFoundException */ public function handle(GetTaxRulesGroupForEditing $query): EditableTaxRulesGroup { $taxRulesGroupId = $query->getTaxRulesGroupId(); $taxRulesGroup = $this->getTaxRulesGroup($taxRulesGroupId); return new EditableTaxRulesGroup( $taxRulesGroupId, $taxRulesGroup->name, (bool) $taxRulesGroup->active, $taxRulesGroup->getAssociatedShops() ); } }