title: api-platform odm iri reference won't be converted into objects in json
body: <p>I want to create a model like this. </p>
  
  <pre><code>{
    "id": 7653,
    "name": "Vortl 123",
     "category": [
      {
        "name": "Electronic",
        "url": "electronic",
        "id": 1
      }, {
        "name": "Phone",
        "url": "phone",
        "id": 2
      },
      {
        "name": "Mobile Phone",
        "url": "mobile-phone",
        "id": 3
      }
  }
  </code></pre>
  
  <p>I created documents with using doctrine odm references. Codes are these.</p>
  
  <p>This is product class.</p>
  
  <pre><code>/**
   * @ApiResource
   *
   * @Document
   */
  class Product
  {
  
      /**
       * @ODM\Id(strategy="INCREMENT", type="integer")
       */
      private $id;
  
      /**
       * @ODM\Field(type="string")
       * @Assert\NotBlank
       */
      public $name;
  
      public function __construct()
      {
          $this-&gt;categories = new ArrayCollection();
      }
  
      /**
       * @ODM\ReferenceMany(targetDocument=Category::class, inversedBy="product", cascade={"persist"}, storeAs="id")
       */
      public $categories;
  
      /**
       * @return mixed
       */
      public function getId(): ?int
      {
          return $this-&gt;id;
      }
  
  
      /**
       * @param Category $category
       */
      public function addCategory(Category $category): void
      {
          $this-&gt;categories-&gt;add($category);
      }
  
      public function removeCategory(Category $category): void
      {
  
          $category-&gt;product = null;
          $this-&gt;categories-&gt;removeElement($category);
      }
  </code></pre>
  
  <p>and my category class is.</p>
  
  <pre><code>/**
   * @ApiResource
   *
   * @ODM\Document
   */
  class Category
  {
  
      /**
       * @ODM\Id(strategy="INCREMENT", type="integer")
       */
      private $id;
  
      /**
       * @ODM\ReferenceOne(targetDocument=Product::class, mappedBy="categories", storeAs="id")
       */
      public $product;
  
  
      /**
       * @ODM\Field(type="string")
       * @Assert\NotBlank
       */
      private $name;
  
  
      /**
       * @ODM\Field(type="string")
       */
      private $url;
  
  
      /**
       * @return mixed
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  
      /**
       * @param mixed $id
       */
      public function setId($id): void
      {
          $this-&gt;id = $id;
      }
  
  
  
  
      /**
       * @return mixed
       */
      public function getName()
      {
          return $this-&gt;name;
      }
  
      /**
       * @param mixed $name
       */
      public function setName($name): void
      {
          $this-&gt;name = $name;
      }
  
      /**
       * @return mixed
       */
      public function getUrl()
      {
          return $this-&gt;url;
      }
  
      /**
       * @param mixed $url
       */
      public function setUrl($url): void
      {
          $this-&gt;url = $url;
      }
  
  
  }
  </code></pre>
  
  <p>It works correct. When I can post category and get them. Then I post product and add categories to product via iri reference. The problem is I see the categories id instead of categories object like this.</p>
  
  <pre><code>{
      "@context": "/api/contexts/Product",
      "@id": "/api/products/17",
      "@type": "Product",
      "name": "Product17",
      "categories": [
          "/api/categories/1",
          "/api/categories/2",
          "/api/categories/3"
      ]
  }
  </code></pre>
  
  <p>I create category with post method then I create product with post method. To add category to product, I'm using iri reference like /api/categories/1 in the post method of product.  </p>
  
  <p>I don't understand why it is showing with iri reference? I want object of those iri references in the example that I want. Can anyone help me? </p>