Skip to content

fix(laravel): resolve casts defined via casts() method#7859

Merged
soyuka merged 1 commit intoapi-platform:4.3from
soyuka:fix/7662
Mar 22, 2026
Merged

fix(laravel): resolve casts defined via casts() method#7859
soyuka merged 1 commit intoapi-platform:4.3from
soyuka:fix/7662

Conversation

@soyuka
Copy link
Member

@soyuka soyuka commented Mar 21, 2026

Q A
Branch? 4.2
Tickets Closes #7662
License MIT
Doc PR

Models created with newInstanceWithoutConstructor() skip initializeHasAttributes(), so casts() method results are never merged into $casts. Use reflection to call casts() in getCastsWithDates().

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Tickets       | Closes api-platform#7662
| License       | MIT
| Doc PR        | ∅

Models created with newInstanceWithoutConstructor() skip
initializeHasAttributes(), so casts() method results are never
merged into $casts. Use reflection to call casts() in getCastsWithDates().
@soyuka soyuka merged commit e14ae87 into api-platform:4.3 Mar 22, 2026
147 of 151 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.

1 participant