Slide 46
Slide 46 text
final class AccountController
{
// ...
public function __construct(CommandBusInterface $bus, RouterInterface $router)
{
// ...
}
public function setupAction(Request $request): Response
{
$id = generateId();
$payload = $request->request->all();
$command = new SetupAccountCommand($id, $payload['email']);
$this->bus->handle($command);
return new Response(null, Response::HTTP_CREATED, [
'Location' => $this->router->generate('account.view', [$id]),
]);
}
}