Project

Contents

Issue #00005480

WGA.app().query() not executed in correct TMLContext if called in (isolated) module controller
Feature/Improvement

WGA.app().query() needs a TMLContext to calculate the full query. If you don't explicitly specify one, a default context is calculated if possible.

If this method is called in a TML controller (normally isolated) no context is available and the query result will be different compared to an execution inside TML.

Sample:

WGA.app().query("content.structentry.contenttype.name='news'")

This should return all news in the current language. If called inside a controller however all news in all languages will be returned: because the query is executed without a TMLContext no language will be available.

Workaround:

Controller.prototype.news = function($cx) {
    var query = "content.structentry.contenttype.name='news'";
    return WGA.app().query(query, {context: $cx})
}

We now changed the way the default context is calculated so that the main context will be used inside (isolated) controller methods. The above workaround is no longer necessary.