ソースを参照

[DoctrineBundle][DoctrineMongoDBBundle] Makes it possible to use shortcuts for defining document or entity classes when using the DaoAuthenticationProvider

Henrik Bjørnskov 14 年 前
コミット
46949e2c22

+ 5 - 0
src/Symfony/Bundle/DoctrineBundle/Security/EntityUserProvider.php

@@ -16,6 +16,11 @@ class EntityUserProvider implements UserProviderInterface
     public function __construct($em, $class, $property = null)
     {
         $this->class = $class;
+
+        if (false !== strpos($this->class, ':')) {
+            $this->class = $em->getClassMetadata($class)->getName();
+        }
+
         $this->repository = $em->getRepository($class);
         $this->property = $property;
     }

+ 5 - 0
src/Symfony/Bundle/DoctrineMongoDBBundle/Security/DocumentUserProvider.php

@@ -16,6 +16,11 @@ class DocumentUserProvider implements UserProviderInterface
     public function __construct($em, $class, $property = null)
     {
         $this->class = $class;
+
+        if (false !== strpos($this->class, ':')) {
+            $this->class = $em->getClassMetadata($class)->getName();
+        }
+
         $this->repository = $em->getRepository($class);
         $this->property = $property;
     }