Skip to content

Make EmbedsRelations::embedsMany and EmbedsRelations::embedsOne public#2588

Merged
GromNaN merged 2 commits intomongodb:5.xfrom
GromNaN:embed-public
Apr 21, 2026
Merged

Make EmbedsRelations::embedsMany and EmbedsRelations::embedsOne public#2588
GromNaN merged 2 commits intomongodb:5.xfrom
GromNaN:embed-public

Conversation

@GromNaN
Copy link
Copy Markdown
Member

@GromNaN GromNaN commented Aug 30, 2023

Fix #2555

Other relation methods are public.

@GromNaN GromNaN requested review from alcaeus and jmikola August 30, 2023 15:05
@GromNaN GromNaN marked this pull request as draft August 30, 2023 15:26
@alcaeus alcaeus changed the base branch from 4.1 to 5.x September 12, 2024 08:53
@GromNaN GromNaN marked this pull request as ready for review April 18, 2026 21:45
@GromNaN GromNaN requested a review from a team as a code owner April 18, 2026 21:45
Copilot AI review requested due to automatic review settings April 18, 2026 21:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Makes MongoDB embedded relationship helpers usable from outside the model (e.g., Model::resolveRelationUsing(...)) by aligning their visibility with other relationship methods in the package.

Changes:

  • Change EmbedsRelations::embedsMany() visibility from protected to public.
  • Change EmbedsRelations::embedsOne() visibility from protected to public.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* @return EmbedsOne
*/
protected function embedsOne($related, $localKey = null, $foreignKey = null, $relation = null)
public function embedsOne($related, $localKey = null, $foreignKey = null, $relation = null)
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

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

embedsOne()'s docblock says "Define an embedded one-to-many relationship", but this method returns EmbedsOne and represents an embedded one-to-one relationship. Please update the docblock description to avoid misleading API docs now that the method is public.

Copilot uses AI. Check for mistakes.
Comment thread src/Eloquent/EmbedsRelations.php
Copy link
Copy Markdown
Member

@alcaeus alcaeus left a comment

Choose a reason for hiding this comment

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

Changes LGTM, and while I think we can skip test updates, fixing the description of embedsOne would be good.

Comment thread src/Eloquent/EmbedsRelations.php Outdated
@GromNaN GromNaN force-pushed the embed-public branch 2 times, most recently from 2904fbe to aca13c4 Compare April 20, 2026 15:28
@GromNaN GromNaN enabled auto-merge (squash) April 20, 2026 15:28
- Fix embedsOne docblock: "one-to-many" -> "one-to-one"
- Add tests for direct call and resolveRelationUsing use case
@GromNaN GromNaN requested a review from alcaeus April 21, 2026 08:41
@GromNaN GromNaN merged commit 42c8028 into mongodb:5.x Apr 21, 2026
36 checks passed
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.

Make relationship methods public [Feature Request]

4 participants