Implementing a Customized loadBy() or loadArrayBy()

By using the instantiateDbResult() method that is code generated for you in each generated class, it is very simple to create your own custom loadBy() or loadArrayBy() method using your own custom SQL. Specify a custom Load query by using a QCubed Query, or by writing your own SQL statement and passing the results into InstantiateDbResult. The code generated logic will take care of the rest, transforming your DB result into an array of that object.

In our example here, we have a custom load function to get an array of all Project objects where the budget is over a given amount. We pass this amount as a parameter to loadArrayByBudgetMinimum().

Load an Array of Projects Where the Budget >= $8,000