doctrine/doctrine2 — pull request #1151 by raziel057 (2014-09-29 09:23:29+00:00)
Title: Failing Test - Paginator with sorted collection

This PR is linked to http://www.doctrine-project.org/jira/browse/DDC-3330

When using the Paginator, there is a problem when sorting the collection plus one other field.

I think we need to remove the ORDER BY part of DQL in the subQuery in getIterator method of the Paginator class.

For example it's possible to avoid the problem by adding (in getIterator() of Doctrine\ORM\Tools\Pagination\Paginator.php) :

```php
$dql = $subQuery->getDql();
if (($pos = strpos($dql, 'ORDER BY')) !== false) {
$subQuery->setDql(substr($dql, 0, $pos));
}
```

Just before ``$subQuery->setFirstResult($offset)->setMaxResults($length);``. I know it's not the good way to fix the problem but it's just to show you that order is not needed here.