public function searchForInLanguages($pattern, $arrLanguages = [])
    {
        $tableName       = $this->getTagSource();
        $idColName       = $this->getIdColumn();
        $langCodeColName = $this->getTagLangColumn();
        $valueColumn     = $this->getValueColumn();
        $aliasColumn     = $this->getAliasColumn();

        $queryBuilder = $this->getConnection()->createQueryBuilder();

        $queryAndLanguages = null;
        if ($arrLanguages) {
            $queryAndLanguages = $queryBuilder->expr()->in($langCodeColName, $arrLanguages);
        }

        $builder = $this->getConnection()->createQueryBuilder()
            ->select('item_id')
            ->from('tl_metamodel_tag_relation')
            ->where(
                $queryBuilder->expr()->in(
                    'value_id',
                    $queryBuilder
                        ->select('DISTINCT ' . $idColName)
                        ->from($tableName)
                        ->where($queryBuilder->expr()->like($valueColumn, $pattern))
                        ->orWhere($queryBuilder->expr()->like($aliasColumn, $pattern))
                        ->andWhere($queryAndLanguages)
                        ->getSQL()
                )
            )
            ->andWhere('att_id=:att')
            ->setParameter('att', $this->get('id'));

        $filterRule = SimpleQuery::createFromQueryBuilder($builder, 'item_id');

        return $filterRule->getMatchingIds();
    }
public function searchForInLanguages($pattern, $arrLanguages = [])
    {
        $tableName       = $this->getTagSource();
        $idColName       = $this->getIdColumn();
        $langCodeColName = $this->getTagLangColumn();
        $valueColumn     = $this->getValueColumn();
        $aliasColumn     = $this->getAliasColumn();

        $queryBuilder = $this->getConnection()->createQueryBuilder();

        $queryAndLanguages = null;
        if ($arrLanguages) {
            $queryAndLanguages = $queryBuilder->expr()->in($langCodeColName, $arrLanguages);
        }

        $builder = $this->getConnection()->createQueryBuilder()
            ->select('item_id')
            ->from('tl_metamodel_tag_relation')
            ->where(
                $queryBuilder->expr()->in(
                    'value_id',
                    $queryBuilder
                        ->select('DISTINCT ' . $idColName)
                        ->from($tableName)
                        ->where($queryBuilder->expr()->like($valueColumn, $pattern))
                        ->orWhere($queryBuilder->expr()->like($aliasColumn, $pattern))
                        ->andWhere($queryAndLanguages)
                        ->getSQL()
                )
            )
            ->andWhere('att_id=:att')
            ->setParameter('att', $this->get('id'));

        $filterRule = SimpleQuery::createFromQueryBuilder($builder, 'item_id');

        return $filterRule->getMatchingIds();
    }
{@inheritdoc}