sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

Compatibility with 2.2 #1214

Closed ecentinela closed 11 years ago

ecentinela commented 11 years ago

I'm having problems with sonada admin and my new symfony 2.2 application. I create a new application with:

composer.phar create-project symfony/framework-standard-edition my_app 2.2.0

Installed sonata with this 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.2.*",
        "doctrine/orm": "~2.2,>=2.2.3",
        "doctrine/doctrine-bundle": "1.2.*",
        "twig/extensions": "1.0.*",
        "symfony/assetic-bundle": "2.1.*",
        "symfony/swiftmailer-bundle": "2.2.*",
        "symfony/monolog-bundle": "2.2.*",
        "sensio/distribution-bundle": "2.2.*",
        "sensio/framework-extra-bundle": "2.2.*",
        "sensio/generator-bundle": "2.2.*",
        "jms/security-extra-bundle": "1.4.*",
        "jms/di-extra-bundle": "1.3.*",

        "sonata-project/admin-bundle": "dev-master",
        "sonata-project/doctrine-orm-admin-bundle": "dev-master",
        "knplabs/knp-menu-bundle": "1.1.*-dev",
        "sonata-project/block-bundle": "dev-master"
    },
    "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"
        ],
        "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"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "minimum-stability": "alpha",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "branch-alias": {
            "dev-master": "2.2-dev"
        }
    }
}

Added sonata configuration to config.yml:

sonata_block:
    default_contexts: [cms]
    blocks:
        sonata.admin.block.admin_list:
            contexts:   [admin]

        sonata.block.service.text:

        sonata.block.service.action:

        sonata.block.service.rss:

sonata_admin:
    title:      Admin
    title_logo: /bundles/mybundle/images/apple-touch-icon-57-precomposed.png

And created a new bundle and controller. On the controller action, I just make an echo and exit.

Then, after saving controller file and config file, if I go to the action url I get an error:

FatalErrorException: Compile Error: Cannot redeclare class Symfony\Bundle\FrameworkBundle\Controller\Controller in /Users/javier/Documents/mercadotes/mercadotes.local/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php line 254

If I reload the page, the error dissapears, but if I save both files again (without any modification), and reload the page, the error appears again.

It's frustating.

mweimerskirch commented 11 years ago

This does not look like a Symfony 2.2 issue. Does your Controller use the right namespace?

ecentinela commented 11 years ago

Yes! It has been created with symfony console command. I just changed the route annotation and added echo and exit

stof commented 11 years ago

Actually, it is an issue in the bundle. It has been fixed in the 2.1 branch already. @rande you should merge it into master

ecentinela commented 11 years ago

Hope to be fixed soon. I was desperate

ecentinela commented 11 years ago

@rande when you will merge this fix? It's very annoying that every time I want to make a change, I need to reload the page two times :(

rande commented 11 years ago

You can create a PR with the merge! Le 8 mars 2013 19:48, "Javier Martinez Fernandez" notifications@github.com a écrit :

@rande https://github.com/rande when you will merge this fix? It's very annoying that every time I want to make a change, I need to reload the page two times :(

— Reply to this email directly or view it on GitHubhttps://github.com/sonata-project/SonataAdminBundle/issues/1214#issuecomment-14636944 .

ecentinela commented 11 years ago

@stof can you make this PR? I don't know where is the fix you said before?

ecentinela commented 11 years ago

@rande do you need a PR when a fix is already on another brand? (forgive my ignorance about git)

sstok commented 11 years ago

Actually you don't, but there might unrelated changes that can sneak in. Thats why its not recommended to back-port changes as this complicates things (no offense to range btw).

I guess its this one https://github.com/sonata-project/SonataAdminBundle/commit/b9170e82181970ee610bb787af4217690a0566f7 ? PS. @rande You can also just cherry pick.

rande commented 11 years ago

this should be fixed now!