A
A
Alexander Evgenievich2015-11-16 13:26:43
symfony
Alexander Evgenievich, 2015-11-16 13:26:43

Is it good practice to use forms solely for binding and validation purposes?

Hello.
Actually the question is, is it good practice to use the form component solely for data binding to the model and for validation? For me, these seem convenient when compared with the use of "manual" data binding in the controller, for example, when there are continuous checks for the presence of a key in the array of values , or the same checks, but in the service. if(isset($data['key'])){do_some_code();}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bears, 2015-11-16
@banderos120

If you use something like Backbone on the client, for example, then https://github.com/schmittjoh/JMSSerializerBundle is a good fit, since you don't have to do anything "by hand", everything just runs in json format. For validation there is symfony.com/doc/current/book/validation.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question