Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Extract CallOtherCommands feature from Illuminate\Console\Command #31026

Merged
merged 1 commit into from
Jan 6, 2020

Conversation

crynobone
Copy link
Member

At the moment Illuminate\Console\Command is tightly couple with Laravel
via $this->laravel->make() usage, this changes make it possible to reuse
CallOtherCommands feature available for Laravel commands to standalone
Symfony commands.

<?php
namespace Foo\Commands;

use Illuminate\Console\Concerns\CallOtherCommands;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

abstract class Command extends \Symfony\Component\Console\Command\Command
{
    use CallOtherCommands;

    /**
     * Resolve the console command instance for the given command.
     *
     * @param  string  $command
     * @return \Symfony\Component\Console\Command\Command
     */
    protected function resolveCommand($command)
    {
        return $this->getApplication()->find($command);
    }
}

Signed-off-by: Mior Muhammad Zaki [email protected]

At the moment Illuminate\Console\Command is tightly couple with Laravel
via $this->laravel->make() usage, this changes make it possible to reuse
CallOtherCommands feature available for Laravel Command to standalone
Symfony command.

Signed-off-by: Mior Muhammad Zaki <[email protected]>
@taylorotwell taylorotwell merged commit 6a79556 into laravel:6.x Jan 6, 2020
@crynobone crynobone deleted the basic-command branch February 1, 2020 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants