Skip to content

Instantly share code, notes, and snippets.

@rmcdaniel
Created April 25, 2023 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmcdaniel/1e8df16dc1b3a71202fc677d9ab4bee0 to your computer and use it in GitHub Desktop.
Save rmcdaniel/1e8df16dc1b3a71202fc677d9ab4bee0 to your computer and use it in GitHub Desktop.
<?php
declare(strict_types=1);
namespace App\Workflows\Database;
use Workflow\Activity;
class DatabaseActivity extends Activity
{
public function execute()
{
return [
SimpleActivity::class,
SimpleActivity::class,
SimpleActivity::class,
];
}
}
<?php
declare(strict_types=1);
namespace App\Workflows\Database;
use Workflow\ActivityStub;
use Workflow\Workflow;
class DatabaseWorkflow extends Workflow
{
public function execute()
{
$activities = yield ActivityStub::make(DatabaseActivity::class);
foreach ($activities as $activity) {
yield ActivityStub::make($activity);
}
}
}
<?php
declare(strict_types=1);
namespace App\Workflows\Database;
use Workflow\Activity;
class SimpleActivity extends Activity
{
public function execute()
{
return 'activity';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment