src/Attribute/TranslatedTags.php
public function getTagCount($ids)
    {
        $tableName = $this->getTagSource();
        $colNameId = $this->getIdColumn();
        $return    = [];

        if ($tableName && $colNameId) {
            $statement = $this->getConnection()->createQueryBuilder()
                ->select('item_id', 'count(*) as count')
                ->from('tl_metamodel_tag_relation')
                ->where('att_id=:att')
                ->andWhere('item_id IN (:items)')
                ->groupBy('item_id')
                ->setParameter('att', $this->get('id'))
                ->setParameter('items', $ids, Connection::PARAM_INT_ARRAY)
                ->execute();

            while ($row = $statement->fetch(\PDO::FETCH_OBJ)) {
                $itemId = $row->item_id;

                $return[$itemId] = (int) $row->count;
            }
        }

        return $return;
    }
public function getTagCount($ids)
    {
        $tableName = $this->getTagSource();
        $colNameId = $this->getIdColumn();
        $return    = [];

        if ($tableName && $colNameId) {
            $statement = $this->getConnection()->createQueryBuilder()
                ->select('item_id', 'count(*) as count')
                ->from('tl_metamodel_tag_relation')
                ->where('att_id=:att')
                ->andWhere('item_id IN (:items)')
                ->groupBy('item_id')
                ->setParameter('att', $this->get('id'))
                ->setParameter('items', $ids, Connection::PARAM_INT_ARRAY)
                ->execute();

            while ($row = $statement->fetch(\PDO::FETCH_OBJ)) {
                $itemId = $row->item_id;

                $return[$itemId] = (int) $row->count;
            }
        }

        return $return;
    }
Determine the amount of entries in the relation table for this attribute and the given value ids.

@param int[] $ids The ids of the items for which the tag count shall be determined.

@return int[] The counts in the array format 'item_id' => count