Skip to content

Commit 7e5447b

Browse files
committed
Merge remote-tracking branch 'SilinMykola/php8-compatibility/fix_functional-tests' into platform-health
2 parents cd5f68a + 3ef8dae commit 7e5447b

File tree

1 file changed

+9
-5
lines changed
  • app/code/Magento/Catalog/Controller/Adminhtml/Category

1 file changed

+9
-5
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Magento\Store\Model\StoreManagerInterface;
1313

1414
/**
15-
* Class Save
15+
* Category save controller
1616
*
1717
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1818
*/
@@ -144,10 +144,10 @@ public function execute()
144144
$categoryPostData = $this->stringToBoolConverting($categoryPostData);
145145
$categoryPostData = $this->imagePreprocessing($categoryPostData);
146146
$categoryPostData = $this->dateTimePreprocessing($category, $categoryPostData);
147-
$storeId = isset($categoryPostData['store_id']) ? $categoryPostData['store_id'] : null;
147+
$storeId = $categoryPostData['store_id'] ?? null;
148148
$store = $this->storeManager->getStore($storeId);
149149
$this->storeManager->setCurrentStore($store->getCode());
150-
$parentId = isset($categoryPostData['parent']) ? $categoryPostData['parent'] : null;
150+
$parentId = $categoryPostData['parent'] ?? null;
151151
if ($categoryPostData) {
152152
$category->addData($categoryPostData);
153153
if ($parentId) {
@@ -168,7 +168,7 @@ public function execute()
168168
if (isset($categoryPostData['use_config']) && !empty($categoryPostData['use_config'])) {
169169
foreach ($categoryPostData['use_config'] as $attributeCode => $attributeValue) {
170170
if ($attributeValue) {
171-
$useConfig[] = $attributeCode;
171+
$useConfig[] = $attributeValue;
172172
$category->setData($attributeCode, null);
173173
}
174174
}
@@ -220,7 +220,11 @@ public function execute()
220220
__('The "%1" attribute is required. Enter and try again.', $attribute)
221221
);
222222
} else {
223-
$this->messageManager->addErrorMessage(__('Something went wrong while saving the category.'));
223+
$this->messageManager->addErrorMessage(
224+
__(
225+
'Something went wrong while saving the category.'
226+
)
227+
);
224228
$this->logger->critical('Something went wrong while saving the category.');
225229
$this->_getSession()->setCategoryData($categoryPostData);
226230
}

0 commit comments

Comments
 (0)