Skip to content

Commit 41bf533

Browse files
docs(deprecations): compatibility with laravel (#2071)
1 parent 2791342 commit 41bf533

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

core/deprecations.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ To deprecate a resource class, use the `deprecationReason` attribute:
2121

2222
```php
2323
<?php
24-
// api/src/Entity/Parchment.php
25-
namespace App\Entity;
24+
// api/src/ApiResource/Parchment.php with Symfony or app/ApiResource/Parchment.php with Laravel
25+
namespace App\ApiResource;
2626

2727
use ApiPlatform\Metadata\ApiResource;
2828

@@ -51,8 +51,8 @@ You can also use this new `deprecationReason` attribute to deprecate specific [o
5151

5252
```php
5353
<?php
54-
// api/src/Entity/Parchment.php
55-
namespace App\Entity;
54+
// api/src/ApiResource/Parchment.php with Symfony or app/ApiResource/Parchment.php with Laravel
55+
namespace App\ApiResource;
5656

5757
use ApiPlatform\Metadata\ApiResource;
5858
use ApiPlatform\Metadata\Get;
@@ -71,8 +71,8 @@ It's also possible to deprecate a single property:
7171

7272
```php
7373
<?php
74-
// api/src/Entity/Review.php
75-
namespace App\Entity;
74+
// api/src/ApiResource/Review.php with Symfony or app/ApiResource/Review.php with Laravel
75+
namespace App\ApiResource;
7676

7777
use ApiPlatform\Metadata\ApiResource;
7878
use ApiPlatform\Metadata\ApiProperty;
@@ -91,9 +91,10 @@ class Review
9191

9292
```yaml
9393
# api/config/api_platform/resources/Review.yaml
94+
# The YAML syntax is only supported for Symfony
9495
properties:
9596
# ...
96-
App\Entity\Review:
97+
App\ApiResource\Review:
9798
# ...
9899
letter:
99100
deprecationReason: 'Use the rating property instead'
@@ -114,8 +115,8 @@ Thanks to the `sunset` attribute, API Platform makes it easy to set this header
114115

115116
```php
116117
<?php
117-
// api/src/Entity/Parchment.php
118-
namespace App\Entity;
118+
// api/src/ApiResource/Parchment.php with Symfony or app/ApiResource/Parchment.php with Laravel
119+
namespace App\ApiResource;
119120
120121
use ApiPlatform\Metadata\ApiResource;
121122
@@ -136,8 +137,8 @@ It's also possible to set the `Sunset` header only for a specific [operation](op
136137

137138
```php
138139
<?php
139-
// api/src/Entity/Parchment.php
140-
namespace App\Entity;
140+
// api/src/ApiResource/Parchment.php with Symfony or app/ApiResource/Parchment.php with Laravel
141+
namespace App\ApiResource;
141142
142143
use ApiPlatform\Metadata\ApiResource;
143144
use ApiPlatform\Metadata\Get;
@@ -162,8 +163,8 @@ You can prefix your URI Templates and change the representation using serializat
162163

163164
```php
164165
<?php
165-
// api/src/Entity/Parchment.php
166-
namespace App\Model;
166+
// api/src/ApiResource/Parchment.php with Symfony or app/ApiResource/Parchment.php with Laravel
167+
namespace App\ApiResource;
167168
168169
use ApiPlatform\Metadata\Get;
169170
use Symfony\Component\Serializer\Attrbute\Groups;

0 commit comments

Comments
 (0)