M
M
magary42016-03-04 14:15:59
symfony
magary4, 2016-03-04 14:15:59

What is the benefit of symfony forms?

If in the project all forms have complex html plus controls that appear, disappear, turn off, etc. (done in Angular) and are sent asynchronously, is there any point in creating a form class and trying to display it through

{{ form_start(form) }}
{{ form_widget(form) }}
{{ form_end(form) }}

how to immediately shove the request into the entity? (after doing all the validation on the same angular)
if( $request->isMethod( 'POST' ) ) {            
            $em = $this->container->get( 'doctrine' )->getManager();            
            ..................
            .......
            $em->persist(  нечто  );
            $em->flush();
        }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2016-03-04
Protko @Fesor

symfony forms are needed if symfony manages your forms (forms of any complexity, etc. are not a problem to make on it, but they will be more static).
If Angular stupidly sends you json - you don't have forms, you have json. There are other things for this.

D
dizzy7, 2016-03-04
@dizzy7

Symphonic forms are very convenient for large static forms. If you build them in angular, then it's easier to do without them - just send json to the server, deserialize into entity, run through the validator and save.
If you really need to bind forms to entity fields, you can make some service that will return a list of entity fields in json and build a form on the front based on them

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question