Skip to content

Commit

Permalink
FIX: Update model class importers
Browse files Browse the repository at this point in the history
- using a  custom URL slug throws exception due to non-existing key equivalent to the model class. Using model tab solves this since it utilises either the custom url slug or the fully-qualified name of the class.
  • Loading branch information
mikenuguid committed May 8, 2024
1 parent 66a937a commit efc9f08
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion code/ModelAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ public function import(array $data, Form $form): HTTPResponse

$importers = $this->getModelImporters();
/** @var BulkLoader $loader */
$loader = $importers[$this->modelClass];
$loader = $importers[$this->modelTab];

// File wasn't properly uploaded, show a reminder to the user
if (empty($_FILES['_CsvFile']['tmp_name']) ||
Expand Down
3 changes: 1 addition & 2 deletions tests/php/ModelAdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\Session;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\FunctionalTest;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldExportButton;
use SilverStripe\Forms\GridField\GridFieldImportButton;
use SilverStripe\Forms\GridField\GridFieldPrintButton;
use SilverStripe\Security\Permission;
use SilverStripe\Dev\FunctionalTest;
use SilverStripe\View\ArrayData;

class ModelAdminTest extends FunctionalTest
{
Expand Down

0 comments on commit efc9f08

Please sign in to comment.