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
Copy file name to clipboardExpand all lines: core/dto.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Using Data Transfer Objects (DTOs)
2
2
3
-
<pclass="symfonycasts"style="text-align: center;"><ahref="https://symfonycasts.com/api-platform-extending?cid=apip"><imgsrc="../symfony/images/symfonycasts-player.png"alt="Custom Resources screencast"><br>Watch the Custom Resources screencast</a></p>
3
+
<pclass="symfonycasts"align="center"><ahref="https://symfonycasts.com/api-platform-extending?cid=apip"><imgsrc="../symfony/images/symfonycasts-player.png"alt="Custom Resources screencast"><br>Watch the Custom Resources screencast</a></p>
4
4
5
5
As stated in [the general design considerations](design.md), in most cases [the DTO pattern](https://en.wikipedia.org/wiki/Data_transfer_object) should be implemented using an API Resource class representing the public data model exposed through the API and [a custom State Provider](state-providers.md). In such cases, the class marked with `#[ApiResource]` will act as a DTO.
|[State Processors](state-processors)| custom business logic and computations to trigger before or after persistence (ex: mail, call to an external API...) |
17
-
|[Normalizers](serialization.md#decorating-a-serializer-and-adding-extra-data)| customize the resource sent to the client (add fields in JSON documents, encode codes, dates...) |
17
+
|[Normalizers](serialization.md#changing-the-serialization-context-dynamically)| customize the resource sent to the client (add fields in JSON documents, encode codes, dates...) |
18
18
|[Filters](filters.md)| create filters for collections and automatically document them (OpenAPI, GraphQL, Hydra) |
|[Messenger Handlers](../symfony/messenger.md)| create 100% custom, RPC, async, service-oriented endpoints (should be used in place of custom controllers because the messenger integration is compatible with both REST and GraphQL, while custom controllers only work with REST) |
20
+
|[Messenger Handlers](../symfony/messenger.md)| create 100% custom, RPC, async, service-oriented endpoints (should be used in place of custom controllers because the messenger integration is compatible with both REST and GraphQL, while custom controllers only work with REST) |
21
21
|[DTOs](dto.md)| use a specific class to represent the input or output data structure related to an operation |
22
22
|[Kernel Events](events.md)| customize the HTTP request or response (REST only, other extension points must be preferred when possible) |
Copy file name to clipboardExpand all lines: core/serialization.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -192,7 +192,7 @@ documentation generator.
192
192
193
193
## Using Serialization Groups per Operation
194
194
195
-
<p align="center" class="symfonycasts"><a href="https://symfonycasts.com/screencast/api-platform/relations?cid=apip"><img src="../symfony/images/symfonycasts-player.png" alt="Relations screencast"><br>Watch the Relations screencast</a></p>
195
+
<p class="symfonycasts" align="center"><a href="https://symfonycasts.com/screencast/api-platform/relations?cid=apip"><img src="../symfony/images/symfonycasts-player.png" alt="Relations screencast"><br>Watch the Relations screencast</a></p>
196
196
197
197
By default, the serializer provided with API Platform represents relations between objects using [dereferenceable IRIs](https://en.wikipedia.org/wiki/Internationalized_Resource_Identifier).
198
198
They allow you to retrieve details for related objects by issuing extra HTTP requests. However, for performance reasons,
Copy file name to clipboardExpand all lines: symfony/index.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,8 +19,8 @@ API Platform is shipped with **[Docker](../deployment/docker-compose.md)** and *
19
19
The easiest and most powerful way to get started is [to download the API Platform distribution](https://github.com/api-platform/api-platform/releases). It contains:
20
20
21
21
- the API skeleton, including [the Core library](../core/index.md), [the Symfony framework](https://symfony.com/) ([optional](../core/bootstrap.md)) and [the Doctrine ORM](https://www.doctrine-project.org/projects/orm.html) ([optional](../core/extending.md))
22
-
-[the client scaffolding tool](../create-client/) to generate [Next.js](../create-client/) web applications from the API documentation ([Nuxt](https://nuxt.com/), [Vue](https://vuejs.org/), [Create React App](https://reactjs.org), [React Native](https://reactnative.dev/), [Quasar](https://quasar.dev/) and [Vuetify](https://vuetifyjs.com/) are also supported)
23
-
-[a beautiful admin interface](../admin/), built on top of React Admin, dynamically created by parsing the API documentation
22
+
-[the client scaffolding tool](../create-client/index.md) to generate [Next.js](../create-client/index.md) web applications from the API documentation ([Nuxt](https://nuxt.com/), [Vue](https://vuejs.org/), [Create React App](https://reactjs.org), [React Native](https://reactnative.dev/), [Quasar](https://quasar.dev/) and [Vuetify](https://vuetifyjs.com/) are also supported)
23
+
-[a beautiful admin interface](../admin/index.md), built on top of React Admin, dynamically created by parsing the API documentation
24
24
- all you need to [create real-time and async APIs using the Mercure protocol](../core/mercure.md)
25
25
- a [Docker](../deployment/docker-compose.md) definition to start a working development environment in a single command, providing containers for the API and the Next.js web application
26
26
- a [Helm](https://helm.sh/) chart to deploy the API in any [Kubernetes](../deployment/kubernetes.md) cluster
Copy file name to clipboardExpand all lines: symfony/jwt.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
> **we recommend adopting open standards such as [OpenID Connect (OIDC)](https://openid.net/connect/)** for robust, scalable,
6
6
> and interoperable authentication.
7
7
8
-
<palign="center"class="symfonycasts"><ahref="https://symfonycasts.com/screencast/symfony-rest4/json-web-token?cid=apip"><imgsrc="../symfony/images/symfonycasts-player.png"alt="JWT screencast"><br>Watch the LexikJWTAuthenticationBundle screencast</a></p>
8
+
<pclass="symfonycasts"align="center"><ahref="https://symfonycasts.com/screencast/symfony-rest4/json-web-token?cid=apip"><imgsrc="../symfony/images/symfonycasts-player.png"alt="JWT screencast"><br>Watch the LexikJWTAuthenticationBundle screencast</a></p>
Copy file name to clipboardExpand all lines: symfony/security.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,8 +110,8 @@ Available variables are:
110
110
- `previous_object`: (`securityPostDenormalize` only) a clone of `object`, before modifications were made - this is `null` for create operations
111
111
- `request` (only at the resource level): the current request
112
112
113
-
Access control checks in the `security` attribute are always executed before the [denormalization step](serialization.md).
114
-
It means that for `PUT` or `PATCH` requests, `object` doesn't contain the value submitted by the user, but values currently stored in [the persistence layer](state-processors.md).
113
+
Access control checks in the `security` attribute are always executed before the [denormalization step](../core/serialization.md).
114
+
It means that for `PUT` or `PATCH` requests, `object` doesn't contain the value submitted by the user, but values currently stored in [the persistence layer](../core/state-processors.md).
115
115
116
116
## Executing Access Control Rules After Denormalization
117
117
@@ -337,17 +337,17 @@ resources:
337
337
338
338
## Filtering Collection According to the Current User Permissions
339
339
340
-
Filtering collections according to the role or permissions of the current user must be done directly at [the state provider](state-providers.md) level. For instance, when using the built-in adapters for Doctrine ORM, MongoDB and ElasticSearch, removing entries from a collection should be done using [extensions](extensions.md).
340
+
Filtering collections according to the role or permissions of the current user must be done directly at [the state provider](../core/state-providers.md) level. For instance, when using the built-in adapters for Doctrine ORM, MongoDB and ElasticSearch, removing entries from a collection should be done using [extensions](../core/extensions.md).
341
341
Extensions allow to customize the generated DQL/Mongo/Elastic/... query used to retrieve the collection (e.g. add `WHERE` clauses depending of the currently connected user) instead of using access control expressions.
342
342
As extensions are services, you can [inject the Symfony `Security` class](https://symfony.com/doc/current/security.html#b-fetching-the-user-from-a-service) into them to access to current user's roles and permissions.
343
343
344
-
If you use [custom state providers](state-providers.md), you'll have to implement the filtering logic according to the persistence layer you rely on.
344
+
If you use [custom state providers](../core/state-providers.md), you'll have to implement the filtering logic according to the persistence layer you rely on.
345
345
346
346
## Disabling Operations
347
347
348
-
To completely disable some operations from your application, refer to the [disabling operations](operations.md#enabling-and-disabling-operations)
348
+
To completely disable some operations from your application, refer to the [disabling operations](../core/operations.md#enabling-and-disabling-operations)
349
349
section.
350
350
351
351
## Changing Serialization Groups Depending of the Current User
352
352
353
-
See [how to dynamically change](serialization.md#changing-the-serialization-context-dynamically) the current Serializer context according to the current loggedin user.
353
+
See [how to dynamically change](../core/serialization.md#changing-the-serialization-context-dynamically) the current Serializer context according to the current logged-in user.
Copy file name to clipboardExpand all lines: symfony/testing.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -377,7 +377,7 @@ If you would like to verify that your stack (including services such as the DBMS
377
377
works, you need [end-to-end testing](https://wiki.c2.com/?EndToEndPrinciple). To do so, we recommend using [Playwright](https://playwright.dev) if you use have PWA/JavaScript-heavy app, or [Symfony Panther](https://github.com/symfony/panther) if you mostly use Twig.
378
378
379
379
Usually, end-to-end testing should be done with a production-like setup. For your convenience, you may [run our Docker Compose setup
380
-
for production locally](../deployment/docker-compose.md#running-the-docker-compose-setup-for-production-locally).
380
+
for production locally](../deployment/docker-compose.md#deploying-with-docker-compose).
Copy file name to clipboardExpand all lines: symfony/validation.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,7 +104,7 @@ error will look like the following if the requested format is JSON-LD (the defau
104
104
}
105
105
```
106
106
107
-
Take a look at the [Errors Handling guide](errors.md) to learn how API Platform converts PHP exceptions like validation
107
+
Take a look at the [Errors Handling guide](../core/errors.md) to learn how API Platform converts PHP exceptions like validation
108
108
errors to HTTP errors.
109
109
110
110
## Using Validation Groups
@@ -136,7 +136,7 @@ class Book
136
136
137
137
With the previous configuration, the validation groups `a` and `b` will be used when validation is performed.
138
138
139
-
Like for [serialization groups](serialization.md#using-different-serialization-groups-per-operation),
139
+
Like for [serialization groups](../core/serialization.md#using-serialization-groups-per-operation),
140
140
you can specify validation groups globally or on a per-operation basis.
141
141
142
142
Of course, you can use XML or YAML configuration format instead of attributes if you prefer.
@@ -146,7 +146,7 @@ the array of group names.
146
146
147
147
## Using Validation Groups on Operations
148
148
149
-
You can have different validation for each [operation](operations.md) related to your resource.
149
+
You can have different validation for each [operation](../core/operations.md) related to your resource.
150
150
151
151
```php
152
152
<?php
@@ -456,7 +456,7 @@ In this example, only `severity` and `anotherPayloadField` will be serialized.
456
456
457
457
Use the [Valid](https://symfony.com/doc/current/reference/constraints/Valid.html) constraint.
458
458
459
-
Note: this is related to the [collection relation denormalization](./serialization.md#collection-relation).
459
+
Note: this is related to the [collection relation denormalization](../core/serialization.md#collection-relation-using-doctrine).
460
460
You may have an issue when trying to validate a relation representing a Doctrine's `ArrayCollection` (`toMany`). Fix the denormalization using the property getter. Return an `array` instead of an `ArrayCollection` with `$collectionRelation->getValues()`. Then, define your validation on the getter instead of the property.
0 commit comments