Skip to content

Commit 42e0121

Browse files
committed
Fixed batch command validations
1 parent ae4c908 commit 42e0121

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Command/BatchCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
8080

8181
// Override mail notifier recipient email
8282
if ($email = $input->getOption('email')) {
83-
if ($errors = $validator->validateValue($email, new Assert\Email())) {
83+
$errors = $validator->validateValue($email, new Assert\Email());
84+
if (count($errors) > 0) {
8485
throw new \RuntimeException(
8586
sprintf('Email "%s" is invalid: %s', $email, $this->getErrorMessages($errors))
8687
);
@@ -90,7 +91,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
9091
->setRecipientEmail($email);
9192
}
9293

93-
if ($errors = $validator->validate($jobInstance, array('Default', 'Execution'))) {
94+
$errors = $validator->validate($jobInstance, array('Default', 'Execution'));
95+
if (count($errors) > 0) {
9496
throw new \RuntimeException(
9597
sprintf('Job "%s" is invalid: %s', $code, $this->getErrorMessages($errors))
9698
);

0 commit comments

Comments
 (0)