Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

CLI task with optional parameters

Hi, Is it currently possible to implement taks which expects any number of parameters but will work even if no parameters provided?

Currently it returns 'argument must be of type array' error if no params passed and task looks like that:

public function myTaskAction(array $params)

I see the only way to store arguments['params'] in di, is that the only option?


You can pass an empty array

edited Jul '15

Thank you, it works.

PS. Also after asking I realized that I could wrap cli call in shell script to make task calls look more concise and set defaults there.