public function fetchOne(Persistence\Query $queryObject)
{
try {
return $queryObject->fetchOne($this);
} catch (NoResultException $e) {
return NULL;
} catch (NonUniqueResultException $e) {
// this should never happen!
throw new InvalidStateException("You have to setup your query calling ->setMaxResult(1).", 0, $e);
} catch (\Exception $e) {
throw $this->handleQueryException($e, $queryObject);
}
}