2
votes

I have a problem with my Symfony2-Project with SonataAdmin- and UserBundle. I installed and configured everything according to both Admin- and UserBundle-Documentations and tried to get it running, which seems fine for the start. So you can say that both Bundles come out-of-the-box. When I try to access the List of the users from the Admin-Dashboard (default Path /admin/sonata/user/user/list), then I get this:

An exception has been thrown during the rendering of a template
("Unable to generate a URL for the named route "value_user_create" as
such route does not exist.") in
"SonataAdminBundle:CRUD:list.html.twig".

As already described, neither did I change the default routing informations provided by Sonata, nor did I overwrite the Controller or anything. According to symfony console router:debug the route admin_sonata_user_user_create, amoungst other CRUD-routes, exists (pointing to /admin/sonata/user/user/create)

So to me it seems like the value in route-name value_user_create does not get replaced by admin_sonata_user-prefix, but that's just a thought and I cannot prove it. Anyways I can't find any place to fix that problem, so every help and tip might be helpful here.

Best Regards and thanks in advance

edit: my sonata user service looks like this:

sonata_user:
    security_acl: false
    class:
        user:   Application\Sonata\UserBundle\Entity\User
        group:  Application\Sonata\UserBundle\Entity\Group
    admin:
        user:
            class:          Repertorium\AdminBundle\Entity\UserAdmin
            controller:     SonataAdminBundle:CRUD
            translation:    SonataUserBundle
        group:
            class:          Sonata\UserBundle\Admin\Entity\GroupAdmin
            controller:     SonataAdminBundle:CRUD
            translation:    SonataUserBundle

After first comment here I created my own UserAdmin-Class which is derived from the default Sonata\UserBundle\Admin\Entity\UserAdmin-Class, except that it sets the baseRouteName to null as mentioned. As config says I'm using the default AdminBundle-CRUD-Controller. No override in that case or anything. Cleared cache, tried again - same error message. Also tried to set it to a Literal such as "user_admin", but same none-effect. Weird thing is, that all other routes seem to work fine; I can open the create user-page, as well as create group and list group-pages.

1

1 Answers

1
votes

How does your service definition looks like? Do you use the default CRUD controller? Also, it seems that you have Admin::$baseRouteName variable overwritten in your Admin class with 'value' instead of null. Try setting it like:

class UserAdmin extends Admin {

    public $baseRouteName = null;

    // ...
}

Does it change anything? Don't forget to try clearing your cache.