mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
FIX: Fixes #2389
- Prevent circular references in `GridFieldAddExistingAutocompleter` when linking DataObjects whose ID matches the current object to which the gridfield is attached.
This commit is contained in:
parent
daa0b3cb79
commit
128c33b82c
@ -231,7 +231,11 @@ class GridFieldAddExistingAutocompleter
|
||||
|
||||
$json = array();
|
||||
foreach($results as $result) {
|
||||
$json[$result->ID] = SSViewer::fromString($this->resultsFormat)->process($result);
|
||||
// Prevent a circular reference and associated error in CMS/admin
|
||||
$showInSearch = ($result->ID != $gridField->getForm()->getRecord()->ID);
|
||||
if($showInSearch) {
|
||||
$json[$result->ID] = SSViewer::fromString($this->resultsFormat)->process($result);
|
||||
}
|
||||
}
|
||||
return Convert::array2json($json);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user