Repository navigation
Fix registered collection base interface and class resolution - #579
Open
dajiaohuang wants to merge 1 commit into
Open
dajiaohuang wants to merge 1 commit into
dajiaohuang wants to merge 1 commit into
Conversation
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.
🔍 What was changed
Match registered collection types with
is_a(..., true)so both the registered base type itself and subclasses resolve to the collection factory. Preserve alias precedence, factory class customization and the fallback for explicit factory names.🤔 Why?
Fixes #573. Using
Doctrine\Common\Collections\Collection::classas the relation collection type currently attempts to autowire the interface, althoughDoctrineCollectionFactory::withCollectionClass()explicitly supports it. Using the registered Illuminate base class also falls through to the container and returns a collection instead of a collection factory.📝 Checklist
Local runtime: PHP 8.3.35, cycle/database 2.23.3, doctrine/collections 2.6.0, illuminate/collections 12.70.0. Other PHP versions and database drivers were not run. Psalm has 12 errors on the base, including the unrelated callable-typecast issue; no new collection-path diagnostic remains. No static-analysis suppressions were added.
📃 Documentation
This restores registered-base collection selection without changing the public API.