Skip to content

Commit 97dd155

Browse files
committed
refactor: unify symfony service id's across all bundles
1 parent e5d98b4 commit 97dd155

14 files changed

Lines changed: 92 additions & 92 deletions

File tree

documentation/components/bridges/symfony-filesystem-bundle.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ flow_filesystem:
120120
client_service_id: app.s3_client
121121
```
122122

123-
The fstab is wired as a private `.flow_filesystem.fstab.<name>` service and aliased to
123+
The fstab is wired as a private `.flow.filesystem.fstab.<name>` service and aliased to
124124
`Flow\Filesystem\FilesystemTable` for autowiring.
125125

126126
### Default Fstab
@@ -458,7 +458,7 @@ flow_filesystem:
458458
default_lifetime: 86400
459459
```
460460

461-
Each pool registers as `flow_filesystem.cache.pool.<name>` (public).
461+
Each pool registers as `flow.filesystem.cache.pool.<name>` (public).
462462

463463
3. Wire the pools into Symfony's cache framework via `cache.adapter.psr6`:
464464

@@ -469,11 +469,11 @@ framework:
469469
pools:
470470
cache.app_fs:
471471
adapter: cache.adapter.psr6
472-
provider: flow_filesystem.cache.pool.app
472+
provider: flow.filesystem.cache.pool.app
473473
474474
cache.sessions_fs:
475475
adapter: cache.adapter.psr6
476-
provider: flow_filesystem.cache.pool.sessions
476+
provider: flow.filesystem.cache.pool.sessions
477477
```
478478

479479
The `cache.adapter.psr6` wrapper is required because Symfony's `CachePoolPass` overwrites the first constructor argument of any service used directly as `adapter:`, which conflicts with this bridge's strict `Filesystem` typing on argument 0.
@@ -539,7 +539,7 @@ flow_filesystem:
539539
bucket: '%env(ARCHIVE_BUCKET)%'
540540
```
541541

542-
Each fstab gets its own `.flow_filesystem.fstab.<name>` service. The default fstab is automatically aliased
542+
Each fstab gets its own `.flow.filesystem.fstab.<name>` service. The default fstab is automatically aliased
543543
to `Flow\Filesystem\FilesystemTable`, allowing direct type-hint injection without specifying a fstab name.
544544
Each named fstab is also aliased as `Flow\Filesystem\FilesystemTable $<camelCasedName>Fstab` for
545545
named-argument autowiring:
@@ -621,7 +621,7 @@ final class MyFilesystemFactory implements FilesystemFactory
621621
```
622622

623623
As long as your service is autoconfigured (the default in `services.yaml` for everything under your `App\`
624-
namespace), the bundle automatically attaches the `flow_filesystem.factory` tag with the right `type`
624+
namespace), the bundle automatically attaches the `flow.filesystem.factory` tag with the right `type`
625625
attribute.
626626

627627
### Explicit Tag
@@ -631,10 +631,10 @@ namespaces, manual definitions):
631631

632632
```yaml
633633
services:
634-
app.flow_filesystem.factory.my_backend:
634+
app.flow.filesystem.factory.my_backend:
635635
class: App\Flow\MyFilesystemFactory
636636
tags:
637-
- { name: flow_filesystem.factory, type: my_backend }
637+
- { name: flow.filesystem.factory, type: my_backend }
638638
```
639639
640640
Either way, you can then mount the backend under any protocol in any fstab:
@@ -665,7 +665,7 @@ flow_filesystem:
665665
- **Mount-protocol routing:** filesystems inside a fstab are resolved at runtime via
666666
`$table->for('warehouse')` / `$table->for($path)`, so application code can hand-off across protocols
667667
without knowing service ids.
668-
- **Factory tag:** filesystem types are pluggable via a standard `flow_filesystem.factory` DI tag;
668+
- **Factory tag:** filesystem types are pluggable via a standard `flow.filesystem.factory` DI tag;
669669
third-party libraries can ship their own factory without bundle changes.
670670
- **CLI commands:** `flow:filesystem:*` ship with the bundle and operate on any configured fstab.
671671
Flysystem Bundle does not ship any console commands.

src/bridge/symfony/filesystem-bundle/src/Flow/Bridge/Symfony/FilesystemBundle/DependencyInjection/Compiler/BuildFstabsPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
final class BuildFstabsPass implements CompilerPassInterface
1515
{
16-
public const string CONFIG_PARAMETER = 'flow_filesystem.config';
16+
public const string CONFIG_PARAMETER = 'flow.filesystem.config';
1717

18-
public const string FSTAB_SERVICE_PREFIX = '.flow_filesystem.fstab.';
18+
public const string FSTAB_SERVICE_PREFIX = '.flow.filesystem.fstab.';
1919

20-
public const string TELEMETRY_CONFIG_SERVICE_PREFIX = '.flow_filesystem.telemetry_config.';
20+
public const string TELEMETRY_CONFIG_SERVICE_PREFIX = '.flow.filesystem.telemetry_config.';
2121

2222
public function process(ContainerBuilder $container) : void
2323
{

src/bridge/symfony/filesystem-bundle/src/Flow/Bridge/Symfony/FilesystemBundle/DependencyInjection/Compiler/RegisterFilesystemFactoriesPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
final class RegisterFilesystemFactoriesPass implements CompilerPassInterface
1212
{
13-
public const string REGISTRY_SERVICE_ID = '.flow_filesystem.factory_registry';
13+
public const string REGISTRY_SERVICE_ID = '.flow.filesystem.factory_registry';
1414

15-
public const string TAG = 'flow_filesystem.factory';
15+
public const string TAG = 'flow.filesystem.factory';
1616

1717
public function process(ContainerBuilder $container) : void
1818
{

src/bridge/symfony/filesystem-bundle/src/Flow/Bridge/Symfony/FilesystemBundle/DependencyInjection/Compiler/RegisterFstabLocatorPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
final class RegisterFstabLocatorPass implements CompilerPassInterface
1111
{
12-
public const string DEFAULT_FSTAB_PARAMETER = 'flow_filesystem.default_fstab';
12+
public const string DEFAULT_FSTAB_PARAMETER = 'flow.filesystem.default_fstab';
1313

14-
public const string LOCATOR_SERVICE_ID = 'flow_filesystem.fstab_locator';
14+
public const string LOCATOR_SERVICE_ID = 'flow.filesystem.fstab_locator';
1515

1616
public function process(ContainerBuilder $container) : void
1717
{

src/bridge/symfony/filesystem-bundle/src/Flow/Bridge/Symfony/FilesystemBundle/FlowFilesystemBundle.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function configure(DefinitionConfigurator $definition) : void
9797
->addDefaultsIfNotSet()
9898
->children()
9999
->arrayNode('pools')
100-
->info('Named cache pools. Each becomes a service "flow_filesystem.cache.pool.<name>" usable as adapter: <id> in framework.cache.pools.')
100+
->info('Named cache pools. Each becomes a service "flow.filesystem.cache.pool.<name>" usable as adapter: <id> in framework.cache.pools.')
101101
->useAttributeAsKey('name')
102102
->arrayPrototype()
103103
->children()
@@ -163,7 +163,7 @@ public function loadExtension(array $config, ContainerConfigurator $container, C
163163

164164
$config['default_fstab'] = $defaultFstab;
165165

166-
$builder->setParameter('flow_filesystem.config', $config);
166+
$builder->setParameter('flow.filesystem.config', $config);
167167

168168
$container->import(__DIR__ . '/Resources/config/services.php');
169169

@@ -213,24 +213,24 @@ private function registerCachePools(array $pools, array $fstabs, string $default
213213
$filesystemDef = new Definition(Filesystem::class);
214214
$filesystemDef->setFactory([new Reference(BuildFstabsPass::FSTAB_SERVICE_PREFIX . $fstabName), 'for']);
215215
$filesystemDef->setArguments([$poolConfig['filesystem']]);
216-
$builder->setDefinition("flow_filesystem.cache.pool.{$name}.filesystem", $filesystemDef);
216+
$builder->setDefinition("flow.filesystem.cache.pool.{$name}.filesystem", $filesystemDef);
217217

218218
$pathDef = new Definition(Path::class);
219219
$pathDef->setFactory([Path::class, 'from']);
220220
$pathDef->setArguments([$poolConfig['path']]);
221-
$builder->setDefinition("flow_filesystem.cache.pool.{$name}.path", $pathDef);
221+
$builder->setDefinition("flow.filesystem.cache.pool.{$name}.path", $pathDef);
222222

223223
$adapterDef = new Definition(FlowFilesystemCacheAdapter::class, [
224-
new Reference("flow_filesystem.cache.pool.{$name}.filesystem"),
225-
new Reference("flow_filesystem.cache.pool.{$name}.path"),
224+
new Reference("flow.filesystem.cache.pool.{$name}.filesystem"),
225+
new Reference("flow.filesystem.cache.pool.{$name}.path"),
226226
$poolConfig['namespace'],
227227
$poolConfig['default_lifetime'],
228228
$poolConfig['marshaller_service_id'] !== null
229229
? new Reference($poolConfig['marshaller_service_id'])
230230
: null,
231231
]);
232232
$adapterDef->setPublic(true);
233-
$builder->setDefinition("flow_filesystem.cache.pool.{$name}", $adapterDef);
233+
$builder->setDefinition("flow.filesystem.cache.pool.{$name}", $adapterDef);
234234
}
235235
}
236236

src/bridge/symfony/filesystem-bundle/src/Flow/Bridge/Symfony/FilesystemBundle/Resources/config/services.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,59 +14,59 @@
1414
$services = $container->services();
1515

1616
$services
17-
->set('.flow_filesystem.factory.file', NativeLocalFilesystemFactory::class)
17+
->set('.flow.filesystem.factory.file', NativeLocalFilesystemFactory::class)
1818
->private()
19-
->tag('flow_filesystem.factory', ['type' => 'file']);
19+
->tag('flow.filesystem.factory', ['type' => 'file']);
2020

2121
$services
22-
->set('.flow_filesystem.factory.memory', MemoryFilesystemFactory::class)
22+
->set('.flow.filesystem.factory.memory', MemoryFilesystemFactory::class)
2323
->private()
24-
->tag('flow_filesystem.factory', ['type' => 'memory']);
24+
->tag('flow.filesystem.factory', ['type' => 'memory']);
2525

2626
$services
27-
->set('.flow_filesystem.factory.stdout', StdoutFilesystemFactory::class)
27+
->set('.flow.filesystem.factory.stdout', StdoutFilesystemFactory::class)
2828
->private()
29-
->tag('flow_filesystem.factory', ['type' => 'stdout']);
29+
->tag('flow.filesystem.factory', ['type' => 'stdout']);
3030

3131
if (\class_exists(AsyncAWSS3Filesystem::class)) {
3232
$services
33-
->set('.flow_filesystem.factory.aws_s3', AsyncAwsS3FilesystemFactory::class)
33+
->set('.flow.filesystem.factory.aws_s3', AsyncAwsS3FilesystemFactory::class)
3434
->private()
3535
->args([service('service_container')])
36-
->tag('flow_filesystem.factory', ['type' => 'aws_s3']);
36+
->tag('flow.filesystem.factory', ['type' => 'aws_s3']);
3737
}
3838

3939
if (\class_exists(AzureBlobFilesystem::class)) {
4040
$services
41-
->set('.flow_filesystem.factory.azure_blob', AzureBlobFilesystemFactory::class)
41+
->set('.flow.filesystem.factory.azure_blob', AzureBlobFilesystemFactory::class)
4242
->private()
4343
->args([service('service_container')])
44-
->tag('flow_filesystem.factory', ['type' => 'azure_blob']);
44+
->tag('flow.filesystem.factory', ['type' => 'azure_blob']);
4545
}
4646

4747
$services
48-
->set('.flow_filesystem.factory_registry', FilesystemFactoryRegistry::class)
48+
->set('.flow.filesystem.factory_registry', FilesystemFactoryRegistry::class)
4949
->private()
5050
->args([[]]);
5151

5252
$services
53-
->set('.flow_filesystem.command.fstab_resolver', FstabResolver::class)
53+
->set('.flow.filesystem.command.fstab_resolver', FstabResolver::class)
5454
->private()
55-
->args([service('flow_filesystem.fstab_locator'), '%flow_filesystem.default_fstab%']);
55+
->args([service('flow.filesystem.fstab_locator'), '%flow.filesystem.default_fstab%']);
5656

5757
foreach ([
58-
'.flow_filesystem.command.ls' => LsCommand::class,
59-
'.flow_filesystem.command.cat' => CatCommand::class,
60-
'.flow_filesystem.command.cp' => CpCommand::class,
61-
'.flow_filesystem.command.mv' => MvCommand::class,
62-
'.flow_filesystem.command.rm' => RmCommand::class,
63-
'.flow_filesystem.command.stat' => StatCommand::class,
64-
'.flow_filesystem.command.touch' => TouchCommand::class,
58+
'.flow.filesystem.command.ls' => LsCommand::class,
59+
'.flow.filesystem.command.cat' => CatCommand::class,
60+
'.flow.filesystem.command.cp' => CpCommand::class,
61+
'.flow.filesystem.command.mv' => MvCommand::class,
62+
'.flow.filesystem.command.rm' => RmCommand::class,
63+
'.flow.filesystem.command.stat' => StatCommand::class,
64+
'.flow.filesystem.command.touch' => TouchCommand::class,
6565
] as $serviceId => $commandClass) {
6666
$services
6767
->set($serviceId, $commandClass)
6868
->private()
69-
->args([service('.flow_filesystem.command.fstab_resolver')])
69+
->args([service('.flow.filesystem.command.fstab_resolver')])
7070
->tag('console.command');
7171
}
7272
};

src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Context/BuildFstabsPassContext.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ final class BuildFstabsPassContext
1616
public function containerWithConfig(array $config) : ContainerBuilder
1717
{
1818
$container = new ContainerBuilder();
19-
$container->setParameter('flow_filesystem.config', $config);
19+
$container->setParameter('flow.filesystem.config', $config);
2020

2121
$registry = new Definition(FilesystemFactoryRegistry::class);
2222
$registry->setArgument(0, []);
23-
$container->setDefinition('.flow_filesystem.factory_registry', $registry);
23+
$container->setDefinition('.flow.filesystem.factory_registry', $registry);
2424

2525
$memoryFactory = new Definition(MemoryFilesystemFactory::class);
26-
$memoryFactory->addTag('flow_filesystem.factory', ['type' => 'memory']);
27-
$container->setDefinition('.flow_filesystem.factory.memory', $memoryFactory);
26+
$memoryFactory->addTag('flow.filesystem.factory', ['type' => 'memory']);
27+
$container->setDefinition('.flow.filesystem.factory.memory', $memoryFactory);
2828

2929
$nativeFactory = new Definition(NativeLocalFilesystemFactory::class);
30-
$nativeFactory->addTag('flow_filesystem.factory', ['type' => 'file']);
31-
$container->setDefinition('.flow_filesystem.factory.file', $nativeFactory);
30+
$nativeFactory->addTag('flow.filesystem.factory', ['type' => 'file']);
31+
$container->setDefinition('.flow.filesystem.factory.file', $nativeFactory);
3232

3333
return $container;
3434
}

src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Context/ConfigurationContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function processConfig(array $flowFilesystemConfig, ?callable $containerC
3535
]);
3636

3737
/** @var array{default_fstab: string, fstabs: array<string, array{filesystems: array<string, array<string, mixed>>, telemetry: array{enabled: bool, telemetry_service_id: null|string, clock_service_id: null|string, options: array{trace_streams: bool, collect_metrics: bool}}}>, cache: array{pools: array<string, array{fstab: null|string, filesystem: string, path: string, namespace: string, default_lifetime: int, marshaller_service_id: null|string}>}} $config */
38-
$config = $kernel->getContainer()->getParameter('flow_filesystem.config');
38+
$config = $kernel->getContainer()->getParameter('flow.filesystem.config');
3939

4040
return $config;
4141
}

src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Integration/CachePoolRegistrationTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function test_cache_pool_resolves_filesystem_through_default_fstab() : vo
3131
},
3232
]);
3333

34-
self::assertInstanceOf(FlowFilesystemCacheAdapter::class, $this->getContainer()->get('flow_filesystem.cache.pool.app'));
34+
self::assertInstanceOf(FlowFilesystemCacheAdapter::class, $this->getContainer()->get('flow.filesystem.cache.pool.app'));
3535
}
3636

3737
public function test_cache_pool_with_marshaller_service_id_injects_marshaller() : void
@@ -62,7 +62,7 @@ public function test_cache_pool_with_marshaller_service_id_injects_marshaller()
6262
]);
6363

6464
$container = $this->getContainer();
65-
$adapter = $container->get('flow_filesystem.cache.pool.app');
65+
$adapter = $container->get('flow.filesystem.cache.pool.app');
6666
self::assertInstanceOf(FlowFilesystemCacheAdapter::class, $adapter);
6767

6868
$marshaller = (new \ReflectionObject($adapter))->getProperty('marshaller')->getValue($adapter);
@@ -92,7 +92,7 @@ public function test_cache_pool_with_named_fstab_resolves_through_that_fstab() :
9292
},
9393
]);
9494

95-
self::assertInstanceOf(FlowFilesystemCacheAdapter::class, $this->getContainer()->get('flow_filesystem.cache.pool.app'));
95+
self::assertInstanceOf(FlowFilesystemCacheAdapter::class, $this->getContainer()->get('flow.filesystem.cache.pool.app'));
9696
}
9797

9898
public function test_no_cache_pool_services_when_cache_section_is_omitted() : void
@@ -107,6 +107,6 @@ public function test_no_cache_pool_services_when_cache_section_is_omitted() : vo
107107
},
108108
]);
109109

110-
self::assertFalse($this->getContainer()->has('flow_filesystem.cache.pool.app'));
110+
self::assertFalse($this->getContainer()->has('flow.filesystem.cache.pool.app'));
111111
}
112112
}

src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Integration/Command/FilesystemCommandsIntegrationTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ private function bootWithMultiFstab() : FstabResolver
376376
$container->addCompilerPass(new class implements CompilerPassInterface {
377377
public function process(ContainerBuilder $container) : void
378378
{
379-
if ($container->hasDefinition('.flow_filesystem.command.fstab_resolver')) {
380-
$container->getDefinition('.flow_filesystem.command.fstab_resolver')->setPublic(true);
379+
if ($container->hasDefinition('.flow.filesystem.command.fstab_resolver')) {
380+
$container->getDefinition('.flow.filesystem.command.fstab_resolver')->setPublic(true);
381381
}
382382
}
383383
});
@@ -386,7 +386,7 @@ public function process(ContainerBuilder $container) : void
386386
]);
387387

388388
/** @var FstabResolver $resolver */
389-
$resolver = $this->getContainer()->get('.flow_filesystem.command.fstab_resolver');
389+
$resolver = $this->getContainer()->get('.flow.filesystem.command.fstab_resolver');
390390

391391
return $resolver;
392392
}

0 commit comments

Comments
 (0)