php - Twig if/else not working -
i'm not sure why code isn't executing. know should working way happens doesn't else portion.
in debugging know descriptions not null , descriptions show have it.
{% if descriptions not null %} {{ dump(descriptions) }} {% description in descriptions %} <td>{{ description.productdesciption }}</td> {% endfor %} {% else %} <td> <a href = "{{ path('description') }}">create description product</a> </td> {% endif %}
you can simplify using the else clause of statement:
{% description in descriptions %} <td> {{ description.productdesciption }} </td> {% else %} <td> <a href = "{{ path('description') }}">create description product</a> </td> {% endfor %}
hope help
Comments
Post a Comment