Skip to content
This repository
Browse code

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
Ingo Schommer authored March 14, 2012

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. 3  model/DataObject.php
3  model/DataObject.php
@@ -1859,7 +1859,8 @@ public function scaffoldFormFields($_params = null) {
1859 1859
 	public function getCMSFields($params = null) {
1860 1860
 		$tabbedFields = $this->scaffoldFormFields(array_merge(
1861 1861
 			array(
1862  
-				'includeRelations' => true,
  1862
+				// Don't allow has_many/many_many relationship editing before the record is first saved
  1863
+				'includeRelations' => ($this->ID > 0),
1863 1864
 				'tabbed' => true,
1864 1865
 				'ajaxSafe' => true
1865 1866
 			),

0 notes on commit 687a1ca

Please sign in to comment.
Something went wrong with that request. Please try again.