diff --git a/components/console/single_command_tool.rst b/components/console/single_command_tool.rst index 8b0396ba9b7..8980aba86e7 100644 --- a/components/console/single_command_tool.rst +++ b/components/console/single_command_tool.rst @@ -54,3 +54,34 @@ Of course, you can still register a command as usual:: $application->setDefaultCommand($command->getName(), true); $application->run(); + +If you need to create a kernel-aware application, you can use +``Symfony\Bundle\FrameworkBundle\Console\Application`` instead of ``Symfony\Component\Console\Application``:: + + #!/usr/bin/env php + add($command); + + $application->setDefaultCommand($command->getName(), true); + $application->run(); + +.. note:: + An instance of ``Symfony\Bundle\FrameworkBundle\Console\Application`` will automatically + load all default commands. If you want to change this behaviour, you can pass ``false`` + as the second argument when creating the object:: + + $application = new Application($kernel, false);