Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Multiple arguments to a task
MaxBurton
January 2014
Hey all,
I'm trying to figure out how you pass multiple arguments to a Task.
I'm running:
php oil refine sometask:run 'some_arg'
with the task code being
class sometask{
public function run($arg1){
echo $arg1;
}
}
and this runs fine.
What I really need to have though is
php oil refine sometask:run 'some arg' 'some arg2'
class sometask{
public function run($arg1,$arg2){
echo $arg1;
echo $arg2;
}
}
which unfortunately doesn't work (no errors seem to be returned). Can someone point me in the right direction on how to handle this?
Thanks
Harro
January 2014
Accepted Answer
No problem whatsover?
<?php
namespace Fuel\Tasks;
class Test
{
public static function run()
{
var_dump(func_get_args());
}
}
and calling it:
$ php oil refine test 'some arg' 'some arg2'
array(2) {
[0] =>
string(8) "some arg"
[1] =>
string(9) "some arg2"
Both get passed as arguments without any problem?
MaxBurton
January 2014
Didn't realise it was that simple. Got a little confused by the Docs
:)
Cheers.
Harro
January 2014
I basically did exactly the same as you, so what did you change to make it work?
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
January 2014
MaxBurton
January 2014