factory = $factory; $this->acl = $acl; } /** * Perform a mass action. * * @throws Forbidden * @throws BadRequest */ public function process(string $entityType, string $action, array $params, StdClass $data): Result { if (!$this->acl->checkScope($entityType)) { throw new ForbiddenSilent(); } try { $massActionParams = Params::fromRaw($params, $entityType); } catch (RuntimeException $e) { throw new BadReqest($e->getMessage()); } $massAction = $this->factory->create($action, $entityType); $result = $massAction->process( $massActionParams, Data::fromRaw($data) ); if ($massActionParams->hasIds()) { return $result; } return $result->withNoIds(); } }