|
MediaWiki master
|
Base class for domain event objects to be used with DomainEventDispatcher. More...
Inherited by MediaWiki\Page\Event\PageEvent.
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 (or "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 33 of file DomainEvent.php.
| MediaWiki\DomainEvent\DomainEvent::__construct | ( | $timestamp = false, | |
| bool | $isReconciliationRequest = false ) |
| string | ConvertibleTimestamp | false | $timestamp | |
| bool | $isReconciliationRequest | see isReconciliationRequest() |
Definition at line 48 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 74 of file DomainEvent.php.
Referenced by MediaWiki\Page\Event\PageMovedEvent\__construct(), MediaWiki\Page\Event\PageDeletedEvent\__construct(), MediaWiki\Page\Event\PageProtectionChangedEvent\__construct(), MediaWiki\Page\Event\PageHistoryVisibilityChangedEvent\__construct(), MediaWiki\Page\Event\PageRecordChangedEvent\__construct(), MediaWiki\Page\Event\PageLatestRevisionChangedEvent\__construct(), MediaWiki\Page\Event\PageCreatedEvent\__construct(), and MediaWiki\Page\Event\PageEvent\__construct().
| MediaWiki\DomainEvent\DomainEvent::getEventTimestamp | ( | ) |
Returns the time at which the event was emitted.
Definition at line 110 of file DomainEvent.php.
| MediaWiki\DomainEvent\DomainEvent::getEventType | ( | ) |
Returns this event's type.
Definition at line 82 of file DomainEvent.php.
| MediaWiki\DomainEvent\DomainEvent::getEventTypeChain | ( | ) |
Returns the event types this event is compatible with.
Definition at line 98 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 64 of file DomainEvent.php.
Referenced by MediaWiki\DomainEvent\DomainEvent\__construct().
| const MediaWiki\DomainEvent\DomainEvent::ANY = '*' |
Definition at line 35 of file DomainEvent.php.