Maybe I’m missing this in the docs and digging through the API, but is there a built-in method to return the single active entity (using coldbox.system.orm.hibernate.ActiveEntity). Right now I’ve just created an ORM Decorator with the following method, but I’m converting a legacy app over and would rather not have to modify all of my views to use the getcolumn method.
`
/**
Returns the current instance of a single result as a query
public function getRateInfo(tourCode) output=“false” {
var tc= filterTourCode(arguments.tourcode);
var t = this.findbyTag(tc);
var r = t.getRates()[1];
return r.getRecordAsQuery();
}
True. I’ve got that. What I was trying to do was to find a way to leverage the loaded one-to-many relationship iterators without having to call the findBy() function. So using this:
`
i.asQuery();
`
Rather than something like this:
`
i.findById(i.getId());
`
Which requires me to pass pass a double reference to the i variable - which seems somehow redundant to me.
I’m probably over-thinking this. I’ve been using PHP frameworks primarily for the last five years and, since the primary data container there is the array, almost all Active Record ORM methods have an “as_array()” equivalent that returns the instance record as named pair array. Thanks, Luis!
Every ORM method allows you to choose whether you want array or queries. We also have a query helper plugin that can help you slice the query up as you need, is that what you are looking for?
Possibly. Perhaps I’m looking for the solution in wrong place. Let me dig in to the docs and see if maybe I missed the answer. In reference your response to the addAsset() question earlier, I hate it when I re-invent the wheel and, when learning a new framework, I’m always sure there’s a perfectly good method out there somewhere. Thanks, again!