Il est parfois utilise d’influencer votre template en fonction de l’environnement en cours. Dans mon cas, j’utilise un script javascript afin de gérer une liste de tags sur l’un de mes projets. Le principe du script est d’ajouter dans le dom une checkbox coché (et caché) identifiant le tag choisis.
Ce qui pose problème lorsque vous souhaitez tester votre formulaire car la manipulation du formulaire nécessite a priori la présence des champs dans le dom:
$form['element_search_form[tags]['.$hardtek_id.']'] = $hardtek_id;
$form['element_search_form[tags]['.$tribe_id.']'] = $tribe_id;
$form['element_search_form[tags]['.$tribe_id.']'] = $tribe_id;
Or dans mon cas ces cases a cocher n’existe pas dans le dom. Une des solutions est donc d’afficher ces cases a cocher lorsque nous somme en environnement de test:
{% if app.environment != 'test' %} [...] {% else %} {{ form_row(form.tags) }} {% endif %}
I do like the manner in which you have framed this specific concern and it does supply us a lot of fodder for thought. Nevertheless, coming from what I have experienced, I simply hope as the remarks pile on that people continue to be on point and in no way embark on a tirade associated with the news of the day. Yet, thank you for this outstanding piece and whilst I do not necessarily go along with the idea in totality, I respect the viewpoint.