Skip to content

[6.x] Fix global variable references not resolving through the data repository#14938

Merged
jasonvarga merged 1 commit into
statamic:6.xfrom
lazerg:fix-globals-reference-resolution
Jul 7, 2026
Merged

[6.x] Fix global variable references not resolving through the data repository#14938
jasonvarga merged 1 commit into
statamic:6.xfrom
lazerg:fix-globals-reference-resolution

Conversation

@lazerg

@lazerg lazerg commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Global variable references use a globals:: prefix, but only the singular global repository was registered, so the reference fell through and got tried against every repository including entries, which throws an invalid ID error on database drivers (for example when adding a set to a Replicator inside a global set). This registers the globals prefix against the global variables repository so the reference resolves correctly.

Fixes statamic/eloquent-driver#537

@grantholle

Copy link
Copy Markdown
Contributor

Is this all it needs 😭

I've been unable to upgrade to Laravel 13 because of this, since I haven't been able to upgrade to v6...

@lazerg

lazerg commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Yep, that's the whole fix. @jasonvarga mind taking a look when you get a chance - would be great to get this in so folks aren't blocked on the v6 upgrade.

@edalzell

edalzell commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

you can always composer patch this in if you need it.

@lazerg

lazerg commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Yes, but the problem still needs to be solved.

@edalzell

edalzell commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Yes, but the problem still needs to be solved.

Yup, and it will be when it gets merged! In the meantime you can patch it in, so you can upgrade etc. The team gets to PRs when they can.

@jasonvarga jasonvarga merged commit 5b5995f into statamic:6.x Jul 7, 2026
20 checks passed
@jasonvarga

Copy link
Copy Markdown
Member

Initially this seemed strange to me.

In statamic/eloquent-driver#537 (comment) Ryan suggested maybe changing globals to global. No, that would've made the GlobalSet resolve, not Variables.

I wondered by this has only come up recently. That's because the change was introduced in #13427 (6.0) and you need to use it only a Replicator field inside a Global. Not super common to put those inside Globals.

Nowhere else do we really call Data::find() passing in a global variables reference.

This PR also happens to fix an edge case issue where the field's "parent" reference was null. (When using the Stache only. When using Eloquent, you'd get the reported exception.)

@grantholle

Copy link
Copy Markdown
Contributor

Thank you @jasonvarga and @lazerg! Very appreciated

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.

Eloquent v6 migration: invalid input syntax for type uuid

4 participants