Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)

This commit is contained in:
Kevin Papst
2022-12-31 21:19:55 +01:00
committed by GitHub
parent 95e06746bd
commit 90a0fd8a22
2164 changed files with 83700 additions and 86426 deletions

View File

@@ -9,11 +9,13 @@
namespace App\Command;
use App\Validator\ValidationFailedException;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Style\SymfonyStyle;
abstract class AbstractUserCommand extends Command
{
@@ -37,4 +39,17 @@ abstract class AbstractUserCommand extends Command
return $helper->ask($input, $output, $passwordQuestion);
}
protected function validationError(ValidationFailedException $exception, SymfonyStyle $style): void
{
$errors = $exception->getViolations();
if ($errors->count() > 0) {
/** @var \Symfony\Component\Validator\ConstraintViolation $error */
foreach ($errors as $error) {
$style->error(
$error->getPropertyPath() . ': ' . $error->getMessage()
);
}
}
}
}