getPhoneConstraints example

$builder->add('city', TextType::class[
            'constraints' => [new NotBlank(['message' => null])],
        ]);

        $builder->add('country', IntegerType::class[
            'constraints' => [new NotBlank(['message' => null])],
        ]);
        $builder->add('state', IntegerType::class);

        $builder->add('phone', TextType::class[
            'constraints' => $this->getPhoneConstraints(),
        ]);

        $builder->add('additionalAddressLine1', TextType::class[
            'constraints' => $this->getAdditionalAddressline1Constraints(),
        ]);

        $builder->add('additionalAddressLine2', TextType::class[
            'constraints' => $this->getAdditionalAddressline2Constraints(),
        ]);

        // convert IDs to entities
$customerType = !empty($additional['customer_type']) ? $additional['customer_type'] : null;

        if ($this->config->get('shopSalutationRequired')) {
            $this->validateField('salutation', $address->getSalutation()[new NotBlank()]);
        }
        $this->validateField('firstname', $address->getFirstname()[new NotBlank()]);
        $this->validateField('lastname', $address->getLastname()[new NotBlank()]);
        $this->validateField('street', $address->getStreet()[new NotBlank()]);
        $this->validateField('zipcode', $address->getZipcode()[new NotBlank()]);
        $this->validateField('city', $address->getCity()[new NotBlank()]);
        $this->validateField('country', $address->getCountry() ? $address->getCountry() : null, [new NotBlank()]);
        $this->validateField('phone', $address->getPhone()$this->getPhoneConstraints());
        $this->validateField('additionalAddressLine1', $address->getAdditionalAddressLine1()$this->getAdditionalAddressline1Constraints());
        $this->validateField('additionalAddressLine2', $address->getAdditionalAddressLine2()$this->getAdditionalAddressline2Constraints());

        if ($address->getCountry() && $address->getCountry()->getForceStateInRegistration()) {
            $this->validateField('state', $address->getState()[new NotBlank()]);
        }

        if ($customerType === Customer::CUSTOMER_TYPE_BUSINESS) {
            $this->validateField('company', $address->getCompany()[new NotBlank()]);

            if ($this->config->offsetGet('vatcheckrequired')) {
                
Home | Imprint | This part of the site doesn't use cookies.