Пример #1
0
 public function emailAddressConfirmed(BaseUser $user)
 {
     if (!empty($user->getNewEmail())) {
         $user->setEmail($user->getNewEmail());
         $user->setNewEmail(null);
     }
     $user->setEnabled(true);
     $this->resetTokenData($user);
     $event = new UserEvent($user);
     $this->dispatcher->dispatch(UserEvents::CONFIRMATION_SUCCESS, $event);
     $this->entityManager->persist($user);
     $this->entityManager->flush();
 }
Пример #2
0
 /**
  * Return the specific Section for an Exception Event
  *
  * @param $id
  * @param $name
  *
  * @return object|Section
  */
 private function getExceptionSection($id, $name)
 {
     // TODO Use a tagging system with internal tags. ie: _section_404
     $sectionRepository = $this->entityManager->getRepository('UnifikSystemBundle:Section');
     $sectionRepository->setCurrentAppName('frontend');
     $sectionRepository->setLocale($this->defaultLocale);
     $section = $sectionRepository->find($id);
     // Doesn't exist, create the Section
     if (!$section) {
         $section = new Section();
         $section->setCurrentLocale($this->defaultLocale);
         $section->setApp($this->entityManager->getRepository('UnifikSystemBundle:App')->find(2));
         $section->setId($id);
         $section->setName($this->translator->trans($name, array(), 'messages', $this->defaultLocale));
         $section->setActive(true);
         $this->entityManager->persist($section);
         // Force ID
         $metadata = $this->entityManager->getClassMetaData(get_class($section));
         $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
         $this->entityManager->flush();
     }
     return $section;
 }