convertCountryStruct example

/** * @return array<string, mixed> */
    private function getCountry(int $countryId): array
    {
        $country = $this->countryGateway->getCountry($countryId$this->context);
        if (!$country instanceof Country) {
            throw new RuntimeException(sprintf('Country with ID "%s" not found', $countryId));
        }

        return $this->structConverter->convertCountryStruct($country);
    }

    /** * @return array<string, mixed> */
    private function getCountryState(int $countryStateId): array
    {
        $countryState = $this->countryGateway->getState($countryStateId$this->context);
        if (!$countryState instanceof State) {
            return [];
        }

        
return;
        }

        $this->response->headers->addCacheControlDirective('no-store');
        $this->response->headers->addCacheControlDirective('no-cache');

        $activeBillingAddressId = $customerData['additional']['user']['default_billing_address_id'] ?? null;
        $activeShippingAddressId = $customerData['additional']['user']['default_shipping_address_id'] ?? null;

        if (!empty($customerData['shippingaddress']['country']['id'])) {
            $country = $this->get(CountryGatewayInterface::class)->getCountry($customerData['shippingaddress']['country']['id']$this->get(ContextServiceInterface::class)->getContext());
            $customerData['shippingaddress']['country'] = $this->get(LegacyStructConverter::class)->convertCountryStruct($country);
        }

        $this->View()->assign('activeBillingAddressId', $activeBillingAddressId);
        $this->View()->assign('activeShippingAddressId', $activeShippingAddressId);
        $this->View()->assign('sUserData', $customerData);
        $this->View()->assign('userInfo', $this->get('shopware_account.store_front_greeting_service')->fetch());
        $this->View()->assign('sUserLoggedIn', $this->admin->sCheckUser());
        $this->View()->assign('sAction', $this->request->getActionName());

        if ($this->isOneTimeAccount() && !\in_array($this->request->getActionName()['abort', 'login', 'register'])) {
            $this->logoutAction();
            
Home | Imprint | This part of the site doesn't use cookies.