* 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 = <<<SQL
SELECT
->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 = [