recordServiceContainer = $recordServiceContainer; } public function postActionProcess(Request $request) : StdClass { $body = $request->getParsedBody(); $entityType = $body->entityType ?? null; $id = $body->id ?? null; $action = $body->action ?? null; $data = $body->data ?? (object) []; if (!$entityType || !$action || !$id) { throw new BadRequest(); } $service = $this->recordServiceContainer->get($entityType); $entity = $service->action($action, $id, $data); return $entity->getValueMap(); } }