mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX: Allow join-object to be referenced as a component
This avoids having arbitrary differences between a join object and a has-one relation.
This commit is contained in:
parent
6ba7bf7b2f
commit
c7c6bdebdf
@ -1844,6 +1844,11 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
return $this->components[$componentName];
|
return $this->components[$componentName];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The join object can be returned as a component, named for its alias
|
||||||
|
if (isset($this->record[$componentName]) && $this->record[$componentName] === $this->joinRecord) {
|
||||||
|
return $this->record[$componentName];
|
||||||
|
}
|
||||||
|
|
||||||
$schema = static::getSchema();
|
$schema = static::getSchema();
|
||||||
if ($class = $schema->hasOneComponent(static::class, $componentName)) {
|
if ($class = $schema->hasOneComponent(static::class, $componentName)) {
|
||||||
$joinField = $componentName . 'ID';
|
$joinField = $componentName . 'ID';
|
||||||
|
Loading…
Reference in New Issue
Block a user