Oihana PHP System

Notice implements JsonSerializable uses ReflectionTrait

Represents a notification or message emitted by a Signal.

This class encapsulates the details of an event, including:

  • The type of the event ($type).
  • The target object that triggered the event ($target).
  • Additional contextual information related to the event ($context).

It is typically used as the payload when emitting signals:

$notice = new Notice
(
    type: 'afterDelete',
    target: $documentModel,
    context:
    [
        'deletedDocuments' => $documents,
        'options'          => $deleteOptions
    ]
);
$afterDeleteSignal->emit($notice);
Tags
author

Marc Alcaraz (ekameleon)

since
1.0.0

Table of Contents

Interfaces

JsonSerializable

Properties

$context  : array<string|int, mixed>
The context of the notice
$target  : mixed
The target of the notice.
$type  : mixed
The type of the notice.

Methods

__construct()  : mixed
Creates a new Notice.
jsonSerialize()  : array<string|int, mixed>
Serializes the current object into a JSON array.
toArray()  : array<string|int, mixed>
Returns the array representation of the notice object.

Properties

$context

The context of the notice

public array<string|int, mixed> $context

$target

The target of the notice.

public mixed $target

$type

The type of the notice.

public mixed $type

Methods

__construct()

Creates a new Notice.

public __construct(string $type[, object|null $target = null ][, array<string|int, mixed> $context = [] ]) : mixed
Parameters
$type : string

The type of the notice.

$target : object|null = null

The target of the notice.

$context : array<string|int, mixed> = []

The context of the notice.

jsonSerialize()

Serializes the current object into a JSON array.

public jsonSerialize() : array<string|int, mixed>
Tags
throws
ReflectionException

If reflection fails when accessing properties.

Return values
array<string|int, mixed>

JSON-LD representation of the object.

toArray()

Returns the array representation of the notice object.

public toArray() : array<string|int, mixed>
Tags
throws
ReflectionException
Return values
array<string|int, mixed>

        
On this page

Search results