Using the doctrine docs example below, I would like to be able to return the all features when querying for a product.
So effectively selecting all products where feature.product_id = product.id
But would like to do this the doctrine object oriented way if possible. Is there any way in doctrine to match these relationships the opposite way?
<?php
use Doctrine\Common\Collections\ArrayCollection;
/** @Entity **/
class Product
{
// ...
/**
* @OneToMany(targetEntity="Feature", mappedBy="product")
**/
private $features;
// ...
public function __construct() {
$this->features = new ArrayCollection();
}
}
/** @Entity **/
class Feature
{
// ...
/**
* @ManyToOne(targetEntity="Product", inversedBy="features")
* @JoinColumn(name="product_id", referencedColumnName="id")
**/
private $product;
// ...
}
Thanks,