coopTilleuls / CoopTilleulsCKEditorSonataMediaBundle

Integrates SonataMediaBundle for Symfony with CKEditor
http://les-tilleuls.coop
MIT License
53 stars 41 forks source link

Unable to generate a URL for the named route "admin_sonata_media_media_browser" #16

Closed lsv closed 8 years ago

lsv commented 9 years ago

Still getting this route error none of the solutions in #13 fixes it

config.yml

sonata_media:
    class:
        media: CmsBundle\Document\Media
        gallery: CmsBundle\Document\Gallery
    default_context: default
    db_driver: doctrine_mongodb
    contexts:
        default:
            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

    filesystem:
        local:
            directory:  %kernel.root_dir%/../web/uploads/media
            create:     false

route.yml

# Admin
admin:
    resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
    prefix: /admin

_sonata_admin:
    resource: .
    type: sonata_admin
    prefix: /admin

gallery:
    resource: '@SonataMediaBundle/Resources/config/routing/gallery.xml'
    prefix: /media/gallery

media:
    resource: '@SonataMediaBundle/Resources/config/routing/media.xml'
    prefix: /media

php app/console debug:router

[router] Current routes
 Name                                      Method   Scheme Host Path                                                                                                             
 sonata_admin_redirect                     ANY      ANY    ANY  /admin/                                                                 
 sonata_admin_dashboard                    ANY      ANY    ANY  /admin/dashboard                                                        
 sonata_admin_retrieve_form_element        ANY      ANY    ANY  /admin/core/get-form-field-element                                      
 sonata_admin_append_form_element          ANY      ANY    ANY  /admin/core/append-form-field-element                                   
 sonata_admin_short_object_information     ANY      ANY    ANY  /admin/core/get-short-object-description.{_format}                      
 sonata_admin_set_object_field_value       ANY      ANY    ANY  /admin/core/set-object-field-value                                      
 sonata_admin_search                       ANY      ANY    ANY  /admin/search                                                           
 sonata_admin_retrieve_autocomplete_items  ANY      ANY    ANY  /admin/core/get-autocomplete-items                                      
 admin_cms_media_list                      ANY      ANY    ANY  /admin/cms/media/list                                                   
 admin_cms_media_create                    ANY      ANY    ANY  /admin/cms/media/create                                                 
 admin_cms_media_batch                     ANY      ANY    ANY  /admin/cms/media/batch                                                  
 admin_cms_media_edit                      ANY      ANY    ANY  /admin/cms/media/{id}/edit                                              
 admin_cms_media_delete                    ANY      ANY    ANY  /admin/cms/media/{id}/delete                                            
 admin_cms_media_show                      ANY      ANY    ANY  /admin/cms/media/{id}/show                                              
 admin_cms_media_export                    ANY      ANY    ANY  /admin/cms/media/export                                                 
 admin_cms_media_browser                   ANY      ANY    ANY  /admin/cms/media/browser                                                
 admin_cms_media_upload                    ANY      ANY    ANY  /admin/cms/media/upload                                                 
 admin_cms_media_ckeditor_browser          ANY      ANY    ANY  /admin/cms/media/ckeditor_browser                                       
 admin_cms_media_ckeditor_upload           ANY      ANY    ANY  /admin/cms/media/ckeditor_upload                                        
 admin_cms_gallery_list                    ANY      ANY    ANY  /admin/cms/gallery/list                                                 
 admin_cms_gallery_create                  ANY      ANY    ANY  /admin/cms/gallery/create                                               
 admin_cms_gallery_batch                   ANY      ANY    ANY  /admin/cms/gallery/batch                                                
 admin_cms_gallery_edit                    ANY      ANY    ANY  /admin/cms/gallery/{id}/edit                                            
 admin_cms_gallery_delete                  ANY      ANY    ANY  /admin/cms/gallery/{id}/delete                                          
 admin_cms_gallery_show                    ANY      ANY    ANY  /admin/cms/gallery/{id}/show                                            
 admin_cms_gallery_export                  ANY      ANY    ANY  /admin/cms/gallery/export                                               
 admin_sonata_media_galleryhasmedia_list   ANY      ANY    ANY  /admin/sonata/media/galleryhasmedia/list                                
 admin_sonata_media_galleryhasmedia_create ANY      ANY    ANY  /admin/sonata/media/galleryhasmedia/create                              
 admin_sonata_media_galleryhasmedia_batch  ANY      ANY    ANY  /admin/sonata/media/galleryhasmedia/batch                               
 admin_sonata_media_galleryhasmedia_edit   ANY      ANY    ANY  /admin/sonata/media/galleryhasmedia/{id}/edit                           
 admin_sonata_media_galleryhasmedia_delete ANY      ANY    ANY  /admin/sonata/media/galleryhasmedia/{id}/delete                         
 admin_sonata_media_galleryhasmedia_show   ANY      ANY    ANY  /admin/sonata/media/galleryhasmedia/{id}/show                           
 admin_sonata_media_galleryhasmedia_export ANY      ANY    ANY  /admin/sonata/media/galleryhasmedia/export                              

AppKernel.php

<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
            new Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle(),
            new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
            new FOS\UserBundle\FOSUserBundle(),
            new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),

            # Admin bundles
            new Sonata\CoreBundle\SonataCoreBundle(),
            new Sonata\MediaBundle\SonataMediaBundle(),
            new Sonata\BlockBundle\SonataBlockBundle(),
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
            new JMS\SerializerBundle\JMSSerializerBundle(),
            new Sonata\DoctrineMongoDBAdminBundle\SonataDoctrineMongoDBAdminBundle(),
            new Sonata\AdminBundle\SonataAdminBundle(),
            new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(),
            new CoopTilleuls\Bundle\CKEditorSonataMediaBundle\CoopTilleulsCKEditorSonataMediaBundle(),
            new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
            new Sonata\FormatterBundle\SonataFormatterBundle(),
            new Sonata\IntlBundle\SonataIntlBundle(),
        );

        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new JMS\DiExtraBundle\JMSDiExtraBundle($this);
            $bundles[] = new JMS\AopBundle\JMSAopBundle();
            $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
            $bundles[] = new IsmaAmbrosi\Bundle\GeneratorBundle\IsmaAmbrosiGeneratorBundle();
            $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
            $bundles[] = new JMS\TranslationBundle\JMSTranslationBundle();
        }

        return $bundles;
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
    }
}
rafalrudnicki commented 9 years ago

Hi, Please check again your routes, sonata change my browser route to: admin_myappname_media_media_ckeditor_browser

bankette commented 9 years ago

@rafalrudnicki :+1: worked for me