From a8d9b5bdb04b8697acf21e9969f6fb868dfa1117 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Houssard?=
<35272857+ghoussard@users.noreply.github.com>
Date: Tue, 8 Aug 2023 09:38:36 +0200
Subject: [PATCH] Be able to configure $lazyRootCreation of
LocalFilesystemAdapter (#282)
---
doc/adapter_local.md | 1 +
src/DependencyInjection/Factory/Adapter/LocalFactory.php | 2 ++
src/Resources/config/adapters.xml | 1 +
3 files changed, 4 insertions(+)
diff --git a/doc/adapter_local.md b/doc/adapter_local.md
index 3caa24a..c362324 100644
--- a/doc/adapter_local.md
+++ b/doc/adapter_local.md
@@ -20,6 +20,7 @@ oneup_flysystem:
dir:
public: 0o755
private: 0o700
+ lazyRootCreation: ~ # boolean (default "false")
```
For more details on the `lazy` parameter, take a look at the [Symfony documentation](http://symfony.com/doc/current/components/dependency_injection/lazy_services.html).
diff --git a/src/DependencyInjection/Factory/Adapter/LocalFactory.php b/src/DependencyInjection/Factory/Adapter/LocalFactory.php
index 79b9d71..cd5f208 100644
--- a/src/DependencyInjection/Factory/Adapter/LocalFactory.php
+++ b/src/DependencyInjection/Factory/Adapter/LocalFactory.php
@@ -37,6 +37,7 @@ public function create(ContainerBuilder $container, string $id, array $config):
->replaceArgument(2, $config['writeFlags'])
->replaceArgument(3, $config['linkHandling'])
->replaceArgument(4, $config['mimeTypeDetector'])
+ ->replaceArgument(5, $config['lazyRootCreation'])
;
}
@@ -91,6 +92,7 @@ public function addConfiguration(NodeDefinition $node): void
->scalarNode('writeFlags')->defaultValue(\LOCK_EX)->end()
->scalarNode('linkHandling')->defaultValue(LocalFilesystemAdapter::DISALLOW_LINKS)->end()
->scalarNode('mimeTypeDetector')->defaultNull()->end()
+ ->scalarNode('lazyRootCreation')->defaultValue(false)->end()
->end()
;
}
diff --git a/src/Resources/config/adapters.xml b/src/Resources/config/adapters.xml
index dfed128..5557c0a 100644
--- a/src/Resources/config/adapters.xml
+++ b/src/Resources/config/adapters.xml
@@ -9,6 +9,7 @@
+