Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)
This commit is contained in:
@@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user