MINOR Provide a better error if incorrect number of arguments are passed

to filter() or exclude() on a DataList
This commit is contained in:
Sean Harvey 2012-05-29 20:09:36 +12:00
parent d7a8fa9266
commit f43273f217

View File

@ -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();