src/EventListener/BrixsApplicantEventListener.php line 44

Open in your IDE?
  1. <?php
  2. namespace App\EventListener;
  3. use App\Event\ApplicantEvent;
  4. use App\Util\BrixsUtil;
  5. use Doctrine\ORM\EntityManagerInterface;
  6. use Exception;
  7. use Flagception\Manager\FeatureManagerInterface;
  8. class BrixsApplicantEventListener
  9. {
  10.     /**
  11.      * @var EntityManagerInterface
  12.      */
  13.     private $entityManager;
  14.     /**
  15.      * @var FeatureManagerInterface
  16.      */
  17.     private $featureManager;
  18.     /**
  19.      * @var BrixsUtil
  20.      */
  21.     private $brixs;
  22.     /**
  23.      * BrixsApplicantEventListener constructor.
  24.      */
  25.     public function __construct(
  26.         EntityManagerInterface $entityManager,
  27.         FeatureManagerInterface $featureManager,
  28.         BrixsUtil $brixs
  29.     ) {
  30.         $this->entityManager $entityManager;
  31.         $this->featureManager $featureManager;
  32.         $this->brixs $brixs;
  33.     }
  34.     /**
  35.      * @throws Exception
  36.      */
  37.     public function applicantSubmit(ApplicantEvent $applicantEvent)
  38.     {
  39.         if (!$this->featureManager->isActive(FeatureFlagListener::FEATURE_BRIXS)) {
  40.             return;
  41.         }
  42.         $applicant $applicantEvent->getApplicant();
  43.         $file $applicantEvent->getForm()['CVFile']->getData();
  44.         $this->brixs->postApplicant($applicant$file);
  45.     }
  46. }