Adding custom query to paginator (KNP Paginator) in Symfony2?

Posted by Unni on Stack Overflow See other posts from Stack Overflow or by Unni
Published on 2012-10-16T10:27:01Z Indexed on 2012/10/16 11:01 UTC
Read the original article Hit count: 321

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about php

Related posts about symfony2