Skip to content
docs

BusinessRule

Marks a class as a declarative business rule. Generic attribute to annotate a business rule with its event, the entities it applies to, and its execution priority. Note: the runtime that consumed this attribute (RuleScanner) was removed as incomplete; the attribute is kept as an inert primitive for future use.

BusinessRule::__construct()

public function __construct(string $event = 'pre.operation', array $entities = [], Milpa\app\Enums\ListenerPriority|int $priority = Milpa\app\Enums\ListenerPriority::HIGH, ?string $description = null, bool $enabled = true):

Parameters

Parámetros de __construct()
NombreTipoDescripción
$eventstringEvent to subscribe to (default: 'pre.operation')
$entitiesarray<int, class-string>Entity classes this rule applies to
$priority(int | ListenerPriority)Execution priority
$description(string | null)Human-readable description of the rule
$enabledboolWhether the rule is enabled

BusinessRule::getPriority()

public function getPriority(): int

Get the numeric priority value.