File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 16
16
use Bazinga \GeocoderBundle \Mapping \ClassMetadata ;
17
17
use Bazinga \GeocoderBundle \Mapping \Exception ;
18
18
use Doctrine \Common \Annotations \Reader ;
19
+ use Doctrine \Persistence \Proxy ;
19
20
20
21
/**
21
22
* @author Markus Bachmann <[email protected] >
@@ -33,12 +34,21 @@ public function isGeocodeable($object): bool
33
34
{
34
35
$ reflection = new \ReflectionObject ($ object );
35
36
37
+ if ($ object instanceof Proxy) {
38
+ $ reflection = $ reflection ->getParentClass ();
39
+ }
40
+
36
41
return (bool ) $ this ->reader ->getClassAnnotation ($ reflection , Annotations \Geocodeable::class);
37
42
}
38
43
39
44
public function loadMetadataFromObject ($ object )
40
45
{
41
46
$ reflection = new \ReflectionObject ($ object );
47
+
48
+ if ($ object instanceof Proxy) {
49
+ $ reflection = $ reflection ->getParentClass ();
50
+ }
51
+
42
52
if (!$ annotation = $ this ->reader ->getClassAnnotation ($ reflection , Annotations \Geocodeable::class)) {
43
53
throw new Exception \MappingException (sprintf ('The class %s is not geocodeable ' , get_class ($ object )));
44
54
}
You can’t perform that action at this time.
0 commit comments