Ejemplo n.º 1
0
 /**
  * Set the event id
  *
  * @param  EventId $eventId the event id
  * @throws EventException - on event type mismatch
  */
 private function setEventId(EventId $eventId)
 {
     $eventType = $eventId->eventType();
     if ($eventType != underscore($this)) {
         throw EventException::invalidType($eventType);
     }
     $this->eventId = $eventId;
 }
Ejemplo n.º 2
0
 /**
  * (non-PHPdoc)
  * @see    texdc\momento\EventStoreInterface::findById()
  * @throws texdc\momento\exception\InvalidEventTypeException
  * @throws texdc\momento\exception\UnknownEventIdException
  */
 public function findById(EventId $anEventId)
 {
     $this->guardEventType($anEventId->eventType());
     if (isset($this->events[(string) $anEventId])) {
         return $this->events[(string) $anEventId];
     }
     throw StorageException::unknownEventId($anEventId);
 }