Tenant-Aware Console Commands
Running your own Console Commands in the context of a given tenant
Example
final class ReportGenerator
{
#[ConsoleCommand('reports:generate')]
public function generate(
#[MultiTenantConnection] Connection $connection
): void
{
$connection->executeStatement('INSERT INTO reports (generated_at) VALUES (NOW())');
}
}Executing Command
bin/console reports:generate --header="tenant:tenant_a"php artisan reports:generate --header="tenant:tenant_a"$messagingSystem->runConsoleCommand('reports:generate', [
'header' => ['tenant:tenant_a'],
]);Propagation to Sub-Flows
Missing Tenant Header
Ecotone's Built-in Console Commands
Last updated
Was this helpful?