original_string: public function getBrands($category, $limit = null)
      {
          $qb = $this->getQueryBuilder()
              ->select('DISTINCT b.id, b.name')
              ->innerJoin('c.products', 'p')
              ->innerJoin('p.brand', 'b')
              ->where('p.active = TRUE')
              ->andWhere('b.available = TRUE');
  
          if ($category->getFamily()) {
              // this is a category
              $qb->andWhere('c.parentCategory = :category')
                  ->setParameter('category', $category);
          } else {
              // this is a subcategory
              $qb->andWhere('c = :category')
                  ->setParameter('category', $category);
          }
  
          if (!is_null($limit)) {
              $qb->setMaxResults($limit);
          }
  
          return $qb->getQuery()
              ->getResult();
      }
code: public function getBrands($category, $limit = null)
      {
          $qb = $this->getQueryBuilder()
              ->select('DISTINCT b.id, b.name')
              ->innerJoin('c.products', 'p')
              ->innerJoin('p.brand', 'b')
              ->where('p.active = TRUE')
              ->andWhere('b.available = TRUE');
  
          if ($category->getFamily()) {
              // this is a category
              $qb->andWhere('c.parentCategory = :category')
                  ->setParameter('category', $category);
          } else {
              // this is a subcategory
              $qb->andWhere('c = :category')
                  ->setParameter('category', $category);
          }
  
          if (!is_null($limit)) {
              $qb->setMaxResults($limit);
          }
  
          return $qb->getQuery()
              ->getResult();
      }
code_tokens: public function getBrands ( $ category , $ limit = null ) { $ qb = $ this -> getQueryBuilder ( ) -> select ( 'DISTINCT b.id, b.name' ) -> innerJoin ( 'c.products' , 'p' ) -> innerJoin ( 'p.brand' , 'b' ) -> where ( 'p.active = TRUE' ) -> andWhere ( 'b.available = TRUE' ) ; if ( $ category -> getFamily ( ) ) { // this is a category $ qb -> andWhere ( 'c.parentCategory = :category' ) -> setParameter ( 'category' , $ category ) ; } else { // this is a subcategory $ qb -> andWhere ( 'c = :category' ) -> setParameter ( 'category' , $ category ) ; } if ( ! is_null ( $ limit ) ) { $ qb -> setMaxResults ( $ limit ) ; } return $ qb -> getQuery ( ) -> getResult ( ) ; }
docstring: Get brands from their products relationship
  
  @param Category     $category
  @param integer|null $limit
  
  @return ArrayCollection
docstring_tokens: Get brands from their products relationship