SIGNALS Docs
Exit Reader View
100%
Theme

Reader View

Plugin Operation Registry

Contract for mapping declared plugin operation names onto invocable core action classes.

Overview

App\Sdk\Data\PluginOperationRegistry maps declared plugin operation names to invocable core action classes.

This is a framework-internal registry, marked @internal; plugin authors call PluginContext::operation() rather than registering or resolving core actions directly. Operations require a signed-in user, retain the action's Gate checks and refuse system/job calls with no user. No service principal is supplied.

Manifest operations[] is a separate allow-list gate: a name must be both registered here and declared on the plugin manifest before the facade will invoke it.

Public surface

Method Purpose
register() Map one operation name to an action class string
has() Check whether an operation name is registered
get() Return the action class for a name or throw
all() Return the complete name => class-string map

Accepted registration shape

Identity is the operation name string in resource.action form (for example activities.complete).

$registry->register('activities.complete', CompleteActivity::class);

The value is a class-string for an invocable action. The registry records the string without instantiating or runtime-checking the class; the container resolves it when PluginDataAccess invokes the operation.

register() assigns directly into an associative map. Registering another class for the same name replaces the prior mapping; duplicate names are not rejected.

Seeded operations

The constructor currently seeds:

Operation Action class
payments.record_external App\Sdk\Data\Operations\RecordExternalPaymentOperation
rentals.change_status App\Sdk\Data\Operations\ChangeRentalStatusOperation
rentals.allocate_assets App\Sdk\Data\Operations\AllocateAssetsOperation
documents.generate App\Sdk\Data\Operations\GenerateDocumentOperation
activities.create App\Actions\Activities\CreateActivity
activities.complete App\Actions\Activities\CompleteActivity
favourites.toggle App\Actions\Favourites\ToggleFavourite

Lookup and facade gating

  • has($name) is the optional guard
  • get($name) throws App\Sdk\Data\PluginDataException with Operation [{name}] is not registered in the plugin operation registry. when missing
  • all() returns the current map in registration / replacement order

PluginDataAccess::operation($package, $action, ...$args) enforces two gates before resolution:

  1. $action must appear in the plugin's stored manifest operations[]
  2. $action must pass has() / get() on this registry

Only then does the facade resolve the action class from the container and invoke it with the supplied arguments. Authorisation remains inside the action.

Worked example

For plugin authors, use the context and declare rentals.change_status in operations[]. The adapter accepts an array and preserves core authorisation:

$result = $context->operation('rentals.change_status', [
    'rental_id' => $rentalId,
    'status' => $statusCode,
]);

A name that is registered here but omitted from the calling plugin's manifest operations[] is still denied by the facade before get() runs for the happy path; an undeclared unknown name fails the manifest gate, while a declared but unregistered name fails with PluginDataException from get().

See Data access for every supported operation signature and result.