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

[BUG] overriding multiples arguments; #60

Closed
JeanCarloLeal opened this issue Nov 21, 2017 · 10 comments
Closed

[BUG] overriding multiples arguments; #60

JeanCarloLeal opened this issue Nov 21, 2017 · 10 comments
Assignees

Comments

@JeanCarloLeal
Copy link

JeanCarloLeal commented Nov 21, 2017

Creating at new task: in the field "PARAMETERS (OPTIONAL)" I insert the following information for a custom command that can accept multiple arguments: "seaport=15 typetraffic=05"
When i click Execute (to force execution) it works, because it don't use the console. However, when using the console (Laravel's schedule), it errors.
I took the liberty to debug the code and found a problem in the file Task.php, method compileParameters.
The problem happens because when running on console it doesn't pass named parameters, and in the mentioned method it will override the first parameter with the second as both will have the key 0.
Following is a Print of a fix.

Please inform me if there is another solution.

@roshangautam
Copy link
Collaborator

@qschmick would you like to take a look at this. I would appreciate it.

@qschmick
Copy link
Collaborator

@roshangautam Sure thing.

@JeanCarloLeal Can you add the -- before each of your arguments. E.g. --seaport=15?

@JeanCarloLeal
Copy link
Author

@qschmick I have not tested creating my command with --options, I believe this works. But using multiple arguments we've found the problem quoted.

@qschmick
Copy link
Collaborator

qschmick commented Dec 4, 2017

@JeanCarloLeal thanks for the follow up. For clarification, you are passing the values seaport=15 as the argument to your command or are you declaring seaport => 15? Would you be able to share your commands signature (obviously redacted as needed)? Thank you in advance for the help.

@JeanCarloLeal
Copy link
Author

JeanCarloLeal commented Dec 4, 2017

protected function getArguments()
    {
        return [
            ['seaport', InputArgument::REQUIRED, 'Código com os portos separados por virgula.'],
            ['typeTraffic', InputArgument::REQUIRED, 'Tipo de trafico separado por virgula.'],
            ['limit', InputArgument::OPTIONAL, 'Limit default 5000'],
            ['date', InputArgument::OPTIONAL, 'No formato \'Y-m-d\', Default -1'],
        ];
    }

In totem Usage: seaport=15 typeTraffic=05
Console Usage: php artisan ce:generate 15 05

qschmick added a commit that referenced this issue Dec 4, 2017
@qschmick
Copy link
Collaborator

qschmick commented Dec 4, 2017

@JeanCarloLeal Just merged in a fix for this issue.

@qschmick qschmick closed this as completed Dec 4, 2017
@qschmick qschmick self-assigned this Dec 4, 2017
@JeanCarloLeal
Copy link
Author

Ty

@JeanCarloLeal
Copy link
Author

JeanCarloLeal commented Dec 6, 2017

@qschmick I was updating my project and had a surprise, I'm using v2.1.

And your fix was for v2.0, can you check?

composer require studio/laravel-totem 
Using version ^2.1 for studio/laravel-totem

@roshangautam
Copy link
Collaborator

Its probably because its not been tagged yet.

@qschmick
Copy link
Collaborator

qschmick commented Dec 7, 2017

@JeanCarloLeal Just tagged v2.2

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

No branches or pull requests

3 participants