src/AdminBundle/Admin/Report/CriticalLogAdmin.php line 10

Open in your IDE?
  1. <?php
  2. namespace AdminBundle\Admin\Report;
  3. use AdminBundle\Admin\BaseAdmin;
  4. use Sonata\AdminBundle\Datagrid\ListMapper;
  5. use Sonata\AdminBundle\Route\RouteCollectionInterface;
  6. use Sonata\AdminBundle\Show\ShowMapper;
  7. class CriticalLogAdmin extends BaseAdmin
  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('message',null, ['label' => 'Message'])
  19.             ->add('contextForAdmin''text', ['label' => 'Context'])
  20.             ->add('level',null, ['label' => 'Level'])
  21.             ->add('level_name'null, ['label' => 'Level name'])
  22.             ->add('domain'null, ['label' => 'Domain'])
  23.             ->add('created_at'null, ['label' => 'Created At'])
  24.             ->add('_action''actions', [
  25.                 'label' => 'Действия',
  26.                 'actions' => [
  27.                     'view' => [],
  28.                 ]
  29.             ])
  30.         ;
  31.     }
  32.     protected function configureShowFields(ShowMapper $show): void
  33.     {
  34.         $show
  35.             ->add('message',null, ['label' => 'Message'])
  36.             ->add('contextForAdmin''textarea', ['label' => 'Context'])
  37.             ->add('extraForAdmin''textarea', ['label' => 'Extra'])
  38.             ->add('level',null, ['label' => 'Level'])
  39.             ->add('level_name',null, ['label' => 'Level name'])
  40.             ->add('domain',null, ['label' => 'Domain'])
  41.             ->add('created_at',null, ['label' => 'Created At']);
  42.     }
  43.     protected $datagridValues = [
  44.         '_sort_order' => 'DESC',
  45.         '_sort_by' => 'id',
  46.     ];
  47. }