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


PHP User::getLogin方法代码示例

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


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

示例1: __invoke

 public function __invoke(User $user)
 {
     $qb = $this->em->createQueryBuilder();
     $qb2 = $this->em->createQueryBuilder();
     $ids = $qb2->select('IDENTITY(u.group)')->from(User::class, 'u')->where('u.login = :login')->setParameter('login', $user->getLogin())->getQuery()->getArrayResult();
     return $qb->select('ug')->from(UserGroup::class, 'ug')->where($qb->expr()->in('ug.id', array_map(function ($el) {
         return current($el);
     }, $ids)))->orderBy('ug.name')->getQuery()->getResult();
 }
开发者ID:Gorik,项目名称:Doctrine2-Relations,代码行数:9,代码来源:GroupsByUser.php

示例2: retrieve

 public function retrieve($login)
 {
     // Creating or retrieving the user
     $user = $this->entityManager->getRepository("AppBundle:User")->findOneByLogin($login);
     if ($user == null) {
         $user = new User();
         $user->setLogin($login);
     }
     // Updating from Intranet
     $connector = new Connector();
     $connector->authenticate(Connector::SIGN_IN_METHOD_CREDENTIALS, $this->connectorParameters["login"], $this->connectorParameters["password"]);
     if (!$connector->isSignedIn()) {
         throw new \Exception();
     }
     $intranetUser = new \EpitechAPI\Component\User($connector, $user->getLogin());
     $user->updateFromIntranet($intranetUser);
     return $user;
 }
开发者ID:Raphy,项目名称:BlihWI,代码行数:18,代码来源:EpitechUserRetriever.php

示例3: updateUser

 public function updateUser(User $user)
 {
     // If the user has not a token, ignore
     if ($user->getToken() == null) {
         return;
     }
     // Connecting with Blih
     $blih = new Blih($user->getLogin());
     $blih->setToken($user->getToken());
     // Getting the repositories
     $blihRepositories = $blih->repository()->all()->body;
     if (!isset($blihRepositories->repositories)) {
         return;
     }
     $blihRepositories = $blihRepositories->repositories;
     $repositories = $user->getRepositories();
     // Removing the repositories removed
     $repositories->forAll(function ($key, Repository $repository) use($blihRepositories) {
         if (!array_key_exists($repository->getName(), $blihRepositories)) {
             $this->entityManager->remove($repository);
         }
         return true;
     });
     // Updating or creating the repositories
     foreach ($blihRepositories as $name => $data) {
         $repository = $this->retrieveOrCreateRepository($user, $name);
         $this->updateRepository($repository);
         $this->entityManager->persist($repository);
     }
     // Updating the user
     $user->setLastRepositoriesUpdateDate(new \DateTime());
     $this->entityManager->persist($user);
     $this->entityManager->flush();
 }
开发者ID:Raphy,项目名称:BlihWI,代码行数:34,代码来源:BlihUpdater.php


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