Revision: 222
http://sourceforge.net/p/beeframework/code/222
Author: m_plomer
Date: 2014-09-18 06:19:09 +0000 (Thu, 18 Sep 2014)
Log Message:
-----------
- use Doctrine2 paginator in DaoBase
Modified Paths:
--------------
trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php
Modified: trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php
===================================================================
--- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-09-18 04:16:17 UTC (rev 221)
+++ trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-09-18 06:19:09 UTC (rev 222)
@@ -20,6 +20,7 @@
use Bee_Utils_Strings;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
+use Doctrine\ORM\Tools\Pagination\Paginator;
use Exception;
/**
@@ -117,8 +118,10 @@
if ($orderAndLimitHolder->getPageSize() > 0) {
- // TODO: build a performant count-query! This is simply bullshit!
- $pageCount = ceil(count($this->getQueryFromBuilder($queryBuilder)->execute()) / $orderAndLimitHolder->getPageSize());
+// $pageCount = ceil(count($this->getQueryFromBuilder($queryBuilder)->execute()) / $orderAndLimitHolder->getPageSize());
+ // TODO: optimize use of the Paginator concept. maybe reimplement it in a more specific way?
+ $paginator = new Paginator($queryBuilder, false);
+ $pageCount = ceil(count($paginator) / $orderAndLimitHolder->getPageSize());
$orderAndLimitHolder->setPageCount($pageCount);
if ($orderAndLimitHolder->getCurrentPage() > $pageCount) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|