Answer the question
In order to leave comments, you need to log in
How in Symfony 5.2 to bind an Entity with a custom unique parameter passed in the controller?
there is a url field, you need to get the Entity by this field (not by id).
That is, the selection must be performed by the Proposition url
/**
* @Route("/present/{url}", name="cv_present", methods={"GET","POST"}, requirements={"url"="[a-z0-9-]+"})
* @param Proposition $proposition
* @param Request $request
* @param CVService $CVService
* @return Response
*/
public function present(Proposition $proposition, Request $request, CVService $CVService): Response
{
Answer the question
In order to leave comments, you need to log in
https://symfony.com/doc/current/doctrine.html#auto...
at the end of the section there is a link to ParamConverter
Here is an example: https://github.com/sensiolabs/SensioFrameworkExtra...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question