Gntvls
Gntvls

Reputation: 230

Restler2 passing random amount of parameters

I have problem in Restler2 with passing parameters to function. In Restler3 you can pass parameters whatever you want like in this function

function sum()
{
    return array_sum(func_get_args());
}

So for example url http://...../math/sum/1/2/3/4/5/6 it will sum all the parameters, but in Restler2 this returns an error

{
  "error": {
    "code": 404,
    "message": "Not Found"
  }
}

. Do you guys know how to solve this?

Upvotes: 0

Views: 61

Answers (1)

Arul Kumaran
Arul Kumaran

Reputation: 993

Restler 2 does not have that feature! Your best option is to add enough and more parameters to the function and then use func_get_args()

function($p1=null, $p2=null, $p3=null, $p4=null, $p6=null, $p7=null, $p8=null) {
    return array_sum(func_get_args());
}

Alternatively you can port the wildcard routes feature to restler 2 and we will gladly accept your pull request :)

Upvotes: 1

Related Questions