Hello, today i started addings records to a database to test the pagination component.
The dbselect query im passing to the adapter as string is this: SELECT `i`.*, `c`.`name` AS `categoryName`, CASE WHEN COUNT(bhi.id) > 0 THEN 1 ELSE 0 END AS `used` FROM `items` AS `i` INNER JOIN `categories` AS `c` ON `c`.`id` = `i`.`category` LEFT JOIN `budget_has_item` AS `bhi` ON `bhi`.`item` = `i`.`id` GROUP BY `i`.`id` This query gets the items from a table 'items', its parent category name from 'categories', and the column 'used' to see if this item has childs in a table 'budget_has_items'. This is working well to retrieve the rows, but the problem comes when i try to paginate this results. I passed the select query as an object to the adapter, and here the count fails because it adds the count field as another field to the row. In ZF1 the DbSelect adapter wrapped the query as a subselect, ie: SELECT COUNT(1) as zend_paginator_row_count FROM (*SUBSELECT*) But now the select generated is: SELECT COUNT(1) AS `c`, `c`.`name` AS `categoryName`, CASE WHEN COUNT(bhi.id) > 0 THEN 1 ELSE 0 END AS `used` FROM `items` AS `i` INNER JOIN `categories` AS `c` ON `c`.`id` = `i`.`category` LEFT JOIN `budget_has_item` AS `bhi` ON `bhi`.`item` = `i`.`id` GROUP BY `i`.`id` What i want to know if this is an issue with the adapter or im executing an invalid query. If i wrap the above query to make it look like the ZF1 one, it works well. Thanks. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/ZF2-Paginator-DbSelect-not-counting-rows-as-expected-tp4658186.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: [email protected] Info: http://framework.zend.com/archives Unsubscribe: [email protected]
