@@ -644,8 +644,8 @@ return a lot of data as JSON and keep the used resources low by make usage of Ge
644
644
645
645
It expects an array which represents the JSON structure and the list which should be
646
646
streamed are represented in the array as ``\Generator ``. It also supports any kind of
647
- Traversable containing JSON Serializable data for a good developer experience,
648
- but for keep the resources usage low as possible it is recommended to use ``\Generators ``,
647
+ Traversable containing JSON serializable data for a good developer experience,
648
+ but for keep the resources usage as low as possible, it is recommended to use ``\Generators ``,
649
649
as they the advantages that only the current returned data need to be keep in memory.
650
650
651
651
The response will stream the JSON with generators in to most efficient way and keep resources as low as possible::
@@ -670,7 +670,7 @@ The response will stream the JSON with generators in to most efficient way and k
670
670
.. tip ::
671
671
672
672
If loading data via doctrine the ``toIterable `` method of ``Doctrine `` can be
673
- used to keep also the resources low and fetch only row by row.
673
+ used to keep the resources low and fetch only row by row.
674
674
See the `Doctrine Batch processing `_ documentation for more::
675
675
676
676
public function __invoke(): Response
@@ -697,19 +697,17 @@ The response will stream the JSON with generators in to most efficient way and k
697
697
698
698
.. tip ::
699
699
700
- If you have a lot of data to be returned you maybe want to call the
700
+ If you have a lot of data to be returned you may want to call the
701
701
PHP `flush <https://www.php.net/manual/en/function.flush.php >`__ method between
702
702
to flush the response after every specific count of items::
703
703
704
704
public function __invoke(): Response
705
705
{
706
- return new StreamedJsonResponse(
707
- [
708
- '_embedded' => [
709
- 'articles' => $this->loadArticles(),
710
- ],
706
+ return new StreamedJsonResponse([
707
+ '_embedded' => [
708
+ 'articles' => $this->loadArticles(),
711
709
],
712
- );
710
+ ] );
713
711
}
714
712
715
713
public function loadArticles(): \Generator
0 commit comments