Allow access to API params from Api4Query
Context:
- I am adding an 'extra' calculated field to a spec provider for a custom entity.
- The value of this extra calculated field depends on a parameter passed to the get action.
- I have access to the query in the setSqlRenderer method (which contains a protected API object) but there doesn't appear to be a way to access the API parameters.
Adding the following method to Api4Query allows read only access to API params and seems inline with other methods like getSelect()
, but feel free to let me know if I am doing it wrong and there is a better approach.
/**
* @return mixed
*/
public function getParam(string $param) {
return call_user_func([$this->api, 'get'.ucfirst($param)]);
}
PR coming up...