-
Notifications
You must be signed in to change notification settings - Fork 20
How to add the Sonata Media Bundle
This method for installing the Sonata Media Bundle into the Sonata Distribution was successfully completed on January 29th, 2014, eventually they won't work anymore. At that time please figure it out and update the Wiki, only you can prevent bad documentation.
The Sonata Media Bundle is an off the shelf module for uploading, performing basic parsing on, storing, & displaying media.
It's also really easy to add to this Sonata Distribution, assuming the following adjustments to the standard instructions are used.
Default install Doc: http://sonata-project.org/bundles/media/master/doc/reference/installation.html
The default doc is very close so this document will just highlight the differences.
- skip adding the doctrine-orm-admin-bundle, it's already in the distribution
- when asked for a version for the media-bundle, 2.2.6 is known to work, failing that try dev-master
- at the time of writing this doc the SonataCoreBundle() was just getting started and 2.2.6 did not use it yet, so skip that
- also skip the SonataEasyExtendsBundle() because it's already part of the distribution
- add the routing to app/config/routing_sonata.yml - The _sonata is just a convention to keep the config files more organized
- doctrine: skip adding entity_mappers, @fabpot made this redundant with "auto_mapping: true", see this blog post: http://symfony.com/blog/symfony2-getting-easier
- doctrine_phpcr: also safe to skip
- sonata_media: add this to app/config/config_sonata.yml, again just separated out to keep the files organized.
-
add "--dest=src" like so:
php app/console sonata:easy-extends:generate SonataMediaBundle --dest=src
This will put the generated code next to the UserBundle already in the distribution, and have it picked up by the autoloader, instead of giving you cryptic errors that take hours and hours to diagnose. Not that I'm bitter ;)
- register the bundle as normal, but put it after the distribution's user bundle, grouping generated sonata module just for OCD style points.
- once again you can ignore the entity mappers through the magic of "auto_mapping: true"
-
only do this on dev, after you backup:
app/console doctrine:schema:update --force
It adds the tables you'll need to make the Sonata Media Bundle go
- no changes
- make sure you php.ini allows your app to handle big image sizes both for uploading and for processing into smaller sizes
- make sure GD is installed and the extension is turned on in your PHP install
- stuff's going to work a little better if you go ahead and set up a local url, not a big deal.
- remember to restart apache if you're still using it.