Add the whole record to the has_many realtion (#131)

* Add the whole record to the has_many realtion
* Removed unnecessary record->write calls
This commit is contained in:
Bram de Leeuw 2016-10-26 10:51:31 +02:00 committed by Thierry François
parent 8c0598a9ba
commit caed3813ee
1 changed files with 2 additions and 4 deletions

View File

@ -107,10 +107,9 @@ class GridFieldBulkUpload_Request extends RequestHandler
// Attach the file to record.
$record->{"{$fileRelationName}ID"} = $uploadResponse['id'];
$record->write();
// attached record to gridField relation
$this->gridField->list->add($record->ID);
$this->gridField->list->add($record);
// JS Template Data
$responseData = $this->newRecordJSTemplateData($record, $uploadResponse);
@ -221,10 +220,9 @@ class GridFieldBulkUpload_Request extends RequestHandler
// attach file
$record->{"{$fileRelationName}ID"} = $attachResponse['id'];
$record->write();
// attached record to gridField relation
$this->gridField->list->add($record->ID);
$this->gridField->list->add($record);
// JS Template Data
$responseData = $this->newRecordJSTemplateData($record, $attachResponse);