O
O
ozornick2019-01-14 20:03:56
symfony
ozornick, 2019-01-14 20:03:56

How to create your own form validator?

Suppose there is a User entity with standard data (name, password, ..) and some specific attribute type parameters. It is required to edit them separately from the whole class. Compliance with validation rules. I didn't find anything like this in the manual. Only through fake entities and static asserts of the validator. The course of action is as follows:
1. We transfer the initial values ​​​​from the User to the form 2. We change
the attributes on the page. Sending form
3. ? Validate non-standard behavior. Not simple notblank, length.. But with conditions and input parameters. That is, "no more than X", "equal to User:: name"..
4. Change the initial User and save

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Komarov, 2019-01-14
@ozornick

Use @Assert\Callback

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question