MediaWiki master
|
Base class for domain event objects to be used with DomainEventDispatcher. More...
Inherited by MediaWiki\Page\Event\PageStateEvent.
Public Member Functions | |
__construct ( $timestamp=false, bool $isReconciliationRequest=false) | |
getEventTimestamp () | |
Returns the time at which the event was emitted. | |
getEventType () | |
Returns this event's type. | |
getEventTypeChain () | |
Returns the event types this event is compatible with. | |
isReconciliationRequest () | |
Determines whether this is a reconciliation event, triggered artificially in order to give listeners an opportunity to catch up on missed events or recreate corrupted data. | |
Public Attributes | |
const | ANY = '*' |
Protected Member Functions | |
declareEventType (string $eventType) | |
Declares the event type. | |
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.
Definition at line 31 of file DomainEvent.php.
MediaWiki\DomainEvent\DomainEvent::__construct | ( | $timestamp = false, | |
bool | $isReconciliationRequest = false ) |
string | ConvertibleTimestamp | false | $timestamp | |
bool | $isReconciliationRequest | see isReconciliationRequest() |
Definition at line 46 of file DomainEvent.php.
References MediaWiki\DomainEvent\DomainEvent\isReconciliationRequest().
|
protected |
Declares the event type.
Must be called from the constructors of all subclasses of DomainEvent!
string | $eventType |
Definition at line 72 of file DomainEvent.php.
Referenced by MediaWiki\Page\Event\PageMovedEvent\__construct(), MediaWiki\Page\Event\PageDeletedEvent\__construct(), MediaWiki\Page\Event\PageStateEvent\__construct(), and MediaWiki\Page\Event\PageRevisionUpdatedEvent\__construct().
MediaWiki\DomainEvent\DomainEvent::getEventTimestamp | ( | ) |
Returns the time at which the event was emitted.
Definition at line 108 of file DomainEvent.php.
MediaWiki\DomainEvent\DomainEvent::getEventType | ( | ) |
Returns this event's type.
Definition at line 80 of file DomainEvent.php.
MediaWiki\DomainEvent\DomainEvent::getEventTypeChain | ( | ) |
Returns the event types this event is compatible with.
Definition at line 96 of file DomainEvent.php.
MediaWiki\DomainEvent\DomainEvent::isReconciliationRequest | ( | ) |
Determines whether this is a reconciliation event, triggered artificially in order to give listeners an opportunity to catch up on missed events or recreate corrupted data.
Reconciliation requests are typically issued by maintenance scripts, but can also be caused by user actions such as null-edits.
Definition at line 62 of file DomainEvent.php.
Referenced by MediaWiki\DomainEvent\DomainEvent\__construct(), MediaWiki\Languages\LanguageEventIngress\handlePageRevisionUpdatedEvent(), and MediaWiki\Search\SearchEventIngress\handlePageRevisionUpdatedEvent().
const MediaWiki\DomainEvent\DomainEvent::ANY = '*' |
Definition at line 33 of file DomainEvent.php.