Hi Stephen,

Thanks for the quick reply!

Your suggestion occurred to me as well so I tried that out. Yet I
cannot see how to do what I want.

Here is the Transfer.xml snip:

===========================
                <package name="text">
                        <!-- TEXTKEY-->
                        <object name="textkey" table="textkey">
                                <id name="id" type="numeric"/>
                                <property name="" type="string" 
column="webTextKey"
nullable="false" />
                                <onetomany name="webtexts">
                                        <link to="text.webtext" 
column="FK_textKey"/>
                                        <collection type="array">
                                                <order property="label" 
order="asc" />
                                        </collection>
                                </onetomany>
                        </object>

                        <!-- WEBTEXT-->
                        <object name="webtext" table="webtext">
                                <id name="id" type="numeric"/>
                                <property name="label" type="string" 
column="label"
nullable="false" />
                                <property name="content" type="string" 
column="content"
nullable="false" />
                                <property name="active" type="boolean" 
column="active"
nullable="false" />
                                <property name="IPRestrict" type="string" 
column="IPRestrict"
nullable="true" />
                                <manytoone name="language">
                                        <link to="text.language" 
column="FK_language" />
                                </manytoone>
                                <manytoone name="textkey" lazy="true">
                                        <link to="text.textkey" 
column="FK_textKey" />
                                </manytoone>
                        </object>

                        <!-- LANGUAGE-->
                        <object name="language" table="language">
                                <id name="id" type="numeric"/>
                                <property name="title" type="string" 
column="title"
nullable="false" />
                                <property name="name" type="string" 
column="name"
nullable="false" />
                        </object>
                </package>
===========================

So I have multiple webtexts, each with properties as described in
object webtext. Each webtext has a value for properties title and name
in object Language. And multiple webtexts share one webTextKey in
object textkey. The idea being textkey.webTextKey "main.intro" points
to several introtexts in text.webtext, for example in different
languages.

Suppose I have a several texts that are related to the textKey
"economy.finance.banks". One is in English, one is in Dutch, another
one might be IPrestricted and so on. How do I retrieve the text for
which textKey.webTextKey "economy.finance.banks"; language.name="EN";
webtext.active=TRUE and webtext.IPRestrict="127.0.0.1"?
If I do a
readByProperty("text.textkey","webTextKey","economy.finance.banks").getwebtextsArray()
I get an array with all webtexts pointing to this textkey. What next?
Loop through the array and ask each object if it is the one I am
looking for via readByProperty("text.webtext",<proprtyname>,<value>)
and object.getLanguage().getName()? Seems a lot of work where a simple
cfquery would be sufficient. Or am I overlooking some Transfer
functionality here?

Thanks,

Marc

On Oct 21, 12:41 pm, Stephen Moretti <[email protected]>
wrote:
> On 21 October 2010 11:24, marc <[email protected]> wrote:
>
>
>
> > If I want to get an object that is spanned over several tables (via
> > onetomany or manytoone) I can use get(cass,key) where key is the value
> > of a property in the class object.
> > Can I also retrieve an object from class using te value of a key in a
> > related table?
>
> > So say I have a table
> > newspaper
> >  - id
> >  - name
> >  - price
> >  - FK_language
>
> > and a table
> > language
> >  - id
> >  - name
> >  - title
>
> > I understand I can't use a get() to retrieve all newspapers in a given
> > language (since it may return more than one). I also can't use list()
> > or one of it's varieties since that only queries 1 single class. So is
> > my only option here to write a TQL query and use list()?
>
> Marc,
>
> How have you set up the relationship between newspaper and language in your
> transfer.xml file?
>
> If you have a onetomany from language to newspaper, you can use the
> generated methods to get an array or struct of associated newspapers simply
> by getting a language object.
>
> http://docs.transfer-orm.com/wiki/Managing_Relationships_and_Composit...http://docs.transfer-orm.com/wiki/Generated_Methods.cfm#OneToMany_Ele...
>
> take a look at these two pieces of documentation, particularly the generated
> methods page. There are all sorts of functions to assist you with retrieving
> related data.
>
> <http://docs.transfer-orm.com/wiki/Generated_Methods.cfm#OneToMany_Ele...>
> Regards
>
> Stephen

-- 
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