diff --git a/manual/docs/en/utilities/pagination/advanced-layouts-with-pager.txt b/manual/docs/en/utilities/pagination/advanced-layouts-with-pager.txt
index dc6b35958..ad930d4ee 100644
--- a/manual/docs/en/utilities/pagination/advanced-layouts-with-pager.txt
+++ b/manual/docs/en/utilities/pagination/advanced-layouts-with-pager.txt
@@ -25,18 +25,18 @@ Now we know how to create the {{Doctrine_Pager_Layout}} and the types that are a
// Creating pager layout
$pager_layout = new Doctrine_Pager_Layout(
- new Doctrine_Pager(
- Doctrine_Query::create()
- ->from( 'User u' )
- ->leftJoin( 'u.Group g' )
- ->orderby( 'u.username ASC' ),
- $currentPage,
- $resultsPerPage
- ),
- new Doctrine_Pager_Range_Sliding(array(
- 'chunk' => 5
- )),
- 'http://wwww.domain.com/app/User/list/page,{%page_number}'
+ new Doctrine_Pager(
+ Doctrine_Query::create()
+ ->from( 'User u' )
+ ->leftJoin( 'u.Group g' )
+ ->orderby( 'u.username ASC' ),
+ $currentPage,
+ $resultsPerPage
+ ),
+ new Doctrine_Pager_Range_Sliding(array(
+ 'chunk' => 5
+ )),
+ 'http://wwww.domain.com/app/User/list/page,{%page_number}'
);
// Assigning templates for page links creation
@@ -63,19 +63,19 @@ The first change we need to do is tho adjust the {{Doctrine_Query}} object and a
// Creating pager layout
$pager_layout = new Doctrine_Pager_Layout(
- new Doctrine_Pager(
- Doctrine_Query::create()
- ->from( 'User u' )
- ->leftJoin( 'u.Group g' )
- ->where( 'LOWER(u.username) LIKE LOWER(?)', array( '%'.$_GET['search'].'%' ) )
- ->orderby( 'u.username ASC' ),
- $currentPage,
- $resultsPerPage
- ),
- new Doctrine_Pager_Range_Sliding(array(
- 'chunk' => 5
- )),
- 'http://wwww.domain.com/app/User/list/page,{%page_number}?search={%search}'
+ new Doctrine_Pager(
+ Doctrine_Query::create()
+ ->from( 'User u' )
+ ->leftJoin( 'u.Group g' )
+ ->where( 'LOWER(u.username) LIKE LOWER(?)', array( '%'.$_GET['search'].'%' ) )
+ ->orderby( 'u.username ASC' ),
+ $currentPage,
+ $resultsPerPage
+ ),
+ new Doctrine_Pager_Range_Sliding(array(
+ 'chunk' => 5
+ )),
+ 'http://wwww.domain.com/app/User/list/page,{%page_number}?search={%search}'
);
@@ -89,6 +89,10 @@ $pager_layout->setSelectedTemplate('[{%page}]');
// Fetching users
$users = $pager_layout->execute();
+
+foreach ($users as $user) {
+ // ...
+}
The method {{display()}} is the place where we define the custom mask we created. This method accepts 2 optional arguments: one array of optional masks and if the output should be returned instead of printed on screen.
@@ -98,7 +102,7 @@ Custom masks are defined in key => value pairs. So all needed code is to define
// Displaying page links
$pager_layout->display( array(
- 'search' => urlencode($_GET['search'])
+ 'search' => urlencode($_GET['search'])
) );
diff --git a/manual/docs/en/utilities/pagination/controlling-range-styles.txt b/manual/docs/en/utilities/pagination/controlling-range-styles.txt
index dd24ec252..f74be3d4a 100644
--- a/manual/docs/en/utilities/pagination/controlling-range-styles.txt
+++ b/manual/docs/en/utilities/pagination/controlling-range-styles.txt
@@ -41,10 +41,10 @@ Now that we know how the different of styles of pager range works, it's time to
$pager_range = new Doctrine_Pager_Range_Sliding(
- array(
- 'chunk' => 5 // Chunk length
- ),
- $pager // Doctrine_Pager object we learned how to create in previous topic
+ array(
+ 'chunk' => 5 // Chunk length
+ ),
+ $pager // Doctrine_Pager object we learned how to create in previous topic
);
diff --git a/manual/docs/en/utilities/pagination/working-with-pager.txt b/manual/docs/en/utilities/pagination/working-with-pager.txt
index 492baa531..e830e9fd5 100644
--- a/manual/docs/en/utilities/pagination/working-with-pager.txt
+++ b/manual/docs/en/utilities/pagination/working-with-pager.txt
@@ -7,12 +7,12 @@ $resultsPerPage = 50;
// Creating pager object
$pager = new Doctrine_Pager(
- Doctrine_Query::create()
- ->from( 'User u' )
- ->leftJoin( 'u.Group g' )
- ->orderby( 'u.username ASC' ),
- $currentPage, // Current page of request
- $resultsPerPage // (Optional) Number of results per page. Default is 25
+ Doctrine_Query::create()
+ ->from( 'User u' )
+ ->leftJoin( 'u.Group g' )
+ ->orderby( 'u.username ASC' ),
+ $currentPage, // Current page of request
+ $resultsPerPage // (Optional) Number of results per page. Default is 25
);
@@ -28,7 +28,11 @@ If you try to access any of the methods provided by Doctrine_Pager now, you'll e
To run the query, the process is similar to the current existent {{Doctrine_Query}} execute call. It even allow arguments the way you usually do it. Here is the PHP complete syntax, including the syntax of optional parameters:
-$pager->execute([$args = array() [, $fetchType = Doctrine::FETCH_RECORD]]);
+$items = $pager->execute([$args = array() [, $fetchType = Doctrine::FETCH_RECORD]]);
+
+foreach ($items as $item) {
+ // ...
+}
There are some special cases where the return records query differ of the counter query. To allow this situation, {{Doctrine_Pager}} has some methods that enable you to count and then to execute. The first thing you have to do is to define the count query: