Question

I have been trying for a few days to get Sonata Media Bundle working inside Symfony. I have reinstalled it a few times in different orders, and all sorts. Every time I install I get the following error:

[RuntimeException]
The autoloader expected class "Sonata\MediaBundle\Document\ODM\BaseGallery" to be defined in file "/vagrant/app/../vendor/bundles/Sonata/MediaBundle/Document/ODM/BaseGallery.php". The file was found but the class was not in it, the class name or namespace probably has a typo.

I can see it is trying to load a Document. I have a mongodb database configured but I am not using it yet, and am using MySQL primarily.

I can mess around with the namespace inside these files which obviously fixes this error, but just causes lots of different errors, and I shouldn't need to do this anyway.

Setup: (default ATM from docs) - config.yml

sonata_media:
    default_context: default
    db_driver: doctrine_orm # or doctrine_mongodb
    contexts:
        default:  # the default context is mandatory
            providers:
                - sonata.media.provider.dailymotion
                - sonata.media.provider.youtube
                - sonata.media.provider.image
                - sonata.media.provider.file

            formats:
                small: { width: 100 , quality: 70}
                big:   { width: 500 , quality: 70}

    cdn:
        server:
            path: /uploads/media # http://media.sonata-project.org/

    filesystem:
        local:
            directory:  %kernel.root_dir%/../web/uploads/media
            create:     false
Was it helpful?

Solution

Think it's a bug - I have just submitted a pull request to fix it.

https://github.com/sonata-project/SonataMediaBundle/pull/134

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top