Skip to content

Commit

Permalink
automatically create DirectCommandBus if a repository has been set
Browse files Browse the repository at this point in the history
  • Loading branch information
Janos Szurovecz committed Nov 8, 2014
1 parent f0e94e6 commit 6df21cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/predaddy/domain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ $eventStore = new DoctrineOrmEventStore($entityManager);
$trBuses = TransactionalBusesBuilder::create(new DoctrineTransactionManager($entityManager))
->interceptEventsWithinTransaction([new EventPersister($eventStore)])
->withRepository(new EventSourcingRepository($eventStore))
->useDirectCommandBus()
->build();
$eventBus = $trBuses->eventBus();
$commandBus = $trBuses->commandBus();
Expand Down
4 changes: 4 additions & 0 deletions src/predaddy/util/TransactionalBusesBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,16 @@ public function interceptEventsOutsideTransaction(array $interceptors)
}

/**
* This builder instance will create a {@link DirectCommandBus}
* with the given {@link Repository}.
*
* @param Repository $repository
* @return $this
*/
public function withRepository(Repository $repository)
{
$this->repository = $repository;
$this->useDirectCommandBus();
return $this;
}

Expand Down

0 comments on commit 6df21cb

Please sign in to comment.