Note that there are some explanatory texts on larger screens.

plurals
  1. PORecovering ID form database
    primarykey
    data
    text
    <p>I have a small problem in recovering the object from the database, the problem is that I recovered all except the ID that I need to pass in url, my object are stored in a table derived from an entity that inherits from an abstract class, have you ever encountered such a problem?</p> <p>Controller.php:</p> <pre><code> // lister toute les affaires: public function listerAction($page) { if( $page &lt; 1 ) { // On déclenche une exception NotFoundHttpException // Cela va afficher la page d'erreur 404 throw $this-&gt;createNotFoundException('Page inexistante (page = '.$page.')'); } $form = $this-&gt;container-&gt;get('form.factory')-&gt;create(new ContactRechercheForm()); $affairesPC = $this-&gt;getDoctrine() -&gt;getManager() -&gt;getRepository('AffaireBundle:AffairePompeChaleur') -&gt;findAll(); $affaires = $this-&gt;getDoctrine() -&gt;getManager() -&gt;getRepository('AffaireBundle:Affaire') -&gt;findAll(); $affairesPS = $this-&gt;getDoctrine() -&gt;getManager() -&gt;getRepository('AffaireBundle:AffairePanneauSolaire') -&gt;findAll(); return $this-&gt;container-&gt;get('templating')-&gt;renderResponse('AffaireBundle:Affaires:affaires.html.twig',array( 'affairesPS' =&gt; $affairesPS, 'affairesPC' =&gt; $affairesPC,'form' =&gt; $form-&gt;createView())); } </code></pre> <p>affaires.html.twig</p> <pre><code> {# src/Crm/AffaireBundle/Resources/views/Affaires/affaires.html.twig #} {% extends "AffaireBundle::layout.html.twig" %} {% block title %} Accueil - {{ parent() }} {% endblock %} {% block Affaire_body %} &lt;form id="form_recherche" action="{{ path('affaire_rechercher_affaire') }}" method="post"&gt; &lt;table style="border-collapse:separate;border-spacing: 10px 8px;"&gt; &lt;tr&gt; &lt;td&gt; {{ form_widget(form.motcle) }} &lt;/td&gt; &lt;td&gt;&lt;input type="submit" value="Rechercher" class="btn btn-small" style="margin-top: -8px;"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;div class="loading"&gt;&lt;/div&gt; &lt;div id="resultats_recherche"&gt; {% include 'AffaireBundle:Affaires:liste.html.twig' with {'affairesPC' : affairesPC} %} &lt;/div&gt; &lt;script&gt; $(".loading").hide(); $("#form_recherche").submit(function(){ $(".loading").show(); var motcle = $("#contactrecherche_motcle").val(); var DATA = 'motcle=' + motcle; $.ajax({ type: "POST", url: "{{ path('affaire_rechercher_affaire')}}", data: DATA, cache: false, success: function(data){ $('#resultats_recherche').html(data); $(".loading").hide(); } }); return false; }); &lt;/script&gt; {% endblock %} </code></pre> <p>liste.html.twig:</p> <pre><code> &lt;h4&gt;Liste des Affaires &lt;a href="{{ path('affaire_afficherformulaire_affaire') }}" class="btn btn-primary" style="float: right;"&gt;ajouter affaire&lt;/a&gt;&lt;/h4&gt; &lt;br&gt; &lt;div id="resultats_recherche"&gt; &lt;form id="mainform" action=""&gt; &lt;table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table"&gt; &lt;thead&gt; &lt;tr&gt; &lt;!--&lt;th class="table-header-check"&gt;&lt;a id="toggle-all" &gt;&lt;/a&gt; &lt;/th&gt;--&gt; &lt;th class="table-header-repeat line-left minwidth-1"&gt;&lt;a href=""&gt;Titre&lt;/a&gt; &lt;/th&gt; &lt;th class="table-header-repeat line-left minwidth-1"&gt;&lt;a href=""&gt;Relative à&lt;/a&gt; &lt;/th&gt; &lt;th class="table-header-repeat line-left minwidth-1"&gt;&lt;a href=""&gt;Phase &lt;/a&gt;&lt;/th&gt; &lt;th class="table-header-repeat line-left minwidth-1"&gt;&lt;a href=""&gt;Type &lt;/a&gt;&lt;/th&gt; &lt;th class="table-header-repeat line-left"&gt;&lt;a href=""&gt;Description&lt;/a&gt;&lt;/th&gt; &lt;th class="table-header-options line-left"&gt;&lt;a href=""&gt;Options&lt;/a&gt;&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; {% for affairePC in affairesPC%} &lt;tr&gt; &lt;!--&lt;td&gt;&lt;input type="checkbox"/&gt;&lt;/td&gt;--&gt; &lt;td&gt;&lt;a href="{{ path('affaire_voir_affaire', { 'id': affairePC.id }) }}"&gt; {{ affairePC.id }} &lt;/td&gt; {#&lt;td&gt;&lt;a href="{{ path('contact_voir_individu', { 'id': affaire.contact.id }) }}"&gt; {{ affaire.contact.nom }} &lt;/td&gt;#} {#&lt;td&gt;{{affaire.phaseAffaire.phase }}&lt;/td&gt;#} {# &lt;td&gt;{{affaire.typeAffaire.type }}&lt;/td&gt;#} &lt;td&gt;{{affairePC.description }}&lt;/td&gt; &lt;td class="options-width"&gt; &lt;a href="{{ path('affaire_modifier_affaire', { 'id': affairePC.id }) }}" class="icon-1 info-tooltip" title="modifier"&gt;&lt;/a&gt; &lt;a href="{{ path('affaire_voir_affaire', { 'id': affairePC.id }) }}" title="supprimer" class="icon-2 info-tooltip"&gt;&lt;/a&gt; &lt;!-- &lt;a href="" title="supprimer" class="icon-2 info-tooltip"&gt;&lt;/a&gt; &lt;a href="" title="Edit" class="icon-3 info-tooltip"&gt;&lt;/a&gt; &lt;a href="" title="Edit" class="icon-4 info-tooltip"&gt;&lt;/a&gt; &lt;a href="" title="Edit" class="icon-5 info-tooltip"&gt;&lt;/a&gt; --&gt; &lt;/td&gt; &lt;/tr&gt; {% endfor %} {% for affairePS in affairesPS%} &lt;tr&gt; &lt;!--&lt;td&gt;&lt;input type="checkbox"/&gt;&lt;/td&gt;--&gt; &lt;td&gt;&lt;a href="{{ path('affaire_voir_affaire', { 'id': affairePS.id }) }}"&gt; {{ affairePS.nom }} &lt;/td&gt; &lt;td&gt;&lt;a href="{{ path('contact_voir_individu', { 'id': affairePS.contact.id }) }}"&gt; {{ affairePS.contact.nom }} &lt;/td&gt; &lt;td&gt;{{affairePS.phaseAffaire.phase }}&lt;/td&gt; &lt;td&gt;{{affairePS.typeAffaire.type }}&lt;/td&gt; &lt;td&gt;{{affairePS.description }}&lt;/td&gt; &lt;td class="options-width"&gt; &lt;a href="{{ path('affaire_modifier_affaire', { 'id': affairePS.id }) }}" class="icon-1 info-tooltip" title="modifier"&gt;&lt;/a&gt; &lt;a href="{{ path('affaire_voir_affaire', { 'id': affairePS.id }) }}" title="supprimer" class="icon-2 info-tooltip"&gt;&lt;/a&gt; &lt;!-- &lt;a href="" title="supprimer" class="icon-2 info-tooltip"&gt;&lt;/a&gt; &lt;a href="" title="Edit" class="icon-3 info-tooltip"&gt;&lt;/a&gt; &lt;a href="" title="Edit" class="icon-4 info-tooltip"&gt;&lt;/a&gt; &lt;a href="" title="Edit" class="icon-5 info-tooltip"&gt;&lt;/a&gt; --&gt; &lt;/td&gt; &lt;/tr&gt; {% endfor %} &lt;/table&gt; &lt;/form&gt; &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload