Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
framework
Validation
ValidationException.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Framework\Validation
;
7
8
use
Magento\Framework\Exception\AggregateExceptionInterface
;
9
use
Magento\Framework\Exception\LocalizedException
;
10
use
Magento\Framework\Phrase
;
11
21
class
ValidationException
extends
LocalizedException
implements
AggregateExceptionInterface
22
{
26
private
$validationResult;
27
34
public
function
__construct
(
35
Phrase
$phrase
,
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
}
Magento\Framework\Validation\ValidationException\getErrors
getErrors()
Definition:
ValidationException.php:47
Magento\Framework\Exception\LocalizedException
Definition:
LocalizedException.php:17
Magento\Framework\Exception\LocalizedException\$phrase
$phrase
Definition:
LocalizedException.php:22
Magento\Framework\Exception\AggregateExceptionInterface
Definition:
AggregateExceptionInterface.php:14
Magento\Framework\Validation\ValidationException\__construct
__construct(Phrase $phrase, \Exception $cause=null, $code=0, ValidationResult $validationResult=null)
Definition:
ValidationException.php:34
Magento\Framework\Validation
Definition:
ValidationException.php:6
Magento\Framework\Phrase
Definition:
Phrase.php:17
Magento\Framework\Validation\ValidationException
Definition:
ValidationException.php:21
Magento\Framework\Phrase
$code
$code
Definition:
info.phtml:12
Magento\Framework\Validation\ValidationResult
Definition:
ValidationResult.php:16