当前位置: 首页>>代码示例>>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;未经允许,请勿转载。