You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unexpected behaviour when set several variables derived from the same field in an entry. Consider the following:
{% set materialTypes = film.materials.all() %}
{% set poster = film.materials.type('poster').one() %}
{{ dump(materialTypes|length) }}
Result is int(4)
{% set poster = film.materials.type('poster').one() %}
{% set materialTypes = film.materials.all() %}
{{ dump(materialTypes|length) }}
Result is int(3)
Where film is an entry and materials is an Entries field. The field has 4 entries attached, 3 of which are of type poster.
What I would expect is int(4) in both cases for the length of materialTypes as the Element criteria is being referenced from the film and therefore shouldn't be effected by other queries executed elsewhere. It appears to me that applying the criteria of .type('poster') is persisting to the next line.
I'm attaching a DB dump and a simplified version of the template where this is occurring.
Database driver & version: MySQL 5.7.20-0ubuntu0.16.04.1
Plugins & versions:
Redactor 1.0.0.1
CP Field Inspect 1.0.2
Asset Rev v6.0.0
The text was updated successfully, but these errors were encountered:
monachilada
changed the title
Order of applied element query parameters in templates effects results of subsequent queries.
[Bug] Order of applied element query parameters in templates effects results of subsequent queries.
Dec 18, 2017
Description
Unexpected behaviour when set several variables derived from the same field in an entry. Consider the following:
Result is
int(4)
Result is
int(3)
Where
film
is an entry andmaterials
is an Entries field. The field has 4 entries attached, 3 of which are of typeposter
.What I would expect is
int(4)
in both cases for the length ofmaterialTypes
as the Element criteria is being referenced from the film and therefore shouldn't be effected by other queries executed elsewhere. It appears to me that applying the criteria of.type('poster')
is persisting to the next line.I'm attaching a DB dump and a simplified version of the template where this is occurring.
coproduction-office_171218_171716_967vyr5h7l_v3.0.0-rc2.zip
films copy.twig.zip
Additional info
The text was updated successfully, but these errors were encountered: