當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserInterface::getUsername方法代碼示例

本文整理匯總了PHP中FOS\UserBundle\Model\UserInterface::getUsername方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserInterface::getUsername方法的具體用法?PHP UserInterface::getUsername怎麽用?PHP UserInterface::getUsername使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FOS\UserBundle\Model\UserInterface的用法示例。


在下文中一共展示了UserInterface::getUsername方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sendMail

 protected function sendMail(JournalItemEvent $itemEvent, $item, $action)
 {
     $journalItem = $itemEvent->getItem();
     foreach ($this->ojsMailer->getJournalRelatedUsers() as $user) {
         $this->ojsMailer->sendToUser($user, 'A ' . $item . ' ' . $action . ' -> ' . $journalItem->getJournal()->getTitle(), 'A ' . $item . ' ' . $action . ' -> ' . $journalItem->getJournal()->getTitle() . ' -> by ' . $this->user->getUsername());
     }
 }
開發者ID:ojs,項目名稱:ojs,代碼行數:7,代碼來源:AbstractJournalItemMailer.php

示例2: sendMail

 protected function sendMail(JournalItemEvent $itemEvent, $item, $action)
 {
     $mailUsers = $this->em->getRepository('OjsUserBundle:User')->findUsersByJournalRole(['ROLE_JOURNAL_MANAGER', 'ROLE_EDITOR']);
     $journalItem = $itemEvent->getItem();
     foreach ($mailUsers as $user) {
         $this->ojsMailer->sendToUser($user, 'A ' . $item . ' ' . $action . ' -> ' . $journalItem->getJournal()->getTitle(), 'A ' . $item . ' ' . $action . ' -> ' . $journalItem->getJournal()->getTitle() . ' -> by ' . $this->user->getUsername());
     }
 }
開發者ID:beyzakokcan,項目名稱:ojs,代碼行數:8,代碼來源:AbstractJournalItemMailer.php

示例3: sendResettingEmailMessage

 /**
  * {@inheritdoc}
  */
 public function sendResettingEmailMessage(UserInterface $user)
 {
     $url = $this->router->generate('fos_user_resetting_reset', array('token' => $user->getConfirmationToken()), true);
     $subject = $this->translate('resetting.email.subject', $user->getUsername(), $url);
     $body = $this->translate('resetting.email.message', $user->getUsername(), $url);
     $rendered = $this->templating->render('@App/Utils/email_structure.html.twig', array('body' => $body));
     $this->sendEmailMessage($rendered, $subject, $this->parameters['from_email']['resetting'], $user->getEmail());
 }
開發者ID:nathix86,項目名稱:bcp-website,代碼行數:11,代碼來源:MailTransportUserMailer.php

示例4: onDeleteUser

 public function onDeleteUser(FilterEntityEvent $event)
 {
     $entity = $event->getEntity();
     if (!$entity instanceof UserInterface) {
         return;
     }
     if ($this->user->getUsername() === $entity->getUsername()) {
         $response = new JsonResponse(array('status' => false, 'message' => $this->translator->trans('message.cant_delete_your_self', array(), $this->container->getParameter('symfonian_id.admin.translation_domain'))));
         $event->setResponse($response);
     }
 }
開發者ID:deryfebriantara,項目名稱:AdminBundle,代碼行數:11,代碼來源:DeleteUserListener.php

示例5: sendMail

 /**
  * @param UserInterface $user
  * @param string $subject
  * @param string $body
  */
 private function sendMail(UserInterface $user, $subject, $body)
 {
     $message = $this->mailer->createMessage();
     $to = array($user->getEmail() => $user->getUsername());
     $message = $message->setSubject($subject)->addFrom($this->mailSender, $this->mailSenderName)->setTo($to)->setBody($body, 'text/html');
     $this->mailer->send($message);
 }
開發者ID:ulakjira,項目名稱:ojs,代碼行數:12,代碼來源:UserEventListener.php

示例6: getPrincipalArray

 /**
  * get Array with Principal-Data from User-Object.
  *
  * @param UserInterface|GroupInterface $principalObject
  * @param bool                         $show_id
  *
  * @return array
  *
  * @throws Exception
  */
 private function getPrincipalArray($principalObject, $show_id = false)
 {
     if (!$principalObject instanceof UserInterface && !$principalObject instanceof GroupInterface) {
         throw new Exception('$principalObject must be of type UserInterface of GroupInterface');
     }
     $principal = array();
     if ($show_id) {
         $principal['id'] = $principalObject->getId();
     }
     if ($principalObject instanceof UserInterface) {
         $principal['uri'] = 'principals/' . $principalObject->getUsername();
     } else {
         $principal['uri'] = 'principals/' . $principalObject->getName();
     }
     // get all fields from $this->fieldMap, additional to 'uri' and 'id'
     foreach ($this->fieldMap as $key => $value) {
         if (!method_exists($principalObject, $value['getter'])) {
             continue;
         }
         $valueGetter = call_user_func(array($principalObject, $value['getter']));
         if ($valueGetter) {
             $principal[$key] = $valueGetter;
         }
     }
     return $principal;
 }
開發者ID:bartv2,項目名稱:SecotrustSabreDavBundle,代碼行數:36,代碼來源:PrincipalBackend.php

示例7: updateUser

 /**
  * {@inheritdoc}
  */
 public function updateUser(UserInterface $user, $andFlush = true)
 {
     // Extract email part before the `@` character to use it as username is username not set
     if (null === $user->getUsername()) {
         $user->setUsername(substr($user->getEmail(), 0, strpos($user->getEmail(), '@')));
     }
     // Call parent after as does not override parent and parent do the flush
     parent::updateUser($user, $andFlush);
 }
開發者ID:PaskR,項目名稱:DunglasApiBundle,代碼行數:12,代碼來源:UserManager.php

示例8: onSuccess

 protected function onSuccess(UserInterface $user, $confirmation)
 {
     $user->setUsername($user->getUsername());
     $user->setLocked(false);
     $user->setEnabled(true);
     $user->setCreatedAt(new \DateTime('now'));
     $em = $this->container->get('doctrine.odm.mongodb.document_manager');
     parent::onSuccess($user, $confirmation);
 }
開發者ID:holtchesley,項目名稱:Zeega,代碼行數:9,代碼來源:RegistrationFormHandler.php

示例9: transform

 /**
  * Transforms a UserInterface instance into a username string.
  *
  * @param UserInterface|null $value UserInterface instance
  *
  * @return string|null Username
  *
  * @throws UnexpectedTypeException if the given value is not a UserInterface instance
  */
 public function transform($value)
 {
     if (null === $value) {
         return null;
     }
     if (!$value instanceof UserInterface) {
         throw new UnexpectedTypeException($value, 'FOS\\UserBundle\\Model\\UserInterface');
     }
     return $value->getUsername();
 }
開發者ID:neteasy-work,項目名稱:hkgbf_crm,代碼行數:19,代碼來源:UserToUsernameTransformer.php

示例10: SamlUser

 function it_load_user_by_username(SamlAuth $auth, UserInterface $user, UserManagerInterface $userManager)
 {
     $auth->getAttributes()->shouldBeCalled();
     $auth->getUsername()->shouldBeCalled();
     $auth->isAuthenticated()->shouldBeCalled();
     $user->getUsername()->shouldBeCalled();
     $user->getRoles()->shouldBeCalled();
     $userManager->findUserByUsername(self::USERNAME)->shouldBeCalled();
     $samlUser = new SamlUser('user@domain.com', ['ROLE_USER'], []);
     $this->loadUserByUsername('user@domain.com')->shouldBeLike($samlUser);
 }
開發者ID:aulasoftwarelibre,項目名稱:CeepsUserBundle,代碼行數:11,代碼來源:FosBackendSamlUserProviderSpec.php

示例11: getQueryPagination

 public function getQueryPagination(UserInterface $entity, $sort, $direction)
 {
     $queryBuilder = $this->createQueryBuilder('u');
     $data = ['id' => $entity->getId(), 'username' => $entity->getUsername(), 'email' => $entity->getEmail(), 'enabled' => $entity->isEnabled()];
     if (!empty($data['id'])) {
         $queryBuilder->andWhere($queryBuilder->expr()->eq('u.id', ':id'))->setParameter('id', $data['id']);
     }
     if (!empty($data['username'])) {
         $queryBuilder->andWhere($queryBuilder->expr()->like('u.username', ':username'))->setParameter('username', "%{$data['username']}%");
     }
     if (!empty($data['email'])) {
         $queryBuilder->andWhere($queryBuilder->expr()->like('u.email', ':email'))->setParameter('email', "%{$data['email']}%");
     }
     if (!empty($data['enabled'])) {
         $queryBuilder->andWhere($queryBuilder->expr()->eq('u.enabled', ':enabled'))->setParameter('enabled', $data['enabled']);
     }
     $queryBuilder->orderBy('u.' . $sort, $direction);
     return $queryBuilder->getQuery();
 }
開發者ID:a2c,項目名稱:bacon-manager,代碼行數:19,代碼來源:UserRepository.php

示例12: getUsername

 public function getUsername()
 {
     return $this->user->getUsername();
 }
開發者ID:kolinalabs,項目名稱:customer-bundle,代碼行數:4,代碼來源:UserTrait.php

示例13: attachRefreshToken

 /**
  * Provides a refresh token.
  *
  * @param UserInterface $user
  *
  * @return string The refresh Json Web Token.
  */
 protected function attachRefreshToken(UserInterface $user)
 {
     $refreshTokenManager = $this->container->get('gesdinet.jwtrefreshtoken.refresh_token_manager');
     $refreshToken = $refreshTokenManager->getLastFromUsername($user->getUsername());
     $refreshTokenTtl = $this->container->getParameter('gesdinet_jwt_refresh_token.ttl');
     if (!$refreshToken instanceof RefreshToken) {
         $refreshToken = $refreshTokenManager->create();
         $expirationDate = new \DateTime();
         $expirationDate->modify(sprintf('+%s seconds', $refreshTokenTtl));
         $refreshToken->setUsername($user->getUsername());
         $refreshToken->setRefreshToken();
         $refreshToken->setValid($expirationDate);
         $refreshTokenManager->save($refreshToken);
     }
     return $refreshToken->getRefreshToken();
 }
開發者ID:chalasr,項目名稱:RCHJWTUserBundle,代碼行數:23,代碼來源:SecurityController.php

示例14: updateCanonicalFields

 /**
  * {@inheritdoc}
  */
 public function updateCanonicalFields(UserInterface $user)
 {
     $user->setUsernameCanonical(strtolower($user->getUsername()));
     $user->setEmailCanonical(strtolower($user->getEmail()));
 }
開發者ID:WebschoolPoitiers,項目名稱:ODEV2,代碼行數:8,代碼來源:UserManager.php

示例15: sendToUser

 /**
  * @param UserInterface $user
  * @param string $subject
  * @param string $body
  */
 public function sendToUser(UserInterface $user, $subject, $body)
 {
     $this->send($subject, $body, $user->getEmail(), $user->getUsername());
 }
開發者ID:beyzakokcan,項目名稱:ojs,代碼行數:9,代碼來源:OjsMailer.php


注:本文中的FOS\UserBundle\Model\UserInterface::getUsername方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。