I have 2 DateTime classes in Symfony2 project. I have entity Stat, in which have $date property.
/**
* @ORM\\Column(type=\"da
A QueryBuilder is a good solution.
But you can use
->andWhere($qb->expr()->between('s.date', ':date_from', 'date_to'))
or
->andWhere($qb->expr()->andX(array(
$qb->expr()->gte('s.date', ':date_from'),
$qb->expr()->lte('s.date', ':date_to'))
)
The $qb->expr()->andX is usefull if you don't want to have some WTF when you add some andWhere or orWhere.
Here you have doctrine2 documentation for queryBuilder
You can also use setParameters method for your parameters
->setParameters(array(
'date_from' => $date_from,
'date_to' => $date_to,
))