title: PUT data through fos_rest.request_body ParamConverter - Symfony 3
body: <p>I am working on a REST API with FOS Rest Bundle and FOS User Bundle</p>
  
  <p>The data being <strong>PUT</strong> to the server is:</p>
  
  <blockquote>
    <p>{"id":1,"email":"email@example.com","username":"adminuser","enabled":true,"locked":false,"groups"
    :[]}</p>
  </blockquote>
  
  <p>The routing looks okay:</p>
  
  <blockquote>
    <p>admin_user_put_user                 PUT        ANY      ANY    /admin/users/{id}          </p>
  </blockquote>
  
  <p>It is reaching this code below:</p>
  
  <pre><code>/**
   * @ParamConverter("userData", converter="fos_rest.request_body")
   * @View(statusCode=204)
   */
  public function putUserAction( $id, User $userData )
  {
      $this-&gt;denyAccessUnlessGranted( 'ROLE_ADMIN', null, 'Unable to access this page!' );
  
      $em = $this-&gt;getDoctrine()-&gt;getManager();
      $user = $em-&gt;getRepository( 'AppBundle:User' )-&gt;find( $id );
      $user-&gt;setEmail( $userData-&gt;getEmail() );
      $user-&gt;setEmailCanonical( $userData-&gt;getEmailCanonical() );
      $user-&gt;setEnabled( $userData-&gt;isEnabled() );
      $user-&gt;setLocked( $userData-&gt;isLocked() );
      $em-&gt;flush();
  
  }
  </code></pre>
  
  <p>The problem is that it is not populating <strong>$userData</strong> with the data sent.</p>
  
  <p>Could it be a configuration issue?</p>
  
  <pre><code>fos_rest:
      disable_csrf_role: ROLE_API
      view:
          view_response_listener: true
          force_redirects:
              html: true
          formats:
              json: true
          templating_formats:
              json: false
              html: true
          mime_types:
              json: ['application/json', 'application/x-json']
          failed_validation: HTTP_BAD_REQUEST
      body_listener: 
          default_format: json
      param_fetcher_listener: 
          force: true
      allowed_methods_listener: true
      access_denied_listener:
          json: true
      body_converter:
          enabled: true
          # validate: true
          # validation_errors_argument: validationErrors # This is the default value
      exception:
          enabled: true
      routing_loader:
          default_format: json
          include_format: false
      format_listener:
          rules:
              -
                  # http://symfony.com/doc/current/bundles/FOSRestBundle/format_listener.html
                  path: ^/admin/users
                  priorities: ['json', 'html', 'xml','form']
                  fallback_format: ~
                  prefer_extension: true
                  methods: [ 'get', 'post', 'put', 'delete']
              - { path: '^/', stop: true }
  </code></pre>
  
  <p>I understand the code is a little awkward and welcome suggestions for improvement.</p>
  
  <p><em>The absence of the group data in the save code is deliberate, I'll get to that later.</em></p>