mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #4082 from chillu/pulls/datadiff-empty-hasone
Allow empty has_one returns in DataDifferencer
This commit is contained in:
commit
6c02770d64
@ -116,7 +116,11 @@ class DataDifferencer extends ViewableData {
|
||||
$toTitle = '';
|
||||
if($this->toRecord->hasMethod($relName)) {
|
||||
$relObjTo = $this->toRecord->$relName();
|
||||
$toTitle = $relObjTo->hasMethod('Title') || $relObjTo->hasField('Title') ? $relObjTo->Title : '';
|
||||
if($relObjTo) {
|
||||
$toTitle = ($relObjTo->hasMethod('Title') || $relObjTo->hasField('Title')) ? $relObjTo->Title : '';
|
||||
} else {
|
||||
$toTitle = '';
|
||||
}
|
||||
}
|
||||
|
||||
if(!$this->fromRecord) {
|
||||
@ -134,7 +138,12 @@ class DataDifferencer extends ViewableData {
|
||||
$fromTitle = '';
|
||||
if($this->fromRecord->hasMethod($relName)) {
|
||||
$relObjFrom = $this->fromRecord->$relName();
|
||||
$fromTitle = $relObjFrom->hasMethod('Title') || $relObjFrom->hasField('Title') ? $relObjFrom->Title : '';
|
||||
if($relObjFrom) {
|
||||
$fromTitle = ($relObjFrom->hasMethod('Title') || $relObjFrom->hasField('Title')) ? $relObjFrom->Title : '';
|
||||
} else {
|
||||
$fromTitle = '';
|
||||
}
|
||||
|
||||
}
|
||||
if(isset($relObjFrom) && $relObjFrom instanceof Image) {
|
||||
// TODO Use CMSThumbnail (see above)
|
||||
|
Loading…
Reference in New Issue
Block a user