Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
139720fb
Commit
139720fb
authored
Nov 25, 2007
by
guilhermeblanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CHG: Updated Doctrine_Pager to become coding standards compliant
parent
05147fbe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
165 additions
and
159 deletions
+165
-159
Pager.php
lib/Doctrine/Pager.php
+165
-159
No files found.
lib/Doctrine/Pager.php
View file @
139720fb
...
@@ -63,7 +63,8 @@ class Doctrine_Pager
...
@@ -63,7 +63,8 @@ class Doctrine_Pager
/**
/**
* __construct
* __construct
*
*
* @param mixed $query Accepts either a Doctrine_Query object or a string (which does the Doctrine_Query class creation).
* @param mixed $query Accepts either a Doctrine_Query object or a string
* (which does the Doctrine_Query class creation).
* @param int $page Current page
* @param int $page Current page
* @param int $maxPerPage Maximum itens per page
* @param int $maxPerPage Maximum itens per page
* @return void
* @return void
...
@@ -88,6 +89,7 @@ class Doctrine_Pager
...
@@ -88,6 +89,7 @@ class Doctrine_Pager
*/
*/
protected
function
initialize
()
protected
function
initialize
()
{
{
// etrieve the number of itens found
$count
=
$this
->
getQuery
()
->
offset
(
0
)
->
limit
(
0
)
->
count
();
$count
=
$this
->
getQuery
()
->
offset
(
0
)
->
limit
(
0
)
->
count
();
$this
->
setNbResults
(
$count
);
$this
->
setNbResults
(
$count
);
...
@@ -104,9 +106,13 @@ class Doctrine_Pager
...
@@ -104,9 +106,13 @@ class Doctrine_Pager
*/
*/
protected
function
adjustOffset
()
protected
function
adjustOffset
()
{
{
$this
->
setLastPage
(
max
(
1
,
ceil
(
$this
->
getNbResults
()
/
$this
->
getMaxPerPage
())));
// Define new total of pages
$this
->
setLastPage
(
max
(
1
,
ceil
(
$this
->
getNbResults
()
/
$this
->
getMaxPerPage
()))
);
$offset
=
(
$this
->
getPage
()
-
1
)
*
$this
->
getMaxPerPage
();
$offset
=
(
$this
->
getPage
()
-
1
)
*
$this
->
getMaxPerPage
();
// Assign new offset and limit to Doctrine_Query object
$p
=
$this
->
getQuery
();
$p
=
$this
->
getQuery
();
$p
->
offset
(
$offset
);
$p
->
offset
(
$offset
);
$p
->
limit
(
$this
->
getMaxPerPage
());
$p
->
limit
(
$this
->
getMaxPerPage
());
...
@@ -333,7 +339,8 @@ class Doctrine_Pager
...
@@ -333,7 +339,8 @@ class Doctrine_Pager
*
*
* Defines the maximum number of itens per page
* Defines the maximum number of itens per page
*
*
* @param $query Accepts either a Doctrine_Query object or a string (which does the Doctrine_Query class creation).
* @param $query Accepts either a Doctrine_Query object or a string
* (which does the Doctrine_Query class creation).
* @return void
* @return void
*/
*/
protected
function
setQuery
(
$query
)
protected
function
setQuery
(
$query
)
...
@@ -351,7 +358,8 @@ class Doctrine_Pager
...
@@ -351,7 +358,8 @@ class Doctrine_Pager
* executes the query and populates the data set
* executes the query and populates the data set
*
*
* @param $params Optional parameters to Doctrine_Query::execute
* @param $params Optional parameters to Doctrine_Query::execute
* @param $hydrationMode Hyddration Mode of Doctrine_Query::execute returned ResultSet. Doctrine::Default is FETCH_RECORD
* @param $hydrationMode Hyddration Mode of Doctrine_Query::execute
* returned ResultSet. Doctrine::Default is FETCH_RECORD
* @return Doctrine_Collection the root collection
* @return Doctrine_Collection the root collection
*/
*/
public
function
execute
(
$params
=
array
(),
$hydrationMode
=
Doctrine
::
FETCH_RECORD
)
public
function
execute
(
$params
=
array
(),
$hydrationMode
=
Doctrine
::
FETCH_RECORD
)
...
@@ -359,5 +367,3 @@ class Doctrine_Pager
...
@@ -359,5 +367,3 @@ class Doctrine_Pager
return
$this
->
getQuery
()
->
execute
(
$params
,
$hydrationMode
);
return
$this
->
getQuery
()
->
execute
(
$params
,
$hydrationMode
);
}
}
}
}
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment