Пример #1
0
 public function loadUserByUsername($username)
 {
     $queryBuilder = $this->entityManager->getRepository('SehBundle:Customer')->createQueryBuilder('c')->andWhere('c.email = :username')->andWhere('c.password IS NOT NULL')->setParameters(array('username' => $username));
     $query = $queryBuilder->getQuery();
     if ($sehCustomer = $query->getOneOrNullResult()) {
         // Checking Ecircle Subscription
         $this->sehNewsletterManager->checkNewslettersByCustomer($sehCustomer);
         // Checking Token Facebook
         $this->facebookManager->setFacebookSessionByCustomer($sehCustomer);
         return $sehCustomer;
     }
     if (preg_match('/^\\d{13}$/', $username)) {
         $queryBuilder = $this->entityManager->getRepository('SehBundle:Customer')->createQueryBuilder('c')->join('c.accentCards', 'ca')->andWhere('ca.number = :accentCard')->setParameters(array('accentCard' => $username));
         $query = $queryBuilder->getQuery();
         if ($sehCustomer = $query->getOneOrNullResult()) {
             $username = $sehCustomer->getEmail();
         }
     }
     if ($galittCustomer = $this->galittProvider->getCustomer($username)) {
         $galittCustomer->setLoyalty(true);
         $this->entityManager->persist($galittCustomer);
         $this->entityManager->flush();
         // Checking Ecircle Subscription
         $this->sehNewsletterManager->checkNewslettersByCustomer($galittCustomer);
         // Checking Token Facebook
         $this->facebookManager->setFacebookSessionByCustomer($galittCustomer);
         return $galittCustomer;
     }
     throw new UsernameNotFoundException(sprintf('Username "%s" does not exist', $username));
 }
Пример #2
0
 /**
  * @param PostResponseEvent $event
  */
 public function onKernelTerminate(PostResponseEvent $event)
 {
     foreach ($this->users as $user) {
         try {
             $this->galittProvider->updateAccountFidelity($user);
         } catch (\Exception $e) {
             $this->logger->error(sprintf('An error occured while trying to update a customer (id : %s, email : %s) account on Galitt via the updateAccountFidelity webservice. Request failed with message : "%s"', $user->getId(), $user->getEmail(), $e->getMessage()));
         }
     }
 }
Пример #3
0
 /**
  * @param string $value
  * @param Constraint $constraint
  */
 public function validate($value, Constraint $constraint)
 {
     if ($value and $this->galittProvider->getAccountValidity($value) === false) {
         $this->context->addViolation($constraint->message);
     }
 }