diff --git a/src/Event/ReplicationEvent.php b/src/Event/ReplicationEvent.php new file mode 100644 index 0000000..77f5b15 --- /dev/null +++ b/src/Event/ReplicationEvent.php @@ -0,0 +1,102 @@ +sourceWorkspace = $source; + $this->targetWorkspace = $target; + } + + /** + * Returns the source workspace. + * + * @return \Drupal\multiversion\Entity\WorkspaceInterface + */ + public function getSourceWorkspace() { + return $this->sourceWorkspace; + } + + /** + * Returns the target workspace. + * + * @return \Drupal\multiversion\Entity\WorkspaceInterface + */ + public function getTargetWorkspace() { + return $this->targetWorkspace; + } + + /** + * Indicates whether the replication succeeded. + * + * @return bool + */ + public function succeeded() { + return $this->getStatus() === TRUE; + } + + /** + * Whether the replication failed. + * + * @return bool + */ + public function failed() { + return $this->getStatus() === FALSE; + } + + /** + * Returns the replication status. + * + * This will be TRUE on success, FALSE on failure, or NULL if the status is + * indeterminate (i.e., the replication is in progress). + * + * @return bool|null + */ + public function getStatus() { + return $this->status; + } + + /** + * Sets the replication status. + * + * @param bool $status + * The replication status. TRUE for success, FALSE for failure. + */ + public function setStatus($status) { + $this->status = (bool) $status; + } + +} diff --git a/src/Event/ReplicationEvents.php b/src/Event/ReplicationEvents.php new file mode 100644 index 0000000..8a5d9a9 --- /dev/null +++ b/src/Event/ReplicationEvents.php @@ -0,0 +1,24 @@ +