Answers for "assert regex syymfony"

PHP
3

assert regex symfony

// src/Entity/Author.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;

class Author
{
    /**
     * @Assert\Regex(
     *     pattern="/\d/",
     *     match=false,
     *     message="Your name cannot contain a number"
     * )
     */
    protected $firstName;
}
Posted by: Guest on October-06-2021

Browse Popular Code Answers by Language