Skip to content

Commit 0daaae9

Browse files
authored
Merge pull request #1196 from COil/2.5
data provider: added missing context
2 parents 8df9187 + 4d5b2ca commit 0daaae9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

core/data-providers.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@ If no data is available, you should return an empty array.
3838

3939
namespace App\DataProvider;
4040

41-
use ApiPlatform\Core\DataProvider\CollectionDataProviderInterface;
41+
use ApiPlatform\Core\DataProvider\ContextAwareCollectionDataProviderInterface;
4242
use ApiPlatform\Core\DataProvider\RestrictedDataProviderInterface;
4343
use ApiPlatform\Core\Exception\ResourceClassNotSupportedException;
4444
use App\Entity\BlogPost;
4545

46-
final class BlogPostCollectionDataProvider implements CollectionDataProviderInterface, RestrictedDataProviderInterface
46+
final class BlogPostCollectionDataProvider implements ContextAwareCollectionDataProviderInterface, RestrictedDataProviderInterface
4747
{
4848
public function supports(string $resourceClass, string $operationName = null, array $context = []): bool
4949
{
5050
return BlogPost::class === $resourceClass;
5151
}
5252

53-
public function getCollection(string $resourceClass, string $operationName = null): \Generator
53+
public function getCollection(string $resourceClass, string $operationName = null, array $context = []): iterable
5454
{
5555
// Retrieve the blog post collection from somewhere
5656
yield new BlogPost(1);

0 commit comments

Comments
 (0)