Thanks Tom.  That is extremely helpful.  I am still very new to ORM so
I didn't realize that it is better to have an object than a query.  I
will re-arrange my relationship to what you recommended.

On Sep 27, 10:03 am, Tom McNeer <[email protected]> wrote:
> David,
>
> I'm not sure of your use case. But it seems to me you may be going about
> things a little wrong.
>
> You may or may not know this (and I apologize if you already do), but the
> "list" functions return query lists, rather than objects. So I'm not sure
> why you'd do:
>
>      var getVariation =
>
>
>
> > APPLICATION.transfer.listByProperty('catalog.variation','varid',ARGUMENTS.varid);'
>
> You're looking for a single "variation," so I'd think you'd simply want to
> do:
>
> APPLICATION.transfer.get("catalog.variation", ARGUMENTS.varid)
>
> That would return the object you're looking for. Since Transfer is an ORM,
> most of the time, you want objects, not queries, right?
>
> In your second example:
>
>   var getValues =
>
>
>
> > APPLICATION.transfer.listByProperty('catalog.variationVal','varid',ARGUMENTS.varid);
>
> ... you're trying to retrieve a list of child "variationVals" for a parent
> "variation." That would suggest that you might want to use a one-to-many on
> "variation," rather than a many-to-one on its child. Many-to-ones only allow
> access from one side of the relationship. Thus, from your code, you can do
> variationVal.getVariation(), but you have no way to access the children from
> the parent.
>
> If you set the relationship as a one-to-many on the parent, you have access
> from both sides.
>
> So you'll be able to get the parent variation from a variationVal, by doing
> variationVal.getParentVariation(), and get the children by doing
> variation.getVariationValArray() (if you set the one-to-many collection as
> an array).
>
> Take another look at the Transfer docs on composition and relationships, and
> I think you'll get the idea.
>
> None of what I've suggested will give you a query list, which is what you
> seem to be looking for. You will always get Transfer objects, singly or in
> arrays. If you truly need a query of variationVals, then you'll either need
> to _not_ set up a relationship in Transfer, or simply use straight SQL.
>
> Hope this was helpful.
>
> --
> Thanks,
>
> Tom
>
> Tom McNeer
> MediumCoolhttp://www.mediumcool.com
> 1735 Johnson Road NE
> Atlanta, GA 30306
> 404.589.0560

-- 
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

Try out the new Transfer ORM Custom Google Search:
http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en

Reply via email to