title: OroCrm using FOSRestBundle $this->getManager()->createEntity()
body: <p>I want to create a post API , and i have a problem when the RestController do this line : </p>
  
  <p><strong>$entity = $this->getManager()->createEntity();</strong></p>
  
  <p>It's return Null so the process to valid the $form bug and i have a error 500.
  Whereas i create a new entity directly in the <strong>public function handleCreateRequest()</strong>
  it's work well , my entity is created and put in my database.
  So why the createEntity() return null knowing that this method is in ApiEntityManager.php et return <strong>new $this->class</strong></p>
  
  <p>this is my Controller Post Method : </p>
  
  <pre><code> /**
  * REST POST Product
  *
  * @ApiDoc(
  *      section="Product",
  *      description="Post product item",
  *      resource=true
  * )
  * @return \Symfony\Component\HttpFoundation\Response
  */
  public function postAction()
  {
  
    return $this-&gt;handleCreateRequest();
  }
  </code></pre>
  
  <p>And this is the <strong>handleCreateRequest()</strong></p>
  
  <pre><code>/**
   * Create new
   *
   * @return Response
   */
   public function handleCreateRequest()
   {
        $entity = $this-&gt;getManager()-&gt;createEntity(); &lt;---- this line return null
  -------------------------------------------------------------------------
  //    $entity = new \GroupeGC\Bundle\ProductBundle\Entity\Product();    |
  //    $entity-&gt;setCode( $this-&gt;getRequest()-&gt;get("code"));              |
  //    $entity-&gt;setLabel( $this-&gt;getRequest()-&gt;get("label"));            |
  -------------------------------------------------------------------------
  //this part of code work well but it's not generic
  
  
      $isProcessed = $this-&gt;processForm($entity);
  
      if ($isProcessed) {
          $entityClass = ClassUtils::getRealClass($entity);
          $classMetadata = $this-&gt;getManager()-&gt;getObjectManager()-&gt;getClassMetadata($entityClass);
          $view = $this-&gt;view($classMetadata-&gt;getIdentifierValues($entity), Codes::HTTP_CREATED);
      } else {
          $view = $this-&gt;view($this-&gt;getForm(), Codes::HTTP_BAD_REQUEST);
      }
  
      return $this-&gt;handleView($view);
  }
  </code></pre>
  
  <p>EDIT 1 :</p>
  
  <p>if i do a var_dump() of $entity : the result is : 
  <strong>string 'GroupeGC\Bundle\ProductBundle\Entity\Product' (length=44)</strong> (so it's not null) 
  So why it's doesn't work 0_o</p>