Skip to content

Instantly share code, notes, and snippets.

@frankdejonge
Created July 30, 2015 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frankdejonge/c114cb80ba55410c727d to your computer and use it in GitHub Desktop.
Save frankdejonge/c114cb80ba55410c727d to your computer and use it in GitHub Desktop.
Subdispatching commandbus
<?php
interface Subdispatchable {};
class SubdispatchingCommandBus extends CommandBus
{
public function handle($command)
{
$response = parent::handle($command);
if ( ! $response instanceof Subdispatchable) {
return $response;
}
return $this->handle($response);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment