Got a question, I have a query where I have to exclude events based on their days.
I have to eliminate all events where the dateStart occurs during a weekend (Friday from 19:30:00 till Sunday). But for some reason this one returned an event that was on a Sunday...
Does anyone have a clue what's wrong with the query and how to solve it?
Thanks in advance!
<?php $qb = $this->createQueryBuilder('r') ->select('count(r.id)') ->leftJoin('r.events', 're') ->leftJoin('r.user', 'ru'); ->andWhere("DAYOFWEEK(re.dateStart) NOT IN (:weekend)")->setParameter('weekend', [1,7]); // Sat and Sunday ->andWhere("DAYOFWEEK(re.dateStart) != :day AND (DATE_FORMAT(re.dateStart, '%T')) = :hour") ->setParameter('hour', '19:30:00']) ->setParameter('day', 6); // Friday