Maybe i'm wrong and there is special internal coldfusion handling involved,
but i don't think, you can cast an Array to a ArrayCollection. You can only
cast the result to something it already is. So if your result is a custom
object, you have to add it to a new ArrayCollection. Casting to
ArrayCollection can't work in this case. Regarding the best place to do the
conversion: I would do it as early as possible. This way i'm always sure,
what kind of data i'm working with. Most of the time this means in the
command.
I also like DTO better btw. VO has a different meaning in domain models
(immutable objects afaik).
Cheers,
Ralf.
On 12/3/06, lostinrecursion <[EMAIL PROTECTED]> wrote:
Hi all,
This is a best practice question really.
I use Cairngorm for the larger apps I build. I also use Coldfusion and
the nifty class mapping that it can perform between DTOs (or VOs,
whatever you call them)
Here's the conundrum. A lot of my top level classes have
ArrayCollections of other supporting classes.
For example: Workplace class has a collection called Employees, which
very possibly could have its own set of collections called Vehicles,
all custom VO classes.
So, when i get them back from Coldfusion and they come in as an Array,
I know that in order to use them as a dataProvider, you need to cast
them as ArrayCollection.
So far, so good.
But if I just do this: {model.workplace.employees as ArrayCollection}
in the dataProvider property, sometimes I receive coercion errors if
the returning array is one element.
Bottom Line: In a Cairngorm app, where is the best place to do my
casting or conversion of arrays??
--
Ralf Bokelberg <[EMAIL PROTECTED]>
Flex & Flash Consultant based in Cologne/Germany