title: Symfony2.1 with EAV Return Values
body: <p>I have three Entity:</p>
  
  <p>1.Feature</p>
  
  <p>2.Value</p>
  
  <p>3.Product</p>
  
  <p>I am getting Value In Product without mentioning It's Feature. I am trying to Get Value according to feature But But I am unable to do it.I don't Know How it can be done?  </p>
  
  <h1>Feature:</h1>
  
  <pre><code>/**
   * @ORM\Table(name="feature")
   * @ORM\Entity
   */
  class Feature
  {
  
  /**
   * @ORM\Id
   * @ORM\Column(name="id", type="integer")
   * @ORM\GeneratedValue(strategy="AUTO")
   */
  protected $id;
  
  /**
   * @ORM\Column(name="name", type="string", length=50)
   */
  protected $name;
  
  /**
   * @ORM\OneToMany(targetEntity="Feature", mappedBy="Feature")
   **/
  protected $value;
  
   /**
   * Constructor
   */
  public function __construct()
  {
      $this-&gt;value = new \Doctrine\Common\Collections\ArrayCollection();
  }
  
  public function __toString()
  {
      return $this-&gt;getName();
  }
  }
  </code></pre>
  
  <h1>Value:</h1>
  
  <pre><code>/**
   * @ORM\Table(name="value")
   * @ORM\Entity
   */
  class Value
  {
  /**
   * @ORM\Id
   * @ORM\Column(name="id", type="integer")
   * @ORM\GeneratedValue(strategy="AUTO")
   */
  protected $id;
  
  /**
   * @ORM\Column(name="name", type="string", length=50)
   */
  protected $value;
  
  /**
   * @ORM\ManyToOne(targetEntity="Feature", inversedBy="value")
   **/
  protected $feature;
  
   /**
   * @ORM\ManyToMany(targetEntity="Product", mappedBy="value")
   **/
  private $product;
  
  public function __construct()
  {
      $this-&gt;feature = new \Doctrine\Common\Collections\ArrayCollection();
  }
  
   public function __toString()
  {
      return $this-&gt;getValue();
  }
  }
  </code></pre>
  
  <h1>Product:</h1>
  
  <pre><code>/**
   * @ORM\Entity
   * @ORM\Table()
   * @ORM\HasLifecycleCallbacks
   */
  class Product 
  {
  /**
   * @ORM\Id
   * @ORM\Column(type="integer")
   * @ORM\GeneratedValue(strategy="AUTO")
   */
  protected $id;
  
  /**
   * @Gedmo\Translatable
   * @ORM\Column(length=64)
   */
  private $title;
  
  /**
   * @Gedmo\Slug(fields={"title"})
   * @ORM\Column(length=64, unique=true)
   */
  private $slug;
  
  /**
   * @ORM\Column(type="integer")
   */
  protected $quantity;
  
  /**
   * @ORM\Column(type="boolean")
   */
  protected $active;
  
  /**
   * @ORM\Column(type="datetime")
   */
  protected $updated;
  
  /**
   * @ORM\Column(type="datetime")
   */
  protected $created;
  
  /**
   * @ORM\ManyToMany(targetEntity="Value", inversedBy="product")
   * @ORM\JoinTable(name="product_value")
   **/
  protected $value;
  
  
  public function __construct()
  {
      $this-&gt;active = true;
      $this-&gt;updated = new \DateTime();
      $this-&gt;created = new \DateTime();
      $this-&gt;value = new ArrayCollection();
  
  }
  
  public function __toString()
  {
      return $this-&gt;getTitle();
  }
  }
  </code></pre>
  
  <p>I m not explaining more due to weak English .</p>
  
  <p>Example What I want:</p>
  
  <p>"I  want to select the feature of product for example size and color with values like red , green &amp; small, medium etc.  as per product ."</p>