Skip to content

Commit d5ff7a8

Browse files
committed
review
1 parent a272144 commit d5ff7a8

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

core/data-persisters.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This interface defines only 3 methods:
2424

2525
* `persist`: to create or update the given data
2626
* `delete`: to delete the given data
27-
* `support`: to tell if the given data can be handled by this specific data persister
27+
* `support`: checks whether the given data is supported by this data persister
2828

2929
Here is an implementation example:
3030

@@ -54,10 +54,10 @@ final class BlogPostDataPersister implements DataPersisterInterface
5454
}
5555
```
5656

57-
If service autowiring and autoconfiguration are enabled (it's the case by default), you are done!
57+
If service autowiring and autoconfiguration are enabled (they are by default), you are done!
5858

5959
Otherwise, if you use a custom dependency injection configuration, you need to register the corresponding service and add the
60-
`api_platform.data_persister` tag to it. The `priority` attribute can be used to order persisters.
60+
`api_platform.data_persister` tag. The `priority` attribute can be used to order persisters.
6161

6262
```yaml
6363
# api/config/services.yaml

core/data-providers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ final class BlogPostCollectionDataProvider implements CollectionDataProviderInte
5858
}
5959
```
6060

61-
If you use the default configuration, the corresponding service will be automatically registered thanks to the [autowiring](https://symfony.com/doc/current/service_container/autowiring.html).
61+
If you use the default configuration, the corresponding service will be automatically registered thanks to [autowiring](https://symfony.com/doc/current/service_container/autowiring.html).
6262
To declare the service explicitly, or to set a custom priority, you can use the following snippet:
6363

6464
```yaml

core/design.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# General Design Considerations
22

3-
Because to create a working web API you only need to describe the structure of data to expose, API Platform is both [a "design-first"
4-
and "code-first"](https://swagger.io/blog/api-design/design-first-or-code-first-api-development/) API framework.
5-
However, the "design-first" methodology is strongly recommended: first you design the **public shape** of API endpoints.
3+
Since you only need to describe the structure of the data to expose, API Platform is both [a "design-first" and "code-first"](https://swagger.io/blog/api-design/design-first-or-code-first-api-development/)
4+
API framework. However, the "design-first" methodology is strongly recommended: first you design the **public shape** of
5+
API endpoints.
66

77
To do so, you have to write a plain old PHP object representing the input and output of your endpoint. This is the class
88
that is [marked with the `@ApiResource` annotation](../distribution/index.md).
@@ -13,21 +13,20 @@ between this class and those docs).
1313

1414
Then, it's up to the developer to feed API Platform with an hydrated instance of this API resource object by implementing
1515
the [`DataProviderInterface`](data-providers.md). Basically, the data provider will query the persistence system (RDBMS,
16-
document or graph DB, external API...), and must hydrate and return the POPO that has been designed in the first time.
16+
document or graph DB, external API...), and must hydrate and return the POPO that has been designed as mentioned above.
1717

18-
When updating a state (`POST`, `PUT`, `PATCH`, `DELETE` HTTP methods), it's up to the developer to persist properly the
19-
data provided by API Platform's resource object [hydrated by the serializer](serialization.md) to the persistence system.
18+
When updating a state (`POST`, `PUT`, `PATCH`, `DELETE` HTTP methods), it's up to the developer to properly persist the
19+
data provided by API Platform's resource object [hydrated by the serializer](serialization.md).
2020
To do so, there is another interface to implement: [`DataPersisterInterface`](data-persisters.md).
2121

22-
Here is the reverse operation, this class will read the API resource object (the one marked with `@ApiResource`) and:
22+
This class will read the API resource object (the one marked with `@ApiResource`) and:
2323

2424
* persist it directly in the database;
2525
* or hydrate a DTO then trigger a command;
2626
* or populate an event store;
2727
* or persist the data in any other useful way.
2828

29-
The logic to execute in data persisters is the responsibility of application developers, and is **out of the API Platform's
30-
scope**.
29+
The logic of data persisters is the responsibility of application developers, and is **out of the API Platform's scope**.
3130

3231
For [Rapid Application Development](https://en.wikipedia.org/wiki/Rapid_application_development), convenience and prototyping,
3332
**if and only if the class marked with `@ApiResource` is also a Doctrine entity**, the developer can use the Doctrine
@@ -48,4 +47,4 @@ approach is:
4847
* to create projections in standard RDBMS (Postgres, MariaDB...) tables or views
4948
* to map those projections with read-only Doctrine entity classes **and** to mark those classes with `@ApiResource`
5049

51-
Then you can benefit of all built-in Doctrine filters, sorting, pagination, auto-joins, etc provided by API Platform.
50+
You can then benefit from the built-in Doctrine filters, sorting, pagination, auto-joins, etc provided by API Platform.

0 commit comments

Comments
 (0)