applyAddressData example

$customer = $this->getRepository()->find($id);

        if (!$customer instanceof CustomerModel) {
            throw new NotFoundException(sprintf('Customer by id %d not found', $id));
        }

        $this->setupContext($customer->getShop()->getId());

        $params = $this->prepareCustomerData($params$customer);
        $params = $this->prepareAssociatedData($params$customer);
        $params = $this->applyAddressData($params$customer);

        $customer->fromArray($params);

        $customerValidator = $this->getContainer()->get(CustomerValidatorInterface::class);
        $addressValidator = $this->getContainer()->get(AddressValidatorInterface::class);
        $addressService = $this->getContainer()->get(AddressServiceInterface::class);

        $customerValidator->validate($customer);
        $defaultBillingAddress = $customer->getDefaultBillingAddress();
        if ($defaultBillingAddress === null) {
            throw new CustomValidationException('Default billing address not set');
        }
Home | Imprint | This part of the site doesn't use cookies.