Search code examples
coldfusioncfwheels

cfwheels and object helpers


I've got a set of processes I frequently do to a model that I keep redoing in the controller, and I'm wondering if there is a way to implement it through a function in the model, so that I can just call the model function pass some parameters and get the right query.

I've got a linked list, and there's a bit of repetition that I want to avoid.


Solution

  • figured it out...

    in model:

    <cffunction name="getCustomResults" returntype="query">
        <cfset all = findAll()>
        <!--- do stuff --->
        <cfreturn myQuery>
    </cffunction>
    

    getting the custom results

    <cfset mySelection = model('myModel').getCustomResults()>