Every company object is with a one-to-many relation with image.
Now in my template I want to check if there is an image of type testtype.
How to handle this with twig? The following gives me an exception:
Unexpected token "string" of value "testtype" ("name" expected)
Twig
{% for image in company.images if image.type is 'testtype' %}
{% endfor %}
if image.type == 'testtype'? - SirDerpingtonimage.type"testtype"? If you want to iterate over all objects and just do a special output for thetesttypeimages you could put the if in your for loop.{% if image.type == 'testtype' %}should work - SirDerpington