anyx / LoginGateBundle

59 stars 23 forks source link

Invalid namespace for ObjectManager in ORM storage driver #29

Closed mrblur closed 4 years ago

mrblur commented 4 years ago

DatabaseStorage constructor requires ObjectManager instance, which for current Doctrine versions is: Doctrine\Persistence\ObjectManager instead of use-d Doctrine\Common\Persistence\ObjectManager.

Due to EntityManagerInterface being extended from Doctrine\Persistence\ObjectManager argument types are different and any LoginGateBundle is throwing exceptions everytime orm driver is being used.

Quick and dirty patch that fixed issue for me:

Index: vendor/anyx/login-gate-bundle/Storage/DatabaseStorage.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- vendor/anyx/login-gate-bundle/Storage/DatabaseStorage.php   (date 1602671224230)
+++ vendor/anyx/login-gate-bundle/Storage/DatabaseStorage.php   (date 1602671224230)
@@ -4,7 +4,7 @@

 use Anyx\LoginGateBundle\Exception\BruteForceAttemptException;
 use Anyx\LoginGateBundle\Model\FailureLoginAttempt;
-use Doctrine\Common\Persistence\ObjectManager;
+use Doctrine\Persistence\ObjectManager;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\Security\Core\Exception\AuthenticationException;
anyx commented 4 years ago

Hi, @mrblur!

Send pr and I'll merge it

anyx commented 4 years ago

Thanks @mrblur!