当前位置: 首页>>代码示例>>PHP>>正文


PHP UserInterface::getId方法代码示例

本文整理汇总了PHP中FOS\UserBundle\Model\UserInterface::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP UserInterface::getId方法的具体用法?PHP UserInterface::getId怎么用?PHP UserInterface::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FOS\UserBundle\Model\UserInterface的用法示例。


在下文中一共展示了UserInterface::getId方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: withEntity

 /**
  * @param UserInterface $user
  * @return UserDTO
  */
 public static function withEntity(UserInterface $user)
 {
     $dto = new UserDTO();
     $dto->setId($user->getId());
     $dto->setEmail($user->getEmail());
     $dto->setApiKey($user->getApiKey());
     return $dto;
 }
开发者ID:sfarkas1988,项目名称:timekeepingAPI,代码行数:12,代码来源:UserDTO.php

示例3: createRecoveryToken

 /**
  * @param UserInterface $user
  * @return bool|HttpToken
  */
 public function createRecoveryToken(UserInterface $user)
 {
     $currentDateTime = new \DateTime('now');
     $expiresAt = clone $currentDateTime;
     $expiresAt->add(new \DateInterval('PT' . self::LIFE_TIME_RECOVERY . 'S'));
     $refreshTo = clone $currentDateTime;
     $refreshTo->add(new \DateInterval('PT' . self::LIFE_TIME_RECOVERY . 'S'));
     $token = new HttpToken();
     $token->setUserId($user->getId())->setRefreshTo($refreshTo)->setExpiresAt($expiresAt)->setRecovery(true);
     $this->entityManager->persist($token);
     try {
         $this->entityManager->flush();
     } catch (ConstraintViolationException $e) {
         error_log($e->getMessage());
         return false;
     }
     return $token;
 }
开发者ID:coresite,项目名称:apiauthbundle,代码行数:22,代码来源:HttpTokenManager.php

示例4: 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

示例5: isUser

 /**
  * Tells if the the given user is this user.
  *
  * Useful when not hydrating all fields.
  *
  * @param UserInterface $user
  * @return Boolean
  */
 public function isUser(UserInterface $user = null)
 {
     return null !== $user && $this->getId() === $user->getId();
 }
开发者ID:Anmoldev,项目名称:FOSUserBundle,代码行数:12,代码来源:User.php

示例6: reloadUser

 /**
  * {@inheritdoc}
  */
 public function reloadUser(UserInterface $user)
 {
     return $this->findUserBy(['id' => $user->getId()]);
 }
开发者ID:WebschoolPoitiers,项目名称:ODEV2,代码行数:7,代码来源:UserManager.php

示例7: isMarked

 public function isMarked(UserInterface $user, Package $package)
 {
     return null !== $this->redis->zrank('usr:' . $user->getId() . ':fav', $package->getId());
 }
开发者ID:ronnylt,项目名称:packagist,代码行数:4,代码来源:FavoriteManager.php

示例8: isOwner

 /**
  * @param UserInterface $user
  * @param BlameableEntityInterface $object
  *
  * @return bool
  */
 protected function isOwner(UserInterface $user, BlameableEntityInterface $object)
 {
     $creator = $object->getCreatedBy();
     return $creator instanceof UserInterface && $user->getId() === $creator->getId();
 }
开发者ID:mikoweb,项目名称:vsymfo-core,代码行数:11,代码来源:AbstractVoter.php

示例9: isUser

 /**
  * Tells if the the given user is this user.
  *
  * Useful when not hydrating all fields.
  *
  * @param UserInterface $user
  * @return Boolean
  */
 public function isUser(FOSUserInterface $user = null)
 {
     return $user instanceof self && $user->getId() == $this->getId();
 }
开发者ID:Djecan,项目名称:EkinoDrupalBundle,代码行数:12,代码来源:HybridUser.php

示例10: reloadUser

 function reloadUser(UserInterface $user)
 {
     $document = $this->documentHandler->get($this->collection, $user->getId());
     $this->fromDocument($user, $document);
 }
开发者ID:sandermarechal,项目名称:MopArangoDbBundle,代码行数:5,代码来源:UserManager.php

示例11: addUserToPerimeter

 /**
  * Add a user to a perimeter
  *
  * @param UserInterface              $user
  * @param BusinessPerimeterInterface $perimeter
  */
 public function addUserToPerimeter(UserInterface $user, BusinessPerimeterInterface $perimeter)
 {
     $this->perimeterManager->addUserToPerimeter($user->getId(), $perimeter->getId());
 }
开发者ID:Tisseo,项目名称:MttBridgeBundle,代码行数:10,代码来源:BusinessPerimeterManager.php

示例12: getRedirectionUrl

 protected function getRedirectionUrl(UserInterface $user)
 {
     return $this->container->get('router')->generate('user_profile', array('id' => $user->getId()));
 }
开发者ID:teraelis,项目名称:forum,代码行数:4,代码来源:ChangePasswordController.php

示例13: getRedirectionUrl

 /**
  * Generate the redirection url when the resetting is completed.
  *
  * @param \FOS\UserBundle\Model\UserInterface $user
  *
  * @return string
  */
 protected function getRedirectionUrl(UserInterface $user)
 {
     return $this->container->get('router')->generate('fos_user_profile_show', array("id" => $user->getId()));
 }
开发者ID:artz20,项目名称:Tv-shows-zone,代码行数:11,代码来源:ChangePasswordController.php


注:本文中的FOS\UserBundle\Model\UserInterface::getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。