title: Serializing Entity Relation only to Id with JMS Serializer
body: <p>I'm trying to serialize a entity relation with JMS Serializer.</p>
  
  <p>Here is the Entity:</p>
  
  <pre><code>class Ad
  { 
  
      /**
       * @Type("string")
       * @Groups({"manage"})
       * 
       * @var string
       */
      private $description;
  
      /**
       * @Type("Acme\SearchBundle\Entity\Country")
       * @Groups({"manage"})
       * 
       * @var \Acme\SearchBundle\Entity\Country
       */
      private $country;
  
      /**
       * @Type("string")
       * @Groups({"manage"})
       * 
       * @var string
       */
      private $title;
  
      /**
       * Set description
       *
       * @param string $description
       * @return Ad
       */
      public function setDescription($description)
      {
          $this-&gt;description = $description;
  
          return $this;
      }
  
      /**
       * Get description
       *
       * @return string 
       */
      public function getDescription()
      {
          return $this-&gt;description;
      }
  
      /**
       * Set country
       *
       * @param \Acme\SearchBundle\Entity\Country $country
       * @return Ad
       */
      public function setCountry($country)
      {
          $this-&gt;country= $country;
  
          return $this;
      }
  
      /**
       * Get country
       *
       * @return string 
       */
      public function getCountry()
      {
          return $this-&gt;country;
      }
  
      /**
       * Set title
       *
       * @param string $title
       * @return Ad
       */
      public function setTituloanuncio($title)
      {
          $this-&gt;title = $title;
  
          return $this;
      }
  
      /**
       * Get title
       *
       * @return string 
       */
      public function getTitle()
      {
          return $this-&gt;title;
      }
  
  }
  </code></pre>
  
  <p>And the Entity of the relationship:</p>
  
  <pre><code>class Country
  {
  
      /**
       * @Type("string")
       * @Groups("manage")
       * 
       * @var string
       */
      private $id;
  
      /**
       * @Type("string")
       * @Groups("admin")
       * 
       * @var string
       */
      private $description;
  
      /**
       * Set description
       * @Groups("")
       *
       * @param string $description
       * @return Country
       */
      public function setDescripcionpais($description)
      {
          $this-&gt;description = $description;
  
          return $this;
      }
  
      /**
       * Get description
       *
       * @return string 
       */
      public function getDescription()
      {
          return $this-&gt;description;
      }
  
      }
  
      /**
       * Get id
       *
       * @return string 
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  }
  </code></pre>
  
  <p>I serialize the entity but I don't know how to convert the country attribute into a simple field.</p>
  
  <p>I get this result in json:</p>
  
  <pre><code>{"description":"foo", "title":"bar", "country":{"id":"en"} }
  </code></pre>
  
  <p>But I want to get the id field of the country like this:</p>
  
  <pre><code>{"description":"foo", "title":"bar", "country": "en" }
  </code></pre>
  
  <p>It is possible with JMS Serializer?</p>
  
  <p>Thank you.</p>
  
  <p><strong>[EDIT]</strong></p>
  
  <p>@VirtualProperty doesn't work.</p>