Skip to content

Commit e69fca4

Browse files
committed
Merge remote-tracking branch 'mainline/develop' into BUGS
2 parents 7d5a015 + a72c664 commit e69fca4

File tree

320 files changed

+2898
-1439
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

320 files changed

+2898
-1439
lines changed

app/code/Magento/Authorization/Model/Acl/AclRetriever.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ public function getAllowedResourcesByUser($userType, $userId)
7575
try {
7676
$role = $this->_getUserRole($userType, $userId);
7777
if (!$role) {
78-
throw new AuthorizationException('The role associated with the specified user cannot be found.');
78+
throw new AuthorizationException(
79+
__('The role associated with the specified user cannot be found.')
80+
);
7981
}
8082
$allowedResources = $this->getAllowedResourcesByRole($role->getId());
8183
} catch (AuthorizationException $e) {

app/code/Magento/Backend/Controller/Adminhtml/Ajax/Translate.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ class Translate extends \Magento\Backend\App\Action
1616
protected $inlineParser;
1717

1818
/**
19-
* @var \Magento\Framework\Controller\Result\JSONFactory
19+
* @var \Magento\Framework\Controller\Result\JsonFactory
2020
*/
2121
protected $resultJsonFactory;
2222

2323
/**
2424
* @param Action\Context $context
2525
* @param \Magento\Framework\Translate\Inline\ParserInterface $inlineParser
26-
* @param \Magento\Framework\Controller\Result\JSONFactory $resultJsonFactory
26+
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
2727
*/
2828
public function __construct(
2929
Action\Context $context,
3030
\Magento\Framework\Translate\Inline\ParserInterface $inlineParser,
31-
\Magento\Framework\Controller\Result\JSONFactory $resultJsonFactory
31+
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
3232
) {
3333
parent::__construct($context);
3434
$this->resultJsonFactory = $resultJsonFactory;
@@ -38,13 +38,13 @@ public function __construct(
3838
/**
3939
* Ajax action for inline translation
4040
*
41-
* @return \Magento\Framework\Controller\Result\JSON
41+
* @return \Magento\Framework\Controller\Result\Json
4242
*/
4343
public function execute()
4444
{
4545
$translate = (array)$this->getRequest()->getPost('translate');
4646

47-
/** @var \Magento\Framework\Controller\Result\JSON $resultJson */
47+
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
4848
$resultJson = $this->resultJsonFactory->create();
4949
try {
5050
$this->inlineParser->processAjaxPost($translate);

app/code/Magento/Backend/Controller/Adminhtml/Auth/DeniedJson.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
class DeniedJson extends \Magento\Backend\Controller\Adminhtml\Auth
1010
{
1111
/**
12-
* @var \Magento\Framework\Controller\Result\JSONFactory
12+
* @var \Magento\Framework\Controller\Result\JsonFactory
1313
*/
1414
protected $resultJsonFactory;
1515

1616
/**
1717
* @param \Magento\Backend\App\Action\Context $context
18-
* @param \Magento\Framework\Controller\Result\JSONFactory $resultJsonFactory
18+
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
1919
*/
2020
public function __construct(
2121
\Magento\Backend\App\Action\Context $context,
22-
\Magento\Framework\Controller\Result\JSONFactory $resultJsonFactory
22+
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
2323
) {
2424
parent::__construct($context);
2525
$this->resultJsonFactory = $resultJsonFactory;
@@ -41,11 +41,11 @@ protected function _getDeniedJson()
4141
/**
4242
* Denied JSON action
4343
*
44-
* @return \Magento\Framework\Controller\Result\JSON
44+
* @return \Magento\Framework\Controller\Result\Json
4545
*/
4646
public function execute()
4747
{
48-
/** @var \Magento\Framework\Controller\Result\JSON $resultJson */
48+
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
4949
$resultJson = $this->resultJsonFactory->create();
5050
return $resultJson->setData($this->_getDeniedJson());
5151
}

app/code/Magento/Backend/Controller/Adminhtml/Cache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected function _validateTypes(array $types)
7474
$allTypes = array_keys($this->_cacheTypeList->getTypes());
7575
$invalidTypes = array_diff($types, $allTypes);
7676
if (count($invalidTypes) > 0) {
77-
throw new LocalizedException(__("Specified cache type(s) don't exist: " . join(', ', $invalidTypes)));
77+
throw new LocalizedException(__('Specified cache type(s) don\'t exist: %1', join(', ', $invalidTypes)));
7878
}
7979
}
8080

app/code/Magento/Backend/Controller/Adminhtml/Index/GlobalSearch.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class GlobalSearch extends \Magento\Backend\Controller\Adminhtml\Index
1010
{
1111
/**
12-
* @var \Magento\Framework\Controller\Result\JSONFactory
12+
* @var \Magento\Framework\Controller\Result\JsonFactory
1313
*/
1414
protected $resultJsonFactory;
1515

@@ -22,12 +22,12 @@ class GlobalSearch extends \Magento\Backend\Controller\Adminhtml\Index
2222

2323
/**
2424
* @param \Magento\Backend\App\Action\Context $context
25-
* @param \Magento\Framework\Controller\Result\JSONFactory $resultJsonFactory
25+
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
2626
* @param array $searchModules
2727
*/
2828
public function __construct(
2929
\Magento\Backend\App\Action\Context $context,
30-
\Magento\Framework\Controller\Result\JSONFactory $resultJsonFactory,
30+
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
3131
array $searchModules = []
3232
) {
3333
$this->_searchModules = $searchModules;
@@ -38,7 +38,7 @@ public function __construct(
3838
/**
3939
* Global Search Action
4040
*
41-
* @return \Magento\Framework\Controller\Result\JSON
41+
* @return \Magento\Framework\Controller\Result\Json
4242
*/
4343
public function execute()
4444
{
@@ -87,7 +87,7 @@ public function execute()
8787
}
8888
}
8989

90-
/** @var \Magento\Framework\Controller\Result\JSON $resultJson */
90+
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
9191
$resultJson = $this->resultJsonFactory->create();
9292
return $resultJson->setData($items);
9393
}

app/code/Magento/Backend/Controller/Adminhtml/System/Account/Save.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function execute()
7878
$user->sendPasswordResetNotificationEmail();
7979
}
8080
$this->messageManager->addSuccess(__('The account has been saved.'));
81-
} catch (\Magento\Framework\Validator\ValidatorException $e) {
81+
} catch (\Magento\Framework\Validator\Exception $e) {
8282
$this->messageManager->addMessages($e->getMessages());
8383
if ($e->getMessage()) {
8484
$this->messageManager->addError($e->getMessage());

app/code/Magento/Backend/Model/Auth.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Framework\Exception\AuthenticationException;
99
use Magento\Framework\Exception\Plugin\AuthenticationException as PluginAuthenticationException;
10+
use Magento\Framework\Phrase;
1011

1112
/**
1213
* Backend Auth model
@@ -81,7 +82,7 @@ public function __construct(
8182
public function setAuthStorage($storage)
8283
{
8384
if (!$storage instanceof \Magento\Backend\Model\Auth\StorageInterface) {
84-
self::throwException('Authentication storage is incorrect.');
85+
self::throwException(__('Authentication storage is incorrect.'));
8586
}
8687
$this->_authStorage = $storage;
8788
return $this;
@@ -199,12 +200,12 @@ public function isLoggedIn()
199200
/**
200201
* Throws specific Backend Authentication \Exception
201202
*
202-
* @param string $msg
203+
* @param \Magento\Framework\Phrase $msg
203204
* @return void
204205
* @throws \Magento\Framework\Exception\AuthenticationException
205206
* @static
206207
*/
207-
public static function throwException($msg = null)
208+
public static function throwException(Phrase $msg = null)
208209
{
209210
if (is_null($msg)) {
210211
$msg = __('Authentication error occurred.');

app/code/Magento/Backend/Model/View/Layout/GeneratorPool.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ class GeneratorPool extends \Magento\Framework\View\Layout\GeneratorPool
2222
* @param ScheduledStructure\Helper $helper
2323
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
2424
* @param \Magento\Framework\App\ScopeResolverInterface $scopeResolver
25+
* @param \Psr\Log\LoggerInterface $logger
2526
* @param Filter\Acl $aclFilter
2627
* @param array $generators
2728
*/
2829
public function __construct(
2930
ScheduledStructure\Helper $helper,
3031
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
3132
\Magento\Framework\App\ScopeResolverInterface $scopeResolver,
33+
\Psr\Log\LoggerInterface $logger,
3234
Filter\Acl $aclFilter,
3335
array $generators = null
3436
) {
@@ -37,6 +39,7 @@ public function __construct(
3739
$helper,
3840
$scopeConfig,
3941
$scopeResolver,
42+
$logger,
4043
$generators
4144
);
4245
}

app/code/Magento/Backup/Model/Backup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public function setFile(&$content)
246246
public function &getFile()
247247
{
248248
if (!$this->exists()) {
249-
throw new \Magento\Framework\Exception\LocalizedException(__("The backup file does not exist."));
249+
throw new \Magento\Framework\Exception\LocalizedException(__('The backup file does not exist.'));
250250
}
251251

252252
return $this->varDirectory->read($this->_getFilePath());
@@ -261,7 +261,7 @@ public function &getFile()
261261
public function deleteFile()
262262
{
263263
if (!$this->exists()) {
264-
throw new \Magento\Framework\Exception\LocalizedException(__("The backup file does not exist."));
264+
throw new \Magento\Framework\Exception\LocalizedException(__('The backup file does not exist.'));
265265
}
266266

267267
$this->varDirectory->delete($this->_getFilePath());

app/code/Magento/Bundle/Model/LinkManagement.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ public function getChildren($productId)
7979
{
8080
$product = $this->productRepository->get($productId);
8181
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
82-
throw new InputException(
83-
'Only implemented for bundle product'
84-
);
82+
throw new InputException(__('Only implemented for bundle product'));
8583
}
8684

8785
$childrenList = [];
@@ -115,7 +113,9 @@ public function addChild(
115113
\Magento\Bundle\Api\Data\LinkInterface $linkedProduct
116114
) {
117115
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
118-
throw new InputException('Product with specified sku: "%1" is not a bundle product', [$product->getSku()]);
116+
throw new InputException(
117+
__('Product with specified sku: "%1" is not a bundle product', $product->getSku())
118+
);
119119
}
120120

121121
$options = $this->optionCollection->create();
@@ -131,8 +131,10 @@ public function addChild(
131131

132132
if ($isNewOption) {
133133
throw new InputException(
134-
'Product with specified sku: "%1" does not contain option: "%2"',
135-
[$product->getSku(), $optionId]
134+
__(
135+
'Product with specified sku: "%1" does not contain option: "%2"',
136+
[$product->getSku(), $optionId]
137+
)
136138
);
137139
}
138140

@@ -142,15 +144,17 @@ public function addChild(
142144
/** @var \Magento\Catalog\Model\Product $linkProductModel */
143145
$linkProductModel = $this->productRepository->get($linkedProduct->getSku());
144146
if ($linkProductModel->isComposite()) {
145-
throw new InputException('Bundle product could not contain another composite product');
147+
throw new InputException(__('Bundle product could not contain another composite product'));
146148
}
147149
if ($selections) {
148150
foreach ($selections as $selection) {
149151
if ($selection['option_id'] == $optionId &&
150152
$selection['product_id'] == $linkProductModel->getId()) {
151153
throw new CouldNotSaveException(
152-
'Child with specified sku: "%1" already assigned to product: "%2"',
153-
[$linkedProduct->getSku(), $product->getSku()]
154+
__(
155+
'Child with specified sku: "%1" already assigned to product: "%2"',
156+
[$linkedProduct->getSku(), $product->getSku()]
157+
)
154158
);
155159
}
156160
}
@@ -171,7 +175,7 @@ public function addChild(
171175
try {
172176
$selectionModel->save();
173177
} catch (\Exception $e) {
174-
throw new CouldNotSaveException('Could not save child: "%1"', [$e->getMessage()], $e);
178+
throw new CouldNotSaveException(__('Could not save child: "%1"', $e->getMessage()), $e);
175179
}
176180

177181
return $selectionModel->getId();
@@ -185,9 +189,7 @@ public function removeChild($sku, $optionId, $childSku)
185189
$product = $this->productRepository->get($sku);
186190

187191
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
188-
throw new InputException(
189-
sprintf('Product with specified sku: %s is not a bundle product', $sku)
190-
);
192+
throw new InputException(__('Product with specified sku: %1 is not a bundle product', $sku));
191193
}
192194

193195
$excludeSelectionIds = [];
@@ -206,7 +208,7 @@ public function removeChild($sku, $optionId, $childSku)
206208
}
207209
if (empty($removeSelectionIds)) {
208210
throw new \Magento\Framework\Exception\NoSuchEntityException(
209-
'Requested bundle option product doesn\'t exist'
211+
__('Requested bundle option product doesn\'t exist')
210212
);
211213
}
212214
/* @var $resource \Magento\Bundle\Model\Resource\Bundle */

app/code/Magento/Bundle/Model/OptionManagement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function save(\Magento\Bundle\Api\Data\OptionInterface $option)
3939
{
4040
$product = $this->productRepository->get($option->getSku());
4141
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
42-
throw new InputException('Only implemented for bundle product');
42+
throw new InputException(__('Only implemented for bundle product'));
4343
}
4444
return $this->optionRepository->save($product, $option);
4545
}

app/code/Magento/Bundle/Model/OptionRepository.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function get($sku, $optionId)
103103
/** @var \Magento\Bundle\Model\Option $option */
104104
$option = $this->type->getOptionsCollection($product)->getItemById($optionId);
105105
if (!$option || !$option->getId()) {
106-
throw new NoSuchEntityException('Requested option doesn\'t exist');
106+
throw new NoSuchEntityException(__('Requested option doesn\'t exist'));
107107
}
108108

109109
$productLinks = $this->linkList->getItems($product, $optionId);
@@ -141,8 +141,7 @@ public function delete(\Magento\Bundle\Api\Data\OptionInterface $option)
141141
$this->optionResource->delete($option);
142142
} catch (\Exception $exception) {
143143
throw new \Magento\Framework\Exception\StateException(
144-
'Cannot delete option with id %option_id',
145-
['option_id' => $option->getOptionId()],
144+
__('Cannot delete option with id %1', $option->getOptionId()),
146145
$exception
147146
);
148147
}
@@ -182,7 +181,7 @@ public function save(
182181
$existingOption = $optionCollection->getFirstItem();
183182

184183
if (!$existingOption->getOptionId()) {
185-
throw new NoSuchEntityException('Requested option doesn\'t exist');
184+
throw new NoSuchEntityException(__('Requested option doesn\'t exist'));
186185
}
187186

188187
$option->setData(array_merge($existingOption->getData(), $option->getData()));
@@ -205,7 +204,7 @@ public function save(
205204
try {
206205
$this->optionResource->save($option);
207206
} catch (\Exception $e) {
208-
throw new CouldNotSaveException('Could not save option', [], $e);
207+
throw new CouldNotSaveException(__('Could not save option'), $e);
209208
}
210209

211210
/** @var \Magento\Bundle\Api\Data\LinkInterface $linkedProduct */
@@ -225,7 +224,7 @@ private function getProduct($sku)
225224
{
226225
$product = $this->productRepository->get($sku);
227226
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
228-
throw new InputException('Only implemented for bundle product');
227+
throw new InputException(__('Only implemented for bundle product'));
229228
}
230229
return $product;
231230
}

app/code/Magento/Bundle/Model/Product/Type.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $produ
678678

679679
try {
680680
if (is_string($result)) {
681-
throw new \Magento\Framework\Exception\LocalizedException($result);
681+
throw new \Magento\Framework\Exception\LocalizedException(__($result));
682682
}
683683

684684
$selections = [];
@@ -1314,7 +1314,7 @@ protected function checkSelectionsIsSale($selections, $skipSaleableCheck, $optio
13141314
protected function checkIsResult($_result)
13151315
{
13161316
if (is_string($_result)) {
1317-
throw new \Magento\Framework\Exception\LocalizedException($_result);
1317+
throw new \Magento\Framework\Exception\LocalizedException(__($_result));
13181318
}
13191319

13201320
if (!isset($_result[0])) {

0 commit comments

Comments
 (0)