} public function search(Request
$request, Context
$context, ResponseFactoryInterface
$responseFactory, string
$entityName, string
$path): Response
{ [$criteria,
$repository] =
$this->
resolveSearch($request,
$context,
$entityName,
$path);
$result =
$context->
scope(Context::CRUD_API_SCOPE,
fn (Context
$context): EntitySearchResult =>
$repository->
search($criteria,
$context));
$definition =
$this->
getDefinitionOfPath($entityName,
$path,
$context);
return $responseFactory->
createListingResponse($criteria,
$result,
$definition,
$request,
$context);
} public function list(Request
$request, Context
$context, ResponseFactoryInterface
$responseFactory, string
$entityName, string
$path): Response
{ [$criteria,
$repository] =
$this->
resolveSearch($request,
$context,
$entityName,
$path);
$result =
$context->
scope(Context::CRUD_API_SCOPE,
fn (Context
$context): EntitySearchResult =>
$repository->
search($criteria,
$context));
$definition =
$this->
getDefinitionOfPath($entityName,
$path,
$context);
return $responseFactory->
createListingResponse($criteria,
$result,
$definition,
$request,
$context);
}