public function search($term, $limit, $offset, $orderBy = null)
    {
        $qb = $this->createQueryBuilder('m');

        $qb->where('m.name LIKE :term')
            ->andWhere('m.status IN (:statuses)')
            ->setParameters(array(
                'term' => '%'.$term.'%',
                'statuses' => array(0, 1),
            )
        );

        if ($limit) {
            $qb->setMaxResults($limit);
        }

        if ($offset) {
            $qb->setFirstResult($offset);
        }

        return $qb->getQuery()->getResult();
    }
public function search($term, $limit, $offset, $orderBy = null)
    {
        $qb = $this->createQueryBuilder('m');

        $qb->where('m.name LIKE :term')
            ->andWhere('m.status IN (:statuses)')
            ->setParameters(array(
                'term' => '%'.$term.'%',
                'statuses' => array(0, 1),
            )
        );

        if ($limit) {
            $qb->setMaxResults($limit);
        }

        if ($offset) {
            $qb->setFirstResult($offset);
        }

        return $qb->getQuery()->getResult();
    }
public function search ( $ term , $ limit , $ offset , $ orderBy = null ) { $ qb = $ this -> createQueryBuilder ( 'm' ) ; $ qb -> where ( 'm.name LIKE :term' ) -> andWhere ( 'm.status IN (:statuses)' ) -> setParameters ( array ( 'term' => '%' . $ term . '%' , 'statuses' => array ( 0 , 1 ) , ) ) ; if ( $ limit ) { $ qb -> setMaxResults ( $ limit ) ; } if ( $ offset ) { $ qb -> setFirstResult ( $ offset ) ; } return $ qb -> getQuery ( ) -> getResult ( ) ; }
Search media items by a searchterm.

@param string $term
@param int    $limit
@param int    $offset
@param array  $orderBy

@return array
Search media items by a searchterm .