Bridge/Symfony/Serializer/Normalizer/AddressNormalizer.php
public function normalize($address, $format = null, array $context = [])
    {
        $data = parent::normalize($address, $format, $context);

        $groups = [
            'Address',
            'CartAddress',
            'CustomerAddress',
            'Default',
            'OrderAddress',
            'QuoteAddress',
            'ShipmentAddress',
            'SupplierAddress',
        ];

        if ($this->contextHasGroup($groups, $context)) {
            $data = array_replace($data, [
                'company'        => $address->getCompany(),
                'gender'         => $address->getGender(),
                'first_name'     => $address->getFirstName(),
                'last_name'      => $address->getLastName(),
                'street'         => $address->getStreet(),
                'complement'     => $address->getComplement(),
                'supplement'     => $address->getSupplement(),
                'postal_code'    => $address->getPostalCode(),
                'city'           => $address->getCity(),
                'country_name'   => $address->getCountry()->getName(),
                'country'        => $address->getCountry()->getCode(),
                //'state'        => $address->getCity(),
                'phone'          => $this->normalizeObject($address->getPhone(), $format, $context),
                'phone_country'  => $this->phoneNumberCountry($address->getPhone()),
                'mobile'         => $this->normalizeObject($address->getMobile(), $format, $context),
                'mobile_country' => $this->phoneNumberCountry($address->getMobile()),
                'digicode1'      => $address->getDigicode1(),
                'digicode2'      => $address->getDigicode2(),
                'intercom'       => $address->getIntercom(),
            ]);

            if ($address instanceof CustomerAddressInterface) {
                $data['invoice_default'] = $address->isInvoiceDefault() ? 1 : 0;
                $data['delivery_default'] = $address->isDeliveryDefault() ? 1 : 0;
            }
        }

        return $data;
    }
public function normalize($address, $format = null, array $context = [])
    {
        $data = parent::normalize($address, $format, $context);

        $groups = [
            'Address',
            'CartAddress',
            'CustomerAddress',
            'Default',
            'OrderAddress',
            'QuoteAddress',
            'ShipmentAddress',
            'SupplierAddress',
        ];

        if ($this->contextHasGroup($groups, $context)) {
            $data = array_replace($data, [
                'company'        => $address->getCompany(),
                'gender'         => $address->getGender(),
                'first_name'     => $address->getFirstName(),
                'last_name'      => $address->getLastName(),
                'street'         => $address->getStreet(),
                'complement'     => $address->getComplement(),
                'supplement'     => $address->getSupplement(),
                'postal_code'    => $address->getPostalCode(),
                'city'           => $address->getCity(),
                'country_name'   => $address->getCountry()->getName(),
                'country'        => $address->getCountry()->getCode(),
                //'state'        => $address->getCity(),
                'phone'          => $this->normalizeObject($address->getPhone(), $format, $context),
                'phone_country'  => $this->phoneNumberCountry($address->getPhone()),
                'mobile'         => $this->normalizeObject($address->getMobile(), $format, $context),
                'mobile_country' => $this->phoneNumberCountry($address->getMobile()),
                'digicode1'      => $address->getDigicode1(),
                'digicode2'      => $address->getDigicode2(),
                'intercom'       => $address->getIntercom(),
            ]);

            if ($address instanceof CustomerAddressInterface) {
                $data['invoice_default'] = $address->isInvoiceDefault() ? 1 : 0;
                $data['delivery_default'] = $address->isDeliveryDefault() ? 1 : 0;
            }
        }

        return $data;
    }
@inheritdoc

@param AddressInterface $address