I have a question about @FOSRest\RequestParam.
How can i give an optional option to request a bulk change.
For example:
$postValue = [
'record_id' => 1234,
'content' => "test",
'ttl' => 0,
'prio' => 0,
];
VS
$postValue = [
[
'record_id' => 1234,
'content' => "test",
'ttl' => 0,
'prio' => 0,
],
[
'record_id' => 1234,
'content' => "test",
'ttl' => 0,
'prio' => 0,
]
];
The RequestParam is set like this:
* @FOSRest\RequestParam(name="record_id", allowBlank=false, requirements={"rule" = "\d+", "error_message" = "record_id must be an integer"}, strict=true, nullable=false, description="Record id")
* @FOSRest\RequestParam(name="content", allowBlank=true, default="", description="Content")
* @FOSRest\RequestParam(name="ttl", allowBlank=true, requirements={"rule" = "\d+", "error_message" = "ttl must be an integer"}, default={}, description="Time to live")
* @FOSRest\RequestParam(name="priority", allowBlank=true, requirements={"rule" = "\d+", "error_message" = "priority must be an integer"}, default={}, description="Priority")
I know that using a map=true can be used for the 2nd example.
But is there a way to check which of the two examples is used and fetch the parameters based on the type of array?
I can solve the issue with Request $request but that's my last solution.
Hope you guys know a solution :)