2
votes

I use API platform.

I have 2 entities (ProductX and ProductY), herited from Product (inheritance type: JOINED). I need to add a condition on ProductX or productY field in a filter. But the query builder doesn't show this entities. Joins are added after (by edge ​​loading ?).

How can I filter on this entities?

1

1 Answers

0
votes

You can use API Platform custom filter and write a join between Product and ProductX in that.

$queryBuilder
        ->leftJoin(Product::class, 'p')
        ->leftJoin(ProductX::class, 'x', Join::WITH, 'p.id = x.id')
        ->andWhere("x.fieldName = :value")
        ->setParameter('value', $value);