File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
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 \Persistence \Proxy ;
1920
2021/**
2122 * @author Markus Bachmann <markus.bachmann@bachi.biz>
@@ -33,12 +34,21 @@ public function isGeocodeable($object): bool
3334 {
3435 $ reflection = new \ReflectionObject ($ object );
3536
37+ if ($ object instanceof Proxy) {
38+ $ reflection = $ reflection ->getParentClass ();
39+ }
40+
3641 return (bool ) $ this ->reader ->getClassAnnotation ($ reflection , Annotations \Geocodeable::class);
3742 }
3843
3944 public function loadMetadataFromObject ($ object )
4045 {
4146 $ reflection = new \ReflectionObject ($ object );
47+
48+ if ($ object instanceof Proxy) {
49+ $ reflection = $ reflection ->getParentClass ();
50+ }
51+
4252 if (!$ annotation = $ this ->reader ->getClassAnnotation ($ reflection , Annotations \Geocodeable::class)) {
4353 throw new Exception \MappingException (sprintf ('The class %s is not geocodeable ' , get_class ($ object )));
4454 }
You can’t perform that action at this time.
0 commit comments