mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-07-03 01:49:37 +02:00
MINOR Provide a better error if incorrect number of arguments are passed
to filter() or exclude() on a DataList
This commit is contained in:
parent
d7a8fa9266
commit
f43273f217
|
@ -216,7 +216,7 @@ class DataList extends ViewableData implements SS_List, SS_Filterable, SS_Sortab
|
|||
*
|
||||
* @todo extract the sql from $customQuery into a SQLGenerator class
|
||||
*
|
||||
* @param String|array Escaped SQL statement. If passed as array, all keys and values are assumed to be escaped.
|
||||
* @param string|array Escaped SQL statement. If passed as array, all keys and values are assumed to be escaped.
|
||||
* @return DataList
|
||||
*/
|
||||
public function filter() {
|
||||
|
@ -227,7 +227,7 @@ class DataList extends ViewableData implements SS_List, SS_Filterable, SS_Sortab
|
|||
} elseif($numberFuncArgs == 2) {
|
||||
$whereArguments[func_get_arg(0)] = func_get_arg(1);
|
||||
} else {
|
||||
throw new InvalidArgumentException('Arguments passed to filter() is wrong');
|
||||
throw new InvalidArgumentException('Incorrect number of arguments passed to filter()');
|
||||
}
|
||||
|
||||
$SQL_Statements = array();
|
||||
|
@ -307,7 +307,7 @@ class DataList extends ViewableData implements SS_List, SS_Filterable, SS_Sortab
|
|||
*
|
||||
* @todo extract the sql from this method into a SQLGenerator class
|
||||
*
|
||||
* @param String|array Escaped SQL statement. If passed as array, all keys and values are assumed to be escaped.
|
||||
* @param string|array Escaped SQL statement. If passed as array, all keys and values are assumed to be escaped.
|
||||
* @return DataList
|
||||
*/
|
||||
public function exclude() {
|
||||
|
@ -319,7 +319,7 @@ class DataList extends ViewableData implements SS_List, SS_Filterable, SS_Sortab
|
|||
} elseif($numberFuncArgs == 2) {
|
||||
$whereArguments[func_get_arg(0)] = func_get_arg(1);
|
||||
} else {
|
||||
throw new InvalidArgumentException('Arguments passed to exclude() is wrong');
|
||||
throw new InvalidArgumentException('Incorrect number of arguments pased to exclude()');
|
||||
}
|
||||
|
||||
$SQL_Statements = array();
|
||||
|
|
Loading…
Reference in New Issue
Block a user