Reputation: 5463
i am in the need to send a non-mapped argument to my custom repository method. However it seems those arguments are purely ignored, I don't get them when I vardump my repository method arguments.
I have found the issue detailed here but without comments : @ParamConverter with custom repository method dropping unmapped arguments
Does anyone know how to resolve this ?
The example in my case :
* @Route("/edit_planning/{planning}/{onlyPending}", name="edit_planning", defaults={"onlyPending": false})
* @ParamConverter("planning", class="AppBundle:FoodAnalytics\Planning", options={"mapping" : {"planning" = "id", "onlyPending"="onlyPending"}, "repository_method" = "findPlanningDependingOnExecution"})
public function editPlanningAction(Request $request, Planning $planning)
OnlyPending route parameter is not passed to the repository method
Upvotes: 2
Views: 1743
Reputation: 20201
I think you could try this: (broke into miltiple lines for readability)
@ParamConverter("planning",
class="AppBundle:FoodAnalytics\Planning",
options = {
"id": {"planning", "onlyPending"},
"repository_method" = "findPlanningDependingOnExecution"
}
)
You are not changing the mapping
but rather the definition of "id". Then findPlanningDependingOnExecution
will receive the array
parameter with keys planning
and onlyPending
.
Hope this helps a bit...
Upvotes: 3