Skip to content

docs(deprecations): compatibility with laravel #2071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions core/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ To deprecate a resource class, use the `deprecationReason` attribute:

```php
<?php
// api/src/Entity/Parchment.php
namespace App\Entity;
// api/src/ApiResource/Parchment.php with Symfony or app/ApiResource/Parchment.php with Laravel
namespace App\ApiResource;

use ApiPlatform\Metadata\ApiResource;

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

```php
<?php
// api/src/Entity/Parchment.php
namespace App\Entity;
// api/src/ApiResource/Parchment.php with Symfony or app/ApiResource/Parchment.php with Laravel
namespace App\ApiResource;

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

```php
<?php
// api/src/Entity/Review.php
namespace App\Entity;
// api/src/ApiResource/Review.php with Symfony or app/ApiResource/Review.php with Laravel
namespace App\ApiResource;

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\ApiProperty;
Expand All @@ -91,9 +91,10 @@ class Review

```yaml
# api/config/api_platform/resources/Review.yaml
# The YAML syntax is only supported for Symfony
properties:
# ...
App\Entity\Review:
App\ApiResource\Review:
# ...
letter:
deprecationReason: 'Use the rating property instead'
Expand All @@ -114,8 +115,8 @@ Thanks to the `sunset` attribute, API Platform makes it easy to set this header

```php
<?php
// api/src/Entity/Parchment.php
namespace App\Entity;
// api/src/ApiResource/Parchment.php with Symfony or app/ApiResource/Parchment.php with Laravel
namespace App\ApiResource;

use ApiPlatform\Metadata\ApiResource;

Expand All @@ -136,8 +137,8 @@ It's also possible to set the `Sunset` header only for a specific [operation](op

```php
<?php
// api/src/Entity/Parchment.php
namespace App\Entity;
// api/src/ApiResource/Parchment.php with Symfony or app/ApiResource/Parchment.php with Laravel
namespace App\ApiResource;

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
Expand All @@ -162,8 +163,8 @@ You can prefix your URI Templates and change the representation using serializat

```php
<?php
// api/src/Entity/Parchment.php
namespace App\Model;
// api/src/ApiResource/Parchment.php with Symfony or app/ApiResource/Parchment.php with Laravel
namespace App\ApiResource;

use ApiPlatform\Metadata\Get;
use Symfony\Component\Serializer\Attrbute\Groups;
Expand Down