Skip to content

Commit 727ca8c

Browse files
committed
MAGETWO-94819: Swatch validation breaks the whole attribute form
1 parent 82cff4b commit 727ca8c

File tree

3 files changed

+20
-4
lines changed
  • app/code/Magento

3 files changed

+20
-4
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
use Magento\Framework\View\Result\PageFactory;
3333

3434
/**
35+
* Product attribute save controller.
36+
*
3537
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
3638
*/
3739
class Save extends Attribute
@@ -126,10 +128,13 @@ public function __construct(
126128
}
127129

128130
/**
131+
* @inheritdoc
132+
*
129133
* @return Redirect
130134
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
131135
* @SuppressWarnings(PHPMD.NPathComplexity)
132136
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
137+
* @throws \Zend_Validate_Exception
133138
*/
134139
public function execute()
135140
{
@@ -158,7 +163,7 @@ public function execute()
158163
$name = trim($name);
159164

160165
try {
161-
/** @var $attributeSet Set */
166+
/** @var Set $attributeSet */
162167
$attributeSet = $this->buildFactory->create()
163168
->setEntityTypeId($this->_entityTypeId)
164169
->setSkeletonId($setId)
@@ -180,7 +185,7 @@ public function execute()
180185

181186
$attributeId = $this->getRequest()->getParam('attribute_id');
182187

183-
/** @var $model ProductAttributeInterface */
188+
/** @var ProductAttributeInterface $model */
184189
$model = $this->attributeFactory->create();
185190
if ($attributeId) {
186191
$model->load($attributeId);
@@ -212,7 +217,7 @@ public function execute()
212217

213218
//validate frontend_input
214219
if (isset($data['frontend_input'])) {
215-
/** @var $inputType Validator */
220+
/** @var Validator $inputType */
216221
$inputType = $this->validatorFactory->create();
217222
if (!$inputType->isValid($data['frontend_input'])) {
218223
foreach ($inputType->getMessages() as $message) {
@@ -340,6 +345,8 @@ public function execute()
340345
}
341346

342347
/**
348+
* Provides an initialized Result object.
349+
*
343350
* @param string $path
344351
* @param array $params
345352
* @param array $response

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use Magento\Framework\DataObject;
1313

1414
/**
15+
* Product attribute validate controller.
16+
*
1517
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1618
*/
1719
class Validate extends \Magento\Catalog\Controller\Adminhtml\Product\Attribute
@@ -69,6 +71,8 @@ public function __construct(
6971
}
7072

7173
/**
74+
* @inheritdoc
75+
*
7276
* @return \Magento\Framework\Controller\ResultInterface
7377
* @SuppressWarnings(PHPMD.NPathComplexity)
7478
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
@@ -146,7 +150,8 @@ public function execute()
146150
}
147151

148152
/**
149-
* Throws Exception if not unique values into options
153+
* Throws Exception if not unique values into options.
154+
*
150155
* @param array $optionsValues
151156
* @param array $deletedOptions
152157
* @return bool
@@ -180,6 +185,8 @@ private function setMessageToResponse($response, $messages)
180185
}
181186

182187
/**
188+
* Performs checking the uniqueness of the attribute options.
189+
*
183190
* @param DataObject $response
184191
* @param array|null $options
185192
* @return $this

app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Save.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
class Save
1717
{
1818
/**
19+
* Performs the conversion of the frontend input value.
20+
*
1921
* @param Attribute\Save $subject
2022
* @param RequestInterface $request
2123
* @return array

0 commit comments

Comments
 (0)