This is not how dependencies work, This class has a dependency on the ORM, if its used or not in some cases. The Doctrine\Search namespace however should be persistence agnostic.