Hello,
Does FAME allow to create one-to-one relationship with automatic update of the back links? So far, I have seen two entities FMMultivalueLink (one-to-many) and FMMultiMultivalueLink (many-to-many) and their examples.
I have an elements and its behavior in separate entities and I would like to create and update one-to-one links between these two entities. I haven't found any example in Moose.
tx, Usman _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Yes, there is an example in: FAMIXAssociation>>next FAMIXAssociation>>previous On Fri, Mar 22, 2013 at 6:10 PM, Usman Bhatti <[hidden email]> wrote:
Andre Hora _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Not quite enough of an explanation :).
Indeed, the case you mentioned is a good case study. But, the question is how do we ensure that when setting previous:, we also set the next: of the previous as well. Like Usman observed, we have no support from Fame here, but we can do it in the setter. In our case, the magic is in the previous: setter: previous: anAssociation previous ~= anAssociation ifTrue: [ | old | old := previous. previous := anAssociation. old notNil ifTrue: [ old next: nil ]. anAssociation notNil ifTrue: [ anAssociation next: self ] ] So, because of that, the following code returns true: previous := FAMIXAssociation new. next := FAMIXAssociation new. next previous: previous. previous next = next Cheers, Doru On Mar 23, 2013, at 1:04 PM, Andre Hora <[hidden email]> wrote: > Yes, there is an example in: > FAMIXAssociation>>next > FAMIXAssociation>>previous > > In this case you don't need to use FMMultivalueLink/FMMultiMultivalueLink/etc links. You just need to say to the non-derived side (in this example FAMIXAssociation>>previous) to also set the derived side (in this example FAMIXAssociation>>next) > > > > On Fri, Mar 22, 2013 at 6:10 PM, Usman Bhatti <[hidden email]> wrote: > Hello, > > Does FAME allow to create one-to-one relationship with automatic update of the back links? So far, I have seen two entities FMMultivalueLink (one-to-many) and FMMultiMultivalueLink (many-to-many) and their examples. > > I have an elements and its behavior in separate entities and I would like to create and update one-to-one links between these two entities. I haven't found any example in Moose. > > tx, > Usman > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev > > > > > -- > Andre Hora > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev -- www.tudorgirba.com "Every now and then stop and ask yourself if the war you're fighting is the right one." _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
tx both. That helps. On Sat, Mar 23, 2013 at 3:08 PM, Tudor Girba <[hidden email]> wrote: Not quite enough of an explanation :). _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
I would like to have such behavior with first class instance variables.
Stef On Mar 24, 2013, at 9:51 AM, Usman Bhatti <[hidden email]> wrote:
_______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Me too :)
Doru On Mar 24, 2013, at 9:49 PM, stephane ducasse <[hidden email]> wrote: > I would like to have such behavior with first class instance variables. > > Stef > > On Mar 24, 2013, at 9:51 AM, Usman Bhatti <[hidden email]> wrote: > >> tx both. That helps. >> >> >> On Sat, Mar 23, 2013 at 3:08 PM, Tudor Girba <[hidden email]> wrote: >> Not quite enough of an explanation :). >> >> Indeed, the case you mentioned is a good case study. But, the question is how do we ensure that when setting previous:, we also set the next: of the previous as well. >> >> Like Usman observed, we have no support from Fame here, but we can do it in the setter. In our case, the magic is in the previous: setter: >> previous: anAssociation >> previous ~= anAssociation ifTrue: >> [ | old | >> old := previous. >> previous := anAssociation. >> old notNil ifTrue: [ old next: nil ]. >> anAssociation notNil ifTrue: [ anAssociation next: self ] ] >> >> So, because of that, the following code returns true: >> previous := FAMIXAssociation new. >> next := FAMIXAssociation new. >> next previous: previous. >> previous next = next >> >> Cheers, >> Doru >> >> >> On Mar 23, 2013, at 1:04 PM, Andre Hora <[hidden email]> wrote: >> >> > Yes, there is an example in: >> > FAMIXAssociation>>next >> > FAMIXAssociation>>previous >> > >> > In this case you don't need to use FMMultivalueLink/FMMultiMultivalueLink/etc links. You just need to say to the non-derived side (in this example FAMIXAssociation>>previous) to also set the derived side (in this example FAMIXAssociation>>next) >> > >> > >> > >> > On Fri, Mar 22, 2013 at 6:10 PM, Usman Bhatti <[hidden email]> wrote: >> > Hello, >> > >> > Does FAME allow to create one-to-one relationship with automatic update of the back links? So far, I have seen two entities FMMultivalueLink (one-to-many) and FMMultiMultivalueLink (many-to-many) and their examples. >> > >> > I have an elements and its behavior in separate entities and I would like to create and update one-to-one links between these two entities. I haven't found any example in Moose. >> > >> > tx, >> > Usman >> > >> > _______________________________________________ >> > Moose-dev mailing list >> > [hidden email] >> > https://www.iam.unibe.ch/mailman/listinfo/moose-dev >> > >> > >> > >> > >> > -- >> > Andre Hora >> > _______________________________________________ >> > Moose-dev mailing list >> > [hidden email] >> > https://www.iam.unibe.ch/mailman/listinfo/moose-dev >> >> -- >> www.tudorgirba.com >> >> "Every now and then stop and ask yourself if the war you're fighting is the right one." >> >> >> >> >> _______________________________________________ >> Moose-dev mailing list >> [hidden email] >> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >> >> _______________________________________________ >> Moose-dev mailing list >> [hidden email] >> https://www.iam.unibe.ch/mailman/listinfo/moose-dev > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev -- www.tudorgirba.com "Be rather willing to give than demanding to get." _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Free forum by Nabble | Edit this page |