Skip to content

[6.x] Stache index cleanup - #15641

Merged
jasonvarga merged 4 commits into
6.xfrom
site-queryable-value
Oct 13, 2026
Merged

jasonvarga merged 4 commits into
6.xfrom
site-queryable-value

Conversation

@jasonvarga

@jasonvarga jasonvarga commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Cleans up a few stache indexes that were storing whole objects or were never read.

Sites resolve to their handles

Site now implements QueryableValue, returning its handle, the same way Blueprint already does.

Without it, any value index that resolves a site (e.g. the forms-2 submission site index, which goes through the generic Value index) stores whole Site objects. Those indexes are persisted to the Laravel cache, and when cache.serializable_classes is restricted (newer Laravel skeletons default it to false), Site isn't on Statamic's allowlist. Any request that reads the cached index then gets __PHP_Incomplete_Class values and the query throws:

strtolower(): Argument #1 ($string) must be of type string, __PHP_Incomplete_Class given

Comparisons like where('site', Site::selected()) keep working since Site casts to its handle.

Entry and term site indexes

Entry::getQueryableValue('site') and LocalizedTerm::getQueryableValue('site') now return the locale directly, so their site store indexes use the regular value index. This avoids resolving a Site object per item, and an item whose site was removed still indexes its locale rather than null (same as before). The dedicated Indexes\Site and Indexes\Terms\Site classes are no longer used and have been marked deprecated.

Unused indexes removed

The submission form index and term taxonomy index are removed. where/whereIn on those columns are intercepted by SubmissionQueryBuilder / TermQueryBuilder to choose which child stores to read, so these eagerly built indexes (which held a Form / Taxonomy object per item) were never used for them. Any other query on those columns will still build the index lazily on first use.

Supersedes #15640.

jasonvarga and others added 2 commits October 13, 2026 11:21
Site now implements QueryableValue, so value indexes store the handle instead of a Site object. Site objects aren't in the cache's serializable classes allowlist, so a cached index would come back as __PHP_Incomplete_Class.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Form wheres are intercepted by the submission query builder to pick which form stores to read, so the eagerly built index was never used for them. Other form queries will still build it lazily.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jasonvarga and others added 2 commits October 13, 2026 11:41
Entries and terms return their locale for the queryable site value, so the regular value index can be used instead of the dedicated site index classes, which are now deprecated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Taxonomy wheres are intercepted by the term query builder to pick which taxonomy stores to read, so the eagerly built index was never used for them. Other taxonomy queries will still build it lazily.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jasonvarga jasonvarga changed the title [6.x] Resolve sites to their handles in queries [6.x] Stache index cleanup Oct 13, 2026
@jasonvarga
jasonvarga merged commit 06798f1 into 6.x Oct 13, 2026
65 checks passed
@jasonvarga
jasonvarga deleted the site-queryable-value branch October 13, 2026 15:56
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