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 <andrehoraa(a)gmail.com> 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 <usman.bhatti(a)gmail.com> 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
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
Andre Hora
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
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."