Getting list back as array from iterator instead of query

6 views
Skip to first unread message

Tom B

unread,
Aug 24, 2011, 7:11:53 AM8/24/11
to Reactor
Hi,

This is a follow on from Mark Drew's post on the getByFilter method in
the abstractGateway. I managed to get it working so that you can now
output an array instead of a query.

In the abstractGateway.cfc just replace:

<cfif format EQ "iterator">
<cfset r_Object = CreateObject("component",
"reactor.iterator.BasicIterator").init(

getByQuery(QueryObj),

_getReactorFactory().createRecord(this.getObjectMetadata().getAlias())
)>
<cfreturn r_Object>
</cfif>

with this:

<cfif format EQ "iterator">
<cfset r_Object = CreateObject("component",
"reactor.iterator.iterator").init(

_getReactorFactory(),

this.getObjectMetadata().getAlias())>
<cfreturn r_Object>
</cfif>



If anyone knows any reason not to use this method then please let me
know. I just think it's sometimes easier to access joined tables by
calling their joined objects rather than doing a joined custom query.
However, it maybe isn't so efficient as using joins on larger
queries.

Cheers,
Tom
Reply all
Reply to author
Forward
0 new messages