File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -709,6 +709,28 @@ after some specific item count to send the contents to the browser::
709
709
}
710
710
}
711
711
712
+ You also have the possibility to directly pass any iterable to
713
+ ``StreamedJsonResponse ``, including generators::
714
+
715
+ public function loadArticles(): \Generator
716
+ {
717
+ yield ['title' => 'Article 1'];
718
+ yield ['title' => 'Article 2'];
719
+ yield ['title' => 'Article 3'];
720
+ }
721
+
722
+ public function __invoke(): Response
723
+ {
724
+ // ...
725
+
726
+ return new StreamedJsonResponse(loadArticles());
727
+ }
728
+
729
+ .. versionadded :: 6.4
730
+
731
+ The support for any iterable in ``StreamedJsonResponse `` was introduced in
732
+ Symfony 6.4.
733
+
712
734
.. _component-http-foundation-serving-files :
713
735
714
736
Serving Files
You can’t perform that action at this time.
0 commit comments