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
9b7246a8
Unverified
Commit
9b7246a8
authored
Jan 21, 2020
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the QueryBuilder::setMaxResults() signature to accept NULL
parent
e5d1edc2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
8 deletions
+21
-8
QueryBuilder.php
lib/Doctrine/DBAL/Query/QueryBuilder.php
+4
-5
QueryBuilderTest.php
tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php
+17
-3
No files found.
lib/Doctrine/DBAL/Query/QueryBuilder.php
View file @
9b7246a8
...
@@ -118,9 +118,9 @@ class QueryBuilder
...
@@ -118,9 +118,9 @@ class QueryBuilder
private
$firstResult
=
null
;
private
$firstResult
=
null
;
/**
/**
* The maximum number of results to retrieve.
* The maximum number of results to retrieve
or NULL to retrieve all results
.
*
*
* @var int
* @var int
|null
*/
*/
private
$maxResults
=
null
;
private
$maxResults
=
null
;
...
@@ -367,7 +367,6 @@ class QueryBuilder
...
@@ -367,7 +367,6 @@ class QueryBuilder
/**
/**
* Gets the position of the first result the query object was set to retrieve (the "offset").
* Gets the position of the first result the query object was set to retrieve (the "offset").
* Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder.
*
*
* @return int The position of the first result.
* @return int The position of the first result.
*/
*/
...
@@ -379,7 +378,7 @@ class QueryBuilder
...
@@ -379,7 +378,7 @@ class QueryBuilder
/**
/**
* Sets the maximum number of results to retrieve (the "limit").
* Sets the maximum number of results to retrieve (the "limit").
*
*
* @param int
$maxResults The maximum number of results to retrieve
.
* @param int
|null $maxResults The maximum number of results to retrieve or NULL to retrieve all results
.
*
*
* @return $this This QueryBuilder instance.
* @return $this This QueryBuilder instance.
*/
*/
...
@@ -393,7 +392,7 @@ class QueryBuilder
...
@@ -393,7 +392,7 @@ class QueryBuilder
/**
/**
* Gets the maximum number of results the query object was set to retrieve (the "limit").
* Gets the maximum number of results the query object was set to retrieve (the "limit").
* Returns NULL if
{@link setMaxResults} was not applied to this query builder
.
* Returns NULL if
all results will be returned
.
*
*
* @return int The maximum number of results.
* @return int The maximum number of results.
*/
*/
...
...
tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php
View file @
9b7246a8
...
@@ -569,13 +569,27 @@ class QueryBuilderTest extends DbalTestCase
...
@@ -569,13 +569,27 @@ class QueryBuilderTest extends DbalTestCase
self
::
assertEquals
(
$sql1
,
$qb
->
getSQL
());
self
::
assertEquals
(
$sql1
,
$qb
->
getSQL
());
}
}
public
function
testSetMaxResults
()
:
void
/**
* @dataProvider maxResultsProvider
*/
public
function
testSetMaxResults
(
?
int
$maxResults
)
:
void
{
{
$qb
=
new
QueryBuilder
(
$this
->
conn
);
$qb
=
new
QueryBuilder
(
$this
->
conn
);
$qb
->
setMaxResults
(
10
);
$qb
->
setMaxResults
(
$maxResults
);
self
::
assertEquals
(
QueryBuilder
::
STATE_DIRTY
,
$qb
->
getState
());
self
::
assertEquals
(
QueryBuilder
::
STATE_DIRTY
,
$qb
->
getState
());
self
::
assertEquals
(
10
,
$qb
->
getMaxResults
());
self
::
assertEquals
(
$maxResults
,
$qb
->
getMaxResults
());
}
/**
* @return mixed[][]
*/
public
static
function
maxResultsProvider
()
:
iterable
{
return
[
'non-null'
=>
[
10
],
'null'
=>
[
null
],
];
}
}
public
function
testSetFirstResult
()
:
void
public
function
testSetFirstResult
()
:
void
...
...
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