|
The light bulb just went on! Thanks for pointing me in the
right direction!
Shan From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Farland Sent: Thursday, July 06, 2006 10:18 AM To: [email protected] Subject: RE: [flexcoders] arrayCollection to custom value object
This is controlled by
CFQuery, so you’d either have to change the data format in CF before you return
it, or continue to do what you’re doing on the client by copying each property
across (although I’d use a for/in loop and [propName]-styled syntax against the
currentUser type rather than specifically writing a line to copy each item). You
can’t cast an Object into another type unless it is literally of that type to
begin with… as is the case with any strongly typed
language. From:
The ArrayCollection was
returned from a CFC (just a simple select * query). Shan From:
I don’t have enough
information here to determine how you got an ArrayCollection in the first
place? From:
So, how can I get my
ArrayCollection row into my object? It's cool that I can test and see that it's
not working using "IS", but it doesn't solve the problem, just allows me to
trap it :) From:
The item may not be an
instance of user, but rather an anonymous Object that contains the correct
properties that match the public interface of the user class. The “as” operator
returns null if the instance cannot be coerced into the requested type… where as
traditional casting syntax will throw an error. You can use
getQualifiedClassName or the “is” operator to determine whether an instance is
of a particular type before casting or using the as
operator. From:
So, I've got an ArrayCollection and
a defined value object. The ArrayCollection has just one record in it, and the
data matches the valueObject perfectly. Here's my
code: model.currentUser.userID
=
loginResult.getItemAt(0).userID; If I do EITHER OF THESE (not all at
once), model.currentUser remains
NULL: 1 model.currentUser
= loginResult.getItemAt(0) as
user;
-- -- -- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS
-- |
- RE: [flexcoders] arrayCollection to custom value object Peter Farland
- RE: [flexcoders] arrayCollection to custom value object Shannon Hicks

