BUGFIX Don't include has_many/many_many relationships in DataObject->scaffoldFormFields() when the record doesn't have an ID yet - as the scaffolded GridFieldAddExistingAutocompleter component assumes the component has an ID to query against (fixes #5723)

This commit is contained in:
Ingo Schommer 2012-03-14 17:02:43 +01:00
parent 74ea2fab82
commit 687a1ca72b

View File

@ -1859,7 +1859,8 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
public function getCMSFields($params = null) {
$tabbedFields = $this->scaffoldFormFields(array_merge(
array(
'includeRelations' => true,
// Don't allow has_many/many_many relationship editing before the record is first saved
'includeRelations' => ($this->ID > 0),
'tabbed' => true,
'ajaxSafe' => true
),