I am trying to filter results from my entity in question by start/end date. I have dates that I am passing in my database by fields startDate and endDate but I am always getting an empty response. No results.
public function getResults(\DateTime $startDate, \DateTime $endDate)
{
$result = $this->getRepository()
->createQueryBuilder('q')
->where('q.created BETWEEN :startDate AND :endDate')
->setParameter('startDate', $startDate)
->setParameter('endDate', $endDate)
->getQuery()
->getResult();
And I am passing trough my controller date ranges that I have in a database to test it:
$this->container->get('app')->getResults(new \DateTime('2019-03-01'), new \DateTime('2019-03-03'));