Sorry for my bad. That's is the right change:

```php
$this->paginator = new LegacyPaginator($query, $fetchJoinCollection);
if (class_exists('Doctrine\ORM\Tools\Pagination\Paginator')) {
    $this->paginator = new DoctrinePaginator($query, $fetchJoinCollection);
}
```