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

Fix variant switcher when overriding ProductVariant model #2089

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

rjvandoesburg
Copy link
Contributor

Hi there!

In our application we extend the ProductVariant model like so

ModelManifest::replace(
    \Lunar\Models\Contracts\ProductVariant::class,
   App\Models\ProductVariant::class,
);

When trying to switch using the button on the top right when editing a variant:

Screenshot 2025-01-31 at 10 54 39

The following error is generated.

Screenshot 2025-01-31 at 10 52 19

After some digging I found that in the closure there was a hard reference to the original model, this caused the evaluation in getRecordUrl to not fill the variable properly. Switching to record makes it work even when extending

Copy link

vercel bot commented Jan 31, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lunar-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 31, 2025 10:00am

@alecritson
Copy link
Collaborator

Thanks! @rjvandoesburg 🙇

@alecritson alecritson merged commit 67f0a37 into lunarphp:1.x Feb 3, 2025
23 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.

2 participants