Skip to content

Instantly share code, notes, and snippets.

@l3l0
Forked from akondas/command.php
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save l3l0/10e48a9bef93b66f3507 to your computer and use it in GitHub Desktop.

Select an option

Save l3l0/10e48a9bef93b66f3507 to your computer and use it in GitHub Desktop.
<?php
// example 1
class ProductController implements CreateProductResponder
{
private $response;
public function createProductAction(Request $request)
{
$this->response = new Response();
$this->get('command_bus')->handle(
new CreateProductCommand('Foo', $this)
);
return $this->response;
}
public function productCreated(ProductId $productId)
{
$this->response = new RedirectResponse(sprintf('/some/url/%s', (string) $productId));
}
}
<?php
interface CreateProductResponder
{
public function productCreated(ProductId $productId);
}
@l3l0

l3l0 commented Jun 20, 2015

Copy link
Copy Markdown
Author

ProductId is UUID

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment