From caed3813eed940b7d1823284e2f521035b5351c7 Mon Sep 17 00:00:00 2001 From: Bram de Leeuw Date: Wed, 26 Oct 2016 10:51:31 +0200 Subject: [PATCH] Add the whole record to the has_many realtion (#131) * Add the whole record to the has_many realtion * Removed unnecessary record->write calls --- bulkUpload/code/GridFieldBulkUpload_Request.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bulkUpload/code/GridFieldBulkUpload_Request.php b/bulkUpload/code/GridFieldBulkUpload_Request.php index 9866bfd..1e584a4 100644 --- a/bulkUpload/code/GridFieldBulkUpload_Request.php +++ b/bulkUpload/code/GridFieldBulkUpload_Request.php @@ -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);