[5.x] FR: More convenient way to access custom fields in JSON column for advanced queries #14557
-
How to use custom fields in advanced queries is described here. Had to do this a lot today when upgrading a project with quite complex queries, (with the help of a custom twig extension). Would be great though to have an easier way in core, something like `valueSql('entryTypeHandle', 'fieldHandle'). So that you can for example do this instead of manually going through all the documented steps: {% set lastSeason = filmQuery.max(valueSql('film', 'season')) %} and a corresponding PHP function |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Just added a new Custom fields can be added to more than just entry types (volumes, global sets, the user field layout, etc.), so the first argument accepts a {% set lastSeason = filmQuery.max(fieldValueSql(entryType('film'), 'season')) %} (7c97465) |
Beta Was this translation helpful? Give feedback.
Just added a new
fieldValueSql()
Twig function for the next release.Custom fields can be added to more than just entry types (volumes, global sets, the user field layout, etc.), so the first argument accepts a
FieldLayoutProviderInterface
instance (e.g.EntryType
) rather than an entry type handle, and I also added a newentryType()
method to fetch the entry type:(7c97465)