5 articles Sonata

Install Sonata

Install Sonata Note To speed up the installation, all composer are used with –no update option. composer update is only used at the end of the installation to get all bundles in once. Get Sonata Make sure composer is updated # sudo /usr/local/bin/composer self-update Get Sonata Bundle # composer require sonata-project/admin-bundle –no-update Get ORM Bundle # composer require…

Sonata – Install UserBundle

Install Sonata user Installation Install FOS # composer require friendsofsymfony/user-bundle –no-update Enable the bundle # composer require sonata-project/user-bundle –no-update # composer require sonata-project/doctrine-orm-admin-bundle –no-update # optional # composer update Then add in app/AppKernel.php <?php // app/AppKernel.php public function registerbundles() { return array( // … // extend the “FOSUserBundle“ new FOS\UserBundle\FOSUserBundle(), new Sonata\UserBundle\SonataUserBundle(‘FOSUserBundle’), ); } Enable preventing…

Sonata – Install MediaBundle

Composer install Installation Execute: composer require sonata-project/media-bundle –no-update composer require jms/serializer-bundle –no-update composer require sonata-project/intl-bundle –no-update composer update Add in app/AppKernel.php # app/AppKernel.php public function registerBundles() {     $bundles = array( /…/ // MediaBundle         new Sonata\MediaBundle\SonataMediaBundle(),         new JMS\SerializerBundle\JMSSerializerBundle(),         new Sonata\IntlBundle\SonataIntlBundle(), /…/ }…

Sonata – MediaBundle Image Resizer

Sonata MediaBundle comes with two type of resizer: sonata.media.resizer.simple and sonata.media.resizer.square. To make a custom resizer which will always keeps the same defined width and height, you need to create your own custom resizer. Step 1: create a service First you have to create a resizer service in order to call it: # app/config/services.yml services:…

Sonata – miscellaneous configuration

Change Sonata Admin bottom sidebar link To change the Sonata Admin bottom sidebar link, you need to: Create the file src/Acme/AdminBundle/standard_layout.html.twig Add : {% extends ‘SonataAdminBundle::standard_layout.html.twig’ %} {% block side_bar_after_nav %} your custom link here {% endblock %} Then add in app/config/config.yml: sonata_admin: // … templates: layout: CanalAdminBundle::standard_layout.html.twig Sonata Admin Remember me To make remember…