0

I have to following tables:

Registration
    id int
    created datetime

Activity
    id int
    startdate datetime

Now I want to add this condition to my SQL query:

(Registration.created + 7 days) <= Activity.startdate

How can I do this in Doctrine 2? I prefer a database independent solution.

Rene Terstegen
  • 7,911
  • 18
  • 52
  • 74

1 Answers1

4

DATE_SUB was the solution. I used it with doctrine 2.1.

$EntityManager->createQueryBuilder()->expr()->gte("r.created", "DATE_SUB(a.startDate, 7, 'day')")
Rene Terstegen
  • 7,911
  • 18
  • 52
  • 74