I have code like below
try {
$user = $query->getSingleResult();
} catch (Doctrine\ORM\NoResultException $e) {
return null;
} catch (Exception $e) {
return null;
}
getSingleResult() will throw NoResultException if no rows are found. and it seems I am still getting the exception ... the catch does not seem to work. why is that?