diff --git a/code/ModelAdmin.php b/code/ModelAdmin.php index f0fe7e4ab..3d4eb7e3a 100644 --- a/code/ModelAdmin.php +++ b/code/ModelAdmin.php @@ -621,6 +621,7 @@ public function getModelImporters() $importers = []; foreach ($importerClasses as $modelClass => $importerClass) { + $tab = $modelClass; if (isset($models[$modelClass])) { $modelClass = $models[$modelClass]['dataClass']; } @@ -628,7 +629,7 @@ public function getModelImporters() if (ClassInfo::hasMethod($importer, 'setCheckPermissions')) { $importer->setCheckPermissions(true); } - $importers[$modelClass] = $importer; + $importers[$tab] = $importer; } return $importers; diff --git a/tests/php/ModelAdminTest.php b/tests/php/ModelAdminTest.php index 0d4021ce3..8302bee70 100644 --- a/tests/php/ModelAdminTest.php +++ b/tests/php/ModelAdminTest.php @@ -168,9 +168,11 @@ public function testGetModelImporters() { $admin = new ModelAdminTest\MultiModelAdmin(); $importers = $admin->getModelImporters(); - $this->assertCount(2, $importers); + $this->assertCount(4, $importers); $this->assertArrayHasKey(Contact::class, $importers); $this->assertArrayHasKey(Player::class, $importers); + $this->assertArrayHasKey('Player', $importers); + $this->assertArrayHasKey('cricket-players', $importers); } public function testGetManagedModels()