I’m returning results via a Sprunje invoked from a SimpleController. I’d like to pass in parameters and it seems I have two standard choices:
- Use the $args <-- Populated by UF4 from parsing the URI as per api-routes.php (myid in code below)
- Use the $params <-- Populated by UF4 with anything after the ? in the URL
I want my sprunje to get them all, should I simply merge both arrays and pass that to my sprunje? Is there a best practice?
My api-routes.php content
$app->get(’/api/bfa/lpd/id/{myid}’, ‘UserFrosting\Sprinkle\UfSprinkleBfa\Controller
\ApiController:apiBfaLpdData’)
->add(‘authGuard’);
My ApiController.php content
public function apiBfaLpdData($request, $response, $args)
{
$params = $request->getQueryParams();
$classMapper = $this->ci->classMapper;
$sprunje = $classMapper->createInstance(‘mysprunje’, $classMapper, $params);
$result = $sprunje->toResponse($response);
return $result;
}
How can I pass the contents of both $args and $params to my sprunje in the most appropriate way?
Thanks in advance for any insight.
Sincerely,
Frank