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:
Ingo Schommer 2010-04-13 02:01:39 +00:00
parent ca2916c948
commit fa5af56384

View File

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