src/Form/LoginType.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\Agent;
  4. use App\Repository\AgentRepository;
  5. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  6. use Symfony\Component\Form\AbstractType;
  7. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  8. use Symfony\Component\Form\Extension\Core\Type\PasswordType;
  9. use Symfony\Component\Form\FormBuilderInterface;
  10. use Symfony\Component\OptionsResolver\OptionsResolver;
  11. class LoginType extends AbstractType
  12. {
  13.     /**
  14.      * @var AgentRepository
  15.      */
  16.     private $agentRepository;
  17.     public function __construct(AgentRepository $agentRepository)
  18.     {
  19.         $this->agentRepository $agentRepository;
  20.     }
  21.     public function buildForm(FormBuilderInterface $builder, array $options)
  22.     {
  23.         $builder
  24.             ->add('login'EmailType::class,[
  25.                 'attr' => [
  26.                     'placeholder' => 'Email',
  27.                     'required' => true,
  28.                     'style' => 'background : #ddd;border:2px solid #005cbf;'
  29.                 ], 'label' => false
  30.             ])
  31.             ->add('password'PasswordType::class,[
  32.                 'attr' => [
  33.                     'placeholder' => '*************',
  34.                     'required' => true,
  35.                     'style' => 'background : #ddd;border:2px solid #005cbf;',
  36.                     'name' => '_password'
  37.                 ],
  38.                 'label' => false
  39.             ])
  40.         ;
  41.     }
  42.     public function configureOptions(OptionsResolver $resolver)
  43.     {
  44.         $resolver->setDefaults([
  45.            // 'data_class' => Utilisateur::class,
  46.             'action' => '/login'
  47.         ]);
  48.     }
  49. }