We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent2afa75a commit04a7911Copy full SHA for 04a7911
components/console/helpers/progressbar.rst
@@ -95,6 +95,23 @@ that the progress bar display is refreshed with a 100% completion.
95
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::display`
96
to show the progress bar again.
97
98
+If you want to use the progress bar to show the progress of an iteration you can use the
99
+:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::iterate` method that will automaticaly call ``start``,
100
+``advance`` and ``finish`` while iterating::
101
+
102
+ use Symfony\Component\Console\Helper\ProgressBar;
103
104
+ $progressBar = new ProgressBar($output);
105
106
+ // starts and displays the progress bar
107
+ foreach ($progressBar->iterate($iterable) as $key => $value) {
108
+ // ... do some work
109
+ }
110
111
+..versionadded::4.3
112
113
+ The ``iterate`` method was introduced in Symfony 4.3.
114
115
Customizing the Progress Bar
116
----------------------------
117