getRouteParam('id'); if ($id === null) { throw new BadRequest(); } $body = $request->getParsedBody(); $data = Data::create() ->withRelatedType($body->relatedType ?? null) ->withRelatedId($body->relatedId ?? null) ->withParentType($body->parentType ?? null) ->withParentId($body->parentId ?? null) ->withEmailAddress($body->emailAddress ?? null); $result = $this->service->process($id, $data); return ResponseComposer::json($result->getValueMap()); } }