Skip to content

Remove ensure associations #434

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

Merged
merged 7 commits into from
May 30, 2025

Conversation

afonic
Copy link
Contributor

@afonic afonic commented May 29, 2025

@ryanmitchell I think this was the other culprit for all the slowness.

The TermRepository was calling $this->ensureAssociations(); which populates the associations index :

protected function ensureAssociations()
{
    Taxonomy::all()->each(function ($taxonomy) {
        $this->store->store($taxonomy->handle())->index('associations');
    });
}

This store is quite complex (over 10MB in my case) and it's probably not required when using the eloquent driver.

I also added a test to make sure the Terms facade still gets the correct count.

PS. With this change and your other PR the first page load is under 1 second.

@ryanmitchell ryanmitchell merged commit d200806 into statamic:4.x May 30, 2025
19 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