X-Git-Url: https://git.rapsys.eu/blogbundle/blobdiff_plain/2aca0f531ee6833b663648cc5205da37743ed2d0..d3a057f6a3cfe062103aead3e88e7c69ec6810d1:/Repository/UserRepository.php diff --git a/Repository/UserRepository.php b/Repository/UserRepository.php index befe695..2aa8e3b 100644 --- a/Repository/UserRepository.php +++ b/Repository/UserRepository.php @@ -282,9 +282,9 @@ SQL; * Find user by id as array * * @param integer $id The user id - * @return array The article array + * @return ?array The article array */ - public function findByIdAsArray(int $id): array { + public function findByIdAsArray(int $id): ?array { //Set the request $req = <<addScalarResult('kt_titles', 'kt_titles', 'string'); //Get data - $data = $this->_em + if (($data = $this->_em ->createNativeQuery($req, $rsm) ->setParameter('id', $id) - ->getOneOrNullResult(); + ->getOneOrNullResult()) === null) { + //Return null + return $data; + } //Set return $return = [