Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Fix contentgraphintegrity:runviolationdetection #4948

Merged
merged 1 commit into from May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -11,29 +11,35 @@
* 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
{
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)
);
mhsdesign marked this conversation as resolved.
Show resolved Hide resolved

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) {
Expand Down