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

Disable structure caching variable logic #664

Closed
jaydublu2002 opened this issue Feb 12, 2024 · 4 comments
Closed

Disable structure caching variable logic #664

jaydublu2002 opened this issue Feb 12, 2024 · 4 comments

Comments

@jaydublu2002
Copy link

Further to issue #641

✏️ Describe the bug
Is the logic in the fix in v4.0.1 for disabling sturcture caching correct? It does disable caching in unit tests (thanks, that resolved #641) but it looks to me like it also disables caching if config('data.structure_caching.enabled') is true.

Should it not be:

        $this->app->singleton(
            DataConfig::class,
            function () {
                if (!config('data.structure_caching.enabled') || $this->app->runningUnitTests()) {
                    return DataConfig::createFromConfig(config('data'));
                }

                return $this->app->make(DataStructureCache::class)->getConfig() ?? DataConfig::createFromConfig(config('data'));
            }
        );

Also, is it possible to put this fix in the v3.x branch so we can update to latest v3.x - we have to do some refactoring of our appllication with regards to the way v4.x has changed how data is passed to / from collections.

@jaydublu2002
Copy link
Author

I've also just noticed the documentation site https://spatie.be/docs/laravel-data/v4/installation-setup hasn't caught up with the new config variable

@rubenvanassche
Copy link
Member

Thanks for the heads up, fixed!

As for v3, you're always welcome to send in a PR.

@jaydublu2002
Copy link
Author

As for v3, you're always welcome to send in a PR.

You could use PR #645?

@rubenvanassche
Copy link
Member

Opened it again, take a look at the conflicts and let me know when they're fixed then we'll merge them in

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

No branches or pull requests

2 participants