public function findByTags(array $tags)
    {
        $qb = $this->createQueryBuilder('c');

        foreach ($tags as $key => $tag) {
            $operator = substr($tag, 0, 1);

            if ($operator === '+' || $operator === '-') {
                $tag = substr($tag, 1);
            }

            $literalExpr = $qb->expr()->literal('%'.$tag.'%');

            if ($operator === '-') {
                $qb->andWhere($qb->expr()->notLike('c.tags', $literalExpr));
            } elseif ($operator === '+') {
                $qb->andWhere($qb->expr()->like('c.tags', $literalExpr));
            } elseif ($key === 0) {
                $qb->where($qb->expr()->like('c.tags', $literalExpr));
            } else {
                $qb->orWhere($qb->expr()->like('c.tags', $literalExpr));
            }
        }

        return $qb->getQuery()->getResult();
    }
public function findByTags(array $tags)
    {
        $qb = $this->createQueryBuilder('c');

        foreach ($tags as $key => $tag) {
            $operator = substr($tag, 0, 1);

            if ($operator === '+' || $operator === '-') {
                $tag = substr($tag, 1);
            }

            $literalExpr = $qb->expr()->literal('%'.$tag.'%');

            if ($operator === '-') {
                $qb->andWhere($qb->expr()->notLike('c.tags', $literalExpr));
            } elseif ($operator === '+') {
                $qb->andWhere($qb->expr()->like('c.tags', $literalExpr));
            } elseif ($key === 0) {
                $qb->where($qb->expr()->like('c.tags', $literalExpr));
            } else {
                $qb->orWhere($qb->expr()->like('c.tags', $literalExpr));
            }
        }

        return $qb->getQuery()->getResult();
    }
public function findByTags ( array $ tags ) { $ qb = $ this -> createQueryBuilder ( 'c' ) ; foreach ( $ tags as $ key => $ tag ) { $ operator = substr ( $ tag , 0 , 1 ) ; if ( $ operator === '+' || $ operator === '-' ) { $ tag = substr ( $ tag , 1 ) ; } $ literalExpr = $ qb -> expr ( ) -> literal ( '%' . $ tag . '%' ) ; if ( $ operator === '-' ) { $ qb -> andWhere ( $ qb -> expr ( ) -> notLike ( 'c.tags' , $ literalExpr ) ) ; } elseif ( $ operator === '+' ) { $ qb -> andWhere ( $ qb -> expr ( ) -> like ( 'c.tags' , $ literalExpr ) ) ; } elseif ( $ key === 0 ) { $ qb -> where ( $ qb -> expr ( ) -> like ( 'c.tags' , $ literalExpr ) ) ; } else { $ qb -> orWhere ( $ qb -> expr ( ) -> like ( 'c.tags' , $ literalExpr ) ) ; } } return $ qb -> getQuery ( ) -> getResult ( ) ; }
Find configured types by tags.

@return array
Find configured types by tags .