#89176Provide better way to traverse array in TS conditions
Description
[request.getQueryParams()['my_ext']['foo'] > 0]
conditions like these cause errors if my_ext is not set or if foo is not set.
For the first case a dirty workaround is:
[request.getQueryParams() && request.getQueryParams()['my_ext'] && request.getQueryParams()['my_ext']['foo'] > 0]
which still crashes for the case when foo is not set.
My suggestion to solve this is:
[traverse(request.getQueryParams(), 'my_ext/foo') > 0]
Reviews 2
Related issues 4
- Bug #88252Route Results are not available via TypoScript
- Bug #88756TypoScript – Symfony Expressions: request.getQueryParams() should do an "is defined" validation
- Bug #88928routeEnhancers and GP conditions (TS) not working
- Bug #90685RST docs of symfony expression language for TypoScript conditions has a typo