Skip to content

#3453 Change aliasIdForQuery visibility to public#3476

Open
dercoder wants to merge 8 commits intomongodb:5.xfrom
dercoder:fix/change-alias-methods-visibility
Open

#3453 Change aliasIdForQuery visibility to public#3476
dercoder wants to merge 8 commits intomongodb:5.xfrom
dercoder:fix/change-alias-methods-visibility

Conversation

@dercoder
Copy link

"Changed the visibility of aliasIdForQuery from private to public.
This allows developers to override the method or call it directly to normalize query data (e.g. id => _id) beforehand, resolving limitations like #3453

Checklist

  • Add tests and ensure they pass

@dercoder dercoder requested a review from a team as a code owner February 10, 2026 10:03
@dercoder dercoder requested a review from GromNaN February 10, 2026 10:03
Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the appropriate extension point for this.

But if we decide to add the methods aliasIdForQuery and aliasIdForResult to the public API, we have to find better names for them.

An idea might be to move this logic to the Grammar class?

Alexander Fedra added 2 commits February 11, 2026 17:12
…thods

Tests cover prepareFieldsForQuery and prepareFieldsForResult methods including id/_id aliasing, arrow/dot notation conversion, DateTime handling, nested structures, and renameEmbeddedIdField configuration. Also reorders PHPDoc annotations to follow consistent format.
@dercoder dercoder requested a review from GromNaN February 11, 2026 16:39
dercoder and others added 4 commits February 11, 2026 19:07
Co-authored-by: Jérôme Tamarelle <jerome@tamarelle.net>
Remove strict type hint from `$collection` property and update PHPDoc to use FQCN. Remove trailing whitespace.
@dercoder dercoder requested a review from GromNaN February 11, 2026 19:49
@dercoder
Copy link
Author

In Laravel 11, the connection is optional in the Grammar class. Any suggestions here?

…ling

Handle Grammar constructor changes in Laravel 12 where connection is passed via constructor instead of setConnection() method. Add backward compatibility for Laravel 11 by checking if setConnection() method exists before calling it.
@dercoder
Copy link
Author

In Laravel 11, the connection is optional in the Grammar class. Any suggestions here?

Laravel 12 passes the connection to Grammar via the constructor, but in Laravel 11 the constructor doesn't accept it
-> setConnection() must be called explicitly.

Added method_exists guards to support both versions.

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.

2 participants