mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR: Boundary condition check in TableListField for more helpful errors. (from r95543) (from r98088)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102580 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
ca2916c948
commit
fa5af56384
@ -408,16 +408,31 @@ JS
|
|||||||
*
|
*
|
||||||
* @param $query SS_Query
|
* @param $query SS_Query
|
||||||
*/
|
*/
|
||||||
function setCustomQuery($query) {
|
function setCustomQuery(SQLQuery $query) {
|
||||||
$this->customQuery = $query;
|
// The type-hinting above doesn't seem to work consistently
|
||||||
|
if($query instanceof SQLQuery) {
|
||||||
|
$this->customQuery = $query;
|
||||||
|
} else {
|
||||||
|
user_error('TableList::setCustomQuery() should be passed a SQLQuery', E_USER_WARNING);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCustomCsvQuery($query) {
|
function setCustomCsvQuery(SQLQuery $query) {
|
||||||
$this->customCsvQuery = $query;
|
// The type-hinting above doesn't seem to work consistently
|
||||||
|
if($query instanceof SQLQuery) {
|
||||||
|
$this->customCsvQuery = $query;
|
||||||
|
} else {
|
||||||
|
user_error('TableList::setCustomCsvQuery() should be passed a SQLQuery', E_USER_WARNING);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCustomSourceItems($items) {
|
function setCustomSourceItems(DataObjectSet $items) {
|
||||||
$this->customSourceItems = $items;
|
// The type-hinting above doesn't seem to work consistently
|
||||||
|
if($items instanceof DataObjectSet) {
|
||||||
|
$this->customSourceItems = $items;
|
||||||
|
} else {
|
||||||
|
user_error('TableList::setCustomSourceItems() should be passed a DataObjectSet', E_USER_WARNING);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sourceItems() {
|
function sourceItems() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user