Closed ozzmaster closed 10 years ago
I am currently thinking about a solution for this too.. Hope to make progress this evening .. if you have any ideas give me a hint
A temporary solution for this issue is to define the knp-menu/knp-menu-bundle in composer as follows:
"knplabs/knp-menu": "dev-master as 1.1",
"knplabs/knp-menu-bundle": "dev-master as 1.1",
It installs the dev-master, but marks it as 1.1, which handles the sonata requirements.
There really isn't a solution for this unless we re-write a lot of stuff. the 1.1.x branch of knpmenu hasn't been updated in over a year and doesn't support menu extensions which was used to make navbars possible. You can still use these bundles together, but just don't enable the navbar extension or use the mopa_bootstrap_menu twig functions. Eg, remove this line if you have it:
mopa_bootstrap:
navbar: ~ # Remove this
It will no longer try to load the knpmenu extension if you remove this. However your issue is probably from a bug that was comitted 2 days ago that made the navbar stuff always on. If you pull master again this shouldn't be a problem anymore.
Thanks, guys!
This worked: mopa_bootstrap: navbar: ~ # Remove this
The issue is that Sonata-Admin has a requirement of KnpMenu 1.1, but 2.0 is fully compatible as well. So you just need to install KnpMenu 2.0, but trick Sonata Admin to think it's actually 1.1, to satistfy it's dependencies.
The requirements in Composer that I wrote above - do just that.
Incredible trick nethunter ! I searched for 3 days how-to work around ... ! Thanks !
So state is sorrowly: sonataadmin required knp menu 1.1 if you need this in a prod system you can not use it together with master branch. you need to use one of the older branches still using the old way
using @nethunter 's trick leads to setCurrentUri isnt defined etc in sonata admin, for my projects in dev i am changing this in sonata admin bundle
if we could provide a bc bridge to use both world that would be awesome
We still want a solution =[
this is a knpmenu / sonataadmin issue :/
Sadly, I know =(
It seems that they don't want to do Anything about that. They don't even answer any issue ... They only accepts Pull Requests ... Ahah. Do you know another way to generate an admin site ? The fact that I have my entire website using your wonderful bundle except the backend ...
I saw http://symfony2admingenerator.org but I'm not sure it's a good bundle or not..
Hi
I managed to fix the incompatibility between SonataAdminBundle and the latest version of the KNPMenuBundle by adding the setCurrentUri function to my local code (when they update the menu bundle I overwrite local and just add the function again).
I am now able to use SonataAdminBundle, KNPMenuBundle (latest version) and the latest version of this bundle.
I can add more info if it will help someone else.
I think a lot of people would be interested by your tweak as a lot of topics exists in different issues and StackOverflow's threads without any working/acceptable fix. I will try it first ^_^
OK:
My composer.json file:
{ "name": "symfony/framework-standard-edition", "description": "The \"Symfony Standard Edition\" distribution", "autoload": { "psr-0": { "": "src/" } }, "require": { "php": ">=5.3.3", "symfony/symfony": "2.3.@dev", "doctrine/orm": "2.3.@dev", "doctrine/doctrine-bundle": "1.2.@dev", "gedmo/doctrine-extensions": "2.3.@dev", "twig/extensions": "1.0.@dev", "symfony/assetic-bundle": "2.3.@dev", "symfony/swiftmailer-bundle": "2.2.@dev", "symfony/monolog-bundle": "2.2.@dev", "sensio/distribution-bundle": "2.2.@dev", "sensio/framework-extra-bundle": "2.2.@dev", "sensio/generator-bundle": "2.2.@dev", "jms/security-extra-bundle": "1.5.@dev", "jms/di-extra-bundle": "1.4.@dev", "doctrine/doctrine-fixtures-bundle": "dev-master", "knplabs/knp-paginator-bundle": "dev-master", "knplabs/knp-menu-bundle": "dev-master as 1.1", "sonata-project/admin-bundle": "dev-master", "sonata-project/doctrine-orm-admin-bundle": "2.2.@dev", "sonata-project/user-bundle": "2.2.@dev", "sonata-project/cache-bundle": "2.1.@dev", "friendsofsymfony/jsrouting-bundle": "dev-master", "mopa/bootstrap-bundle": "dev-master", "twbs/bootstrap": "dev-master", "craue/formflow-bundle": "dev-master", "liip/theme-bundle": "dev-master", "noiselabs/smarty-bundle": "dev-master", "egeloen/ckeditor-bundle": "dev-master", "simplethings/entity-audit-bundle": "dev-master", "egeloen/google-map-bundle": "2.1.@dev", "kriswallsmith/buzz": "", "willdurand/geocoder": "2.2.@dev", "widop/http-adapter-bundle": "1.1.@dev", "symfony/stopwatch": "2.3.@dev", "pk/markdownify-bundle": "dev-master", "gregwar/captcha-bundle": "dev-master", "friendsofsymfony/elastica-bundle": "3.0.@dev" }, "scripts": { "post-install-cmd": [ "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap", "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache", "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets", "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile", "Mopa\Bundle\BootstrapBundle\Composer\ScriptHandler::postInstallSymlinkTwitterBootstrap" ], "post-update-cmd": [ "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap", "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache", "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets", "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile", "Mopa\Bundle\BootstrapBundle\Composer\ScriptHandler::postInstallSymlinkTwitterBootstrap" ] },
"include-path": ["vendor/smarty/smarty/distribution/libs/"],
"minimum-stability": "dev",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web"
}
}
Then I get this error when I open a screen in Sonata Admin Bundle:
PHP Fatal error: Call to undefined method Knp\Menu\MenuItem::setCurrentUri() in ...
So I add these lines in ~/vendor/knplabs/knp-menu/src/Knp/Menu/MenuItem.php on line 155 (just after setUri function):
public function setCurrentUri($uri)
{
return $this->setUri($uri);
}
Problem solved! Sonata works and I am able to carry on working. I keep an eye on updates for a fix and hope I can remove my hot fix soon.
Hello
I get this error:
PHP Fatal error: Interface 'Knp\Menu\Factory\ExtensionInterface' not found in /home/otto/wwwroots/BitBucket/iga-core-symfony/iga-core-2.1/vendor/mopa/bootstrap-bundle/Mopa/Bundle/BootstrapBundle/Navbar/Factory/NavbarExtension.php on line 9
Sonata admin bundle requires version 1.1 of this menu bundle. I have logged an issue there as well.
Can I help to implement a fix for this issue on this bundle?
Thanks in advance.