Skip to content

Commit 5593024

Browse files
authored
demo: links to the demo code (#1207)
1 parent 05079e5 commit 5593024

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

core/data-providers.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ register and use this data provider. The optional attribute `priority` allows yo
7777
data providers are called. The first data provider not throwing a `ApiPlatform\Core\Exception\ResourceClassNotSupportedException`
7878
will be used.
7979

80+
You can find a full working example in the [API Platform's demo application](https://github.com/api-platform/demo/blob/master/api/src/DataProvider/TopBookCollectionDataProvider.php).
81+
8082
## Custom Item Data Provider
8183

8284
The process is similar for item data providers. Create a `BlogPostItemDataProvider` implementing the [`ItemDataProviderInterface`](https://github.com/api-platform/core/blob/master/src/DataProvider/ItemDataProviderInterface.php)
@@ -125,6 +127,8 @@ services:
125127
#tags: [ 'api_platform.item_data_provider' ]
126128
```
127129

130+
You can find a full working example in the [API Platform's demo application](https://github.com/api-platform/demo/blob/master/api/src/DataProvider/TopBookItemDataProvider.php).
131+
128132
## Injecting the Serializer in an `ItemDataProvider`
129133

130134
In some cases, you may need to inject the `Serializer` in your `DataProvider`. There are no issues with the

core/extensions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Extensions are specific to Doctrine and Elasticsearch-PHP, and therefore, the Do
66
reading support must be enabled to use this feature. If you use custom providers it's up to you to implement your own
77
extension system or not.
88

9+
You can find a working example of a custom data provider using a pagination extension in the [API Platform's demo application](https://github.com/api-platform/demo/blob/master/api/src/DataProvider/Extension/TopBookPaginationExtension.php).
10+
911
## Custom Doctrine ORM Extension
1012

1113
Custom extensions must implement the `ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\QueryCollectionExtensionInterface` and / or the `ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\QueryItemExtensionInterface` interfaces, to be run when querying for a collection of items and when querying for an item respectively.

0 commit comments

Comments
 (0)