From 6253fdd3c12ca1d2f4e6f481243fc57d24d5e476 Mon Sep 17 00:00:00 2001 From: ShinDarth Date: Tue, 27 Dec 2016 15:54:29 +0100 Subject: [PATCH 1/4] [Console] add documentation for kernel-aware console applications --- components/console/single_command_tool.rst | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/components/console/single_command_tool.rst b/components/console/single_command_tool.rst index 8b0396ba9b7..2c4405d489d 100644 --- a/components/console/single_command_tool.rst +++ b/components/console/single_command_tool.rst @@ -54,3 +54,33 @@ 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(); + +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); From ce2dd0c11a47528b5b34e0aec1fcea20ef619f91 Mon Sep 17 00:00:00 2001 From: ShinDarth Date: Tue, 27 Dec 2016 16:06:28 +0100 Subject: [PATCH 2/4] created note --- components/console/single_command_tool.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/console/single_command_tool.rst b/components/console/single_command_tool.rst index 2c4405d489d..e55a8bc9823 100644 --- a/components/console/single_command_tool.rst +++ b/components/console/single_command_tool.rst @@ -79,8 +79,9 @@ If you need to create a kernel-aware application, you can use $application->setDefaultCommand($command->getName(), true); $application->run(); -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: +.. 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); + ``$application = new Application($kernel, false);`` From bbb3be32742f000121f27b8d61f5c7e845b0ce4d Mon Sep 17 00:00:00 2001 From: ShinDarth Date: Tue, 27 Dec 2016 16:15:39 +0100 Subject: [PATCH 3/4] format correction --- components/console/single_command_tool.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/console/single_command_tool.rst b/components/console/single_command_tool.rst index e55a8bc9823..abf25220467 100644 --- a/components/console/single_command_tool.rst +++ b/components/console/single_command_tool.rst @@ -56,7 +56,7 @@ Of course, you can still register a command as usual:: $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`` +``Symfony\Bundle\FrameworkBundle\Console\Application`` instead of ``Symfony\Component\Console\Application``:: #!/usr/bin/env php Date: Tue, 27 Dec 2016 16:31:31 +0100 Subject: [PATCH 4/4] format correction --- components/console/single_command_tool.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/console/single_command_tool.rst b/components/console/single_command_tool.rst index abf25220467..8980aba86e7 100644 --- a/components/console/single_command_tool.rst +++ b/components/console/single_command_tool.rst @@ -84,4 +84,4 @@ If you need to create a kernel-aware application, you can use 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);`` + $application = new Application($kernel, false);