Skip to content

Commit

Permalink
TASK: Remove getService method
Browse files Browse the repository at this point in the history
  • Loading branch information
dlubitz committed Jul 28, 2023
1 parent eb96560 commit a9d381e
Show file tree
Hide file tree
Showing 21 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ protected function initCleanContentRepository(array $adapterKeys): void
$this->contentRepository->setUp();
self::$wasContentRepositorySetupCalled = true;
}
$this->contentRepositoryInternals = $this->contentRepositoryRegistry->getService(
$this->contentRepositoryInternals = $this->contentRepositoryRegistry->buildService(
$this->contentRepositoryId,
new ContentRepositoryInternalsFactory()
);
Expand All @@ -150,7 +150,7 @@ protected function getContentRepositoryService(
$contentRepositoryRegistry = $this->contentRepositoryRegistry
?: $this->objectManager->get(ContentRepositoryRegistry::class);

return $contentRepositoryRegistry->getService(
return $contentRepositoryRegistry->buildService(
$contentRepositoryId,
$factory
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(
ContentRepositoryRegistry $contentRepositoryRegistry,
PerformanceMeasurementServiceFactory $performanceMeasurementServiceFactory
) {
$this->performanceMeasurementService = $contentRepositoryRegistry->getService(
$this->performanceMeasurementService = $contentRepositoryRegistry->buildService(
ContentRepositoryId::fromString('default'),
$performanceMeasurementServiceFactory
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ protected function initCleanContentRepository(array $adapterKeys): void
$this->contentRepository->setUp();
self::$wasContentRepositorySetupCalled = true;
}
$this->contentRepositoryInternals = $this->contentRepositoryRegistry->getService($this->contentRepositoryId, new ContentRepositoryInternalsFactory());
$this->contentRepositoryInternals = $this->contentRepositoryRegistry->buildService($this->contentRepositoryId, new ContentRepositoryInternalsFactory());

$availableContentGraphs = [];
$availableContentGraphs['DoctrineDBAL'] = $this->contentRepository->getContentGraph();
Expand Down Expand Up @@ -201,7 +201,7 @@ protected function getEnvironment()

protected function getContentRepositoryService(ContentRepositoryId $contentRepositoryId, ContentRepositoryServiceFactoryInterface $factory): ContentRepositoryServiceInterface
{
return $this->getContentRepositoryRegistry()->getService($contentRepositoryId, $factory);
return $this->getContentRepositoryRegistry()->buildService($contentRepositoryId, $factory);
}

protected function getDbalClient(): DbalClientInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function iRunTheFollowingNodeMigration(string $workspaceName, string $con
$migrationConfiguration = new MigrationConfiguration(Yaml::parse($string->getRaw()));
$contentStreamIds = array_map(fn (string $cs) => ContentStreamId::fromString($cs), explode(',', $contentStreams));
$command = new ExecuteMigration($migrationConfiguration, WorkspaceName::fromString($workspaceName), $contentStreamIds);
$nodeMigrationService = $this->getContentRepositoryRegistry()->getService($this->getContentRepositoryId(), new NodeMigrationServiceFactory());
$nodeMigrationService = $this->getContentRepositoryRegistry()->buildService($this->getContentRepositoryId(), new NodeMigrationServiceFactory());
$nodeMigrationService->executeMigration($command);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ abstract protected function getContentRepositoryRegistry(): ContentRepositoryReg

protected function getStructureAdjustmentService(): StructureAdjustmentService
{
return $this->getContentRepositoryRegistry()->getService($this->getContentRepositoryId(), new StructureAdjustmentServiceFactory());
return $this->getContentRepositoryRegistry()->buildService($this->getContentRepositoryId(), new StructureAdjustmentServiceFactory());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ public function migrateLegacyDataCommand(bool $verbose = false, string $config =
$this->connection->executeStatement('TRUNCATE ' . $connection->quoteIdentifier($eventTableName));
// we also need to reset the projections; in order to ensure the system runs deterministically. We
// do this by replaying the just-truncated event stream.
$projectionService = $this->contentRepositoryRegistry->getService($contentRepositoryId, $this->projectionReplayServiceFactory);
$projectionService = $this->contentRepositoryRegistry->buildService($contentRepositoryId, $this->projectionReplayServiceFactory);
$projectionService->replayAllProjections();
$this->outputLine('Truncated events');

$liveContentStreamId = ContentStreamId::create();

$legacyMigrationService = $this->contentRepositoryRegistry->getService(
$legacyMigrationService = $this->contentRepositoryRegistry->buildService(
$contentRepositoryId,
new LegacyMigrationServiceFactory(
$connection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function importCommand(string $contentStream, string $file = null): void
public function pruneCommand(string $contentRepositoryIdentifier = 'default', bool $removeTemporary = false): void
{
$contentRepositoryId = ContentRepositoryId::fromString($contentRepositoryIdentifier);
$contentStreamPruner = $this->contentRepositoryRegistry->getService($contentRepositoryId, new ContentStreamPrunerFactory());
$contentStreamPruner = $this->contentRepositoryRegistry->buildService($contentRepositoryId, new ContentStreamPrunerFactory());

$unusedContentStreams = $contentStreamPruner->prune($removeTemporary);
$unusedContentStreamsPresent = false;
Expand All @@ -147,7 +147,7 @@ public function pruneCommand(string $contentRepositoryIdentifier = 'default', bo
public function pruneRemovedFromEventStreamCommand(string $contentRepositoryIdentifier = 'default'): void
{
$contentRepositoryId = ContentRepositoryId::fromString($contentRepositoryIdentifier);
$contentStreamPruner = $this->contentRepositoryRegistry->getService($contentRepositoryId, new ContentStreamPrunerFactory());
$contentStreamPruner = $this->contentRepositoryRegistry->buildService($contentRepositoryId, new ContentStreamPrunerFactory());

$unusedContentStreams = $contentStreamPruner->pruneRemovedFromEventStream();
$unusedContentStreamsPresent = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function setupCommand(string $contentRepository = 'default'): void
public function replayCommand(string $projection, string $contentRepository = 'default', bool $quiet = false, int $until = 0): void
{
$contentRepositoryId = ContentRepositoryId::fromString($contentRepository);
$projectionService = $this->contentRepositoryRegistry->getService($contentRepositoryId, $this->projectionServiceFactory);
$projectionService = $this->contentRepositoryRegistry->buildService($contentRepositoryId, $this->projectionServiceFactory);

if (!$quiet) {
$this->outputLine('Replaying events for projection "%s" of Content Repository "%s" ...', [$projection, $contentRepositoryId->value]);
Expand All @@ -70,7 +70,7 @@ public function replayCommand(string $projection, string $contentRepository = 'd
public function replayAllCommand(string $contentRepository = 'default', bool $quiet = false): void
{
$contentRepositoryId = ContentRepositoryId::fromString($contentRepository);
$projectionService = $this->contentRepositoryRegistry->getService($contentRepositoryId, $this->projectionServiceFactory);
$projectionService = $this->contentRepositoryRegistry->buildService($contentRepositoryId, $this->projectionServiceFactory);
if (!$quiet) {
$this->outputLine('Replaying events for all projections of Content Repository "%s" ...', [$contentRepositoryId->value]);
// TODO start progress bar
Expand All @@ -90,13 +90,13 @@ public function pruneCommand(string $contentRepository = 'default'): void

$contentRepositoryId = ContentRepositoryId::fromString($contentRepository);

$contentStreamPruner = $this->contentRepositoryRegistry->getService(
$contentStreamPruner = $this->contentRepositoryRegistry->buildService(
$contentRepositoryId,
new ContentStreamPrunerFactory()
);
$contentStreamPruner->pruneAll();

$workspaceMaintenanceService = $this->contentRepositoryRegistry->getService(
$workspaceMaintenanceService = $this->contentRepositoryRegistry->buildService(
$contentRepositoryId,
new WorkspaceMaintenanceServiceFactory()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(
public function fillAffectedDimensionSpacePointsInNodePropertiesWereSetCommand(string $contentRepository = 'default'): void
{
$contentRepositoryId = ContentRepositoryId::fromString($contentRepository);
$eventMigrationService = $this->contentRepositoryRegistry->getService($contentRepositoryId, $this->eventMigrationServiceFactory);
$eventMigrationService = $this->contentRepositoryRegistry->buildService($contentRepositoryId, $this->eventMigrationServiceFactory);
$eventMigrationService->fillAffectedDimensionSpacePointsInNodePropertiesWereSet($this->outputLine(...));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function migrateCommand(string $version, $workspace = 'live', bool $force
$this->quit(1);
}

$nodeMigrationService = $this->contentRepositoryRegistry->getService($contentRepositoryId, new NodeMigrationServiceFactory());
$nodeMigrationService = $this->contentRepositoryRegistry->buildService($contentRepositoryId, new NodeMigrationServiceFactory());
$nodeMigrationService->executeMigration(
new ExecuteMigration(
$migrationConfiguration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class StructureAdjustmentsCommandController extends CommandController
public function detectCommand(string $nodeType = null, string $contentRepositoryIdentifier = 'default'): void
{
$contentRepositoryId = ContentRepositoryId::fromString($contentRepositoryIdentifier);
$structureAdjustmentService = $this->contentRepositoryRegistry->getService($contentRepositoryId, new StructureAdjustmentServiceFactory());
$structureAdjustmentService = $this->contentRepositoryRegistry->buildService($contentRepositoryId, new StructureAdjustmentServiceFactory());

if ($nodeType !== null) {
$errors = $structureAdjustmentService->findAdjustmentsForNodeType(
Expand All @@ -48,7 +48,7 @@ public function detectCommand(string $nodeType = null, string $contentRepository
public function fixCommand(string $nodeType = null, string $contentRepositoryIdentifier = 'default'): void
{
$contentRepositoryId = ContentRepositoryId::fromString($contentRepositoryIdentifier);
$structureAdjustmentService = $this->contentRepositoryRegistry->getService($contentRepositoryId, new StructureAdjustmentServiceFactory());
$structureAdjustmentService = $this->contentRepositoryRegistry->buildService($contentRepositoryId, new StructureAdjustmentServiceFactory());

if ($nodeType !== null) {
$errors = $structureAdjustmentService->findAdjustmentsForNodeType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class WorkspaceCommandController extends CommandController
public function rebaseOutdatedCommand(string $contentRepositoryIdentifier = 'default'): void
{
$contentRepositoryId = ContentRepositoryId::fromString($contentRepositoryIdentifier);
$workspaceMaintenanceService = $this->contentRepositoryRegistry->getService(
$workspaceMaintenanceService = $this->contentRepositoryRegistry->buildService(
$contentRepositoryId,
new WorkspaceMaintenanceServiceFactory()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(
public function syncCommand(string $contentRepository = 'default', bool $quiet = false): void
{
$contentRepositoryId = ContentRepositoryId::fromString($contentRepository);
$assetUsageSyncService = $this->contentRepositoryRegistry->getService(
$assetUsageSyncService = $this->contentRepositoryRegistry->buildService(
$contentRepositoryId,
new AssetUsageSyncServiceFactory(
$this->assetRepository,
Expand Down
4 changes: 2 additions & 2 deletions Neos.Neos/Classes/Command/CrCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function exportCommand(string $path, string $contentRepository = 'default
Files::createDirectoryRecursively($path);
$filesystem = new Filesystem(new LocalFilesystemAdapter($path));

$exportService = $this->contentRepositoryRegistry->getService(
$exportService = $this->contentRepositoryRegistry->buildService(
$contentRepositoryId,
new ExportServiceFactory(
$filesystem,
Expand Down Expand Up @@ -88,7 +88,7 @@ public function importCommand(string $path, string $contentRepository = 'default
$contentRepositoryId = ContentRepositoryId::fromString($contentRepository);
$contentStreamIdentifier = ContentStreamId::create();

$importService = $this->contentRepositoryRegistry->getService(
$importService = $this->contentRepositoryRegistry->buildService(
$contentRepositoryId,
new ImportServiceFactory(
$filesystem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function indexAction(string $type = 'intraDimension', string $dimensionSp
{
$contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest())
->contentRepositoryId;
$dimensionControllerInternals = $this->contentRepositoryRegistry->getService(
$dimensionControllerInternals = $this->contentRepositoryRegistry->buildService(
$contentRepositoryId,
new DimensionControllerInternalsFactory()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function showAction(WorkspaceName $workspace): void
$contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest())
->contentRepositoryId;
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
$workspacesControllerInternals = $this->contentRepositoryRegistry->getService(
$workspacesControllerInternals = $this->contentRepositoryRegistry->buildService(
$contentRepositoryId,
new WorkspacesControllerInternalsFactory()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function indexAction()
{
$contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest())
->contentRepositoryId;
$controllerInternals = $this->contentRepositoryRegistry->getService(
$controllerInternals = $this->contentRepositoryRegistry->buildService(
$contentRepositoryId,
new ContentDimensionsControllerInternalsFactory()
);
Expand Down
4 changes: 2 additions & 2 deletions Neos.Neos/Classes/Domain/Service/SiteService.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class SiteService
*/
public function pruneSite(Site $site): void
{
$siteServiceInternals = $this->contentRepositoryRegistry->getService(
$siteServiceInternals = $this->contentRepositoryRegistry->buildService(
$site->getConfiguration()->contentRepositoryId,
new SiteServiceInternalsFactory()
);
Expand Down Expand Up @@ -173,7 +173,7 @@ public function createSite(
$site->setName($siteName);
$this->siteRepository->add($site);

$siteServiceInternals = $this->contentRepositoryRegistry->getService(
$siteServiceInternals = $this->contentRepositoryRegistry->buildService(
$site->getConfiguration()->contentRepositoryId,
new SiteServiceInternalsFactory()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function buildItems(): array
$contentRepositoryId,
);

$dimensionMenuItemsImplementationInternals = $this->contentRepositoryRegistry->getService(
$dimensionMenuItemsImplementationInternals = $this->contentRepositoryRegistry->buildService(
$contentRepositoryId,
new DimensionsMenuItemsImplementationInternalsFactory()
);
Expand Down
2 changes: 1 addition & 1 deletion Neos.Neos/Classes/View/FusionExceptionView.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function render()

$siteDetectionResult = SiteDetectionResult::fromRequest($httpRequest);
$contentRepository = $this->contentRepositoryRegistry->get($siteDetectionResult->contentRepositoryId);
$fusionExceptionViewInternals = $this->contentRepositoryRegistry->getService(
$fusionExceptionViewInternals = $this->contentRepositoryRegistry->buildService(
$siteDetectionResult->contentRepositoryId,
new FusionExceptionViewInternalsFactory()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ protected function initCleanContentRepository(array $adapterKeys): void
$this->contentRepository->setUp();
self::$wasContentRepositorySetupCalled = true;
}
$this->contentRepositoryInternals = $this->contentRepositoryRegistry->getService(
$this->contentRepositoryInternals = $this->contentRepositoryRegistry->buildService(
$this->contentRepositoryId,
new ContentRepositoryInternalsFactory()
);
Expand All @@ -178,7 +178,7 @@ protected function getContentRepositoryService(
$contentRepositoryRegistry = $this->contentRepositoryRegistry
?: $this->objectManager->get(ContentRepositoryRegistry::class);

return $contentRepositoryRegistry->getService(
return $contentRepositoryRegistry->buildService(
$contentRepositoryId,
$factory
);
Expand Down

0 comments on commit a9d381e

Please sign in to comment.