Skip to content

Commit

Permalink
[Doctrine] fixed Doctrine guesser when the object is a proxy and not …
Browse files Browse the repository at this point in the history
…an original entity instance

After this patch, the guesser is run for regular entity instances and proxy instances.
  • Loading branch information
fabpot committed Jul 6, 2011
1 parent f562e60 commit d3b7807
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
Expand Up @@ -16,6 +16,7 @@
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
{
Expand Down Expand Up @@ -122,8 +123,10 @@ protected function getMetadata($class)

$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
}
}
}
Expand Down

0 comments on commit d3b7807

Please sign in to comment.