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
Exception
AbstractAggregateException.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Framework\Exception
;
8
9
use
Magento\Framework\Phrase
;
10
15
abstract
class
AbstractAggregateException
extends
LocalizedException
implements
AggregateExceptionInterface
16
{
22
protected
$errors
= [];
23
29
protected
$originalPhrase
;
30
36
private
$addErrorCalls = 0;
37
45
public
function
__construct
(
Phrase
$phrase
, \Exception $cause =
null
,
$code
= 0)
46
{
47
$this->originalPhrase =
$phrase
;
48
parent::__construct(
$phrase
, $cause,
$code
);
49
}
50
57
public
function
addError
(
Phrase
$phrase
)
58
{
59
$this->addErrorCalls++;
60
if
(empty($this->errors)) {
61
if
(1 === $this->addErrorCalls) {
62
// First call: simply overwrite the phrase and message
63
$this->phrase =
$phrase
;
64
$this->message =
$phrase
->render();
65
$this->logMessage =
null
;
66
}
elseif
(2 === $this->addErrorCalls) {
67
// Second call: store the error from the first call and the second call in the array
68
// restore the phrase to its original value
69
$this->errors[] =
new
LocalizedException
($this->phrase);
70
$this->errors[] =
new
LocalizedException
(
$phrase
);
71
$this->phrase =
$this->originalPhrase
;
72
$this->message = $this->originalPhrase->render();
73
$this->logMessage =
null
;
74
}
75
}
else
{
76
// All subsequent calls after the second should reach here
77
$this->errors[] =
new
LocalizedException
(
$phrase
);
78
}
79
return
$this;
80
}
81
87
public
function
addException
(
LocalizedException
$exception)
88
{
89
$this->addErrorCalls++;
90
$this->errors[] = $exception;
91
return
$this;
92
}
93
99
public
function
wasErrorAdded
()
100
{
101
return
(0 < $this->addErrorCalls);
102
}
103
107
public
function
getErrors
()
108
{
109
return
$this->errors
;
110
}
111
}
Magento\Framework\Exception\AbstractAggregateException\addException
addException(LocalizedException $exception)
Definition:
AbstractAggregateException.php:87
Magento\Framework\Exception\AbstractAggregateException\__construct
__construct(Phrase $phrase, \Exception $cause=null, $code=0)
Definition:
AbstractAggregateException.php:45
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\Exception\AbstractAggregateException\$errors
$errors
Definition:
AbstractAggregateException.php:22
elseif
elseif(isset( $params[ 'redirect_parent']))
Definition:
iframe.phtml:17
Magento\Framework\Exception\AbstractAggregateException\wasErrorAdded
wasErrorAdded()
Definition:
AbstractAggregateException.php:99
Magento\Framework\Exception\AbstractAggregateException\getErrors
getErrors()
Definition:
AbstractAggregateException.php:107
Magento\Framework\Exception
Definition:
AbstractAggregateException.php:7
Magento\Framework\Exception\AbstractAggregateException
Definition:
AbstractAggregateException.php:15
Magento\Framework\Exception\AbstractAggregateException\addError
addError(Phrase $phrase)
Definition:
AbstractAggregateException.php:57
Magento\Framework\Exception\AbstractAggregateException\$originalPhrase
$originalPhrase
Definition:
AbstractAggregateException.php:29
Magento\Framework\Phrase
Definition:
Phrase.php:17
Magento\Framework\Phrase
$code
$code
Definition:
info.phtml:12