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

View File

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