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

Throw a full-fledged exception on invalid call #11308

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

greg0ire
Copy link
Member

@greg0ire greg0ire commented Feb 25, 2024

In 2.x, getAssociationMappedByTargetField() used to return null when called with the owning side of an association.
That was undocumented and wrong because the phpdoc advertises a string as a return type.

In #10723, I wrongly assumed that nobody would be calling this method with the owning side of an association.

Let us throw a full fledged exception and advertise the proper way of avoiding this situation.

Closes #11250

In 2.x, getAssociationMappedByTargetField() used to return null when
called with the owning side of an association.
That was undocumented and wrong because the phpdoc advertises a string
as a return type.

In 6ce0cf4, I wrongly assumed that
nobody would be calling this method with the owning side of an
association.

Let us throw a full fledged exception and advertise the proper way of
avoiding this situation.

Closes doctrine#11250
Copy link
Member

@SenseException SenseException left a comment

Choose a reason for hiding this comment

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

I think this should be fine.

@greg0ire greg0ire added this to the 3.0.2 milestone Feb 26, 2024
@greg0ire greg0ire merged commit b187bc8 into doctrine:3.0.x Feb 26, 2024
64 checks passed
@greg0ire greg0ire deleted the throw-instead-of-assert branch February 26, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getAssociationMappedByTargetField on the owning side of a relation fails in 3.0
2 participants