Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ValidationException.php
Go to the documentation of this file.
1 <?php
7 
11 
22 {
26  private $validationResult;
27 
34  public function __construct(
36  \Exception $cause = null,
37  $code = 0,
38  ValidationResult $validationResult = null
39  ) {
40  parent::__construct($phrase, $cause, $code);
41  $this->validationResult = $validationResult;
42  }
43 
47  public function getErrors(): array
48  {
49  $localizedErrors = [];
50  if (null !== $this->validationResult) {
51  foreach ($this->validationResult->getErrors() as $error) {
52  $localizedErrors[] = new LocalizedException($error);
53  }
54  }
55  return $localizedErrors;
56  }
57 }
__construct(Phrase $phrase, \Exception $cause=null, $code=0, ValidationResult $validationResult=null)
$code
Definition: info.phtml:12