Пример #1
0
 /**
  * @param UserInterface $user
  * @return VanillaUser
  */
 public function createVanillaUser(UserInterface $user)
 {
     /** @var $user \FOS\UserBundle\Model\User */
     $vanillaUser = new VanillaUser($user->getUsername());
     $vanillaUser->setEmail($user->getEmail());
     if ($user->isSuperAdmin()) {
         $vanillaUser->setRoles([VanillaUser::ROLE_MEMBER, VanillaUser::ROLE_ADMINISTRATOR]);
     }
     return $vanillaUser;
 }
Пример #2
0
 /**
  * @param VanillaUser $user
  * @return int
  */
 public function register(VanillaUser $user)
 {
     $fields = ['Name' => $user->getName(), 'Email' => $user->getEmail(), 'Password' => $user->getPassword(), 'ShowEmail' => (int) $user->isShowEmail(), 'DateFirstVisit' => $user->getDateFirstVisit()->format('U'), 'DateLastActive' => $user->getDateLastActive()->format('U'), 'DateInserted' => $user->getDateInserted()->format('U'), 'LastIPAddress' => $user->getLastIPAddress(), 'InsertIPAddress' => $user->getInsertIPAddress(), 'Photo' => $user->getPhoto(), 'Title' => $user->getTitle(), 'Roles' => $user->getRoles()];
     $options = ['SaveRoles' => 1, 'NoConfirmEmail' => 1];
     $uid = (int) $this->_Insert($fields, $options);
     $this->UpdateVisit($uid);
     return $uid;
 }