I have two Tables in symfony join by ManyToOne bidirectional relationship. articles and dates.
I would like to sum all the d.quantity for the same a.id How can I do that ?
I try :
In my table (dates) i have :
+----------------------------
| id | a.id | quantity
+----------------------------
| 1 | 4 | 1
| 2 | 4 | 3
| 3 | 6 | 4
| 4 | 5 | 6
| 5 | 4 | 15
----------------------------
$allIndispo = $qb
->select('a2.id')
->leftJoin('a2.dates', 'd')
->where('(a2.quantity - COUNT(d.quantity)) <= 0')
->groupBy('d.quantity')
->orderBy('a2.id', 'ASC');