misd-service-development / phone-number-bundle

Integrates libphonenumber into your Symfony2-Symfony4 application
459 stars 143 forks source link

AssertPhoneNumber not work #176

Open Mapteg34 opened 6 years ago

Mapteg34 commented 6 years ago

i use

use Misd\PhoneNumberBundle\Validator\Constraints\PhoneNumber as AssertPhoneNumber;

    /**
     * @var string
     *
     * @ORM\Column(name="phone", type="text", nullable=false)
     * @AssertPhoneNumber(type="mobile")
     */
    private $phone = '';

but they don't work:`

$user = new User();
$user->setPhone("qwerty");
$userManager->saveUser($user, "qwe");

create user with bad phone... what i need to validate phone in entity?

osavchenko commented 6 years ago

Use validator component. It's not triggering automatically on persist or other events.