src/Repository/ArticleRepository.php
/**
     * Find last active articles for an active user.
     */
Find last active articles for an active user.
Find last active articles for an active user .
public function findLatestByUser(User $user, $limit = null): DoctrinePaginator
    {
        $qb = $this->createQueryBuilder('a')
            ->addSelect('u')
            ->innerJoin('a.user', 'u')
            ->andWhere('a.isActive = :status')
            ->andWhere('a.user = :user')
            ->andWhere('u.isActive = :status')
            ->orderBy('a.createdAt', 'DESC')
            ->setParameter('status', true)
            ->setParameter('user', $user)
        ;
        if (null !== $limit) {
            $qb->setMaxResults($limit);
        }
        return new DoctrinePaginator($qb);
    }
public function findLatestByUser ( User $ user , $ limit = null ) : DoctrinePaginator { $ qb = $ this -> createQueryBuilder ( 'a' ) -> addSelect ( 'u' ) -> innerJoin ( 'a.user' , 'u' ) -> andWhere ( 'a.isActive = :status' ) -> andWhere ( 'a.user = :user' ) -> andWhere ( 'u.isActive = :status' ) -> orderBy ( 'a.createdAt' , 'DESC' ) -> setParameter ( 'status' , true ) -> setParameter ( 'user' , $ user ) ; if ( null !== $ limit ) { $ qb -> setMaxResults ( $ limit ) ; } return new DoctrinePaginator ( $ qb ) ; }
Find last active articles for an active user.
Find last active articles for an active user .