A
A
Alexander Evgenievich2015-02-19 11:26:53
symfony
Alexander Evgenievich, 2015-02-19 11:26:53

How to pass data from Request to Entity without using FormType?

Hello.
Please tell me if there is a possibility not to use Symfony forms, but to be able to be just as elegant:

$form = $this->createForm(new BriefType(), new Brief());

            $form->handleRequest($request);

            if($form->isValid()){ 

                $brief = $form->getData();
                // ....
            }

pass values ​​from Request to Entity ? (validated by a validator, of course, based on Assert values).
Or am I thinking stupid?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Benkovsky, 2015-02-19
@banderos120

to be as elegant, you need to do the same. There are no other forms in symfony2 (officially, maybe there are some implementations on the github).
But, for the API, you can use JMS_Serializer.
In any case, you have the $request object - write your own implementations of creating an entity from the data, and your bicycles will be "just as elegant" for you

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question