File tree 1 file changed +3
-10
lines changed
1 file changed +3
-10
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 \Common \Util \ClassUtils ;
19
20
use Doctrine \Persistence \Proxy ;
20
21
21
22
/**
@@ -32,22 +33,14 @@ public function __construct(Reader $reader)
32
33
33
34
public function isGeocodeable ($ object ): bool
34
35
{
35
- $ reflection = new \ReflectionObject ($ object );
36
-
37
- if ($ object instanceof Proxy) {
38
- $ reflection = $ reflection ->getParentClass ();
39
- }
36
+ $ reflection = ClassUtils::newReflectionObject ($ object );
40
37
41
38
return (bool ) $ this ->reader ->getClassAnnotation ($ reflection , Annotations \Geocodeable::class);
42
39
}
43
40
44
41
public function loadMetadataFromObject ($ object )
45
42
{
46
- $ reflection = new \ReflectionObject ($ object );
47
-
48
- if ($ object instanceof Proxy) {
49
- $ reflection = $ reflection ->getParentClass ();
50
- }
43
+ $ reflection = ClassUtils::newReflectionObject ($ object );
51
44
52
45
if (!$ annotation = $ this ->reader ->getClassAnnotation ($ reflection , Annotations \Geocodeable::class)) {
53
46
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