private static function mapJoinAliases(iterable $joins): array
    {
        $aliasMap = [];

        foreach ($joins as $join) {
            $alias = $join->getAlias();
            $relationship = $join->getJoin();

            if (false !== strpos($relationship, '.')) {
                $aliasMap[$alias] = explode('.', $relationship);
            } else {
                $aliasMap[$alias] = $relationship;
            }
        }

        return $aliasMap;
    }