Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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)
  • Loading branch information...
commit 687a1ca72b4300309043d54f9b592c96731f65d8 1 parent 74ea2fa
@chillu chillu authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  model/DataObject.php
View
3  model/DataObject.php
@@ -1859,7 +1859,8 @@ public function scaffoldFormFields($_params = null) {
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
),
Please sign in to comment.
Something went wrong with that request. Please try again.