예제 #1
0
 /**
  * @param StoryId $storyId
  * @param \Prooph\Done\Shared\StoryName $storyName
  * @return StoryWasStarted
  */
 public static function withStoryIdAndName(StoryId $storyId, StoryName $storyName)
 {
     $self = self::occur($storyId->toString(), ['story_name' => $storyName->toString()]);
     $self->storyId = $storyId;
     $self->storyName = $storyName;
     return $self;
 }
예제 #2
0
 /**
  * @param StoryName $storyName
  * @param StoryTeller $storyTeller
  * @throws \Prooph\Done\Shared\Exception\StoryTeller
  */
 public function registerStoryTeller(StoryName $storyName, StoryTeller $storyTeller)
 {
     if (isset($this->storyTellers[$storyName->toString()])) {
         throw Exception\StoryTeller::alreadyRegisteredForStoryName($storyName);
     }
     $this->storyTellers[$storyName->toString()] = $storyTeller;
 }
예제 #3
0
 /**
  * @param StoryName $storyName
  * @param ChapterNumber $chapterNumber
  * @param Message $previousMessage
  * @return Message
  */
 public function startChapter(StoryName $storyName, ChapterNumber $chapterNumber, Message $previousMessage)
 {
     $command = $this->chapterCommandTemplate->createMessageFromPreviousMessage($previousMessage);
     $command = $command->withAddedMetadata(Metadata::STORY_CHAPTER, $chapterNumber->toString());
     return $command->withAddedMetadata(Metadata::STORY_NAME, $storyName->toString());
 }
예제 #4
0
 /**
  * @param \Prooph\Done\Story\ChapterName $chapterName
  * @param StoryName $storyName
  * @return ChapterName
  */
 public static function isDuplicateForStory(\Prooph\Done\Story\ChapterName $chapterName, StoryName $storyName)
 {
     return new self(sprintf('Duplicate Chapter name %s for story %s detected', $chapterName->toString(), $storyName->toString()));
 }
예제 #5
0
파일: Story.php 프로젝트: bweston92/done
 /**
  * @param ChapterName $chapterName
  * @param StoryName $storyName
  * @return Story
  */
 public static function cannotFindMatchingTemplateForChapterName(ChapterName $chapterName, StoryName $storyName)
 {
     return new self(sprintf('Story %s cannot find matching template for chapter name %s', $storyName->toString(), $chapterName->toString()));
 }