From 866c9e40cc45ea3b35b25e033ea3909161d4da32 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sat, 16 Mar 2024 22:07:30 +0100 Subject: [PATCH] BUGFIX: Repair `flow contentgraphintegrity:runviolationdetection` Too few arguments to function ContentGraphIntegrityCommandController 0 passed --- ...ContentGraphIntegrityCommandController.php | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Neos.ContentRepositoryRegistry/Classes/Command/ContentGraphIntegrityCommandController.php b/Neos.ContentRepositoryRegistry/Classes/Command/ContentGraphIntegrityCommandController.php index dd10ce1d5a6..71683ca6422 100644 --- a/Neos.ContentRepositoryRegistry/Classes/Command/ContentGraphIntegrityCommandController.php +++ b/Neos.ContentRepositoryRegistry/Classes/Command/ContentGraphIntegrityCommandController.php @@ -11,8 +11,12 @@ * source code. */ -use Neos\ContentRepository\Core\Projection\ContentGraph\ProjectionIntegrityViolationDetectionRunner; +use Neos\ContentGraph\DoctrineDbalAdapter\DoctrineDbalProjectionIntegrityViolationDetectionRunnerFactory; +use Neos\ContentRepository\Core\Infrastructure\DbalClientInterface; +use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; +use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Error\Messages\Result; +use Neos\Flow\Annotations as Flow; use Neos\Flow\Cli\CommandController; final class ContentGraphIntegrityCommandController extends CommandController @@ -20,20 +24,22 @@ final class ContentGraphIntegrityCommandController extends CommandController private const OUTPUT_MODE_CONSOLE = 'console'; private const OUTPUT_MODE_LOG = 'log'; - private ProjectionIntegrityViolationDetectionRunner $detectionRunner; + #[Flow\Inject()] + protected DbalClientInterface $dbalClient; + #[Flow\Inject()] + protected ContentRepositoryRegistry $contentRepositoryRegistry; - public function __construct(ProjectionIntegrityViolationDetectionRunner $detectionRunner) + public function runViolationDetectionCommand(string $contentRepository = 'default', string $outputMode = null): void { - $this->detectionRunner = $detectionRunner; - parent::__construct(); - } + $detectionRunner = $this->contentRepositoryRegistry->buildService( + ContentRepositoryId::fromString($contentRepository), + new DoctrineDbalProjectionIntegrityViolationDetectionRunnerFactory($this->dbalClient) + ); - public function runViolationDetectionCommand(string $outputMode = null): void - { $outputMode = $this->resolveOutputMode($outputMode); /** @var Result $result */ - $result = $this->detectionRunner->run(); + $result = $detectionRunner->run(); switch ($outputMode) { case self::OUTPUT_MODE_CONSOLE: foreach ($result->getErrors() as $error) {