I am having 2 issues with fetching data from doctrine:
- Select records from start of month to current date
- Select records from start of year to current date
How can I write a Doctrine queries to do the same thing as we do in Mysql
Here is my incomplete code from my repository?
public function findByYearlyAttendanceTillToday($id)
{
$em = $this->getEntityManager();
$query = $em->createQuery("SELECT count(a) FROM CollegeStudentBundle:StudentAttendance a where a.present LIKE 'A' and a.student_id = :id and a.date > :date");
$query->setParameter('id', $id);
$query->setParameter('date', **?????**);
return $query->getResult();
}
Here is what you need:
I would also change this:
to this: