title: How to solve passing IDs in URL with Symfony
body: <p>i'm making an app to make appointments with doctors, and in the template of the patient I need to use the id of the entity doctor in the path because I use it in the code of my controller, and I still can't get the Id of the entity doctor because when i do {{ doctor.id }} nothing appears on my screen, the content is empty.</p>
  
  <p>As a solution I used the email of the doctor in the URL but it is quite ugly.</p>
  
  <p>This is the code of the controller </p>
  
  <pre><code>     /**
        * @Route("/patient/ajouter-medecin-favoris/{id}", name="meet_my_doc_ajouter_medecin_favoris")
        */
        public function ajouterMedecinFavoris(MedecinRepository $repoMedecin, ObjectManager $manager, $id)
        {
          $patient = $this-&gt;getUser();
  
          $medecin = $repoMedecin-&gt;findOneById($id);
  
          $patient-&gt;addMedecinsFavori($medecin);
  
          $manager-&gt;persist($patient);
  
          $manager-&gt;flush();
  
          return $this-&gt;RedirectToRoute('accueil');
        }
  </code></pre>
  
  <p>here's the code of the element I use to click on it to redirect on the controller previously</p>
  
  <pre><code>&lt;fieldset&gt;
       &lt;h4&gt;&lt;a href="{{path('meet_my_doc_ajouter_medecin_favoris',{id: medecin.id})}}" style="color: black;"&gt;&lt;i class="fa fa-star"&gt;&lt;/i&gt;&lt;/a&gt; Dr. {{ medecin.nom }} {{ medecin.prenom }}&lt;/h4&gt;
  &lt;/fieldset&gt;
  </code></pre>
  
  <p>I expected to be able to use the id of the doctor in the URL but I think when you're logged as an entity you can't get the ID (not the id used to log in) of other users and the content of the variable is empty. But I would know if there's a solution to use the ID because passing the email into the url isn't the solution I want, and I had the same problem on other piece of code where the of other entity is empty.</p>
  
  <p>Here's the code of the controller that send the datas to the view </p>
  
  <pre><code>     /**
        * @Route("/patient/medecins-favoris", name="meet_my_doc_afficher_medecin_favoris")
        */
        public function afficherMedecinFavoris()
        {
          $patient = $this-&gt;getUser();
  
          $medecins = $this-&gt;getUser()-&gt;getMedecinsFavoris();
  
          return $this-&gt;Render('meet_my_doc/afficherLesMedecinsFavoris.html.twig', ['medecins' =&gt; $medecins]);
        }
  </code></pre>