refactor: guard external relationships in User model #63
Open
Charon
wants to merge 1 commit from
feat/consolidate-user-relationships-v2 into dev
pull from: feat/consolidate-user-relationships-v2
merge into: core:dev
core:dev
core:feat/test-workspace-controller
core:feat/workspace-ownership-transfer
core:feat/ide-helper-annotations
core:feat/test-namespace-service
core:feat/artisan-provision-command
core:feat/workspace-activity-audit-log
core:feat/bulk-workspace-invitations
core:feat/openapi-docs
core:feat/add-infection-mutation-testing
core:feat/fix-readme-namespaces
core:feat/test-entitlement-webhook-service
core:feat/invitation-and-role-improvements
core:feat/workspace-lazy-loading
core:feat/invitation-soft-deletes
core:feat/totp-edge-case-tests
core:feat/standardise-error-responses
core:feat/entitlement-exception-hierarchy
core:feat/clarify-workspace-scope-architecture
core:feat/validate-invitation-token-format
core:feat/constrain-feature-code-fk
core:feat/fix-usage-race-condition
core:feat/fix-token-timing-attack
core:feat/add-workspace-role-index
core:feat/add-phpstan-larastan
core:feat/complete-user-stats-stubs
core:feat/fix-namespace-n-plus-1
core:feat/fix-parent-feature-cascade
core:feat/namespace-cascade-delete
core:feat/pin-core-dependency
core:feat/remove-hardcoded-domain
core:feat/test-workspace-team-service
core:feat/workspace-return-types
core:main
1 commit
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
275cba29d7
|
refactor: guard external relationships in User model with class_exists()
Moves all external module relationships (Page, Project, Domain, Pixel, AnalyticsWebsite, AnalyticsGoal, PushWebsite, PushCampaign, PushSegment, PushFlow, TrustCampaign, TrustNotification, Order) out of the User model into dedicated opt-in traits that resolve model classes at runtime via class_exists(). This prevents fatal errors when consuming apps do not have those modules installed. New traits: - HasPageRelationships (pages, projects, domains, pixels, bio/sub-page entitlements) - HasAnalyticsRelationships (analytics websites, goals) - HasPushRelationships (push websites, campaigns, segments, flows) - HasTrustRelationships (trust campaigns, notifications) - HasOrderRelationships (orders, vanity URL entitlement) The User model still uses all five traits so existing consumers see no breaking changes — the relationships now return null instead of throwing a class-not-found error when the backing module is absent. Fixes #6 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |