How to avoid paramConverter exception

I tried to get data from 2 different entities but i got this exception.
"AppEntityCar object not found by the @ParamConverter annotation."

I saw some post on this forum. People said to change the order of the controller or use requirement on the route but this exception still appears.

my controller:

/**
 * @Route("/individualQuote/{id}", name="user_individualQuote", methods={"GET","POST"})
 **/
public function getIndividualQuote(Prospect $prospect,Car $car): Response
{


    return $this->render('user/_individualQuote.html.twig', [
        'prospect'=>$prospect,
        'car'=>$car




    ]);
}

my twig template:

{% extends 'base.html.twig' %}


{% block body %}


    {% if app.user %}
    <ul>
        {% for agency in app.user.agencies %}
            <li>
                {{ agency.name }}
                <ul>
                    {% for quote in agency.quotes %}

                        <li><a href="{{ path('user_individualQuote', {id: quote.prospect.car.id}) }}"> {{ quote.prospect.fullname }}</a></li>
                    {% endfor %}

                </ul>


            </li>
        {% endfor %}
    </ul>
        {% else %}
            <button class="btn btn-danger"><a href="{{ path('default') }}">Retour</a></button>
    {% endif %}

    
{% endblock %}

thanks for your help

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *