Sulu\Bundle\ContactBundle\Entity\AccountRepository::countDistinctAccountChildrenAndContacts PHP Метод

countDistinctAccountChildrenAndContacts() публичный Метод

distinct count account's children and contacts.
public countDistinctAccountChildrenAndContacts ( $id ) : mixed
$id
Результат mixed
    public function countDistinctAccountChildrenAndContacts($id)
    {
        try {
            $qb = $this->createQueryBuilder('account')->leftJoin('account.children', 'children')->leftJoin('account.accountContacts', 'accountContacts')->leftJoin('accountContacts.contact', 'contacts')->select('count(DISTINCT children.id) AS numChildren')->addSelect('count(DISTINCT contacts.id) AS numContacts')->where('account.id = :accountId');
            $query = $qb->getQuery();
            $query->setParameter('accountId', $id);
            return $query->getSingleResult();
        } catch (NoResultException $ex) {
            return;
        }
    }