Skip to content

Commit c010fa3

Browse files
committed
Add Laravel for operations and doc tips
1 parent adae1bb commit c010fa3

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

core/operations.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ an implementation point of view, an operation is a link between a resource, a ro
66
<p align="center" class="symfonycasts"><a href="https://symfonycasts.com/screencast/api-platform/operations?cid=apip"><img src="../symfony/images/symfonycasts-player.png" alt="Operations screencast"><br>Watch the Operations screencast</a></p>
77

88
API Platform automatically registers typical [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) operations
9-
and describes them in the exposed documentation (Hydra and Swagger). It also creates and registers routes corresponding
10-
to these operations in the Symfony routing system (if it is available).
9+
and describes them in the exposed documentation (Hydra and Swagger). It also creates and registers routes
10+
for these operations in the Symfony routing system, if available, or in the Laravel routing system,
11+
should that be the case.
1112

1213
The behavior of built-in operations is briefly presented in the [Getting started](getting-started.md#mapping-the-entities)
1314
guide.
@@ -42,13 +43,20 @@ Method | Mandatory | Description | Registered b
4243
`PATCH` | no | Apply a partial modification to an element | yes
4344
`DELETE` | no | Delete an element | yes
4445

45-
Note: the `PATCH` method must be enabled explicitly in the configuration, refer to the [Content Negotiation](content-negotiation.md) section for more information.
46+
> [!NOTE]
47+
> The `PATCH` method must be enabled explicitly in the configuration, refer to the [Content Negotiation](content-negotiation.md) section for more information.
4648
47-
Note: with JSON Merge Patch, the [null values will be skipped](https://symfony.com/doc/current/components/serializer.html#skipping-null-values) in the response.
49+
---
4850

49-
Note: Current `PUT` implementation behaves more or less like the `PATCH` method.
50-
Existing properties not included in the payload are **not** removed, their current values are preserved.
51-
To remove an existing property, its value must be explicitly set to `null`.
51+
> [!NOTE]
52+
> With JSON Merge Patch, the [null values will be skipped](https://symfony.com/doc/current/components/serializer.html#skipping-null-values) in the response.
53+
54+
---
55+
56+
> [!NOTE]
57+
> Current `PUT` implementation behaves more or less like the `PATCH` method.
58+
> Existing properties not included in the payload are **not** removed, their current values are preserved.
59+
> To remove an existing property, its value must be explicitly set to `null`.
5260
5361
## Enabling and Disabling Operations
5462

@@ -64,7 +72,13 @@ for the `GET` method for both `collection` and `item` to create a readonly endpo
6472
If the operation's name matches a supported HTTP method (`GET`, `POST`, `PUT`, `PATCH` or `DELETE`), the corresponding `method` property
6573
will be automatically added.
6674

67-
Note: The `#[GetCollection]` attribute is an alias for `#[Get(collection: true)]`
75+
> [!TIP]
76+
> The `#[GetCollection]` attribute is an alias for `#[Get(collection: true)]`
77+
78+
---
79+
80+
> [!NOTE]
81+
> In Symfony we use the term “entities”, while the following documentation is mostly for Laravel “models”.
6882
6983
<code-selector>
7084

0 commit comments

Comments
 (0)