Symfony 4 findAll with join table

时间:2018-05-25 11:20:20

标签: php symfony4

我有两个表:ProductCategory,其关系为ManyToOne。 在我Product只有print all product表之前,我使用:

$productes = $this->getDoctrine()->getRepository(Product::class)->findAll();

现在,我想要使用product打印所有category

我该怎么办?

1 个答案:

答案 0 :(得分:0)

使用dql查询可以更轻松地完成此操作。像这样;

在产品库类

https://github.com/lvillani/android-cropimage
https://github.com/biokys/cropimage
https://github.com/MMP-forTour/cropimage (forked from the above one)
https://github.com/dtitov/pickncrop