File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change 1616use Bazinga \GeocoderBundle \Mapping \ClassMetadata ;
1717use Bazinga \GeocoderBundle \Mapping \Exception ;
1818use Doctrine \Common \Annotations \Reader ;
19+ use Doctrine \Common \Util \ClassUtils ;
1920use Doctrine \Persistence \Proxy ;
2021
2122/**
@@ -32,22 +33,14 @@ public function __construct(Reader $reader)
3233
3334 public function isGeocodeable ($ object ): bool
3435 {
35- $ reflection = new \ReflectionObject ($ object );
36-
37- if ($ object instanceof Proxy) {
38- $ reflection = $ reflection ->getParentClass ();
39- }
36+ $ reflection = ClassUtils::newReflectionObject ($ object );
4037
4138 return (bool ) $ this ->reader ->getClassAnnotation ($ reflection , Annotations \Geocodeable::class);
4239 }
4340
4441 public function loadMetadataFromObject ($ object )
4542 {
46- $ reflection = new \ReflectionObject ($ object );
47-
48- if ($ object instanceof Proxy) {
49- $ reflection = $ reflection ->getParentClass ();
50- }
43+ $ reflection = ClassUtils::newReflectionObject ($ object );
5144
5245 if (!$ annotation = $ this ->reader ->getClassAnnotation ($ reflection , Annotations \Geocodeable::class)) {
5346 throw new Exception \MappingException (sprintf ('The class %s is not geocodeable ' , get_class ($ object )));
You can’t perform that action at this time.
0 commit comments