Skip to content

Commit

Permalink
Merge pull request #4948 from mhsdesign/task/allowTestsOnOlderMariaDb…
Browse files Browse the repository at this point in the history
…Versions

BUGFIX: Fix `contentgraphintegrity:runviolationdetection`
  • Loading branch information
mhsdesign authored May 13, 2024
2 parents 162680f + 866c9e4 commit 6cd089a
Showing 1 changed file with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
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)
);

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

0 comments on commit 6cd089a

Please sign in to comment.