doctrine/doctrine2 — pull request #1220 by zeroedin-bill (2014-12-15 23:03:02+00:00)
Title: * LimitSubqueryOutputWalker should not duplicate orderBy clauses

When using the paginator, the LimitSubqueryOutputWalker uses the passed query as a subquery in a generated query.

Ex:
```SQL
SELECT a0_.id AS id_0, a0_.name AS name_1, a0_.name AS name_2 FROM Author a0_ ORDER BY a0_.name
```
Becomes:
```SQL
SELECT DISTINCT id_0, name_2 FROM (SELECT a0_.id AS id_0, a0_.name AS name_1, a0_.name AS name_2 FROM Author a0_ ORDER BY a0_.name) dctrn_result ORDER BY name_2 DESC
```

This transformation duplicates the ORDER BY clause unnecessarily -- In SQL Server, this is not valid - it will cause an error unless combined with the TOP clause. In other DBMS, the inner ORDER BY clause is meaningless unless combined with a limit/offset clause, and even then there is no guarantee that the order prescribed in the inner subquery will be maintained in the outer expression. ORM does not generate any subqueries where the order by clause is meaningful. The duplicate inner ORDER BY clause can safely be dropped, without any side effects.

I have modified LimitSubqueryOutputWalker to drop ORDER BY clauses in the subquery generated in the walkSelectStatement method. I have also modified the tests to remove the ORDER BY clauses inside subqueries.