I think I've got a nice solution for the 'one onetomany too many'
problem, actually a workaround I'd like to share.

Both Contacts and Representatives do not have any onetomanys or
manytoones anymore.

<object name="Contacts" table="contacts" decorator="ContactDecorator">

        <id name="IDContacts" column="IDContact" type="string" />
        <property name="enumType" type="string" column="enumType" />
        <property name="name" type="string" column="name" />
        <property name="address" type="string" column="address" />

</object>

<object name="Representatives" table="representatives"
decorator="RepresentativesDecorator>

        <id name="IDRepresentatives" column="IDRepresentative"
type="string" />

        <property name="job" type="string" column="job" />
        <!-- yes, we're back: -->
        <property name="IDPerson" />
        <property name="IDOrganization" />

</object>

The ContactDecorator now has a function getRepresentativesArray(),
which runs a TQL query searching both Representatives.IDPerson
and Representatives.IDOrganization for IDContact, thus returning a
recordset of IDRepresentatives which I then use to populate the Array
to be returned with
the corresponding Objects I get from Transfer.

RepresentativeDecorator has a function getPerson() returning
transfer.get("Contact",getIDPerson()) and a function getOrganization()
likewise, and there you go.

Now I've got all the things I need and they just look like regular
transfer functions! What would life be worth without transfer
decorators?

- Richard



On Oct 10, 2:38 am, acdhirr <[EMAIL PROTECTED]> wrote:
> Mark,
>
> If I would do that then when IDContacts is an organization, there are
> no corresponding representatives, because there's only a lookup on
> column IDPerson in Representatives.
> You see, that's why I need both onetomany's. Any IDContact can be
> either in Representatives.IDPerson or Representatives.IDOrganization
>
> Since there are no fields IDPerson and IDOrganization any longer in a
> Representative object, so neither the corresponding methods, I
> actually also need 2 manytoones on Representatives to link back to
> Contacts to get further details.
>
> But there are some tricky loops here.
>
> All seems fine as long as all relations are set lazy.
>
> Well, going to take some sleep first - 2:30 in the morning here.
>
> Thanks again,
> Richard
>
> On Oct 10, 1:40 am, "Mark Mandel" <[EMAIL PROTECTED]> wrote:
>
> > Ooooh, I see the problem... and... erk, yeah, not your fault.
>
> > There is a limitation on onetomany that means it can only be connected
> > to an object once... basically, because of a bad design decision I
> > made. :P
>
> > The way I would set this up (and it should also be easier to work with):
>
> > <object name="Contacts" table="contacts">
> >        <id name="IDContacts" column="IDContact" type="string" />
> >        <property name="enumType" type="string" column="enumType" />
> >        <property name="name" type="string" column="name" />
> >        <property name="address" type="string" column="address" />
>
> >        <onetomany name="repr1">
> >                <link to="Representatives" column="IDPerson" />
> >                <collection type="array"/>
> >        </onetomany>
> > </object>
>
> > <object name="Representatives" table="representatives">
> >        <id name="IDRepresentatives" column="IDRepresentative" type="string" 
> > />
> >        <property name="job" type="string" column="job" />
>
> >        <manytoone name="Organization>
> >            <link to="Contacts" column="IDOrganization" />
> >        </manytoone>
> > </object>
>
> > That way you have an array of Contacts, that link to Organisations..
> > and also means you shouldn't get a rediculously large object as well.
>
> > Sorry about that, but that should get you going.
>
> > Mark
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to