Category: foreign-keys

Symfony ManyToMany how fetch object related to another object

I don’t understand how to access Product related to CartLine. I have two entities CartLine entity: /** * @ORMManyToMany(targetEntity=”AppEntityProduct”, inversedBy=”cartLines”) * @ORMJoinTable(name=”cart_line_product”) */ private $product; public function __construct() { $this->product = new ArrayCollection(); } /** * @return Collection|Product[] */ public…