You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Resources/doc/doctrine.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,37 @@ class User
34
34
}
35
35
```
36
36
37
+
Instead of annotating a property, you can also annotate a getter:
38
+
39
+
```php
40
+
41
+
use Bazinga\GeocoderBundle\Mapping\Annotations as Geocoder;
42
+
43
+
/**
44
+
* @Geocoder\Geocodeable
45
+
*/
46
+
class User
47
+
{
48
+
/**
49
+
* @Geocoder\Latitude
50
+
*/
51
+
private $latitude;
52
+
53
+
/**
54
+
* @Geocoder\Longitude
55
+
*/
56
+
private $longitude;
57
+
58
+
/**
59
+
* @Geocoder\Address
60
+
*/
61
+
public function getAddress(): string
62
+
{
63
+
// Your code...
64
+
}
65
+
}
66
+
```
67
+
37
68
Secondly, register the Doctrine event listener and its dependencies in your `services.yaml` file.
38
69
You have to indicate which provider to use to reverse geocode the address. Here we use `acme` provider we declared in bazinga_geocoder configuration earlier.
0 commit comments