Skip to content

Commit 61b2835

Browse files
committed
minor symfony#64 Fixed the help notes of the AddUser command (javiereguiluz)
This PR was squashed before being merged into the master branch (closes symfony#64). Discussion ---------- Fixed the help notes of the AddUser command In the [run() method of the Command class](https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Console/Command/Command.php#L220-263) you can see the following: ```php public function run(InputInterface $input, OutputInterface $output) { // ... $this->initialize($input, $output); // ... if ($input->isInteractive()) { $this->interact($input, $output); } // ... $statusCode = $this->execute($input, $output); return is_numeric($statusCode) ? (int) $statusCode : 0; } ``` Therefore, our help note was wrong and the method order is ` initialize()` -> `interact()` -> `execute()` Commits ------- 7afdf50 Fixed the help notes of the AddUser command
2 parents 9d1013f + 7afdf50 commit 61b2835

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/AppBundle/Command/AddUserCommand.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,21 @@ protected function configure()
6161
}
6262

6363
/**
64-
* This method is executed before initialize() and execute(). Its purpose is
65-
* to check if some of the options/arguments are missing and interactively
64+
* This method is executed before the interact() and the execute() methods.
65+
* It's main purpose is to initialize the variables used in the rest of the
66+
* command methods.
67+
*
68+
* Beware that the input options and arguments are validated after executing
69+
* the interact() method, so you can't blindly trust their values in this method.
70+
*/
71+
protected function initialize(InputInterface $input, OutputInterface $output)
72+
{
73+
$this->em = $this->getContainer()->get('doctrine')->getManager();
74+
}
75+
76+
/**
77+
* This method is executed after initialize() and before execute(). Its purpose
78+
* is to check if some of the options/arguments are missing and interactively
6679
* ask the user for those values.
6780
*
6881
* This method is completely optional. If you are developing an internal console
@@ -147,16 +160,6 @@ protected function interact(InputInterface $input, OutputInterface $output)
147160
}
148161
}
149162

150-
/**
151-
* This method is executed before the interact() and the execute() methods.
152-
* It's main purpose is to initialize the variables used in the rest of the
153-
* command methods.
154-
*/
155-
protected function initialize(InputInterface $input, OutputInterface $output)
156-
{
157-
$this->em = $this->getContainer()->get('doctrine')->getManager();
158-
}
159-
160163
/**
161164
* This method is executed after interact() and initialize(). It usually
162165
* contains the logic to execute to complete this command task.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy