sonata-project / SonataFormatterBundle

Symfony SonataFormatterBundle
https://docs.sonata-project.org/projects/SonataFormatterBundle
MIT License
81 stars 117 forks source link

Dependency on MediaAdminController in CkeditorAdminController.php #88

Closed jasperdcbe closed 9 years ago

jasperdcbe commented 9 years ago

Hi there, I just included the SonataFormatterBundle in one of our projects and I noticed that there is a hard dependency on the SonataMediaBundle. Is there any way around this by changing the configuration?

When clearing the Symfony cache I receive the following exception: PHP Fatal error: Class 'Sonata\MediaBundle\Controller\MediaAdminController' not found in /var/www/vendor/sonata-project/formatter-bundle/Controller/CkeditorAdminController.php on line 21

rande commented 9 years ago

Can you provide a stack trace ?

jasperdcbe commented 9 years ago

I tried to run cache:clear in verbose mode but no extra information here: www-data@packer-virtualbox-iso:~/csmb$ app/console cache:clear -vvv Clearing the cache for the dev environment with debug true PHP Fatal error: Class 'Sonata\MediaBundle\Controller\MediaAdminController' not found in /var/www/vendor/sonata-project/formatter-bundle/Controller/CkeditorAdminController.php on line 21

jasperdcbe commented 9 years ago

I went through the list of used bundles and disabled "JmsDiExtraBundle" and this solved the problem. Thanks for the quick response.

rande commented 9 years ago

@jasperdcbe so it seems to be an issue with JmsDIExtraBundle. So if you want to use JmsDIExtraBundle and SonataFormatterBundle, you need to install optionals dependencies as JMS introspection can load non existant class.

jasperdcbe commented 9 years ago

Indeed @rande, after doing some research I came to the conclusion the JmsDiExtraBundle was not really necessary in this project anyway so I removed it and now the formatter block is working nicely with SonataPageBundle :-)

Davidmattei commented 9 years ago

If you still need the JmsDiExtraBundle, add following code to your symfony app config.

jms_di_extra:
    cache_warmer:
        controller_file_blacklist: 
            - /var/www/vendor/sonata-project/formatter-bundle/Controller/CkeditorAdminController.php
sagikazarmark commented 8 years ago

Thanks @Davidmattei, helped me a lot. I changed your config a bit:

    cache_warmer:
        controller_file_blacklist:
            - %kernel.root_dir%/../vendor/sonata-project/formatter-bundle/Controller/CkeditorAdminController.php
OskarStark commented 8 years ago

@sagikazarmark can you add this to the docs? or what can we do to "fix" this?

sagikazarmark commented 8 years ago

Not sure yet what the problem is, but will try to look into it. Until then, this is google first hit.

OskarStark commented 8 years ago

:+1: :smile: