Skip to content

fix(database): fix is relation loaded and correctly unset properties#2063

Open
laylatichy wants to merge 8 commits intotempestphp:3.xfrom
laylatichy:feat/unset-default-belongs-to-many-relations
Open

fix(database): fix is relation loaded and correctly unset properties#2063
laylatichy wants to merge 8 commits intotempestphp:3.xfrom
laylatichy:feat/unset-default-belongs-to-many-relations

Conversation

@laylatichy
Copy link
Contributor

@laylatichy laylatichy commented Mar 21, 2026

unset property so lazy loading works correctly for belongstoman, isRelationLoaded returns corect value and empty results are correctly set

@laylatichy laylatichy force-pushed the feat/unset-default-belongs-to-many-relations branch 2 times, most recently from e2b3028 to 4e5c183 Compare March 21, 2026 17:18
@github-actions
Copy link

github-actions bot commented Mar 21, 2026

Benchmark Results

Comparison of feat/unset-default-belongs-to-many-relations against 3.x (3d5833ee0dc13c60845bb421f5cb72e3ac9b1452).

Open to see the benchmark results
Benchmark Set Mem. Peak Time Variability
ViewRenderBench(benchExpressions) - 24.513mb 0.00% 545.292μs +5.38% ±1.08% -58.19%

Generated by phpbench against commit e733691

@laylatichy laylatichy force-pushed the feat/unset-default-belongs-to-many-relations branch 9 times, most recently from 201e271 to 235a93c Compare March 21, 2026 18:15
@laylatichy laylatichy force-pushed the feat/unset-default-belongs-to-many-relations branch from 235a93c to a208259 Compare March 21, 2026 18:24
@laylatichy laylatichy changed the title feat(database): unset default belongs to many relations fix(database): unset default belongs to many relations Mar 21, 2026
@laylatichy laylatichy force-pushed the feat/unset-default-belongs-to-many-relations branch from a208259 to 177b33c Compare March 21, 2026 18:56
@laylatichy laylatichy changed the title fix(database): unset default belongs to many relations fix(database): fix is relation loaded and correctly unset properties Mar 21, 2026
@laylatichy laylatichy force-pushed the feat/unset-default-belongs-to-many-relations branch from 177b33c to 680c0fa Compare March 21, 2026 19:14
@laylatichy laylatichy marked this pull request as ready for review March 21, 2026 19:38
@laylatichy
Copy link
Contributor Author

laylatichy commented Mar 21, 2026

@brendt some fixes so isRelationLoaded works correctly

but, it might have breaking behavior, kinda I guess if somebody relied on broken behavior in his app to work

now

class Author {
    public ?Publisher $publisher = null
}

isrelationloaded false, author->publisher throws relationmissing if we dont ->load('publisher') before

class Author {
    #[Lazy]
    public ?Publisher $publisher = null
}

isrelationloaded false, author->publisher loads data

class Author {
    #[Eager]
    public ?Publisher $publisher = null
}

isrelationloaded true, author->publisher shows data loaded at the time of author fetch

I guess thats how it should work?

@laylatichy laylatichy force-pushed the feat/unset-default-belongs-to-many-relations branch from 680c0fa to 16d248d Compare March 21, 2026 19:51
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.

1 participant