GridFieldBulkEditingTools
GridFieldBulkEditingTools copied to clipboard
Uncaught Exception BadMethodCallException: "Items must be saved before adding to a changeset"
Hi I get that error using BulkUploader in SS4.3
Uncaught Exception BadMethodCallException: "Items must be saved before adding to a changeset"
That s my gridfield-config
$gridFieldConfig=GridFieldConfig::create()
->addComponent(new GridFieldButtonRow('before'))
->addComponent($dataColumn=new GridFieldDataColumns)
->addComponent(new GridFieldDeleteAction())
->addComponent(new GridFieldEditButton())
->addComponent(new GridFieldDetailForm())
->addComponent(new GridFieldSortableHeader())
->addComponent(new GridFieldFilterHeader())
->addComponent(new GridFieldPaginator())
->addComponent(new GridFieldAddNewButton())
->addComponent($bulkUploader=new \Colymba\BulkUpload\BulkUploader('Image'))
The DataObject
use Silverstripe\ORM\DataObject;
use Silverstripe\Assets\Image;
class GalleryImage extends DataObject{
private static $table_name="galleryimage";
private static $db=[
"SortID"=>"Int"
];
private static $has_one=[
"Image"=>Image::class,
];
private static $belongs_many_many=[
"Galleries"=>Gallery::class
];
public function onAfterWrite()
{
$this->Image()->doPublish();
}
public function getThumbnail(){
return $this->Image()->CMSThumbnail();
}
}
;