Skip to content
Merged

cs #2246

Show file tree
Hide file tree
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
9 changes: 6 additions & 3 deletions core/dto.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ In API Platform, [the general design considerations](design.md) recommended patt

This reference covers three implementation strategies:

- For automated CRUD operations, link a DTO Resource to an Entity: [State Options](#1-the-dto-resource-state-options)
- For automated Write operation, use input DTOs with stateOptions: [Automated Mapped Inputs](#2-automated-mapped-inputs-and-outputs)
- For specific business actions, use input DTOs with custom State Processors : [Custom Business Logic](#3-custom-business-logic-custom-processor)
- For automated CRUD operations, link a DTO Resource to an Entity:
[State Options](#1-the-dto-resource-state-options)
- For automated Write operation, use input DTOs with stateOptions:
[Automated Mapped Inputs](#2-automated-mapped-inputs-and-outputs)
- For specific business actions, use input DTOs with custom State Processors :
[Custom Business Logic](#3-custom-business-logic-custom-processor)

## 1. The DTO Resource (State Options)

Expand Down
9 changes: 6 additions & 3 deletions core/identifiers.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ Your `PersonProvider` will now work as expected!

## Decorating the IdentifiersExtractor

The `IdentifiersExtractor` is responsible for extracting identifiers from a resource. By default, when `\DateTime` objects are used as identifiers, their serialization to `IRI` format is handled by the `DateTimeUriVariableTransformer`, which internally uses Symfony's `DateTimeNormalizer`. If you need a custom format, you can decorate the `IdentifiersExtractor`.
The `IdentifiersExtractor` is responsible for extracting identifiers from a resource. By default,
when `\DateTime` objects are used as identifiers, their serialization to `IRI` format is handled by
the `DateTimeUriVariableTransformer`, which internally uses Symfony's `DateTimeNormalizer`. If you
need a custom format, you can decorate the `IdentifiersExtractor`.

Let's say you want to format all `\DateTime` identifiers to `Y-m-d`.

Expand Down Expand Up @@ -220,8 +223,8 @@ Then, configure the service decoration in your `services.yaml`:
# api/config/services.yaml
services:
App\Identifier\DateTimeIdentifiersExtractor:
decorates: 'api_platform.identifiers.identifiers_extractor'
arguments: ['@.inner']
decorates: "api_platform.identifiers.identifiers_extractor"
arguments: ["@.inner"]
public: false
```
Expand Down