Skip to content

Commit d3c074d

Browse files
Apply suggestions from code review
Co-authored-by: Oskar Stark <[email protected]>
1 parent 2f00351 commit d3c074d

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

components/http_foundation.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -644,8 +644,8 @@ return a lot of data as JSON and keep the used resources low by make usage of Ge
644644

645645
It expects an array which represents the JSON structure and the list which should be
646646
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``,
649649
as they the advantages that only the current returned data need to be keep in memory.
650650

651651
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
670670
.. tip::
671671

672672
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.
674674
See the `Doctrine Batch processing`_ documentation for more::
675675

676676
public function __invoke(): Response
@@ -697,19 +697,17 @@ The response will stream the JSON with generators in to most efficient way and k
697697

698698
.. tip::
699699

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
701701
PHP `flush <https://www.php.net/manual/en/function.flush.php>`__ method between
702702
to flush the response after every specific count of items::
703703

704704
public function __invoke(): Response
705705
{
706-
return new StreamedJsonResponse(
707-
[
708-
'_embedded' => [
709-
'articles' => $this->loadArticles(),
710-
],
706+
return new StreamedJsonResponse([
707+
'_embedded' => [
708+
'articles' => $this->loadArticles(),
711709
],
712-
);
710+
]);
713711
}
714712

715713
public function loadArticles(): \Generator

0 commit comments

Comments
 (0)