Skip to content

Add filterCallback to EntityCollectionMappingFilter and EntityMapping - #7

Merged
addfs merged 1 commit into
retailcrm:masterfrom
1on:master
Aug 3, 2026
Merged

Add filterCallback to EntityCollectionMappingFilter and EntityMapping#7
addfs merged 1 commit into
retailcrm:masterfrom
1on:master

Conversation

@1on

@1on 1on commented Jul 31, 2026

Copy link
Copy Markdown

Changes

Added support for custom existing-entity resolution in EntityMappingFilter and
EntityCollectionMappingFilter.

Both filters now accept an optional filterCallback. It can be used to define custom
lookup logic, for example resolving an entity by uuid. If the callback is not provided
or does not return an entity, the previous id-based lookup behavior is preserved.

Details

  • Added optional filterCallback constructor argument to EntityMappingFilter.
  • Added optional filterCallback constructor argument to EntityCollectionMappingFilter
    and pass it to the inner EntityMappingFilter.
  • Collection item deletion can now resolve deleted items without an input id:
    • if id is present, the previous behavior is used;
    • otherwise, the filter attempts to resolve the entity through filterCallback and uses
      its getId().
  • Covered the existing id lookup behavior with a regression test.
  • Moved test helper classes to tests/Utils.

Why

This allows EntityCollectionMappingFilter to support inputs identified by external
identifiers such as uuid, while keeping backward compatibility with the existing
id-based mapping behavior.

@addfs
addfs merged commit 3e58682 into retailcrm:master Aug 3, 2026
15 checks passed
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

Successfully merging this pull request may close these issues.

2 participants