Answer the question
In order to leave comments, you need to log in
Many-To-Many Symfony/Doctrine how to output data?
Let's say there is a product table and a pictures table. There is a many-to-many relationship between them. By means of the console, I created getters with setters. I figured out adding to the database. A table is created that correlates id. But I still don’t understand how to display it.
For example, a product with id = 1 includes images with id =2 and 3 ; How to get their path?
/**
* @ORM\ManyToMany(targetEntity="Pictures", inversedBy="products")
*/
private $pictures;
/////////////////////////////
/**
* @ORM\ManyToMany(targetEntity="Products", mappedBy="pictures")
*/
private $products;
/**
* @var string
*
* @ORM\Column(name="path", type="string", length=255)
*/
private $path;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question