From 5af4111fd4b813116bbcde40cb8e83dd79f6cb42 Mon Sep 17 00:00:00 2001 From: Joshua Schumacher Date: Mon, 11 Jul 2022 19:26:27 +0200 Subject: [PATCH] The services_bolt.yaml file now keeps the binds after regenerating it --- src/Extension/ExtensionCompilerPass.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Extension/ExtensionCompilerPass.php b/src/Extension/ExtensionCompilerPass.php index 1a784e032..4e207f728 100644 --- a/src/Extension/ExtensionCompilerPass.php +++ b/src/Extension/ExtensionCompilerPass.php @@ -36,11 +36,14 @@ public function process(ContainerBuilder $container): void public function buildServices(array $packages): void { + $filename = $this->projectDir . '/config/services_bolt.yaml'; + $oldServices = Yaml::parseFile($filename); $services = [ 'services' => [ '_defaults' => [ 'autowire' => true, 'autoconfigure' => true, + 'bind' => isset($oldServices['services']['_defaults']['bind']) ? $oldServices['services']['_defaults']['bind'] : [], ], ], ]; @@ -54,8 +57,8 @@ public function buildServices(array $packages): void } } - $yaml = "# This file is auto-generated by Bolt. Do not modify.\n\n"; - $yaml .= Yaml::dump($services, 3); + $yaml = "# This file is auto-generated by Bolt. Please change no more than binds.\n\n"; + $yaml .= Yaml::dump($services, 4); $filename = $this->projectDir . '/config/services_bolt.yaml'; file_put_contents($filename, $yaml);