src/ViewCombination/ViewCombinationBuilder.php
private function getCombinationsFromDatabase($userGroups, $userType)
    {
        if (empty($userGroups)) {
            return null;
        }

        $builder = $this
            ->connection
            ->createQueryBuilder();

        $combinations = $builder
            ->select('*')
            ->from('tl_metamodel_dca_combine')
            ->where($builder->expr()->in($userType . '_group', ':groupList'))
            ->setParameter('groupList', $userGroups, Connection::PARAM_STR_ARRAY)
            ->orWhere($userType . '_group=0')
            ->orderBy('pid')
            ->addOrderBy('sorting')
            ->execute()
            ->fetchAll(\PDO::FETCH_ASSOC);

        $result = [
            'byName' => [],
            'byId' => []
        ];

        foreach ($combinations as $combination) {
            $metaModelId = $combination['pid'];
            if (isset($result['byId'][$metaModelId])) {
                continue;
            }
            $name = $this->factory->translateIdToMetaModelName($metaModelId);

            $result['byId'][$metaModelId] = $result['byName'][$name] = [
                'dca_id'   => $combination['dca_id'],
                'view_id' => $combination['view_id']
            ];
        }

        return $result;
    }
private function getCombinationsFromDatabase($userGroups, $userType)
    {
        if (empty($userGroups)) {
            return null;
        }

        $builder = $this
            ->connection
            ->createQueryBuilder();

        $combinations = $builder
            ->select('*')
            ->from('tl_metamodel_dca_combine')
            ->where($builder->expr()->in($userType . '_group', ':groupList'))
            ->setParameter('groupList', $userGroups, Connection::PARAM_STR_ARRAY)
            ->orWhere($userType . '_group=0')
            ->orderBy('pid')
            ->addOrderBy('sorting')
            ->execute()
            ->fetchAll(\PDO::FETCH_ASSOC);

        $result = [
            'byName' => [],
            'byId' => []
        ];

        foreach ($combinations as $combination) {
            $metaModelId = $combination['pid'];
            if (isset($result['byId'][$metaModelId])) {
                continue;
            }
            $name = $this->factory->translateIdToMetaModelName($metaModelId);

            $result['byId'][$metaModelId] = $result['byName'][$name] = [
                'dca_id'   => $combination['dca_id'],
                'view_id' => $combination['view_id']
            ];
        }

        return $result;
    }
Retrieve the palette combinations from the database.

@param string $userGroups The user groups of the user to fetch information for.
@param string $userType   The user type.

@return null|array