/** * Get the data to be serialized and assigned to the response document. * * @param ServerRequestInterface $request * @param Document $document * @return mixed */ protected function data(ServerRequestInterface $request, Document $document) { $id = $request->getParsedBody()['id']; $msgs = FetchChatController::GetMessages(FetchChatController::GetDB(), $id); return $this->bus->dispatch(new FetchChat($msgs)); }