-
-
Save l3l0/10e48a9bef93b66f3507 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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)); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| interface CreateProductResponder | |
| { | |
| public function productCreated(ProductId $productId); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ProductId is UUID