Category: mariadb

Symfony docker container don’t manage to connect to mariadb container

I’m using docker to run : Symfony image MariaDB image Here is my docker-compose.yaml file : version: ‘2’ services: myapp: image: ‘bitnami/symfony:1’ ports: – ‘8000:8000’ volumes: – ‘.:/app’ environment: – SYMFONY_PROJECT_NAME=backend – MARIADB_HOST=mariadb – MARIADB_PORT_NUMBER=3306 – MARIADB_USER=monty – MARIADB_PASSWORD=monty -…

Database connection issue through docker containers

I have set up a dev environment with Symfony and MariaDB through docker. I’ve taken the bitman/symfony image there : https://hub.docker.com/r/bitnami/symfony This is my docker-compose.yaml version: ‘2’ services: myapp: image: ‘bitnami/symfony:1’ ports: – ‘8000:8000’ volumes: – ‘.:/app’ environment: – SYMFONY_PROJECT_NAME=backend…

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()));…