|
12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?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;
-
- 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())
- ];
- }
- }
|