original_string: public function findNews($family, $limit = null)
      {
          $qb = $this->getQueryBuilder()
              ->orderBy('p.highlighted', 'desc')
              ->addOrderBy('p.createdAt', 'desc');
  
          // filter by family
          if (!is_null($family)) {
              $qb->innerJoin('p.category', 'c')
                  ->innerJoin('c.parentCategory', 'pc')
                  ->andWhere('pc.family = :family')
                  ->setParameter('family', $family);
          }
  
          if (!is_null($limit)) {
              $qb->setMaxResults($limit);
          }
  
          return $qb->getQuery()
              ->getResult();
      }
code: public function findNews($family, $limit = null)
      {
          $qb = $this->getQueryBuilder()
              ->orderBy('p.highlighted', 'desc')
              ->addOrderBy('p.createdAt', 'desc');
  
          // filter by family
          if (!is_null($family)) {
              $qb->innerJoin('p.category', 'c')
                  ->innerJoin('c.parentCategory', 'pc')
                  ->andWhere('pc.family = :family')
                  ->setParameter('family', $family);
          }
  
          if (!is_null($limit)) {
              $qb->setMaxResults($limit);
          }
  
          return $qb->getQuery()
              ->getResult();
      }
code_tokens: public function findNews ( $ family , $ limit = null ) { $ qb = $ this -> getQueryBuilder ( ) -> orderBy ( 'p.highlighted' , 'desc' ) -> addOrderBy ( 'p.createdAt' , 'desc' ) ; // filter by family if ( ! is_null ( $ family ) ) { $ qb -> innerJoin ( 'p.category' , 'c' ) -> innerJoin ( 'c.parentCategory' , 'pc' ) -> andWhere ( 'pc.family = :family' ) -> setParameter ( 'family' , $ family ) ; } if ( ! is_null ( $ limit ) ) { $ qb -> setMaxResults ( $ limit ) ; } return $ qb -> getQuery ( ) -> getResult ( ) ; }
docstring: Find new products
  
  @param Family|null $family
  @param int|null    $limit
  
  @return ArrayCollection
docstring_tokens: Find new products