Permalink
Browse files

bug #4209 Fix method for adding placholders in progressBar (danez)

This PR was merged into the 2.5 branch.

Discussion
----------

Fix method for adding placholders in progressBar

The method is called setPlaceholderFormatterDefinition and not setPlaceholderFormatter

see [here][1]

Edit:
I found another glitch: The name of the placeholder must not be packed in %-characters, like it is the case when using the placeholders in the format. As you can see [here][2] the defaults are also not like this and best indication:  it does not work if doing like in the docs :)

[1]: https://github.com/symfony/symfony/blob/2.5/src/Symfony/Component/Console/Helper/ProgressBar.php#L82

[2]: https://github.com/symfony/symfony/blob/2.5/src/Symfony/Component/Console/Helper/ProgressBar.php#L486

Commits
-------

f3ef9dc The name of the placeholder must not be encapsulated in %
fb0e79c Fix method for adding placholders in progressBar
  • Loading branch information...
weaverryan committed Sep 15, 2014
2 parents 4a7f973 + f3ef9dc commit 02d1091e9795cfc773bf3061b61e3933f08c4e11
Showing with 2 additions and 2 deletions.
  1. +2 −2 components/console/helpers/progressbar.rst
@@ -289,8 +289,8 @@ display that are not available in the list of built-in placeholders, you can
create your own. Let's see how you can create a ``remaining_steps`` placeholder
that displays the number of remaining steps::
ProgressBar::setPlaceholderFormatter(
'%remaining_steps%',
ProgressBar::setPlaceholderFormatterDefinition(
'remaining_steps',
function (ProgressBar $bar, OutputInterface $output) {
return $bar->getMaxSteps() - $bar->getStep();
}

0 comments on commit 02d1091

Please sign in to comment.