setter fails in a many-to-many entity relationship

10 views
Skip to first unread message

Gregory Thrush

unread,
Jul 20, 2016, 5:15:34 PM7/20/16
to cf-orm-dev
I've got a pair of ORM entities that have a many-to-many relationship.

component displayname="log" persistent="true" accessors="true" table="logs"
{

property name="id" fieldtype="id"
ormtype="string"
generator="assigned" length="16";
property name="serviceDate" ormtype="timestamp";
property name="notes" ormtype="clob" default="";
property name="participants"
fieldtype="many-to-many"
cfc="clients"
type="array" singularname="client"
fkcolumn="fk_clientid"
inversejoincolumn="fk_logid"
linktable="logs_clients";
}

and

component persistent="true" accessors="true" table="clients" {

property name="id" fieldtype="id"
ormtype="integer"
generator="assigned" length="16";
property name="firstName" ormtype="string" length="100";
property name="lastName" ormtype="string" length="100";
property name="logs"
fieldtype="many-to-many"
cfc="logs"
type="array" singularname="log"
linktable="logs_clients"
fkcolumn="fk_logid" inversejoincolumn="fk_clientid";

}

Hibernate successfully generates the linktable 'logs_clients'. However, when I try to add a client to a log with the following code

Log = EntityNew('logs');
Participant = EntityLoadByPK('clients', 1234);
Log.setParticipants( Participant );

A valid entity Participant exists but trying to set it I get the error 'The passed value does not evaluate to a valid array object.' A web search turned up nothing relevant. What am I missing here?

Thanks,
Greg

Cameron Childress

unread,
Jul 20, 2016, 5:43:04 PM7/20/16
to cf-or...@googlegroups.com
I tend to avoid many-to-many but try a singular add:

Log.addParticipant( Participant );

-Cameron


--
You received this message because you are subscribed to the Google Groups "cf-orm-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cf-orm-dev+...@googlegroups.com.
To post to this group, send email to cf-or...@googlegroups.com.
Visit this group at https://groups.google.com/group/cf-orm-dev.
For more options, visit https://groups.google.com/d/optout.



--
Cameron Childress
--
p:   678.637.5072
im: cameroncf

Gregory Thrush

unread,
Jul 20, 2016, 8:16:20 PM7/20/16
to cf-orm-dev
Yes, I had set singularname="client"

Log.addClient( Participant ) worked.

Thank you and regards,

Greg

Reply all
Reply to author
Forward
0 new messages