<?php

namespace Shaygan\AffiliateBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * ReferralRegistrationRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class ReferralRegistrationRepository extends EntityRepository
{

    public function getRegistrationByUser($user)
    {
        return $this->_em
                        ->createQuery('SELECT rr,r FROM ShayganAffiliateBundle:ReferralRegistration rr '
                                . 'JOIN rr.referrer r '
                                . 'WHERE r.id=:id '
                                . 'ORDER BY rr.id DESC ')
                        ->setParameter("id", $user->getId())
        ;
    }

    public function getRegistrationCountByUser($user)
    {
        return $this->_em
                        ->createQuery('SELECT COUNT(*) FROM ShayganAffiliateBundle:ReferralRegistration rr '
                                . 'WHERE r.id=:id ')
                        ->setParameter("id", $user->getId())
                        ->getSingleScalarResult()
        ;
    }

}

<?php

namespace Shaygan\AffiliateBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * ReferralRegistrationRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class ReferralRegistrationRepository extends EntityRepository
{

    public function getRegistrationByUser($user)
    {
        return $this->_em
                        ->createQuery('SELECT rr,r FROM ShayganAffiliateBundle:ReferralRegistration rr '
                                . 'JOIN rr.referrer r '
                                . 'WHERE r.id=:id '
                                . 'ORDER BY rr.id DESC ')
                        ->setParameter("id", $user->getId())
        ;
    }

    public function getRegistrationCountByUser($user)
    {
        return $this->_em
                        ->createQuery('SELECT COUNT(*) FROM ShayganAffiliateBundle:ReferralRegistration rr '
                                . 'JOIN rr.referrer r '
                                . 'WHERE r.id=:id ')
                        ->setParameter("id", $user->getId())
                        ->getSingleScalarResult()
        ;
    }

}

Add get registration count to service
Add get registration count to service