1
votes

Per https://documentation.concrete5.org/developers/routing/routing-basics one captures parameters from the route as follows:

$router->get('/api/customer/{customerId}', function($customerId) {
    return 'The customer ID is: ' . $customerId;
});

However, per https://documentation.concrete5.org/developers/routing/controllers one shouldn't use closure and instead use a separate controller as follows:

$router->get('/api/current_user', 'Application\Api\Controller\UserController::getCurrentUser');

class UserController
{
    public function getCurrentUser()
    {
        //...
    }
}

How do I pass a parameter when using a controller? I would have expected the following, but $customerId is not passed to the controller method.

$router->get('/api/customer/{customerId}', 'Application\Api\Controller\UserController::getSomeUser');

class UserController
{
    public function getSomeUser($customerId)
    {
        //...
    }
}