point-tools/src/Skobkin/Bundle/PointToolsBundle/Entity/SubscriptionRepository.php

24 lines
552 B
PHP
Raw Normal View History

2015-06-23 09:38:43 +00:00
<?php
namespace Skobkin\Bundle\PointToolsBundle\Entity;
use Doctrine\ORM\EntityRepository;
class SubscriptionRepository extends EntityRepository
{
/**
* @param integer $id
* @return integer
*/
public function getUserSubscribersCountById($id)
{
$qb = $this->createQueryBuilder('s');
return $qb
->select('COUNT(s)')
->innerJoin('s.author', 'a')
->where('a.id = :id')
->setParameter('id', $id)
->getQuery()->getSingleScalarResult()
;
}
}