src/AdminBundle/Admin/AdminLogAdmin.php line 11

Open in your IDE?
  1. <?php
  2. namespace AdminBundle\Admin;
  3. use Sonata\AdminBundle\Admin\AbstractAdmin;
  4. use Sonata\AdminBundle\Datagrid\ListMapper;
  5. use Sonata\AdminBundle\Route\RouteCollectionInterface;
  6. use Sonata\AdminBundle\Show\ShowMapper;
  7. class AdminLogAdmin extends AbstractAdmin
  8. {
  9.     protected function configureRoutes(RouteCollectionInterface $collection): void
  10.     {
  11.         $collection->remove('edit');
  12.         $collection->remove('create');
  13.         $collection->remove('delete');
  14.     }
  15.     protected function configureListFields(ListMapper $listMapper): void
  16.     {
  17.         $listMapper->addIdentifier('id')
  18.             ->add('date_create'null, ['label' => 'Дата'])
  19.             ->add('user.id'null, ['label' => 'Пользователь'])
  20.             ->addIdentifier('user.username'null, ['label' => 'Пользователь'])
  21.             ->add('entity_id'null, ['label' => 'ID'])
  22.             ->add('entity_type'null, ['label' => 'Сущность'])
  23.             ->add('before_data'null, ['label' => 'Before data'])
  24.             ->add('after_data'null, ['label' => 'After data'])
  25.             ->add(
  26.                 '_action',
  27.                 'actions',
  28.                 [
  29.                     'label' => 'Действия',
  30.                     'actions' => [
  31.                         'view' => [],
  32.                     ]
  33.                 ]
  34.             );
  35.     }
  36.     protected function configureShowFields(ShowMapper $show): void
  37.     {
  38.         $show
  39.             ->add('date_create'null, ['label' => 'Дата создания'])
  40.             ->add('user.id'null, ['label' => 'Пользователь ID'])
  41.             ->add('user.name'null, ['label' => 'Пользователь Имя'])
  42.             ->add('user.lastname'null, ['label' => 'Пользователь Фамилия'])
  43.             ->add('entity_id'null, ['label' => 'ID'])
  44.             ->add('entity_type'null, ['label' => 'Сущность'])
  45.             ->add('before_data'null, ['label' => 'Before data'])
  46.             ->add('after_data'null, ['label' => 'After data']);
  47.     }
  48. }