Skip to content

Commit cc2e0d6

Browse files
committed
docs(adr): Resource => ApiResource
1 parent 288851e commit cc2e0d6

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

docs/adr/0002-resource-definition.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ In API Platform, this resource identifier is also named [IRI (Internationalized
2424
```php
2525
<?php
2626

27-
#[Resource]
27+
#[ApiResource]
2828
class Users
2929
{
3030
#[ApiProperty(iri="hydra:member")]
@@ -33,8 +33,8 @@ class Users
3333
public float $averageRate;
3434
}
3535

36-
#[Resource("/companies/{companyId}/users/{id}", normalization_context=["groups"= [....]]), operations={}]
37-
#[Resource(normalization_context=["groups"= [....]], operations=[
36+
#[ApiResource("/companies/{companyId}/users/{id}", normalization_context=["groups"= [....]]), operations={}]
37+
#[ApiResource(normalization_context=["groups"= [....]], operations=[
3838
new Get(),
3939
new Post(),
4040
])]
@@ -61,7 +61,7 @@ For convenience and to ease the upgrade path, these would still be available on
6161
```php
6262
<?php
6363

64-
#[Resource]
64+
#[ApiResource]
6565
class User {}
6666
```
6767

@@ -78,7 +78,7 @@ corresponding to
7878
class User {}
7979
```
8080

81-
Verbs declared on a PHP class define API Platform operations. The `Resource` attributes would become optional and the only thing needed is to specify at least a verb and an IRI representing the Resource. Some examples:
81+
Verbs declared on a PHP class define API Platform operations. The `ApiResource` attributes would become optional and the only thing needed is to specify at least a verb and an IRI representing the Resource. Some examples:
8282

8383
<table>
8484
<tr>
@@ -165,12 +165,12 @@ class User {
165165
}
166166
```
167167

168-
The `Resource` attribute could be used to set defaults properties on operations:
168+
The `ApiResource` attribute could be used to set defaults properties on operations:
169169

170170
```php
171171
<?php
172172

173-
#[Resource(normalization_context=["groups"= [....]])]
173+
#[ApiResource(normalization_context=["groups"= [....]])]
174174
#[Get("/users/{id}")]
175175
class User {}
176176
```
@@ -184,11 +184,14 @@ These properties can also be specified directly on the verb attribute:
184184
class User {}
185185
```
186186

187-
Internally, HTTP verbs are aliases to the Resource Attribute holding a method and a default path. The Resource Attribute is a reflection of the underlying metadata:
187+
Internally, HTTP verbs are aliases to the Resource Attribute holding a method and a default path. The `ApiResource` attribute is a reflection of the underlying metadata:
188188

189189
```php
190190
<?php
191-
class Resource {
191+
192+
namespace ApiPlatform\Metadata;
193+
194+
class ApiResource {
192195
public string $iri;
193196
public bool $mercure;
194197
public string $security;

0 commit comments

Comments
 (0)