I have 2 extbase models: product and category. A product can be assigned to multiple categories, this is an m:n relation. Now I need to find all categories with at least 1 article. Is this possible with an extbase query?
I tried this:
$query = $this->createQuery();
$query->getQuerySettings()->setIgnoreEnableFields(true);
$constraints[] = $query->greaterThan('products', 0);
$query = $query->matching(
$query->logicalAnd($constraints)
);
return $query->execute();
But that just returns no categories at all. Can I do this with extbase queries? Or, if not, how else can I achieve this?