Sean,
Thanks for the reply! Unfortunately, the organisations and persons are
not related directly. This is my transfer.xml file:
<package name="dc">
<object name="Organisation" table="organisations">
<id name="OrgId" type="string" generate="false" column="ORG_ID" />
<property name="CommonName" type="string" nullable="false"
column="COMMON_NAME" />
...
<onetomany name="OrgPerson" lazy="true">
<link to="dc.OrgPerson" column="ORG_ID" />
<collection type="struct">
<key property="OrgPersonId"/>
</collection>
</onetomany>
</object>
<object name="Person" table="DC_PERSONS">
<id name="PersonId" column="PERSON_ID" type="string"
generate="false" />
<property name="FirstName" type="string" nullable="false"
column="FIRST_NAME"/>
<property name="FamilyName" type="string" nullable="false"
column="FAMILY_NAME"/>
...
<onetomany name="OrgPerson" lazy="true">
<link to="dc.OrgPerson" column="PERSON_ID" />
<collection type="struct">
<key property="OrgPersonId"/>
</collection>
</onetomany>
</object>
<object name="OrgPerson" table="DC_ORG_PERSON" >
<id name="OrgPersonId" column="ORG_PERSON_ID" type="string"
generate="false" />
<property name="PersonId" type="string" nullable="false"
column="PERSON_ID" />
<property name="OrgId" type="string" nullable="false"
column="ORG_ID" />
<property name="Role" type="string" nullable="false" column="ROLE" /
>
<property name="StartDate" type="date" nullable="true"
column="START_DATE" />
<property name="EndDate" type="date" nullable="true"
column="END_DATE" />
</object>
As I need to have many roles per person and organisation, i.e. a many-
to-many relation between organisations and persons with extra data in
the linking table.
I'd like to append the OrgPerson Struct that belongs to Organisation
2, to the Organisation 1 that replaces it. Something like:
<cfset org1persons = org1.getPersonsStruct() />
<cfset org2persons = org2.getPersonsStruct() />
<cfset StructAppend(org1persons, org2persons, true) />
<cfset org1.setPersonsStruct(org1persons) />
I'd like to avoid looping through all org2persons struct members. Is
your commendation something like the following?
<cfloop collection="#org2persons#" item="OrgPersonId" >
<cfset orgpersons[OrgPersonId].setParentOrganization(org1) />
</cfloop>
TIA,
Pedro.
On Nov 30, 2:02 pm, Sean Coyne <[email protected]> wrote:
> depends on your Transfer configuration but most likely you would do
> something like:
>
> <cfset person.setParentOrganization(org) />
>
> where person is your person object and org is your organization
> object. Note that this will only work if you have specified a one to
> many in the organization configuration and that you called
> organizations "Organization" in your transfer config.
>
> Sean
>
> On Nov 28, 10:14 pm, pedrobl <[email protected]> wrote:
>
> > Hi!
>
> > I have an organisation object with two o2m relations person and
> > projects. In order to eliminate duplicates, I need to move the related
> > persons and projects from one organisation to another.
>
> > Is there an easy way to do this with transfer? I use two linking
> > tables org_person, and org_project to store the relation between them,
> > and also stores other information like the person's role (staff,
> > contact, administrator, etc...), or the initial and end date for the
> > relation. I'd like to move those relationships unchanged, just to move
> > them from organisation A to organisation B.
>
> > In SQL this would be trivial to do by just updating the organisation
> > FK from organisation A, to organisation B in the org_person table.
>
> > I'd like to avoid looping through the org_person structure to modify
> > each org_person.OrgId from one organisation to the other, as I'd need
> > to create the organisation objects.
>
> > Can this be achieved in one shot? Something like:
>
> > <cfset org1persons = org1.getPersonsStruct() />
> > <cfset org2persons = org2.getPersonsStruct() />
> > <cfset StructAppend(org1persons, org2persons, true) />
> > <cfset org1.setPersons(org1persons) />
>
> > TIA!
>
> > Pedro.
>
>
--
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