Answer the question
In order to leave comments, you need to log in
How to install lazy load for League\Flysystem\Adapter\Local service?
Hey!
Please tell me how to solve this problem correctly.
Symfony 5.0, dev env, package 1up-lab/OneupFlysystemBundle .
I want to set lazy loading for League\Flysystem\Adapter\Local, but it doesn't work.
Checking class_implements($filesystem) doesn't show proxy interfaces, checking via bin/console debug:container doesn't change anything either.
#config/services.yaml
services:
_defaults:
autowire: true
autoconfigure: true
bind:
$filesystem: '@oneup_flysystem.local_filesystem_adapter'
#other stuff
League\Flysystem\Adapter\Local:
lazy: true
The definition for "oneup_flysystem.local_filesystem_adapter" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error.
The configuration key "lazy" is unsupported for the service "League\Flysystem\Adapter\Local" which is defined as an alias in "/app/config/services.yaml". Allowed configuration keys for service ali
ases are "alias", "public" and "deprecated" in /app/config/services.yaml (which is loaded in resource "/app/config/services.yaml").
Answer the question
In order to leave comments, you need to log in
// App\Kernel
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
{
// ...
$container->addCompilerPass(new class implements CompilerPassInterface {
public function process(ContainerBuilder $container)
{
$container->getDefinition('oneup_flysystem.adapter.local')->setLazy(true);
}
});
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question