mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUG Fix DataObject::dbObject assigning incorrect table to DBField instance
This commit is contained in:
parent
cac326eebb
commit
00c9c2c775
@ -2590,7 +2590,8 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
*/
|
*/
|
||||||
public function dbObject($fieldName) {
|
public function dbObject($fieldName) {
|
||||||
// Check for field in DB
|
// Check for field in DB
|
||||||
$helper = static::getSchema()->fieldSpec(static::class, $fieldName, DataObjectSchema::INCLUDE_CLASS);
|
$schema = static::getSchema();
|
||||||
|
$helper = $schema->fieldSpec(static::class, $fieldName, DataObjectSchema::INCLUDE_CLASS);
|
||||||
if(!$helper) {
|
if(!$helper) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -2604,8 +2605,9 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
list($table, $spec) = explode('.', $helper);
|
list($class, $spec) = explode('.', $helper);
|
||||||
/** @var DBField $obj */
|
/** @var DBField $obj */
|
||||||
|
$table = $schema->tableName($class);
|
||||||
$obj = Object::create_from_string($spec, $fieldName);
|
$obj = Object::create_from_string($spec, $fieldName);
|
||||||
$obj->setTable($table);
|
$obj->setTable($table);
|
||||||
$obj->setValue($value, $this, false);
|
$obj->setValue($value, $this, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user