Author: fabien
Date: 2010-01-21 09:30:03 +0100 (Thu, 21 Jan 2010)
New Revision: 26966

Modified:
   branches/2.0/src/Symfony/Components/Console/Command/Command.php
Log:
Merge branch 'master' of git://github.com/symfony/symfony

Modified: branches/2.0/src/Symfony/Components/Console/Command/Command.php
===================================================================
--- branches/2.0/src/Symfony/Components/Console/Command/Command.php     
2010-01-21 08:20:13 UTC (rev 26965)
+++ branches/2.0/src/Symfony/Components/Console/Command/Command.php     
2010-01-21 08:30:03 UTC (rev 26966)
@@ -104,6 +104,25 @@
   {
   }
 
+  /**
+   * Initializes the command just after the input has been validated.
+   *
+   * This is mainly useful when a lot of commands extends one main command
+   * where some things need to be initialized based on the input arguments and 
options.
+   *
+   * @param InputInterface  $input  An InputInterface instance
+   * @param OutputInterface $output An OutputInterface instance
+   */
+  protected function initialize(InputInterface $input, OutputInterface $output)
+  {
+  }
+
+  /**
+   * Runs the command.
+   *
+   * @param InputInterface  $input  An InputInterface instance
+   * @param OutputInterface $output An OutputInterface instance
+   */
   public function run(InputInterface $input, OutputInterface $output)
   {
     // add the application arguments and options
@@ -122,6 +141,8 @@
       }
     }
 
+    $this->initialize($input, $output);
+
     if ($input->isInteractive())
     {
       $this->interact($input, $output);

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" 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-svn?hl=en.


Reply via email to