/**
  * @param GameLostEvent $event
  */
 public function applyGameLost(GameLostEvent $event)
 {
     $readModel = new GameEnd();
     $readModel->setGameId($event->getGameId());
     $readModel->setStatus(0);
     $this->repository->save($readModel);
 }
 public function applyGameLost(GameLost $event)
 {
     $readModel = $this->repository->find($event->getGameId());
     $readModel->setStatus("Game lost!");
     $readModel->setGameEndTime($event->getExpandedTimeOnGame());
     $this->repository->save($readModel);
 }
 /**
  * @param WrongLetterGuessed $event
  */
 public function applyWrongLetterGuessed(WrongLetterGuessed $event)
 {
     $readModel = new LetterChosen();
     $readModel->setGameId($event->getGameId());
     $readModel->setLetter($event->getLetter());
     $readModel->setMisGuessed(true);
     $this->repository->save($readModel);
 }
 /**
  * @param string $tag
  *
  * @return void
  */
 public function decrement($category)
 {
     /** @var PostCategoryCount $postCategoryCount */
     $postCategoryCount = $this->broadwayRepository->find($category);
     if ($postCategoryCount) {
         $postCategoryCount->setCount($postCategoryCount->getCount() - 1);
     } else {
         $postCategoryCount = new PostCategoryCount($category, 1);
     }
     $this->broadwayRepository->save($postCategoryCount);
 }
 public function getGameStaticAction($id)
 {
     $readModel = $this->readModelRepository->find($id);
     if (null === $readModel) {
         return ["no-content found"];
     }
     return json_encode(serialize($readModel));
 }
 /**
  * @param string $uuid
  * @return string
  */
 private function getIdOfGame($uuid)
 {
     $game = $this->readModelRepository->findBy(["gameId" => $uuid]);
     if (count($game) < 1) {
         throw new NotFoundHttpException("item not found");
     }
     return $game[0]->getId();
 }
 /**
  * {@inheritDoc}
  */
 public function transferTo(RepositoryInterface $otherRepository)
 {
     foreach ($this->data as $model) {
         $otherRepository->save($model);
     }
 }
 /**
  * @param GameStartedEvent $event
  */
 public function applyGameStarted(GameStartedEvent $event)
 {
     $readModel = new GameStarted($event->getGameId(), $event->getWord(), $event->getStartTime());
     $this->repository->save($readModel);
 }
Example #9
0
 public function applyPollCreatedEvent(PollCreatedEvent $event)
 {
     $poll = new Poll((string) $event->getPollId(), $event->getTitle());
     $this->repository->save($poll);
 }
 /**
  * @param PublishedPost $publishedPost
  *
  * @return void
  */
 public function save(PublishedPost $publishedPost)
 {
     $this->broadwayRepository->save($publishedPost);
 }