G
G
gachkydxvbgd2017-04-24 13:49:04
symfony
gachkydxvbgd, 2017-04-24 13:49:04

How to fix validation in symfony?

in entity

/**
     * @Assert\Regex("/^[а-яА-ЯёЁa-zA-Z0-9]+$/")
     * @Assert\NotBlank()
     * @ORM\Column(name="name", type="string", length=255)
     */
    public $name;

Fails: string, test 2, AnAn, etc.
Passes: STRING, test, etc

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mi7teR, 2017-04-24
@gachkydxvbgd

Try expression '/[^ \w]+/u';for Assert\Regex

/**
     * @Assert\Regex("/[^ \w]+/u")
     * @Assert\NotBlank()
     * @ORM\Column(name="name", type="string", length=255)
     */

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question