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

Update property type in case if we don't have record in related table #304

Open
wants to merge 1 commit into
base: v1.x
Choose a base branch
from

Conversation

antevgen
Copy link
Contributor

@antevgen antevgen commented Dec 3, 2024

No description provided.

@XedinUnknown
Copy link

XedinUnknown commented Dec 4, 2024

When B has an FK to A, that's effectively a 0..M relationship of A to B. At present, nothing represents that 0 in the corresponding property type. This creates problems: without null-safe access $a->b?->fieldName, there's a possibility that there will be 0 related rows in B; yet the type B declared by this package is non-nullable, causing static checkers to fail.

This PR makes the typehint B|null, to reflect that there may not be a record in $a->b.

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