src/Attribute/TranslatedTags.php
public function getTranslatedDataFor($arrIds, $strLangCode)
    {
        $tableName       = $this->getTagSource();
        $idColName       = $this->getIdColumn();
        $langCodeColName = $this->getTagLangColumn();
        $sortColumn      = $this->getSortingColumn();

        if (!$this->isProperlyConfigured()) {
            return [];
        }

        $metaModelItemId = $this->getMetaModel()->getTableName() . '_id';

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

        $statement = $this->getConnection()->createQueryBuilder()
            ->select('v.*', 'r.item_id AS ' . $metaModelItemId)
            ->from($tableName, 'v')
            ->leftJoin(
                'v',
                'tl_metamodel_tag_relation',
                'r',
                $queryBuilder->expr()->andX()
                    ->add('r.att_id=:att')
                    ->add('r.value_id=v.' . $idColName)
                    ->add('v.' . $langCodeColName . '=:langcode')
            )
            ->where('r.item_id IN (:ids)')
            ->setParameter('att', $this->get('id'))
            ->setParameter('ids', $arrIds, Connection::PARAM_STR_ARRAY)
            ->setParameter('langcode', $strLangCode);

        if ($this->getTagSortSourceTable()) {
            $statement->join(
                'v',
                $this->getTagSortSourceTable(),
                's',
                $queryBuilder->expr()->eq('v.' . $idColName, 's.id')
            );

            if ($this->getTagSortSourceColumn()) {
                $statement->addSelect($this->getTagSortSourceColumn('s'));
                $statement->orderBy('srcsorting');
            }
        }

        if ($this->getWhereColumn()) {
            $statement->andWhere('(' . $this->getWhereColumn() . ')');
        }

        $statement->addOrderBy($sortColumn);

        return $this->convertRows($statement->execute(), $metaModelItemId, $idColName);
    }
public function getTranslatedDataFor($arrIds, $strLangCode)
    {
        $tableName       = $this->getTagSource();
        $idColName       = $this->getIdColumn();
        $langCodeColName = $this->getTagLangColumn();
        $sortColumn      = $this->getSortingColumn();

        if (!$this->isProperlyConfigured()) {
            return [];
        }

        $metaModelItemId = $this->getMetaModel()->getTableName() . '_id';

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

        $statement = $this->getConnection()->createQueryBuilder()
            ->select('v.*', 'r.item_id AS ' . $metaModelItemId)
            ->from($tableName, 'v')
            ->leftJoin(
                'v',
                'tl_metamodel_tag_relation',
                'r',
                $queryBuilder->expr()->andX()
                    ->add('r.att_id=:att')
                    ->add('r.value_id=v.' . $idColName)
                    ->add('v.' . $langCodeColName . '=:langcode')
            )
            ->where('r.item_id IN (:ids)')
            ->setParameter('att', $this->get('id'))
            ->setParameter('ids', $arrIds, Connection::PARAM_STR_ARRAY)
            ->setParameter('langcode', $strLangCode);

        if ($this->getTagSortSourceTable()) {
            $statement->join(
                'v',
                $this->getTagSortSourceTable(),
                's',
                $queryBuilder->expr()->eq('v.' . $idColName, 's.id')
            );

            if ($this->getTagSortSourceColumn()) {
                $statement->addSelect($this->getTagSortSourceColumn('s'));
                $statement->orderBy('srcsorting');
            }
        }

        if ($this->getWhereColumn()) {
            $statement->andWhere('(' . $this->getWhereColumn() . ')');
        }

        $statement->addOrderBy($sortColumn);

        return $this->convertRows($statement->execute(), $metaModelItemId, $idColName);
    }
{@inheritDoc}