You can only have one relationship per foreign key. Check out the big warning: http://docs.transfer-orm.com/wiki/Transfer_Configuration_File.cfm#onetomany
On Sun, Oct 4, 2009 at 9:08 PM, Matthew <[email protected]> wrote: > > Hi all > > I'm getting some weird behaviour where I've got several o2m > relationships pointing to the same object but with different "where" > conditions. As you can see in the display code at the bottom I'm just > dumping the 3 different o2m Arrays (I get the same bug when I iterate > through the records). When I run the page the 1st time it reflects the > database i.e. there are 2 records linked from the base object to the > child on the 2nd relationship i.e. > "ContentTreeContentPanelsPosition2". But when I refresh the page (and > on all subsequent refreshes) "ContentTreeContentPanelsPosition1" > suddenly has 2 copies of whatever was in > "ContentTreeContentPanelsPosition2". So when there was 1 relationship > in Position2 then Position1 had 2 Array items. When I added a 2nd > relationship to Position2 suddenly Position1 had 4 Array items. My > current theory on possible guilty parties are: > 1) Transfer cache copying and doubling up the Array from > "ContentTreeContentPanelsPosition2" to > "ContentTreeContentPanelsPosition1". But why it doesn't copy it to > "ContentTreeContentPanelsPosition3" I don't know. > 2) The child object i.e. the "m" in the o2m has a composite key. So > when the base object joins onto the child this may be an issue. > > I'm going to setup an isolated test case to rule as many factors out > as possible (such as removing MachII and ColdSpring from the equation) > but I just thought I'd see if anyone can see any obvious issues? I've > got lots of other relationships throughout the system which are fine > it's just these ones which use the WHERE condition. > > **** XML CONFIG **** > //// BASE OBJECT //// > <object name="ContentTree" > decorator="decorators.contentTreeDecorator"> > <id name="contentTreeId" type="numeric"></id> > <onetomany name="ContentTreeContentPanelsPosition1" lazy="true"> > <link to="ContentTree_ContentPanel" column="contentTreeId" > /> > <collection type="array"> > <condition where="{layoutPosition} = 1" /> > <order property="sequencePosition" order="asc" /> > </collection> > </onetomany> > <onetomany name="ContentTreeContentPanelsPosition2" lazy="true"> > <link to="ContentTree_ContentPanel" column="contentTreeId" > /> > <collection type="array"> > <condition where="{layoutPosition} = 2" /> > <order property="sequencePosition" order="asc" /> > </collection> > </onetomany> > <onetomany name="ContentTreeContentPanelsPosition3" lazy="true"> > <link to="ContentTree_ContentPanel" column="contentTreeId" > /> > <collection type="array"> > <condition where="{layoutPosition} = 3" /> > <order property="sequencePosition" order="asc" /> > </collection> > </onetomany> > </object> > > //// CHILD OBJECT //// > <object name="ContentTree_ContentPanel" > table="ContentTree_ContentPanel"> > <compositeid> > <manytoone name="ContentPanel" /> > <parentonetomany class="ContentTree" /> > </compositeid> > <property name="layoutPosition" type="numeric" /> > <property name="sequencePosition" type="numeric" /> > <manytoone name="ContentPanel"> > <link to="ContentPanel" column="contentPanelId" /> > </manytoone> > </object> > > **** DISPLAY CODE **** > <cfdump > var="#oContentTreeItemTab.getContentTreeContentPanelsPosition1Array() > #"> > <cfdump > var="#oContentTreeItemTab.getContentTreeContentPanelsPosition2Array() > #"> > <cfdump > var="#oContentTreeItemTab.getContentTreeContentPanelsPosition3Array() > #"> > > **** ENVIRONMENT **** > Transfer 1.1, Mach-II, ColdSpring > > Cheers > Matthew > > > -- E: [email protected] T: http://www.twitter.com/neurotic W: www.compoundtheory.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
