I'm using symfony2 and doctrine. I just want to check if specific row in table exist or not. no need to get back object of that Entity if exist. for example if I use something like this to check if someone with ip of $clientIp visit video I JUST WANT TRUE OR FALSE not VideoVisit instance.
$query = $this->getEntityManager()->createQuery(
'SELECT v FROM MjVideoBundle:VideoVisit v'
. ' WHERE v.video=:videoId'
. ' AND v.ip=:clientIp')
->setParameters(array(
'videoId'=> $videoId,
'clientIp' => $clientIp));
try{
$result = $query->getSingleResult();
} catch (\Doctrine\Orm\NoResultException $ex) {
$result = false;
}
if($result == false){
//do something
}
else{
//do something else
}