Skip to content

Commit e76734f

Browse files
author
Thibaudeau Pierre
committed
forgotten namespaces and uses
1 parent 73f32f5 commit e76734f

File tree

6 files changed

+36
-6
lines changed

6 files changed

+36
-6
lines changed

admin/validation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ For instance, with API Platform Core as backend, if you write the following:
1212
```php
1313
<?php
1414
// api/src/Entity/Book.php
15+
namespace App\Entity;
1516

1617
use ApiPlatform\Metadata\ApiResource;
1718
use Symfony\Component\Validator\Constraints as Assert;
@@ -45,6 +46,7 @@ For example if you have this code:
4546
```php
4647
<?php
4748
// api/src/Entity/Book.php
49+
namespace App\Entity;
4850

4951
use ApiPlatform\Metadata\ApiResource;
5052
use Symfony\Component\Validator\Constraints as Assert;

core/file-upload.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ namespace App\Entity;
5353
5454
use ApiPlatform\Metadata\ApiProperty;
5555
use ApiPlatform\Metadata\ApiResource;
56+
use ApiPlatform\Metadata\Get;
57+
use ApiPlatform\Metadata\GetCollection;
58+
use ApiPlatform\Metadata\Post;
5659
use App\Controller\CreateMediaObjectAction;
5760
use Doctrine\ORM\Mapping as ORM;
5861
use Symfony\Component\HttpFoundation\File\File;
@@ -350,6 +353,8 @@ namespace App\Entity;
350353

351354
use ApiPlatform\Metadata\ApiProperty;
352355
use ApiPlatform\Metadata\ApiResource;
356+
use ApiPlatform\Metadata\GetCollection;
357+
use ApiPlatform\Metadata\Post;
353358
use Doctrine\ORM\Mapping as ORM;
354359
use Symfony\Component\HttpFoundation\File\File;
355360
use Symfony\Component\Serializer\Annotation\Groups;

core/openapi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ You also have full control over both built-in and custom operations documentatio
300300
```php
301301
<?php
302302
// api/src/Entity/Rabbit.php
303-
303+
namespace App\Entity;
304304

305305
use ApiPlatform\Metadata\ApiResource;
306306
use ApiPlatform\Metadata\Post;

core/pagination.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ It can also be disabled for a specific resource:
7575
```php
7676
<?php
7777
// api/src/Entity/Book.php
78+
namespace App\Entity;
7879

7980
use ApiPlatform\Metadata\ApiResource;
8081

@@ -117,6 +118,7 @@ The client ability to disable the pagination can also be set in the resource con
117118
```php
118119
<?php
119120
// api/src/Entity/Book.php
121+
namespace App\Entity;
120122
121123
use ApiPlatform\Metadata\ApiResource;
122124
@@ -147,6 +149,7 @@ api_platform:
147149
```php
148150
<?php
149151
// api/src/Entity/Book.php
152+
namespace App\Entity;
150153
151154
use ApiPlatform\Metadata\ApiResource;
152155
@@ -180,6 +183,7 @@ Changing the number of items per page can be enabled (or disabled) for a specifi
180183
```php
181184
<?php
182185
// api/src/Entity/Book.php
186+
namespace App\Entity;
183187
184188
use ApiPlatform\Metadata\ApiResource;
185189
@@ -208,6 +212,7 @@ api_platform:
208212
```php
209213
<?php
210214
// api/src/Entity/Book.php
215+
namespace App\Entity;
211216
212217
use ApiPlatform\Metadata\ApiResource;
213218
@@ -223,8 +228,10 @@ class Book
223228
```php
224229
<?php
225230
// api/src/Entity/Book.php
231+
namespace App\Entity;
226232
227233
use ApiPlatform\Metadata\ApiResource;
234+
use ApiPlatform\Metadata\GetCollection;
228235
229236
#[ApiResource]
230237
#[GetCollection(paginationMaximumItemsPerPage: 50)]
@@ -344,8 +351,10 @@ The [PaginationExtension](https://github.com/api-platform/core/blob/main/src/Bri
344351
```php
345352
<?php
346353
// api/src/Entity/Book.php
354+
namespace App\Entity;
347355
348356
use ApiPlatform\Metadata\ApiResource;
357+
use ApiPlatform\Metadata\GetCollection;
349358
350359
#[ApiResource(paginationFetchJoinCollection: false)]
351360
#[GetCollection]
@@ -363,8 +372,10 @@ The [PaginationExtension](https://github.com/api-platform/core/blob/main/src/Bri
363372
```php
364373
<?php
365374
// api/src/Entity/Book.php
375+
namespace App\Entity;
366376
367377
use ApiPlatform\Metadata\ApiResource;
378+
use ApiPlatform\Metadata\GetCollection;
368379
369380
#[ApiResource(paginationUseOutputWalkers: false)]
370381
#[GetCollection]

core/performance.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ class User
283283
namespace App\Entity;
284284
285285
use ApiPlatform\Metadata\ApiResource;
286+
use ApiPlatform\Metadata\Get;
287+
use ApiPlatform\Metadata\Post;
288+
use ApiPlatform\Metadata\GetCollection;
286289
use Doctrine\ORM\Mapping as ORM;
287290
288291
/**

core/subresources.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ You can control the path of subresources with the `path` option of the `subresou
200200
```php
201201
<?php
202202
// api/src/Entity/Question.php
203+
namespace App\Entity;
204+
205+
use ApiPlatform\Metadata\ApiResource
203206
204207
#[ApiResource(
205208
subresourceOperations: [
@@ -211,6 +214,7 @@ You can control the path of subresources with the `path` option of the `subresou
211214
)]
212215
class Question
213216
{
217+
// ...
214218
}
215219
```
216220

@@ -221,17 +225,21 @@ The `subresourceOperations` attribute also allows you to add an access control o
221225
```php
222226
<?php
223227
// api/src/Entity/Answer.php
228+
namespace App\Entity;
224229
225-
#[ApiResource(
230+
use ApiPlatform\Metadata\ApiResource
231+
232+
#[ApiResource(
226233
subresourceOperations: [
227234
'api_questions_answer_get_subresource' => [
228235
'security' => "is_granted('ROLE_AUTHENTICATED')",
229236
],
230237
],
231-
)]
232-
class Answer
233-
{
234-
}
238+
)]
239+
class Answer
240+
{
241+
// ...
242+
}
235243
```
236244

237245
### Limiting Depth
@@ -242,6 +250,7 @@ such as `comments`and you don't want the route `api/questions/{id}/answers/{id}/
242250
```php
243251
<?php
244252
// api/src/Entity/Question.php
253+
namespace App\Entity;
245254
246255
use ApiPlatform\Metadata\ApiProperty;
247256
use ApiPlatform\Metadata\ApiResource;

0 commit comments

Comments
 (0)