I tried installing the sonata admin package to administer my users.
I use the FOS package.
I described the instructions, but everything went wrong, and I did not find that.
I have an error:
Unable to automatically determine the base route name, specify the default baseRouteName for the admin class UserBundle\Admin\UserAdmin in C: \ Users \ Alexandre \ hubiC \ www \ questionnaire \ app / config. (which is imported from "C: \ Users \ Alexandre \ hubiC \ www \ questionnaire \ app / config \ routing.yml").
In my service, I:
services: sonata.admin.user: class: UserBundle\Admin\UserAdmin tags: - { name: sonata.admin, manager_type: orm, group: "Content", label: "User" } arguments: - ~ - UserBundle\Entity\User - ~ calls: - [ setTranslationDomain, [UserBundle]]
In my configuration:
imports: - { resource: parameters.yml } - { resource: security.yml } - { resource: services.yml } - { resource: @UserBundle/Resources/config/admin.yml } sonata_block: default_contexts: [cms] blocks: # Enable the SonataAdminBundle block sonata.admin.block.admin_list: contexts: [admin] # Your other blocks
And the UserAdmin file:
<?php // namespace UserBundle\Admin; use Sonata\AdminBundle\Admin\Admin; use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Form\FormMapper; class UserAdmin extends Admin { // Fields to be shown on create/edit forms protected function configureFormFields(FormMapper $formMapper) { $formMapper ->add('nom') ->add('prenom') ->add('adresse') ->add('npa') ->add('localite') ->add('entreprise') ; } // Fields to be shown on filter forms protected function configureDatagridFilters(DatagridMapper $datagridMapper) { $datagridMapper ->add('nom') ->add('prenom') ->add('adresse') ->add('npa') ->add('localite') ->add('entreprise') ; } // Fields to be shown on lists protected function configureListFields(ListMapper $listMapper) { $listMapper ->addIdentifier('nom') ->add('prenom') ->add('adresse') ->add('npa') ->add('localite') ->add('entreprise') ; } }
This file is located in the UserBundle / Admin folder.
What happened?
thanks
source share