Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use InteractsWithDictionary in Eloquent collection #46196

Merged
merged 1 commit into from
Feb 21, 2023

Conversation

alcaeus
Copy link
Contributor

@alcaeus alcaeus commented Feb 21, 2023

This improves the behaviour of database collections when using non-scalar primary keys by using the same dictionary behaviour used elsewhere.

The use case is the jenssegers/laravel-mongodb library, where identifiers may be non-scalar values. Using InteractsWithDictionary fixes this for all stringable objects directly, but also would allow us to support other complex objects by overriding the getDictionaryKey method without having to override all methods making use of the dictionary.

This improves the behaviour of database collections when using non-scalar primary keys by using the same dictionary behaviour used elsewhere.
@alcaeus alcaeus force-pushed the eloquent-collection-dictionary branch from 6a77163 to d7f2afb Compare February 21, 2023 09:27
@taylorotwell taylorotwell merged commit d91e03a into laravel:10.x Feb 21, 2023
@alcaeus alcaeus deleted the eloquent-collection-dictionary branch February 21, 2023 11:39
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.

3 participants