Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Doctrine: use native Paginator from ORM 2.2.x

  • Loading branch information...
commit 8165d252c065179fee250a34e7bf1f0739469fa4 1 parent 1e8f88b
@Vrtak-CZ Vrtak-CZ authored
Showing with 7 additions and 11 deletions.
  1. +7 −6 Nella/Doctrine/QueryObject.php
  2. +0 −4 README.md
  3. +0 −1  composer.json
View
13 Nella/Doctrine/QueryObject.php
@@ -9,7 +9,7 @@
namespace Nella\Doctrine;
-use DoctrineExtensions\Paginate\Paginate,
+use Doctrine\ORM\Tools\Pagination\Paginator,
Nella\Model\IQueryable;
/**
@@ -55,7 +55,8 @@ protected function doCreateQuery(IQueryable $broker)
*/
public function count(IQueryable $broker)
{
- return Paginate::getTotalQueryResults($this->doCreateQuery($broker));
+ $tmp = new Paginator($this->doCreateQuery($broker));
+ return count($tmp);
}
/**
@@ -66,11 +67,11 @@ public function fetch(IQueryable $broker)
{
$query = $this->doCreateQuery($broker);
- if ($this->paginator) { // Paginate
- $query = Paginate::getPaginateQuery($query, $this->paginator->getOffset(), $this->paginator->getLength());
- }
-
try{
+ if ($this->paginator) {
+ $query->setFirstResult($this->paginator->getOffset())->setMaxResults($this->paginator->getLength());
+ return new Paginator($query);
+ }
return $query->getResult();
} catch (\Doctrine\ORM\NoResultException $e) {
return array();
View
4 README.md
@@ -15,10 +15,6 @@ Nella Framework requires PHP 5.3.2 with PDO.
- Doctrine ORM 2.2.x
- Symfony Console 2.0.x
-Optional
-
-- Doctrine Extension - Paginate
-
Installation
------------
View
1  composer.json
@@ -27,7 +27,6 @@
"doctrine/orm": ">=2.2.0,<2.2.x-dev",
"doctrine/migrations": "*",
"symfony/console": ">=2.0.0,<2.0.x-dev",
- "beberlei/DoctrineExtensions": "*",
"nette/nette": "2.0.*"
},
"replace": {
Please sign in to comment.
Something went wrong with that request. Please try again.