Skip to content

Commit e0ae2b2

Browse files
authored
Merge pull request #301 from pierredup/doctrine-proxy
Fix annotation metadata driver with Doctrine proxies
2 parents af68f44 + 9cffc63 commit e0ae2b2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Mapping/Driver/AnnotationDriver.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Bazinga\GeocoderBundle\Mapping\ClassMetadata;
1717
use Bazinga\GeocoderBundle\Mapping\Exception;
1818
use Doctrine\Common\Annotations\Reader;
19+
use Doctrine\Common\Util\ClassUtils;
1920

2021
/**
2122
* @author Markus Bachmann <[email protected]>
@@ -31,14 +32,15 @@ public function __construct(Reader $reader)
3132

3233
public function isGeocodeable($object): bool
3334
{
34-
$reflection = new \ReflectionObject($object);
35+
$reflection = ClassUtils::newReflectionObject($object);
3536

3637
return (bool) $this->reader->getClassAnnotation($reflection, Annotations\Geocodeable::class);
3738
}
3839

3940
public function loadMetadataFromObject($object)
4041
{
41-
$reflection = new \ReflectionObject($object);
42+
$reflection = ClassUtils::newReflectionObject($object);
43+
4244
if (!$annotation = $this->reader->getClassAnnotation($reflection, Annotations\Geocodeable::class)) {
4345
throw new Exception\MappingException(sprintf('The class %s is not geocodeable', get_class($object)));
4446
}

0 commit comments

Comments
 (0)