mirror of
https://github.com/werkraum-media/events.git
synced 2024-11-22 09:36:10 +01:00
Provide access to original destination.one data within PSR-14 event
There is already an event in place that allows to modify the imported data. The original incoming data is now exposed by that event. Relates: #10629
This commit is contained in:
parent
27ee70d0cf
commit
e2adee20bc
2 changed files with 26 additions and 2 deletions
|
@ -284,7 +284,8 @@ class DestinationDataImportService
|
|||
|
||||
$this->eventDispatcher->dispatch(new EventImportEvent(
|
||||
$existingEvent,
|
||||
$this->tmpCurrentEvent
|
||||
$this->tmpCurrentEvent,
|
||||
$event
|
||||
));
|
||||
|
||||
// Update and persist
|
||||
|
|
|
@ -37,21 +37,44 @@ final class EventImportEvent
|
|||
*/
|
||||
private $eventToImport;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $eventData;
|
||||
|
||||
public function __construct(
|
||||
Event $existingEvent,
|
||||
Event $eventToImport
|
||||
Event $eventToImport,
|
||||
array $eventData
|
||||
) {
|
||||
$this->existingEvent = $existingEvent;
|
||||
$this->eventToImport = $eventToImport;
|
||||
$this->eventData = $eventData;
|
||||
}
|
||||
|
||||
/**
|
||||
* The existing event, or newly created, prior applying modifications.
|
||||
* Can be used to compare existing data with new data for import.
|
||||
*/
|
||||
public function getBaseEvent(): Event
|
||||
{
|
||||
return clone $this->existingEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* The object that will finally be imported.
|
||||
* Modifications to this object will result in modifications of imported data.
|
||||
*/
|
||||
public function getEventToImport(): Event
|
||||
{
|
||||
return $this->eventToImport;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original data as received from API.
|
||||
*/
|
||||
public function getEventData(): array
|
||||
{
|
||||
return $this->eventData;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue