← Back
Editing: OrganizationCrudController.php
<?php namespace App\Controller\Admin; use App\Entity\Organization; use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; use EasyCorp\Bundle\EasyAdminBundle\Config\Filters; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\BooleanField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use Symfony\Component\HttpKernel\KernelInterface; class OrganizationCrudController extends AbstractCrudController { private $basePath; public function __construct(KernelInterface $kernel) { $this->basePath = $kernel->getProjectDir().'/public/uploads/logos/'; } public static function getEntityFqcn(): string { return Organization::class; } public function configureCrud(Crud $crud): Crud { return $crud // the visible title at the top of the page and the content of the <title> element // it can include these placeholders: %entity_id%, %entity_label_singular%, %entity_label_plural% ->setPageTitle('index', 'Organismes'); } public function configureFilters(Filters $filters): Filters { return $filters ->add('name'); } public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), ImageField::new('logo') ->setBasePath('/uploads/logos/') ->setUploadDir('/public/uploads/logos/'), TextField::new('name'), AssociationField::new('solutions'), BooleanField::new('isActive'), ]; } }
Save File
Cancel