Hello all,

After watching the Symfony slides about the Console, I tried giving a
wirl to finally write some much needed utilities I need when setting
up a project.

Looking at the code and through usage I have come across a possible
enhancement in the Symfony\Components\Console\DialogHelper.

The function askAndValidate, should take an extra parameter where we
can define a default that can be parsed to the closure which will
validate the $value.

A sample situation is the following:

1.) I want to ask my user for a directory destination
2.) I provide a suggestion on question that is displayed
3.) I askAndValidate, using my closure that will validate if I can
create that directory.
4.) In case I can't create the user doesn't type anything and just
presses enter, I can $value to be the one I suggested.

In order to do this, I have:

$docRootFunction = function($doc_root){

  if(file_exists($doc_return $doc_root;
                        }

                        if(!mkdir($doc_root)){
                                throw new \Exception("The $doc_root cannot be 
created");
                        }

                        return $doc_root;

                };

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to