How can I convert the following SQL Query to Doctrine?
select * from `Leave_types`
where (leave_name = in_leave_name or leave_code=in_leave_code)
and academic_year_id =in_academic_year_id
I trying the follow code:
$em = $this->doctrine->em;
$qb = $em->createQueryBuilder();
$qb->select('lt');
$qb->from('Entity\LeaveTypes', 'lt');
$qb->innerjoin('lt.academicYear', 'ay');
$qb->where('ay.academicId = :academicId');
$qb->andwhere(
$qb->orWhere('leaveName', '?1'),
$qb->orWhere('leaveCode', '?2')
);
$qb->setParameter('academicId', $add_data['academic_year_id']);
$qb->setParameter(1, $add_data['leave_name']);
$qb->setParameter(2, $add_data['leave_code']);
$result = $qb->getQuery()->getResult();