src/Repository/OpinionRepository.php
/**
     * Find self::PAGE_SIZE last opinions for an active user.
     *
     * @throws Exception dateTime Emits Exception in case of an error
     */
Find self::PAGE_SIZE last opinions for an active user.
@throws Exception dateTime Emits Exception in case of an error
Find self :: PAGE_SIZE last opinions for an active user . @throws Exception dateTime Emits Exception in case of an error
public function findLatestByUser(User $user, $limit = self::PAGE_SIZE): DoctrinePaginator
    {
        $qb = $this->createQueryBuilder('o')
            ->addSelect('u', 'r')
            ->innerJoin('o.user', 'u')
            ->innerJoin('o.reduction', 'r')
            ->andWhere('o.user = :user')
            ->andWhere('u.isActive = :status')
            ->andWhere('r.isActive = :status')
            ->orderBy('r.createdAt', 'DESC')
            ->setParameter('status', true)
            ->setParameter('user', $user)
        ;
        if (null !== $limit) {
            $qb->setMaxResults($limit);
        }
        return new DoctrinePaginator($qb);
    }
public function findLatestByUser ( User $ user , $ limit = self :: PAGE_SIZE ) : DoctrinePaginator { $ qb = $ this -> createQueryBuilder ( 'o' ) -> addSelect ( 'u' , 'r' ) -> innerJoin ( 'o.user' , 'u' ) -> innerJoin ( 'o.reduction' , 'r' ) -> andWhere ( 'o.user = :user' ) -> andWhere ( 'u.isActive = :status' ) -> andWhere ( 'r.isActive = :status' ) -> orderBy ( 'r.createdAt' , 'DESC' ) -> setParameter ( 'status' , true ) -> setParameter ( 'user' , $ user ) ; if ( null !== $ limit ) { $ qb -> setMaxResults ( $ limit ) ; } return new DoctrinePaginator ( $ qb ) ; }
Find self::PAGE_SIZE last opinions for an active user.
Find self :: PAGE_SIZE last opinions for an active user .