mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MNT Deprecation notice if param has wrong type (#10853)
This commit is contained in:
parent
66f2df2571
commit
a57adfc778
@ -186,7 +186,7 @@ class GridFieldFilterHeader extends AbstractGridFieldComponent implements GridFi
|
||||
|
||||
$dataListClone = clone($dataList);
|
||||
$results = $this->getSearchContext($gridField)
|
||||
->getQuery($filterArguments, false, false, $dataListClone);
|
||||
->getQuery($filterArguments, false, null, $dataListClone);
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ use SilverStripe\Forms\CheckboxField;
|
||||
use InvalidArgumentException;
|
||||
use Exception;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\ORM\DataQuery;
|
||||
|
||||
/**
|
||||
@ -140,6 +141,13 @@ class SearchContext
|
||||
*/
|
||||
public function getQuery($searchParams, $sort = false, $limit = false, $existingQuery = null)
|
||||
{
|
||||
if ((count(func_get_args()) >= 3) && (!in_array(gettype($limit), ['array', 'NULL', 'string']))) {
|
||||
Deprecation::notice(
|
||||
'5.1.0',
|
||||
'$limit should be type of array|string|null'
|
||||
);
|
||||
$limit = null;
|
||||
}
|
||||
$this->setSearchParams($searchParams);
|
||||
$query = $this->prepareQuery($sort, $limit, $existingQuery);
|
||||
return $this->search($query);
|
||||
|
Loading…
Reference in New Issue
Block a user