I use annotations to define routes in my project. I have a controller method that has such a route:
/**
* @Route("/{slug}", name="showcompany")
*/
public function show(Company $company): Response
{
...
}
This is done to catch requests like website.com/company1
, website.com/company2
, etc...
I get this error:
"App\Entity\Company object not found by the @ParamConverter annotation."
Since obviously all other routes such as website.com/signup are considered as slugs
of the Company entity.
The question is how to avoid this behavior without moving all routes to routes.yaml
and ordering them manually? I want all routes to be prioritized over this /{slug}
route.