本文整理汇总了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();
}
示例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;
}
示例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();
}