How do I get the Output for the current Command #42488
-
I have a quick question: How do I receive the current output from the current Command? I know that I have them available to me in all of the methods Symphony's Command class implements, but what if I want to have my own methods? Do I really have to add a parameter to my own methods? Example: // ...
use Symfony\Component\Console\Command\Command;
// ...
class MyCommand extends Command
// ...
{
protected function logAndPrint($message, OutputInterface $output)
{
$this->log($message);
$output->writeln($message);
}
}
// ... Do I really have to handle the Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
There is no |
Beta Was this translation helpful? Give feedback.
There is no
getOutput
in Symfony because the Command receives the output object in itsexecute()
method, not as part of its instantiation.