SonataPageBundle: Unable update deprecated RequestFactory::createFromGlobals('host_with_path'); in index.php
https://docs.sonata-project.org/projects/SonataPageBundle/en/3.x/reference/multisite/ contains example index.php. createFromGlobals method is deprecated and SonataPagePathRuntime::createFromGlobals(). https://docs.sonata-project.org/projects/SonataPageBundle/en/5.x/reference/multisite/ contains instructions for Host and Path Strategy configuration, but there is not new index.php. I tried Sonata\PageBundle\Runtime\SonataPagePathRuntime::createFromGlobals() but I got Attempted to call an undefined method named “createFromGlobals” of class “Sonata\PageBundle\Runtime\SonataPagePathRuntime”. I tried another option: Sonata\PageBundle\Request\SiteRequest::createFromGlobals() but got another error: An exception has been thrown during the rendering of a template (“You must configure runtime on your composer.json in order to use “Host path” strategy, take a look on page bundle multiside doc.”). on line {{ render(controller('App\\Controller\\NotificationController::detail')) }} in twig template.
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Reactions: 1
- Comments: 16 (11 by maintainers)
Well it is a comment from @mesiarm, I guess there is some miss understanding here.
it wasn’t provided an issue with steps to reproduce. and yeah snapshot isn’t related with runtime, I suspect it was just some cache that should be clean up.
and why I am saying it isn’t related with sonata? because his
oldandcurrentsolution just uses symfony’s code, nothing from sonata.the steps provided to reproduce are not reproducible for others, because you and @haivala migrated to symfony runtime and none of you faced this issue.
if it contains issue: it MUST have clear steps what need to do, otherwise it won’t be fixed!
You must install
symfony/runtimeand makes changes to your index.php according to it: https://symfony.com/doc/current/components/runtime.html after that the page runtime has to be defined in your composer.json.