Adding custom query to paginator (KNP Paginator) in Symfony2?
- by Unni
I have the following query , how to write these query in Symfony2
SELECT Inventory_Stock.id, Inventory_Stock.quantity, SUM(InventoryUsage.quantity)
,Inventory_Stock.quantity - SUM(InventoryUsage.quantity) AS Stock
FROM Inventory_Stock LEFT JOIN InventoryUsage ON Inventory_Stock.id = InventoryUsage.InventoryStock_id
WHERE Inventory_Stock.id = 26 OR
Inventory_Stock.id = 27
GROUP BY Inventory_Stock.id
ORDER BY Stock DESC
I need to paginate this as well
Would be great if any one could help me out as this has been pulling my hair out for couple of days.