Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix fake field casting when translations are enabled #5768

Merged
merged 1 commit into from
Feb 4, 2025
Merged

Conversation

pxpm
Copy link
Contributor

@pxpm pxpm commented Feb 4, 2025

WHY

BEFORE - What was wrong? What was happening before this PR?

Spatie/Laravel-Translatable introduced a Breaking Change (IMO), and broke our functionality. TLDR: Casts are now "forced" into the model, and our functionality was expecting the previous behavior (casts only available upon calling getCasts()).

AFTER - What is happening after this PR?

I've added a workaround in our Fake Fields functionality, so hopefully we can circumvent this issue.

HOW

How did you achieve that, in technical terms?

Check if the column is translatable, if it is, ignore the cast.

Is it a breaking change?

I don't think so, no.

@pxpm pxpm merged commit 2300375 into main Feb 4, 2025
11 checks passed
@pxpm pxpm deleted the fix-fake-fields branch February 4, 2025 11:25
@mrinaldidfs
Copy link

Please @pxpm , would it be possible to merge in backpack version 5 too? On my environment I currently cannot upgrade to version 6.
Thanks

@pxpm
Copy link
Contributor Author

pxpm commented Feb 4, 2025

Hello @mrinaldidfs I am sorry but we are not pushing patch fixes to v5 for a long time now.

I'd suggest you lock spatie/laravel-translatable to 6.9.3 to avoid the issue if you can't update Backpack.

Cheers

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants