silverstripe / silverstripe-admin

Silverstripe Admin Component
BSD 3-Clause "New" or "Revised" License
25 stars 91 forks source link

ModelAdmin defined the custom url segment approach broken #1668

Closed pack254 closed 5 months ago

pack254 commented 5 months ago

Module version(s) affected

1.13.19

Description

I have found an issue in silverstripe/admin version 1.13.19 when I did the upgrade security patches. this version it breaks the ModelAdmin which is defined using the custom url segment approach e.g.

private static $managed_models = [
  'product-category' => [
    'dataClass' => Category::class,
    'title' => 'Product categories',
   ],
]

This patch 1.13.19 appears to break potentially caused from line 662 ModelAdmin.php is changed from modelClass to modelTab. In a nuthshell, any module that uses this approach will break i.e. SiteBanner module

How to reproduce

This can be reproduced by using the silverStripe/admin version 1.13.19 and nzta/silverstripe-sitebanner version 3.0.1 after running composer install && composer dev-build flush=all logged in to CMS and then go to Site Banner tab at the left panel, so you will see this error.

Screen Shot 2024-01-31 at 2 02 12 PM

Possible Solution

revert code back to $importer = new $importerClass($this->modelClass);

Additional Context

No response

Validations

PRs

emteknetnz commented 5 months ago

@pack254 linked PR has been merged, will be auto-tagged shortly

Note I left a comment on https://github.com/silverstripe/silverstripe-admin/pull/1670#pullrequestreview-1857624066 that the site banner possibly isn't working correctly, so you'll want to validate this on your local

Fixing that would be a totally separate issue and it's not a module that the open-source team look after

emteknetnz commented 5 months ago

Note this hasn't released just yet because of a CI failure in silverstripe/admin which is being tracked here

emteknetnz commented 5 months ago

This has now released as 1.13.21