3 namespace Mixstore\StoreBundle\Entity
;
5 use Doctrine\ORM\EntityRepository
;
7 class UsecaseRepository
extends EntityRepository
9 function safeFindById($id)
13 $qb = $this->createQueryBuilder('u');
14 $qb->where('u.id = '.$id);
15 $usecase = $qb->getQuery()->getResult()[0];
18 $usecase = new Usecase();
23 function countByPkgId($pkgid)
26 ->createQueryBuilder('u')
27 ->select('COUNT(u.id) AS ucscount, AVG(u.grade) AS rating')
28 ->where('u.package = '.$pkgid)
31 //->getSingleScalarResult();