You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$A = new A();
foreach(self::get_devices() as $k => $machine) {
$task[$k] = new ProcessCallbackTask(function() use($k, $machine, $A) {
A->run($machine->name); // No way
$A->run($machine->name); // No way
});
Just to let you know, there are problems with your code sample.
There is no need for $A = new A(); you have extended the class, the methods is now part of class B.
Since the methods of A are included/part of B, you need to reference like $this->run().
If you want to access class A directly you need to do A::run(); not A->run($machine->name);
I don't see how you code would run right under any conditions without those changes
I have some errors with this piece of code:
How to call
A
class method fromProcessCallbackTask
inB
class?I would like to process async commands on a set of online machines, taken from db
Thanks in advance
The text was updated successfully, but these errors were encountered: