I am trying to match two entities based on a set of criteria but I can't seem to make it work in this particular case.
For the purpose of the example, let's say I have:
Article with N tags Category with 1 tag
What I would like to do would be to, in my repository do something like:
$this->createQueryBuilder('article')
->join('App\Enttiy\Category', 'c', Join::WITH, 'c.id = :category_id)
->where('c.tag IN article.tags')
->andWhere(':category_id', $category->getId())
->getQuery()
->getResult();
Of course, in this example, the simplest way would be to define a relationship between my objects but in my real case, this relationship would be a nightmare .
The problem I face is the where
line as the IN
clause doesn't work that way.
Anyone has an idea of how I could use DQL to do this ? :)
Thanks by advance