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/data-providers.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ final class BlogPostCollectionDataProvider implements CollectionDataProviderInte
58
58
}
59
59
```
60
60
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).
62
62
To declare the service explicitly, or to set a custom priority, you can use the following snippet:
Copy file name to clipboardExpand all lines: core/design.md
+9-10Lines changed: 9 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# General Design Considerations
2
2
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.
6
6
7
7
To do so, you have to write a plain old PHP object representing the input and output of your endpoint. This is the class
8
8
that is [marked with the `@ApiResource` annotation](../distribution/index.md).
@@ -13,21 +13,20 @@ between this class and those docs).
13
13
14
14
Then, it's up to the developer to feed API Platform with an hydrated instance of this API resource object by implementing
15
15
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.
17
17
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).
20
20
To do so, there is another interface to implement: [`DataPersisterInterface`](data-persisters.md).
21
21
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:
23
23
24
24
* persist it directly in the database;
25
25
* or hydrate a DTO then trigger a command;
26
26
* or populate an event store;
27
27
* or persist the data in any other useful way.
28
28
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**.
31
30
32
31
For [Rapid Application Development](https://en.wikipedia.org/wiki/Rapid_application_development), convenience and prototyping,
33
32
**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:
48
47
* to create projections in standard RDBMS (Postgres, MariaDB...) tables or views
49
48
* to map those projections with read-only Doctrine entity classes **and** to mark those classes with `@ApiResource`
50
49
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