Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3925

Symfony 4.4 Querybuilder exclude all events during a weekend

$
0
0

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

Viewing all articles
Browse latest Browse all 3925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>