This repository has been archived by the owner on Aug 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 120
Using choice field to filter aggregated field in manyToMany list #206
Comments
Hi, I think you can add the |
Thanks , will try that . |
@cedric-g sorry for the delay. I did try the From what i could gather , i seems that it can't either create the HAVING expression and attach it to the query after the |
Sample manyToMany: 'apply_filter' => function(QueryInterface $filterQuery, $field, $values) {
$ids = array_map(function($v) { return $v->getId(); }, $values['value']->toArray());
$count_ids = count($ids);
if ($count_ids) {
$query = $filterQuery->getQueryBuilder();
$query->having('COUNT(DISTINCT m.id) = ' . $count_ids);
$query->groupBy('e.id');
$query->leftJoin($field, 'm', \Doctrine\ORM\Query\Expr\Join::WITH, $query->expr()->in('m.id', $ids));
}
} |
Thanks @qRoC ; Im trying to get it working with the fact that Doctrine has issues with'Having' clause . |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello guys,
I would like to move a filter to aggregations for obvious reasons but I'm struggling to implement the filters on them. I'm not sure if what I'm facing is a missing implementation or me getting this completely wrong.
The scenario is that i've a manyToMany relationship between 2 entities Parents and Training (Owning side).I'm displaying a list of Parents details including the number of trainings they are linked to using a count() in the repository query.
Using the lexikFilterBundle i've been able to implement filter based on the various properties of each entities. However, i'm unable to apply a filter (Radio button check to select only parents linked to at least one training or linked to more than one) on this calculated column since it doesn't belong to any of the entities.
The repository :
It's however throws the following error which i don't get since im not adding any item.
The text was updated successfully, but these errors were encountered: