Skip to content

Commit 709dbb3

Browse files
authored
Added documentation for doctrine (#142)
This will fix #97 and fix #141
1 parent e8dd361 commit 709dbb3

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

Resources/doc/doctrine.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
```

0 commit comments

Comments
 (0)