public function count($id) { $em = Doctrine::getInstance(); $repo = $em->getRepository($this->getEntity()); $count = $repo->createQueryBuilder('e')->select('COUNT(e)')->where('e.id = :id')->setParameter('id', $id)->getQuery()->getResult(); return $count[0][1]; }
function __construct() { $this->em = \Doctrine::getInstance()->getEm(); }