Matthew,

I do this by applying a 'condition' to my relationships. As an example, peek
these M2M's.  I am using these so I can keep my database normalized with all
'attachments' in a single table, yet I can retrieve them under different
relationships here based on the property 'type'.

<manytomany name="preliminaryPicture" table="xAuctionAttachments"
lazy="true" proxied="true">
    <link to="auction" column="auctionID" />
    <link to="attachment" column="attachmentID" />
    <collection type="array">
        <condition property="type" value="image" />
    </collection>
</manytomany>

<manytomany name="badge" table="xAuctionAttachments" lazy="true">
    <link to="auction" column="auctionID" />
    <link to="attachment" column="attachmentID" />
    <collection type="array">
        <condition property="type" value="badge" />
    </collection>
</manytomany>      
        
<manytomany name="thumbnail" table="xAuctionAttachments" lazy="true">
    <link to="auction" column="auctionID" />
    <link to="attachment" column="attachmentID" />
    <collection type="array">
        <condition property="type" value="thumb" />
    </collection>
</manytomany>


Hth,
Chris Peterson


On 5/21/09 7:52 PM, "Matthew" <[email protected]> wrote:

> 
> Hi
> 
> Is it possible to filter the retrieval of manytomany objects? I've
> looked at readByPropertyMap() but this only allows you to filter the
> top level object but not the siblings in a manytomany relationship.
> 
> Example: I'm retriving a Page object which has a manytomany
> relationship with Promotion objects i.e. PageA has X promotions linked
> to it. Even though PageA has say 6 promotions linked to it I need to
> filter based on session configuration e.g. if the user is on the
> Australia version of the website they can only see 4 of the 6
> promotions. The filter is a flag on the Promotion table
> "showAu","showNz" etc.
> 
> Perhaps there is a better way to do this by re-modeling the database
> so the Page objects are only joined to Promotion objects per country,
> however I'm sure you'd still have the same problem.
> 
> In more general terms: the 6 Promotions are related to PageA when you
> are managing the relationships via an admin system but when it is
> published to the user the promotions need to be filter based on their
> locale.
> 
> Platform: Transfer 1.1, CF 7
> 
> Cheers
> Matthew
> > 



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