@@ -61,8 +61,21 @@ protected function configure()
61
61
}
62
62
63
63
/**
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
66
79
* ask the user for those values.
67
80
*
68
81
* This method is completely optional. If you are developing an internal console
@@ -147,16 +160,6 @@ protected function interact(InputInterface $input, OutputInterface $output)
147
160
}
148
161
}
149
162
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
-
160
163
/**
161
164
* This method is executed after interact() and initialize(). It usually
162
165
* contains the logic to execute to complete this command task.
0 commit comments