Using FOSRestbundle, trying to insert data into table using POST and content-type as application/json
. My config.yml
has the following
fos_rest:
param_fetcher_listener: true
body_listener: true
format_listener:
default_priorities: ['json', html, '*/*']
prefer_extension: true
view:
view_response_listener: force
failed_validation: HTTP_BAD_REQUEST
default_engine: php
formats:
json: true
In controller added something like this
$request= $this->getRequest();
$form->bindRequest($request);
$em = $this->get('doctrine')->getEntityManager();
$em->persist($entity);
$em->flush();
But getting null
values for all the DB fields. Any idea?