ElKlaaso
unread,Nov 14, 2008, 9:41:51 AM11/14/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Reactor development
Hi,
I started using reactor 3 weeks ago, basically because it has good
performance, has a quite basic setup, and lets me extend it easily
with SQL if things are just to complicated or slow to implement in
Reactor itself.
I was wondering if there is an easier way to find a single record by
field values other then the primary key.
As far as i know at the moment, i have to use a gateway to find record
by other values, for example, if want to find a user by email and
password, it seems like i would have to do it something like this:
<cfset userQuery=userGateway.getByFields(email=arguments.email,
password=arguments.password)>
<cfif userQuery.recordCount eq 1>
<cfset user.setUserId(userQuery.userId) />
<cfset user.load() />
</cfif>
I find this quite verbose for functionality im likely to use quite
often.
I have a method that can get row one of the query, and populate a user
record with it. This would be quicker then the way described above.
But, it would be handy if reactor has a build in method for this so i
can do this with 1 line of code.. does this exist?
A solution would be to have a getByFields, that woul return 1 record,
and if it find more then 1, would throw an exception like
ToManyRowsException or MoreThenOneRowException.
Forgive me if this already exist or if im missing out on a great
'but'....
Greets,
Klaas-Jan Winkel