feat: Import Wizard relationship mapping and smart matching#76
Merged
ManukMinasyan merged 5 commits into3.xfrom Jan 15, 2026
Merged
feat: Import Wizard relationship mapping and smart matching#76ManukMinasyan merged 5 commits into3.xfrom
ManukMinasyan merged 5 commits into3.xfrom
Conversation
- Configure People entity with email-based lookup identifier - Configure Company entity with domain-based lookup identifier - Add LookupFieldMatcher service for matching records by unique attributes - Add relationship mapping support with company/contact columns - Add public email domain filtering for company matching - Enhance import preview with relationship match status - Add MatchType enum for standardized match type handling - Improve date/timestamp format detection in CSV analysis - Add polymorphic relationship syncing for tasks and notes
7d3c184 to
4552d5f
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces comprehensive relationship mapping and smart matching capabilities to the Import Wizard, enabling intelligent linking of imported records through multiple matching strategies (ID, name, email, domain). The implementation includes public email domain filtering, polymorphic relationship support for Tasks/Notes, lookup field matching by unique attributes, and enhanced preview functionality showing relationship match status.
Changes:
- Added relationship mapping UI with dedicated two-level selection controls (relationship + matcher)
- Implemented smart matching with configurable lookup identifiers (emails for People, domains for Company)
- Integrated public email domain filtering (4700+ domains) to prevent false company associations
- Extended preview functionality to display relationship match status, confidence, and method
- Added polymorphic relationship support for Tasks and Notes to link to multiple entity types
Reviewed changes
Copilot reviewed 47 out of 49 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| RelationshipMappingTest.php | Comprehensive test suite (362 assertions) covering relationship field mapping, auto-mapping, persistence, and creation |
| PublicEmailDomainFilterTest.php | Tests public email filtering with 119 assertions covering domain identification and CompanyMatcher integration |
| PublicEmailDomainFilter.php | Filters 4700+ free email domains with O(1) lookup performance using hash map |
| RelationshipPreviewMatcher.php | Matches relationship values during preview with caching for performance |
| LookupFieldMatcher.php | Matches lookup fields by unique attributes (email/domain) with batch support |
| CompanyMatcher.php | Enhanced with public email filtering option |
| PreviewChunkService.php | Refactored to process relationship matches instead of company-specific logic |
| CsvAnalyzer.php | Added choice field validation and field type determination improvements |
| ImportWizard.php | Added relationship mapping UI, missing options creation, and choice field support |
| HasColumnMapping.php | Implements relationship field mapping with auto-mapping and conflict resolution |
| StreamingImportCsv.php | Added runtime flag for creating missing select options with proper cleanup |
| ProcessImportPreview.php | Updated to track relationship counts instead of company names |
| TaskImporter.php | Added polymorphic relationship fields and syncing via new trait |
| SyncsPolymorphicLinks.php | New trait for syncing polymorphic entity links |
| config/custom-fields.php | Configured lookup identifiers for People and Company entities |
| free-email-domains.json | 4781 public email domains for filtering |
| composer.json/lock | Changed custom-fields package to local path with @dev version |
…ts in custom-fields.php and StreamingImportCsv.php
add phone number as unique identifier for people duplicate detection during csv imports, following the same pattern as email matching. matching precedence: id -> email -> phone - add Phone case to MatchType enum - mark phone_number as unique in PeopleField enum - add findByPhone() and phone normalization to PeopleImporter - extend ImportRecordResolver with phone cache and lookup - add phone matcher to RelationshipField::contact() - update RelationshipPreviewMatcher for phone match type - simplify LookupFieldMatcher and PreviewChunkService
- Creates migration that calls custom-fields:upgrade command - Handles lookup field migration, email/phone format conversion - Skips cache clearing (will be handled by deployment) - Sets appropriate memory and time limits for large datasets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Comprehensive Import Wizard enhancement for 3.x that adds intelligent relationship mapping and smart record matching.
Relationship Mapping
Smart Matching
Preview Enhancements
Configuration
EntityModel::configure()now acceptslookupIdentifierparameteremailsfield as lookup identifierdomainsfield as lookup identifierNew Files
HasCompanyRelationshipColumns- Company linking via ID/name/domainHasContactRelationshipColumns- Contact linking via ID/name/emailHasPolymorphicRelationshipFields- Polymorphic linking for Tasks/NotesSyncsPolymorphicLinks- Sync polymorphic relationships after importLookupFieldMatcher- Match lookup fields by unique attributesPublicEmailDomainFilter- Filter 4700+ free email domainsRelationshipPreviewMatcher- Preview relationship matchingUpdateEmailDomainsCommand- Update free email domains listTest plan
PublicEmailDomainFilterTest- 119 assertionsRelationshipMappingTest- 362 assertions