Skip to content

Instantly share code, notes, and snippets.

@dgafka
Last active February 18, 2024 16:14
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 dgafka/1e1d138349f990022da4fb46f755955c to your computer and use it in GitHub Desktop.
Save dgafka/1e1d138349f990022da4fb46f755955c to your computer and use it in GitHub Desktop.
multi-tenancy-11.php
<?php
final readonly class HookTenantSwitchSubscription
{
/** Hooking in tenant activation */
#[OnTenantActivation]
public function whenActivated(string|ConnectionReference $tenantConnectionName, #[Header('tenant')] $tenantName): void
{
echo sprintf("HOOKING into flow: Tenant name %s is about to be activated\n", $tenantName);
}
/** Hooking in tenant deactivation */
#[OnTenantDeactivation]
public function whenDeactivated(string|ConnectionReference $tenantConnectionName, #[Header('tenant')] $tenantName): void
{
echo sprintf("HOOKING into flow: Tenant name %s is about to be deactivated\n", $tenantName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment