I'd just create a new array, if the item fits, then add it to the new array,
and then return that new array.

No need to remove, and thread safe :D

Mark

On Mon, Oct 5, 2009 at 3:42 PM, Matthew <[email protected]> wrote:

>
> Hi Mark
>
> Any ideas on how I can achieve what I'm after? Perhaps I should use a
> decorator. So off the top of my head I'd retrieve all child objects
> (getContentTreeContentPanels) and then add a decorator method
> getPanelsByPosition(n). Within the decorator I'd loop through all the
> child objects and just return the items with match the "n" argument.
> How would you recommend filtering and returning the collection inside
> the decorator? I'd have to be careful not to loop through the iterator
> and call the remove() method because this would remove it for any
> subsequent calls to the decorator method. So would you Copy() the o2m
> array inside the decorator, loop through it, strip out items based on
> argument "n" and return the filtered array?
>
> Cheers
> Matthew
>
> On Oct 6, 8:32 am, Mark Mandel <[email protected]> wrote:
> > You can only have one relationship per foreign key.
> >
> > Check out the big warning:
> http://docs.transfer-orm.com/wiki/Transfer_Configuration_File.cfm#one...
> >
> >
> >
> > 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
> >
>


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

Reply via email to