Closed DamienDeSousa closed 4 years ago
Hi, I already created an issue but in the wrong project. You can find it here
I looked in the vendor/sonata-project/seo-bundle/src/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php file and I edit the following lines (line 123 to 125):
You can use permalinks for this, like so: https://github.com/sonata-project/SonataSeoBundle/blob/2c9c4629b4ed66bdbee6d813c1d5eef95e14e193/src/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php#L119-L125
Looking at the history of knp/menu
, both setCurrent
and setUri
seem very old, not sure why/if we need these method_exists
calls.
I think they were needed for support of knp/menu
1 https://github.com/sonata-project/SonataSeoBundle/commit/b0ae33a121ab8beb2a517224b778d46fd50faca8
That version does not support php 7, which we require, so we can just drop both checks
@DamienDeSousa consider sending a PR with your fix, but without the if
I close this issue and link here the Pull Request.
Environment
I get this bug in my docker container.
Sonata packages
Symfony packages
Knp packages
PHP version
Subject
I am following the Page Bundle chapter 4 - Getting Started.
When I go on the root page, I get an error on the Knp\Menu\MenuItem::setCurrent().
Steps to reproduce
Install the SonataPageBundle, then follow all steps up to chapter 4 - Getting started. I ran the following commands :
bin/console sonata:page:create-site --enabled=true --name=localhost --locale=- --host=localhost --relativePath=/ --enabledFrom=now --enabledTo="+10 years" --default=true
php bin/console sonata:page:update-core-routes --site=all
php bin/console sonata:page:create-snapshots --site=all
All these commands return a OK result like in the tutorial. Then go onthe url http://base_url/
to see the error.Expected results
The expected result is the following (I suppose):
Actual results
I have the following result:
This is the stack trace:
I looked in the vendor/sonata-project/seo-bundle/src/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php file and I edit the following lines (line 123 to 125):
to these new lines:
And it fix the problem.
Before submitting the issue, I check on the already present issues and I don't find something similar. If an issue already exists, I am very sorry, I didn't seen this one :/
Don't hesistate to tell me if my fix really fix the problem or not :D
I'm not sure if it's a real bug or just a wrong dependency on my project. If you need more informations ask me :D