/** * Get the mini-game corresponding to the id * * @param MiniGameId $id * @throws GameNotFoundException * @return MiniGame */ public function load(MiniGameId $id) { $game = $this->repository->load($id); if ($game !== null && !$game instanceof MiniGame) { throw new \InvalidArgumentException(); } return $game; }
/** * Get the user corresponding to the id * * @param ApplicationUserId $id * * @throws MessageAppException * @return SourcedUser */ public function load(ApplicationUserId $id) { $user = $this->repository->load($id); if ($user !== null && !$user instanceof SourcedUser) { throw new \InvalidArgumentException(); } return $user; }
/** * @test */ public function itShouldThrowAnExceptionIfTheLoadedEntityIsNotAnApplicationUser() { $userId = \Mockery::mock(ApplicationUserId::class); $user = \Mockery::mock(AggregateRoot::class); $repository = new UserEventSourcedRepository($this->repository); $this->repository->shouldReceive('load')->with($userId)->andReturn($user); $this->setExpectedException(\InvalidArgumentException::class); $repository->load($userId); }
public function __construct(EventStoreInterface $eventStore, EventBusInterface $eventBus) { parent::__construct($eventStore, $eventBus, 'Pollo\\Core\\Domain\\Model\\Poll\\Poll', new PublicConstructorAggregateFactory()); }
public function __construct(EventStoreInterface $eventStore, EventBusInterface $eventBus, array $eventStreamDecorators = []) { parent::__construct($eventStore, $eventBus, '\\HangmanBundle\\Game\\Domain\\Game\\Game', new PublicConstructorAggregateFactory(), $eventStreamDecorators); }
/** * @param RegistrationRequest $registrationRequest */ public function save(RegistrationRequest $registrationRequest) { $this->repo->save($registrationRequest); }
/** * @param Member $member */ public function save(Member $member) { $this->repo->save($member); }
public function __construct(\Broadway\EventStore\EventStoreInterface $eventStore, \Broadway\EventHandling\EventBusInterface $eventBus) { parent::__construct($eventStore, $eventBus, 'Marriage\\Domain\\Marriage', new \Broadway\EventSourcing\AggregateFactory\PublicConstructorAggregateFactory()); }
private function givenGameDoesNotExist() { $this->eventSourcingRepository->shouldReceive('load')->with($this->gameId)->andReturn(null); }
/** * @param Book $Book */ public function save(Book $Book) { $this->repo->save($Book); }
/** * @param Post $post */ public function save(Post $post) { $this->repo->save($post); }
/** * @test */ public function it_publishes_decorated_events() { $projector = new TestMetadataPublishedProjector(); $this->eventBus->subscribe($projector); $repository = new EventSourcingRepository($this->eventStore, $this->eventBus, get_class($this->createAggregate()), new PublicConstructorAggregateFactory(), array(new MetadataEnrichingEventStreamDecorator(array(new TestDecorationMetadataEnricher())))); $aggregate = $this->createAggregate(); $aggregate->apply(new DidNumberEvent(42)); $repository->save($aggregate); $metadata = $projector->getMetadata(); $data = $metadata->serialize(); $this->assertArrayHasKey('decoration_test', $data); $this->assertEquals('I am a decorated test', $data['decoration_test']); }
public function __construct(EventStoreInterface $eventStore, EventBusInterface $eventBus, Connection $connection) { $this->eventStore = $eventStore; $this->connection = $connection; parent::__construct($eventStore, $eventBus, Part::class, new PublicConstructorAggregateFactory()); }
public function __construct(EventStoreInterface $eventStore, EventBusInterface $eventBus, array $eventStreamDecorators = array()) { parent::__construct($eventStore, $eventBus, '\\BroadwayDemo\\Basket\\Basket', new PublicConstructorAggregateFactory(), $eventStreamDecorators); }
/** * @param Committee $committee */ public function save(Committee $committee) { $this->repo->save($committee); }
public function __construct(EventStoreInterface $eventStore, EventBusInterface $eventBus, array $eventStreamDecorators = array()) { parent::__construct($eventStore, $eventBus, ExpenseList::class, new NamedConstructorAggregateFactory(), $eventStreamDecorators); }
public function __construct(EventStoreInterface $eventStore, EventBusInterface $eventBus, array $eventStreamDecorators = []) { parent::__construct($eventStore, $eventBus, Account::class, new PublicConstructorAggregateFactory(), $eventStreamDecorators); }