public function createConditionGenerator($query, SearchCondition $searchCondition)
    {
        if ($query instanceof NativeQuery) {
            return new NativeQueryConditionGenerator($query, $searchCondition);
        }

        if ($query instanceof Query || $query instanceof QueryBuilder) {
            return new DqlConditionGenerator($query, $searchCondition);
        }

        throw new \InvalidArgumentException(
            sprintf('Query "%s" is not supported by the DoctrineOrmFactory.', \get_class($query))
        );
    }