Thanks Chris. Actually the issue was in trying to save a transaction
object rather than a system object. I changed the relationship from a
onetomany on the system object to a manytoone on the transaction
object and it seems to be working fine now. My xml now looks like
this:
<object name="system" table="Systems">
<id name="systemid" type="numeric" />
<property name="systemname" type="string" />
</object>
<object name="transaction" table="Transactions">
<id name="transactionid" type="numeric" />
<property name="transactiontimestamp" type="date" />
<property name="transactiontype" type="string" />
<property name="transactionpayload" type="string" />
<manytoone name="systems">
<link to="system" column="creatorsystemid" />
</manytoone>
</object>
Then the code to save in my function looks like this (variables.tf
points to transferfactory):
var tx = variables.tf.get( "transaction", arguments.TransactionId );
tx.setTransactionId( arguments.TransactionId );
tx.setTransactionType( arguments.TransactionType );
tx.setTransactionPayload( payload );
if ( structkeyexists(arguments, "CreatorSystemId" )) {
tx.setSystems( variables.tf.get("system",
arguments.CreatorSystemId ) );
}
variables.tf.save( tx );
I'm sure I'll be back with more questions!
On Dec 3, 11:29 am, "Chris Peterson" <[EMAIL PROTECTED]> wrote:
> sorry, tried to tab and press space and sent early (yea, thats what SHE
> said!) anyway...
> ****************************
> well, you can use a self-closing tag for the collection type, ie:
>
> <collection type="array" />
>
> (probably not a big deal, but meh)
>
> Also, you need to attach the 'transaction' object to something (your system
> object), so your code should (could) look something like this:
>
> <cfscript>
> system = transfer.get("system", 1);
> transaction = transfer.new("transaction");
> transaction.setTransactionFields("values"); // obviously you would set
> all your transaction values here
>
> system.addTransaction(transaction);
> transfer.cascadeSave(system);
> </cfscript>
>
> ***********************
>
>
>
> On Wed, Dec 3, 2008 at 2:28 PM, Chris Peterson <[EMAIL PROTECTED]> wrote:
> > well, you can use a self-closing tag for the collection type, ie:
>
> > <collection type="array" />
>
> > (probably not a big deal, but meh)
>
> > Also, you need to attach the 'transaction' object to something (your system
> > object), so your code should (could) look something like this:
>
> > <cfscript>
> > system = transfer.get("system", 1);
> > transaction = transfer.new("transaction");
>
> > </cfscript>
>
> > On Wed, Dec 3, 2008 at 1:52 PM, JoshNathanson <[EMAIL PROTECTED]>wrote:
>
> >> Hey all,
>
> >> Got Transfer up and running, but when I try to set up a onetomany
> >> relationship, and do a save() on the "transaction" transfer object, I
> >> get the error referenced in the subject line. When I comment out the
> >> onetomany xml it works fine. Below is the pertinent xml:
>
> >> <object name="system" table="Systems">
> >> <id name="systemid" type="numeric" />
> >> <property name="systemname" type="string" />
> >> <onetomany name="transactions">
> >> <link to="transaction" column="creatorsystemid"/>
> >> <collection type="array">
> >> </collection>
> >> </onetomany>
> >> </object>
>
> >> <object name="transaction" table="Transactions">
> >> <id name="transactionid" type="numeric" />
> >> <property name="transactiontimestamp" type="date" />
> >> <property name="transactiontype" type="string" />
> >> <property name="transactionpayload" type="string" />
> >> <property name="creatorsystemid" type="numeric" />
> >> </object>
>
> >> Anything jump out?
>
> > --
> > Hey! I dont tell you how to tell me what to do, so dont tell me how to do
> > what you tell me to do! ~ Bender (Futurama)
>
> --
> Hey! I dont tell you how to tell me what to do, so dont tell me how to do
> what you tell me to do! ~ Bender (Futurama)
--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer
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
-~----------~----~----~----~------~----~------~--~---