File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ # Doctrine annotation support
2+
3+ * [ << Back to documentation index] ( Resources/doc/index.md ) *
4+
5+ Wouldn't it be great if you could automatically save the coordinates of a users
6+ address every time it is updated? Wait not more here is the feature you been always
7+ wanted.
8+
9+ ``` php
10+
11+ use Bazinga\GeocoderBundle\Mapping\Annotation as Geocoder;
12+
13+ /**
14+ * @Geocoder\Geocodable
15+ */
16+ class User
17+ {
18+ /**
19+ * @Geocoder\Address
20+ */
21+ private $address;
22+
23+ /**
24+ * @Geocoder\Latitude
25+ */
26+ private $latitude;
27+
28+ /**
29+ * @Geocoder\Longitude
30+ */
31+ private $longitude;
32+ }
33+
34+ $user = new User();
35+ $user->setAddress('Brandenburger Tor, Pariser Platz, Berlin');
36+
37+ $em->persist($event);
38+ $em->flush();
39+
40+ echo $user->getLatitude(); // will output 52.516325
41+ echo $user->getLongitude(); // will output 13.377264
42+ ```
You can’t perform that action at this time.
0 commit comments