I should be using DAOs, but to be honest that woul...
# fw1
c
I should be using DAOs, but to be honest that would only provide an extra level of organisation. However, I absolutely agree with your opinion about
variables
scope mutation inside a singleton. I only used this approach, because I found it in an FW1 example application. And to be fair, the objective, within the example app, was very possibly correct and I corrupted it. So, I’m going to remove the
variables
scope variable and just return the list data from the
page()
method. Before:
Copy code
function page(page){
    // build variables.blogs struct from DB query
    …
   cfloop(query=local.qGetFile, startrow=local.startrow, endrow=local.endrow){
        // add blog bean to variables.blogs
        …
        variables.blogs[local.qGetFile.File_ID] = blog;
    }
}
After:
Copy code
function page(page){
    // build variables.blogs struct from DB query
    …
    local.pagedata = {
        recordcount: local.recordcount,
        list: {}
    };
   cfloop(query=local.qGetFile, startrow=local.startrow, endrow=local.endrow){
        // add blog bean to variables.blogs
        …
        local.pagedata.list[local.qGetFile.File_ID] = blog;
    }
    return local.pagedata;
}