title: Symfony Restful API - Expose virtual property isLiked by current logged in user
body: <p>There are two entities Restaurant and Users. Restaurant entity has many-to-many relation with user, field name favoriteBy.</p>
  
  <pre><code>&lt;many-to-many field="favoriteBy" target-entity="UserBundle\Entity\Users" mapped-by="favoriteRestaurants"/&gt;
  </code></pre>
  
  <p>I am using JMS Serializer along with FOSRestfulAPI. In restaurant listing API I have to expose one extra boolean field "isFavorited", which will be true if current logged in user has in array collection favoriteBy.</p>
  
  <p>How I can find whether current user has favorited the restaurant or not within entity?</p>
  
  <pre><code>/**
   * Get is favorited
   * @JMS\VirtualProperty()
   * @JMS\Groups({"listing", "details"})
   */
  public function isFavorited()
  {
      // some logic in entity
      return false;
  }
  </code></pre>
  
  <p>One way I am thinking is to inject current user object to entity and user contains method to find out, but its look like not good approach. 
  Please suggest me some method, or guide me to right direction.</p>