array check to ensure getRemoteJoinField() gets an array from Config::inst()->get($remoteClass, 'has_one') (related issue: #2570)

This commit is contained in:
Zauberfisch 2013-10-21 04:03:51 +00:00
parent 5c1a9d9da5
commit 8de1ce4a56

View File

@ -1533,7 +1533,11 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
return substr($remoteClass, $fieldPos + 1) . 'ID'; 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 // look for remote has_one joins on this class or any parent classes
foreach(array_reverse(ClassInfo::ancestry($this)) as $class) { foreach(array_reverse(ClassInfo::ancestry($this)) as $class) {