Skip to content
This repository has been archived by the owner on Feb 6, 2020. It is now read-only.

Warmup lazy services #278

Open
snapshotpl opened this issue Feb 14, 2019 · 7 comments
Open

Warmup lazy services #278

snapshotpl opened this issue Feb 14, 2019 · 7 comments

Comments

@snapshotpl
Copy link
Contributor

Hi there!

I would like to generate all proxies before app deployment (like doctrine has orm:generate-proxies). Some host services (like Heroku) require to do this during "compile" process. Sure, generate on-demain works, but there is many cases when cache is purge.

@Ocramius
Copy link
Member

This is only currently possible by running through the instantiation of all services once, in a warmup script.

@snapshotpl
Copy link
Contributor Author

So I need to write this script or it exists somewhere?

@Ocramius
Copy link
Member

Ocramius commented Feb 14, 2019 via email

@snapshotpl
Copy link
Contributor Author

snapshotpl commented Feb 14, 2019

Or:

    public function warmup(): void
    {
        foreach ($this->services as $service) {
            $this->container->get($service);
        }
    }

where services is lazy_services.class_map keys.

Anyway ready script in package will be nice addon

@Ocramius
Copy link
Member

Ocramius commented Feb 14, 2019 via email

@snapshotpl
Copy link
Contributor Author

Or zf module ;)

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-servicemanager; a new issue has been opened at laminas/laminas-servicemanager#5.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants