You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[YAML](http://yaml.org/) | `yaml` | `application/x-yaml` | no
27
+
[YAML](https://yaml.org/) | `yaml` | `application/x-yaml` | no
28
28
[CSV](https://tools.ietf.org/html/rfc4180) | `csv` | `text/csv` | no
29
29
[HTML](https://whatwg.org/) (API docs) | `html` | `text/html` | no
30
30
[XML](https://www.w3.org/XML/) | `xml` | `application/xml`, `text/xml` | no
@@ -119,9 +119,9 @@ Additionally the `csv` format is added with the MIME type `text/csv`.
119
119
It is also important to notice that the usage of this attribute will override the formats defined in the configuration, therefore
120
120
this configuration might disable the `json` or the `html` on this resource for example.
121
121
122
-
You can specify different accepted formats at operation level too, it's especially convenient for to configure formats available for the `PATCH` method:
122
+
You can specify different accepted formats at operation level too, it's especially convenient to configure formats available for the `PATCH` method:
123
123
124
-
[codeSelector]
124
+
<code-selector>
125
125
126
126
```php
127
127
<?php
@@ -178,12 +178,12 @@ resources:
178
178
</resources>
179
179
```
180
180
181
-
[/codeSelector]
181
+
</code-selector>
182
182
183
183
## Supporting Custom Formats
184
184
185
185
The API Platform content negotiation system is extendable.
186
-
You can add support for formats not available by default by creating custom normalizer and encoders.
186
+
You can add support for formats not available by default by creating custom normalizers and encoders.
187
187
Refer to the Symfony documentation to learn [how to create and register such classes](https://symfony.com/doc/current/serializer.html#adding-normalizers-and-encoders).
188
188
189
189
Then, register the new format in the configuration:
Copy file name to clipboardExpand all lines: core/controllers.md
+14-14
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Note: using custom controllers with API Platform is **discouraged**. Also, Graph
4
4
[For most use cases, better extension points, working both with REST and GraphQL, are available](design.md).
5
5
6
6
API Platform can leverage the Symfony routing system to register custom operations related to custom controllers. Such custom
7
-
controllers can be any valid [Symfony controller](http://symfony.com/doc/current/book/controller.html), including standard
7
+
controllers can be any valid [Symfony controller](https://symfony.com/doc/current/controller.html), including standard
8
8
Symfony controllers extending the [`Symfony\Bundle\FrameworkBundle\Controller\AbstractController`](http://api.symfony.com/4.1/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.html)
9
9
helper class.
10
10
@@ -15,7 +15,7 @@ implements the [Action-Domain-Responder](https://github.com/pmjones/adr) pattern
15
15
The distribution of API Platform also eases the implementation of the ADR pattern: it automatically registers action classes
16
16
stored in `api/src/Controller` as autowired services.
17
17
18
-
Thanks to the [autowiring](http://symfony.com/doc/current/components/dependency_injection/autowiring.html) feature of the
18
+
Thanks to the [autowiring](https://symfony.com/doc/current/service_container/autowiring.html) feature of the
19
19
Symfony Dependency Injection container, services required by an action can be type-hinted in its constructor, it will be
20
20
automatically instantiated and injected, without having to declare it explicitly.
21
21
@@ -85,7 +85,7 @@ the client.
85
85
86
86
The routing has not been configured yet because we will add it at the resource configuration level:
87
87
88
-
[codeSelector]
88
+
<code-selector>
89
89
90
90
```php
91
91
<?php
@@ -143,7 +143,7 @@ resources:
143
143
</resources>
144
144
```
145
145
146
-
[/codeSelector]
146
+
</code-selector>
147
147
148
148
It is mandatory to set the `method`, `uriTemplate` and `controller` attributes. They allow API Platform to configure the routing path and
149
149
the associated controller respectively.
@@ -158,7 +158,7 @@ To avoid that, API Platform provides the `ApiPlatform\Action\PlaceholderAction`
158
158
159
159
You just need to set the `controller` attribute with this class. Here, the previous example updated:
160
160
161
-
[codeSelector]
161
+
<code-selector>
162
162
163
163
```php
164
164
// api/src/Entity/Book.php
@@ -215,13 +215,13 @@ resources:
215
215
</resources>
216
216
```
217
217
218
-
[/codeSelector]
218
+
</code-selector>
219
219
220
220
## Using Serialization Groups
221
221
222
222
You may want different serialization groups for your custom operations. Just configure the proper `normalizationContext` and/or `denormalizationContext` in your operation:
223
223
224
-
[codeSelector]
224
+
<code-selector>
225
225
226
226
```php
227
227
<?php
@@ -240,7 +240,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
If you want to bypass the automatic retrieval of the entity in your custom operation, you can set `read: false` in the
300
300
operation attribute:
301
301
302
-
[codeSelector]
302
+
<code-selector>
303
303
304
304
```php
305
305
<?php
@@ -357,7 +357,7 @@ resources:
357
357
</resources>
358
358
```
359
359
360
-
[/codeSelector]
360
+
</code-selector>
361
361
362
362
This way, it will skip the `ReadListener`. You can do the same for some other built-in listeners. See [Built-in Event Listeners](events.md#built-in-event-listeners)
363
363
for more information.
@@ -377,7 +377,7 @@ for `book_post_discontinuation` when neither `method` nor `routeName` attributes
377
377
378
378
First, let's create your resource configuration:
379
379
380
-
[codeSelector]
380
+
<code-selector>
381
381
382
382
```php
383
383
<?php
@@ -430,10 +430,10 @@ resources:
430
430
</resources>
431
431
```
432
432
433
-
[/codeSelector]
433
+
</code-selector>
434
434
435
435
API Platform will automatically map this `post_publication` operation to the route `book_post_publication`. Let's create a custom action
Copy file name to clipboardExpand all lines: core/deprecations.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ It's a tedious task that should be avoided as much as possible.
9
9
On the other hand, the evolution strategy (also known as versionless APIs) consists of deprecating the fields, resources
10
10
types or operations that will be removed at some point.
11
11
12
-
Most modern API formats including [JSON-LD / Hydra](content-negotiation.md), [GraphQL](graphql.md) and [OpenAPI](swagger.md)
12
+
Most modern API formats including [JSON-LD / Hydra](content-negotiation.md), [GraphQL](graphql.md) and [OpenAPI](openapi.md)
13
13
allow you to mark resources types, operations or fields as deprecated.
14
14
15
15
## Deprecating Resource Classes, Operations and Properties
@@ -67,7 +67,7 @@ class Parchment
67
67
68
68
It's also possible to deprecate a single property:
69
69
70
-
[codeSelector]
70
+
<code-selector>
71
71
72
72
```php
73
73
<?php
@@ -99,7 +99,7 @@ properties:
99
99
deprecationReason: 'Use the rating property instead'
100
100
```
101
101
102
-
[/codeSelector]
102
+
</code-selector>
103
103
104
104
* With JSON-lD / Hydra, [an `owl:deprecated` annotation property](https://www.w3.org/TR/owl2-syntax/#Annotation_Properties) will be added to the appropriate data structure
105
105
* With Swagger / OpenAPI, [a `deprecated` property](https://swagger.io/docs/specification/2-0/paths-and-operations/) will be added
0 commit comments