|
123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
-
- namespace Lc\SovBundle\Controller\User;
-
- use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\EmailField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
- use Lc\SovBundle\Controller\AbstractAdminController;
- use Lc\SovBundle\Definition\RolesDefinition;
- use Lc\SovBundle\Definition\RolesDefinitionInterface;
- use Lc\SovBundle\Doctrine\EntityManager;
- use Lc\SovBundle\Translation\TranslatorAdmin;
- use Symfony\Component\HttpFoundation\RequestStack;
- use Symfony\Component\HttpFoundation\Session\SessionInterface;
-
- use function Symfony\Component\Translation\t;
-
- abstract class UserAdminController extends AbstractAdminController
- {
- protected $rolesDefinition;
- public function __construct(
- SessionInterface $session,
- RequestStack $request,
- EntityManager $em,
- TranslatorAdmin $translatorAdmin,
- RolesDefinitionInterface $rolesDefinition
- ) {
- parent::__construct($session, $request, $em, $translatorAdmin);
- $this->rolesDefinition = $rolesDefinition;
- }
-
- public function configureFields(string $pageName): iterable
- {
-
- return [
- EmailField::new('email'),
- TextField::new('lastname'),
- TextField::new('firstname'),
- ChoiceField::new('roles')
- ->allowMultipleChoices()
- ->autocomplete()
- ->setChoices($this->rolesDefinition->getRolesList())
- ];
- }
- }
|