/** * Saves a mini-game * * @param MiniGame $game * @return MiniGame */ public function save(MiniGame $game) { if (!$game instanceof AggregateRoot) { throw new \InvalidArgumentException(); } $this->repository->save($game); }
/** * Saves a mini-game * * @param SourcedUser $user * * @return void */ public function save(SourcedUser $user) { if (!$user instanceof AggregateRoot) { throw new \InvalidArgumentException(); } $this->repository->save($user); }
/** * @param RegistrationRequest $registrationRequest */ public function save(RegistrationRequest $registrationRequest) { $this->repo->save($registrationRequest); }
/** * @param Member $member */ public function save(Member $member) { $this->repo->save($member); }
/** * @param Committee $committee */ public function save(Committee $committee) { $this->repo->save($committee); }
/** * @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']); }