mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX Don't try lazy loading fields when the record ID is set to something non-numeric, otherwise you'll get a SQL error.
This commit is contained in:
parent
0a6ec3d9c9
commit
b1104dac25
@ -1991,12 +1991,15 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
*
|
||||
* @param tableClass Base table to load the values from. Others are joined as required.
|
||||
*/
|
||||
|
||||
protected function loadLazyFields($tableClass = null) {
|
||||
// Smarter way to work out the tableClass? Should the functionality in toMap and getField be moved into here?
|
||||
if (!$tableClass) $tableClass = $this->ClassName;
|
||||
|
||||
$dataQuery = new DataQuery($tableClass);
|
||||
|
||||
// TableField sets the record ID to "new" on new row data, so don't try doing anything in that case
|
||||
if(!is_numeric($this->record['ID'])) return false;
|
||||
|
||||
$dataQuery->where("\"$tableClass\".\"ID\" = {$this->record['ID']}")->limit(1);
|
||||
$columns = array();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user