src/Controller/Admin/AppPushNotificationCrudController.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Admin;
  3. use App\Entity\AppPushNotification;
  4. use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
  5. use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
  6. use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
  7. use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
  8. use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
  9. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  10. class AppPushNotificationCrudController extends AbstractCrudController
  11. {
  12.     public static function getEntityFqcn(): string
  13.     {
  14.         return AppPushNotification::class;
  15.     }
  16. //    public function createEntity(string $entityFqcn)
  17. //    {
  18. //        $appPushNotification = new AppPushNotification();
  19. //        $appPushNotification->setAuthor($this->getUser());
  20. //
  21. //        return $article;
  22. //    }
  23. //    public function configureFilters(Filters $filters): Filters
  24. //    {
  25. //        return $filters
  26. //            ->add('publishedAt');
  27. //    }
  28.     public function configureCrud(Crud $crud): Crud
  29.     {
  30.         return $crud
  31.             ->setEntityLabelInSingular('Notification Push')
  32.             ->setEntityLabelInPlural('Notifications Push')
  33.             ->setSearchFields(['code''title''text']);
  34.     }
  35.     public function configureFields(string $pageName): iterable
  36.     {
  37.         $id IntegerField::new('id''ID');
  38.         $code TextField::new('code','Code Unique');
  39.         $title TextField::new('title','Titre');
  40.         $text TextField::new('text','Contenu');
  41.         if (Crud::PAGE_INDEX === $pageName) {
  42.             return [$id$code$title$text];
  43.         }
  44.         return [
  45.             FormField::addPanel('Informations'),
  46.             $code$title$text
  47.         ];
  48.     }
  49. }