I think you can make one assignment instead of two here <code>$repositoryClassName = $entityManager->getConfiguration()->getDefaultRepositoryClassName()</code>