mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
more fixes for calendar syncs
This commit is contained in:
@@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\GroupCenter;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\NoResultException;
|
||||
use Doctrine\ORM\Query\ResultSetMapping;
|
||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
@@ -143,11 +144,15 @@ final class UserRepository implements UserRepositoryInterface
|
||||
return $this->repository->findOneBy($criteria, $orderBy);
|
||||
}
|
||||
|
||||
public function findOneByUsernameOrEmail(string $pattern)
|
||||
public function findOneByUsernameOrEmail(string $pattern): ?User
|
||||
{
|
||||
$qb = $this->queryByUsernameOrEmail($pattern);
|
||||
$qb = $this->queryByUsernameOrEmail($pattern)->select('u');
|
||||
|
||||
return $qb->getQuery()->getSingleResult();
|
||||
try {
|
||||
return $qb->getQuery()->getSingleResult();
|
||||
} catch (NoResultException $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -55,7 +55,7 @@ interface UserRepositoryInterface extends ObjectRepository
|
||||
|
||||
public function findOneBy(array $criteria, ?array $orderBy = null): ?User;
|
||||
|
||||
public function findOneByUsernameOrEmail(string $pattern);
|
||||
public function findOneByUsernameOrEmail(string $pattern): ?User;
|
||||
|
||||
/**
|
||||
* Get the users having a specific flags.
|
||||
|
Reference in New Issue
Block a user