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: doc/doctrine.md
+13-69Lines changed: 13 additions & 69 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,26 +10,18 @@ First of all, update your entity:
10
10
11
11
```php
12
12
13
-
use Bazinga\GeocoderBundle\Mapping\Annotations as Geocoder;
13
+
use Bazinga\GeocoderBundle\Mapping\Attributes as Geocoder;
14
14
15
-
/**
16
-
* @Geocoder\Geocodeable
17
-
*/
15
+
#[Geocoder\Geocodeable()]
18
16
class User
19
17
{
20
-
/**
21
-
* @Geocoder\Address
22
-
*/
18
+
#[Geocoder\Address()]
23
19
private $address;
24
20
25
-
/**
26
-
* @Geocoder\Latitude
27
-
*/
21
+
#[Geocoder\Latitude()]
28
22
private $latitude;
29
23
30
-
/**
31
-
* @Geocoder\Longitude
32
-
*/
24
+
#[Geocoder\Longitude()]
33
25
private $longitude;
34
26
}
35
27
```
@@ -38,47 +30,36 @@ Instead of annotating a property, you can also annotate a getter:
38
30
39
31
```php
40
32
41
-
use Bazinga\GeocoderBundle\Mapping\Annotations as Geocoder;
33
+
use Bazinga\GeocoderBundle\Mapping\Attributes as Geocoder;
42
34
43
-
/**
44
-
* @Geocoder\Geocodeable
45
-
*/
35
+
#[Geocoder\Geocodeable()]
46
36
class User
47
37
{
48
-
/**
49
-
* @Geocoder\Latitude
50
-
*/
38
+
#[Geocoder\Latitude()]
51
39
private $latitude;
52
40
53
-
/**
54
-
* @Geocoder\Longitude
55
-
*/
41
+
#[Geocoder\Longitude()]
56
42
private $longitude;
57
43
58
-
/**
59
-
* @Geocoder\Address
60
-
*/
44
+
#[Geocoder\Address()]
61
45
public function getAddress(): string
62
46
{
63
47
// Your code...
64
48
}
65
49
}
66
50
```
67
51
68
-
Secondly, register the Doctrine event listener and its dependencies in your `config/services.yaml` file.
52
+
Secondly, register the Doctrine event listener and its dependencies in your `config/services.yaml`or `config/services.php`file.
69
53
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.
'message' => '#^Method Bazinga\\\\GeocoderBundle\\\\Mapping\\\\Driver\\\\AnnotationDriver\\:\\:getReflection\\(\\) return type with generic class ReflectionClass does not specify its types\\: T$#',
'message' => '#^Method Bazinga\\\\GeocoderBundle\\\\Mapping\\\\Driver\\\\AttributeDriver\\:\\:getReflection\\(\\) return type with generic class ReflectionClass does not specify its types\\: T$#',
0 commit comments