Fix polymorphic relationship handling in FixtureService#36
Merged
chrispenny merged 3 commits intomainfrom Mar 29, 2026
Merged
Conversation
When has_one relationships are configured as arrays (polymorphic relationships), the code was failing with a fatal error trying to check if the array value existed as a class configuration. This fix: - Checks if relationClassName is an array - Extracts the 'class' key for polymorphic relationships - Adds proper warning handling for invalid configurations - Validates that field_classname_map returns valid class names Fixes fatal error: DataObject::get() cannot query non-subclass DataObject directly when processing polymorphic has_one relationships defined as arrays.
… messages - Extract polymorphic relationship logic into dedicated handlePolymorphicRelationship() method - Replace var_export with json_encode for cleaner warning output - Add better error handling for unexpected relationship types - Addresses review feedback from PR #32
4523f94 to
98c49e0
Compare
98c49e0 to
f5699bc
Compare
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.
Builds on #32 by @jsirish (sorry, I didn't have access to the fork to be able to push new commits)
Closes #32