Replies: 1 comment
-
I've found my answer and its working: $list = ForkMultiple::new()->multiple($closures);
<?php
namespace ...;
use Spatie\Fork\Fork;
use Spatie\Fork\Task;
class ForkMultiple extends Fork {
public static function new(): self
{
return new self();
}
public function multiple($callables = []): array
{
$tasks = [];
foreach ($callables as $nr => $callable) {
$tasks[] = Task::fromCallable($callable, $nr);
}
return $this->waitFor(...$tasks);
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
i've tried to make the call to this:
Which is working like a charm (by the way)
Dynamic
But i cannot make it dynamic yet, can you help me with this, so i might want to have any number of forks in the range of 1-256 maybe even more if the tests are fine...
I get this error:
Error: Second array member is not a valid method in $list = Fork::new() ....
Beta Was this translation helpful? Give feedback.
All reactions