Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links support Collection API #88

Open
Gabriel-Darbord opened this issue Nov 19, 2024 · 0 comments
Open

Links support Collection API #88

Gabriel-Darbord opened this issue Nov 19, 2024 · 0 comments

Comments

@Gabriel-Darbord
Copy link
Member

Since FMMultivalueLink and FMSlotMultivalueLink inherit from OrderedCollection (#70), a lot of API has been inherited that can add or remove elements, or even set the entire inner collection directly.
As explained in the PR, these methods seem to work, but do not affect the opposite of the link.
This should be fixed to ensure that links remain in the correct state no matter what method is used.

Here is the (hopefully exhaustive) list of unsupported methods:

  • addFirst:
  • at:put:
  • insert:before: (see note)
  • removeIndex:
  • removeAllSuchThat:
  • removeFirst
  • removeLast
  • setCollection:
  • setContents:

A good practice is to handle the private method that is used by multiple public methods, thus reducing the amount of methods to handle.
For example, addLast: takes care of add:, addAllLast: and addNoSort:.
The same could be done with removeIndex: which would take care of remove:ifAbsent:, removeAt: and removeAtIndex:.

Note: insert:before: has a working extension in FASTRefactor. There is also a convenient replace: oldEntity with: newEntity, which is a new API not from Collection, but not sure if it should be brought over?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant