Permalink
Browse files

Updated documentation

  • Loading branch information...
1 parent d06eea3 commit 5e603874bc7089e7df424d322000224c32413a31 @romankonz romankonz committed Mar 20, 2013
Showing with 15 additions and 8 deletions.
  1. +15 −8 doc/Paginator.md
View
23 doc/Paginator.md
@@ -4,13 +4,20 @@ Pagination Adapter
#### Example:
```php
-// note: the cursor is not executed until you receive items from the pagination adapter
-$cursor = $documentManager->getRepository('Users')->findAll();
-$paginationAdapter = DoctrineMongoODMModule\Paginator\Adapter\DoctrinePaginator($cursor);
-// Get first 5 users. Only the first five users are fetched from MongoDB.
-$users = $paginationAdapter->getItems(0, 5);
+use Zend\Paginator\Paginator;
+use DoctrineMongoODMModule\Paginator\Adapter\DoctrinePaginator;
-// If you call it the second time, a new query is executed on MongoDB.
-$users2 = $paginationAdapter->getItems(5, 5);
-```
+// Create a mongo cursor
+$cursor = $documentManager->getRepository('Users')->findAll();
+
+// Create the pagination adapter
+$paginationAdapter = DoctrinePaginator($cursor);
+
+// Create the paginator itself
+$paginator = new Paginator($adapter);
+$paginator->setCurrentPageNumber(1)
+ ->setItemCountPerPage(5);
+
+// Pass it to the view, and use it like a "standard" Zend paginator
+```

0 comments on commit 5e60387

Please sign in to comment.