public static function addField(ConfigInterface $config, $idProperty, QueryBuilder $queryBuilder)
    {
        if ($config->getIdOnly()) {
            $queryBuilder->select($idProperty);
            return;
        }

        if (null !== $config->getFields()) {
            $connection = $queryBuilder->getConnection();
            $fields     = implode(
                ', ',
                array_map(
                    function ($field) use ($connection) {
                        return $connection->quoteIdentifier($field);
                    },
                    $config->getFields()
                )
            );

            if (false !== stripos($fields, 'DISTINCT') || \in_array($idProperty, $config->getFields(), true)) {
                $queryBuilder->select($fields);
                return;
            }

            $queryBuilder->select($idProperty . ', ' . $fields);
            return;
        }

        $queryBuilder->select('*');
    }