mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #11073 from creative-commoners/pulls/5/limit-int
API Use correct param types
This commit is contained in:
commit
ff38ff1d63
@ -130,17 +130,17 @@ class SearchContext
|
|||||||
* for example "Comments__Name" instead of the filter name "Comments.Name".
|
* for example "Comments__Name" instead of the filter name "Comments.Name".
|
||||||
* @param array|bool|string $sort Database column to sort on.
|
* @param array|bool|string $sort Database column to sort on.
|
||||||
* Falls back to {@link DataObject::$default_sort} if not provided.
|
* Falls back to {@link DataObject::$default_sort} if not provided.
|
||||||
* @param array|null|string $limit
|
* @param int|array|null $limit
|
||||||
* @param DataList $existingQuery
|
* @param DataList $existingQuery
|
||||||
* @return DataList
|
* @return DataList
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getQuery($searchParams, $sort = false, $limit = false, $existingQuery = null)
|
public function getQuery($searchParams, $sort = false, $limit = false, $existingQuery = null)
|
||||||
{
|
{
|
||||||
if ((count(func_get_args()) >= 3) && (!in_array(gettype($limit), ['array', 'NULL', 'string']))) {
|
if ((count(func_get_args()) >= 3) && (!in_array(gettype($limit), ['integer', 'array', 'NULL']))) {
|
||||||
Deprecation::notice(
|
Deprecation::notice(
|
||||||
'5.1.0',
|
'5.1.0',
|
||||||
'$limit should be type of array|string|null'
|
'$limit should be type of int|array|null'
|
||||||
);
|
);
|
||||||
$limit = null;
|
$limit = null;
|
||||||
}
|
}
|
||||||
@ -172,7 +172,7 @@ class SearchContext
|
|||||||
* Prepare the query to begin searching
|
* Prepare the query to begin searching
|
||||||
*
|
*
|
||||||
* @param array|bool|string $sort Database column to sort on.
|
* @param array|bool|string $sort Database column to sort on.
|
||||||
* @param array|null|string $limit
|
* @param int|array|null $limit
|
||||||
*/
|
*/
|
||||||
private function prepareQuery($sort, $limit, ?DataList $existingQuery): DataList
|
private function prepareQuery($sort, $limit, ?DataList $existingQuery): DataList
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user