MediaWiki master
MediaWiki\DomainEvent\DomainEvent Class Reference

Base class for domain event objects to be used with DomainEventDispatcher. More...

Inherited by MediaWiki\Storage\PageUpdatedEvent.

Public Member Functions

 __construct (string $type, $timestamp=false)
 
 getEventTimestamp ()
 
 getEventType ()
 

Detailed Description

Base class for domain event objects to be used with DomainEventDispatcher.

Domain events are used to notify other parts of the code (oder "domains") about a change to the persistent state of the local wiki.

The idea of domain events is borrowed from the Domain Driven Design paradigm. For a thorough explanation, see https://learn.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/domain-events-design-implementation. Also compare https://martinfowler.com/eaaDev/DomainEvent.html.

Domain event objects must be immutable.

An event object should contain all information that was used to affect that change (the command parameters) as well as information representing the outcome of the change.

Since
1.44
Stability: unstable
until 1.45, should become stable to extend

Definition at line 28 of file DomainEvent.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\DomainEvent\DomainEvent::__construct ( string $type,
$timestamp = false )
Stability: stable
to call
Parameters
string$type
string | ConvertibleTimestamp | false$timestamp

Definition at line 38 of file DomainEvent.php.

Member Function Documentation

◆ getEventTimestamp()

MediaWiki\DomainEvent\DomainEvent::getEventTimestamp ( )
Returns
ConvertibleTimestamp

Definition at line 56 of file DomainEvent.php.

◆ getEventType()

MediaWiki\DomainEvent\DomainEvent::getEventType ( )
Returns
string

Definition at line 49 of file DomainEvent.php.


The documentation for this class was generated from the following file: