Category: mariadb

Why does select max from a column with querybuilder return an array?

I’m trying to get the last contact of a user, here is the query: public function dateDernierContact($utilisateur): ?Contact { return $this->createQueryBuilder(‘c’) ->select(‘MAX(c.dateFin)’) ->andWhere(‘c.utilisateur = :val’) ->andWhere(‘c.archive = true’) ->setParameter(‘val’, $utilisateur) ->getQuery() ->getOneOrNullResult() ; } And where I use it: $dateDeb=strtotime($contactRepository->dateDernierContact($user->getId()));…