mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
array check to ensure getRemoteJoinField() gets an array from Config::inst()->get($remoteClass, 'has_one') (related issue: #2570)
This commit is contained in:
parent
5c1a9d9da5
commit
8de1ce4a56
@ -1532,8 +1532,12 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
if($fieldPos = strpos($remoteClass, '.')) {
|
||||
return substr($remoteClass, $fieldPos + 1) . 'ID';
|
||||
}
|
||||
|
||||
$remoteRelations = array_flip(Config::inst()->get($remoteClass, 'has_one'));
|
||||
|
||||
$remoteRelations = Config::inst()->get($remoteClass, 'has_one');
|
||||
if(!is_array($remoteRelations)) {
|
||||
$remoteRelations = array();
|
||||
}
|
||||
$remoteRelations = array_flip($remoteRelations);
|
||||
|
||||
// look for remote has_one joins on this class or any parent classes
|
||||
foreach(array_reverse(ClassInfo::ancestry($this)) as $class) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user