src/Admin/Controller/AgreementCrudController.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Admin\Controller;
  3. use App\Entity\Agreement;
  4. use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
  5. use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
  6. use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
  7. use EasyCorp\Bundle\EasyAdminBundle\Config\Filters;
  8. use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
  9. use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
  10. use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
  11. use EasyCorp\Bundle\EasyAdminBundle\Field\Field;
  12. use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
  13. use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField;
  14. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  15. class AgreementCrudController extends AbstractCrudController
  16. {
  17.     public static function getEntityFqcn(): string
  18.     {
  19.         return Agreement::class;
  20.     }
  21.     public function configureCrud(Crud $crud): Crud
  22.     {
  23.         return $crud
  24.             ->setEntityLabelInSingular('Agreement')
  25.             ->setEntityLabelInPlural('Agreements')
  26.             ->setSearchFields(['id''customer_id''customer.name_original''code''name_original''currency_id''organization_id''priceType.name_original''comment''customer_segment_id''source_id''source_type']);
  27.     }
  28.     public function configureFilters(Filters $filters): Filters
  29.     {
  30.         return parent::configureFilters($filters)
  31.             ->add('priceType')
  32.             ->add('organization');
  33.     }
  34.     public function configureActions(Actions $actions): Actions
  35.     {
  36.         return $actions
  37.             ->remove(Crud::PAGE_INDEXAction::NEW)
  38.             ->remove(Crud::PAGE_INDEXAction::DELETE)
  39.             ->remove(Crud::PAGE_INDEXAction::EDIT)
  40.             ;
  41.     }
  42.     public function configureFields(string $pageName): iterable
  43.     {
  44.         $customerId IntegerField::new('customer_id');
  45.         $code TextField::new('code');
  46.         $nameOriginal TextField::new('name_original''Name original');
  47.         $currencyId IntegerField::new('currency_id');
  48.         $organizationId IntegerField::new('organization_id');
  49.         $priceTypeId IntegerField::new('price_type_id');
  50.         $comment TextareaField::new('comment');
  51.         $isDefault Field::new('is_default','Default');
  52.         $enabled Field::new('enabled');
  53.         $customerSegmentId IntegerField::new('customer_segment_id');
  54.         $needBalanceBuild Field::new('needBalanceBuild');
  55.         $sourceId TextField::new('source_id');
  56.         $sourceType TextField::new('source_type');
  57.         $deletedAt DateTimeField::new('deletedAt');
  58.         $createdAt DateTimeField::new('createdAt');
  59.         $updatedAt DateTimeField::new('updatedAt');
  60.         $customer AssociationField::new('customer');
  61.         $currency AssociationField::new('currency');
  62.         $organization AssociationField::new('organization');
  63.         $priceType AssociationField::new('priceType''Price type');
  64.         $customerSegment AssociationField::new('customerSegment');
  65.         $id IntegerField::new('id''ID');
  66.         $name TextareaField::new('name');
  67.         $customerSegment TextareaField::new('customer_segment''Customer segment');
  68.         return [$id$enabled$nameOriginal$name$customer$organization$priceType$currency$customerSegment$isDefault];
  69.     }
  70. }