for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Odiseo\SyliusReferralsPlugin\Repository;
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
use Sylius\Component\Core\Model\CustomerInterface;
class AffiliateViewRepository extends EntityRepository implements AffiliateViewRepositoryInterface
{
public function countViewsByCustomer(CustomerInterface $customer): int
return (int) $this->createQueryBuilder('o')
->select('COUNT(o.id)')
->innerJoin('o.affiliate', 'a')
->andWhere('a.customer = :customer')
->setParameter('customer', $customer)
->getQuery()
->getSingleScalarResult()
;
}