Skip to content

PHPORM-140: Fix documentation for inverse embed relationships #2734

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

Merged
merged 1 commit into from
Feb 21, 2024

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Feb 21, 2024

PHPORM-140

The issue is that fetching books through its model isn't possible, as it's an embedded relationship. I updated the code to fetch a book through the user to have a functional example, even if the use case isn't realistic.

Checklist

  • Add tests and ensure they pass
  • Add an entry to the CHANGELOG.md file
  • Update documentation for new features

@alcaeus alcaeus requested a review from GromNaN February 21, 2024 14:08
@alcaeus alcaeus self-assigned this Feb 21, 2024
@@ -351,7 +351,7 @@ relation definition.

.. code-block:: php

$book = Book::first();
$book = User::first()->books()->first();
Copy link
Member

Choose a reason for hiding this comment

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

Correct, Book::first() sends a query to the books collection. Which is not expected for embeds.

@alcaeus alcaeus merged commit 5388dd0 into mongodb:4.1 Feb 21, 2024
@alcaeus alcaeus deleted the fix-documentation branch February 21, 2024 14:18
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