Explorar el Código

[Doctrine] fixed Doctrine guesser when the object is a proxy and not an original entity instance

After this patch, the guesser is run for regular entity instances and proxy instances.
Fabien Potencier hace 14 años
padre
commit
d3b78075f0
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php

+ 4 - 1
src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php

@@ -16,6 +16,7 @@ use Symfony\Component\Form\Guess\Guess;
 use Symfony\Component\Form\Guess\TypeGuess;
 use Symfony\Component\Form\Guess\ValueGuess;
 use Symfony\Bridge\Doctrine\RegistryInterface;
+use Doctrine\ORM\Mapping\MappingException;
 
 class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
 {
@@ -122,8 +123,10 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
 
         $this->cache[$class] = null;
         foreach ($this->registry->getEntityManagers() as $name => $em) {
-            if (!$em->getConfiguration()->getMetadataDriverImpl()->isTransient($class)) {
+            try {
                 return $this->cache[$class] = array($em->getClassMetadata($class), $name);
+            } catch (MappingException $e) {
+                // not an entity or mapped super class
             }
         }
     }