I can't find an example of DQL, here's what the semi-pseudocode would look like:
Bring back invoices
- Where company id = 5
AND
(
->where('DATE(i.startPeriod) BETWEEN :startDate AND :endDate')
->orWhere('DATE(i.endPeriod) BETWEEN :startDate AND :endDate')
->orWhere(':startDate BETWEEN DATE(i.startPeriod) and DATE(i.endPeriod)')
->orWhere(':endDate BETWEEN DATE(i.startPeriod) and DATE(i.endPeriod)')
)
So you have four OR's nested within one encapsulating AND.
Does anyone know how to do that with Doctrine DQL? Nest a bunch of OR's within one giant AND?