Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyphens in managed_models keys cause errors #1219

Closed
1 task
andrewandante opened this issue May 27, 2021 · 4 comments · Fixed by #1220, #1226 or #1228
Closed
1 task

Hyphens in managed_models keys cause errors #1219

andrewandante opened this issue May 27, 2021 · 4 comments · Fixed by #1220, #1226 or #1228

Comments

@andrewandante
Copy link
Contributor

andrewandante commented May 27, 2021

According to the docs we should be able to have a $managed_models key like so:

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

However, adding one always results in the error: ModelAdmin::init(): Invalid Model class

I believe this is due to the unsanitiseClassName() call but I'm setting out to prove it shortly.

Pull request

@maxime-rainville
Copy link
Contributor

One of the test added by the PR is failing the build on the kitchen sink.

1) SilverStripe\Admin\Tests\ModelAdminTest::testMultiModelAdminOpensEachTab
BadMethodCallException: No session available for this HTTPRequest
/home/travis/build/silverstripe/cwp-recipe-kitchen-sink/vendor/silverstripe/framework/src/Control/HTTPRequest.php:938
/home/travis/build/silverstripe/cwp-recipe-kitchen-sink/vendor/silverstripe/admin/code/LeftAndMain.php:1667
/home/travis/build/silverstripe/cwp-recipe-kitchen-sink/vendor/silverstripe/admin/code/LeftAndMain.php:1695
/home/travis/build/silverstripe/cwp-recipe-kitchen-sink/vendor/silverstripe/subsites/src/Extensions/LeftAndMainSubsites.php:314
/home/travis/build/silverstripe/cwp-recipe-kitchen-sink/vendor/silverstripe/framework/src/Core/Extensible.php:468
/home/travis/build/silverstripe/cwp-recipe-kitchen-sink/vendor/silverstripe/framework/src/Control/Controller.php:123
/home/travis/build/silverstripe/cwp-recipe-kitchen-sink/vendor/silverstripe/admin/tests/php/ModelAdminTest.php:48
/home/travis/build/silverstripe/cwp-recipe-kitchen-sink/vendor/sminnee/phpunit/phpunit:52

@emteknetnz
Copy link
Member

emteknetnz commented Jun 8, 2021

Have merged PR - rerunning kitchen-sink

If testMultiModelAdminOpensEachTab is resolved on build, then will close this issue

Last red build pre merge with failure - https://travis-ci.com/github/silverstripe/cwp-recipe-kitchen-sink/builds/228312788

Build post merge that's expected to go green - https://travis-ci.com/github/silverstripe/cwp-recipe-kitchen-sink/builds/228395717

@emteknetnz
Copy link
Member

emteknetnz commented Jun 9, 2021

@maxime-rainville - re-run did not fix issue https://travis-ci.com/github/silverstripe/cwp-recipe-kitchen-sink/jobs/512232011

@maxime-rainville
Copy link
Contributor

Third time is the charm #1228

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment