Skip to content

Commit e51e512

Browse files
committed
Merge branch '2.0'
2 parents d9fc842 + 6162e97 commit e51e512

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

core/data-providers.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Then declare a Symfony service, for example:
5959
services:
6060
blog_post.collection_data_provider:
6161
class: 'AppBundle\DataProvider\BlogPostCollectionDataProvider'
62+
public: false
6263
tags:
6364
- { name: 'api_platform.collection_data_provider', priority: 2 }
6465
```
@@ -88,8 +89,7 @@ use ApiPlatform\Core\Exception\ResourceClassNotSupportedException;
8889
8990
final class BlogPostItemDataProvider implements ItemDataProviderInterface
9091
{
91-
public function getItem(string $resourceClass, $id, string $operationName = null, bool $fetchData = false)
92-
{
92+
public function getItem(string $resourceClass, $id, string $operationName = null, array $context = []) {
9393
if (BlogPost::class !== $resourceClass) {
9494
throw new ResourceClassNotSupportedException();
9595
}
@@ -107,8 +107,9 @@ attribute can be used to order providers.
107107
# app/config/services.yml
108108
109109
services:
110-
blog_post.collection_data_provider:
111-
class: 'AppBundle\DataProvider\BlogPostCollectionDataProvider'
110+
blog_post.item_data_provider:
111+
class: 'AppBundle\DataProvider\BlogPostItemDataProvider'
112+
public: false
112113
tags:
113114
- { name: 'api_platform.item_data_provider' }
114115
```

0 commit comments

Comments
 (0)