Skip to content

Commit 1e230b1

Browse files
authored
Merge pull request #4132 from magento-trigger/MAGETWO-99324-trigger
- reverting backward incompatible changes
2 parents 4992141 + 715eca8 commit 1e230b1

File tree

7 files changed

+17
-107
lines changed

7 files changed

+17
-107
lines changed

app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
namespace Magento\Catalog\Model\ResourceModel;
1010

1111
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
12-
use Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend;
13-
use Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend;
14-
use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource;
15-
use Magento\Eav\Model\Entity\Attribute\UniqueValidationInterface;
1612

1713
/**
1814
* Catalog entity abstract model
@@ -43,18 +39,16 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity
4339
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
4440
* @param \Magento\Catalog\Model\Factory $modelFactory
4541
* @param array $data
46-
* @param UniqueValidationInterface|null $uniqueValidator
4742
*/
4843
public function __construct(
4944
\Magento\Eav\Model\Entity\Context $context,
5045
\Magento\Store\Model\StoreManagerInterface $storeManager,
5146
\Magento\Catalog\Model\Factory $modelFactory,
52-
$data = [],
53-
UniqueValidationInterface $uniqueValidator = null
47+
$data = []
5448
) {
5549
$this->_storeManager = $storeManager;
5650
$this->_modelFactory = $modelFactory;
57-
parent::__construct($context, $data, $uniqueValidator);
51+
parent::__construct($context, $data);
5852
}
5953

6054
/**
@@ -94,7 +88,7 @@ protected function _isApplicableAttribute($object, $attribute)
9488
/**
9589
* Check whether attribute instance (attribute, backend, frontend or source) has method and applicable
9690
*
97-
* @param AbstractAttribute|AbstractBackend|AbstractFrontend|AbstractSource $instance
91+
* @param AbstractAttribute|\Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend|\Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend|\Magento\Eav\Model\Entity\Attribute\Source\AbstractSource $instance
9892
* @param string $method
9993
* @param array $args array of arguments
10094
* @return boolean

app/code/Magento/Catalog/Model/ResourceModel/Product.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Magento\Catalog\Model\ResourceModel\Product\Website\Link as ProductWebsiteLink;
99
use Magento\Framework\App\ObjectManager;
1010
use Magento\Catalog\Model\Indexer\Category\Product\TableMaintainer;
11-
use Magento\Eav\Model\Entity\Attribute\UniqueValidationInterface;
1211

1312
/**
1413
* Product entity resource model
@@ -102,7 +101,6 @@ class Product extends AbstractResource
102101
* @param \Magento\Catalog\Model\Product\Attribute\DefaultAttributes $defaultAttributes
103102
* @param array $data
104103
* @param TableMaintainer|null $tableMaintainer
105-
* @param UniqueValidationInterface|null $uniqueValidator
106104
*
107105
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
108106
*/
@@ -117,8 +115,7 @@ public function __construct(
117115
\Magento\Eav\Model\Entity\TypeFactory $typeFactory,
118116
\Magento\Catalog\Model\Product\Attribute\DefaultAttributes $defaultAttributes,
119117
$data = [],
120-
TableMaintainer $tableMaintainer = null,
121-
UniqueValidationInterface $uniqueValidator = null
118+
TableMaintainer $tableMaintainer = null
122119
) {
123120
$this->_categoryCollectionFactory = $categoryCollectionFactory;
124121
$this->_catalogCategory = $catalogCategory;
@@ -130,8 +127,7 @@ public function __construct(
130127
$context,
131128
$storeManager,
132129
$modelFactory,
133-
$data,
134-
$uniqueValidator
130+
$data
135131
);
136132
$this->connectionName = 'catalog';
137133
$this->tableMaintainer = $tableMaintainer ?: ObjectManager::getInstance()->get(TableMaintainer::class);
@@ -661,7 +657,7 @@ public function save(\Magento\Framework\Model\AbstractModel $object)
661657
}
662658

663659
/**
664-
* Retrieve entity manager object.
660+
* Retrieve entity manager object
665661
*
666662
* @return \Magento\Framework\EntityManager\EntityManager
667663
*/
@@ -675,7 +671,7 @@ private function getEntityManager()
675671
}
676672

677673
/**
678-
* Retrieve ProductWebsiteLink object.
674+
* Retrieve ProductWebsiteLink object
679675
*
680676
* @deprecated 101.1.0
681677
* @return ProductWebsiteLink
@@ -686,7 +682,7 @@ private function getProductWebsiteLink()
686682
}
687683

688684
/**
689-
* Retrieve CategoryLink object.
685+
* Retrieve CategoryLink object
690686
*
691687
* @deprecated 101.1.0
692688
* @return \Magento\Catalog\Model\ResourceModel\Product\CategoryLink
@@ -702,7 +698,6 @@ private function getProductCategoryLink()
702698

703699
/**
704700
* Extends parent method to be appropriate for product.
705-
*
706701
* Store id is required to correctly identify attribute value we are working with.
707702
*
708703
* @inheritdoc

app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckingAttributeValueOnProductEditPageTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
<!--Go to Product edit page-->
5454
<amOnPage url="{{AdminProductEditPage.url($$createSimpleProduct.id$$)}}" stepKey="goToProductEditPage"/>
55+
<waitForPageLoad stepKey="waitForPageLoad"/>
5556
<!--Click on attribute dropdown-->
5657
<click selector="{{AdminProductFormSection.customAttributeDropdownField($$createDropdownProductAttribute.attribute[attribute_code]$$)}}" stepKey="clickOnAttributeDropdown"/>
5758
<!--Check attribute dropdown options-->

app/code/Magento/Eav/Model/Entity/AbstractEntity.php

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend;
1313
use Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend;
1414
use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource;
15-
use Magento\Eav\Model\Entity\Attribute\UniqueValidationInterface;
1615
use Magento\Framework\App\Config\Element;
1716
use Magento\Framework\DataObject;
1817
use Magento\Framework\DB\Adapter\DuplicateException;
@@ -218,21 +217,12 @@ abstract class AbstractEntity extends AbstractResource implements EntityInterfac
218217
*/
219218
protected $objectRelationProcessor;
220219

221-
/**
222-
* @var UniqueValidationInterface
223-
*/
224-
private $uniqueValidator;
225-
226220
/**
227221
* @param Context $context
228222
* @param array $data
229-
* @param UniqueValidationInterface|null $uniqueValidator
230223
*/
231-
public function __construct(
232-
Context $context,
233-
$data = [],
234-
UniqueValidationInterface $uniqueValidator = null
235-
) {
224+
public function __construct(Context $context, $data = [])
225+
{
236226
$this->_eavConfig = $context->getEavConfig();
237227
$this->_resource = $context->getResource();
238228
$this->_attrSetEntity = $context->getAttributeSetEntity();
@@ -241,8 +231,6 @@ public function __construct(
241231
$this->_universalFactory = $context->getUniversalFactory();
242232
$this->transactionManager = $context->getTransactionManager();
243233
$this->objectRelationProcessor = $context->getObjectRelationProcessor();
244-
$this->uniqueValidator = $uniqueValidator ?:
245-
ObjectManager::getInstance()->get(UniqueValidationInterface::class);
246234
parent::__construct();
247235
$properties = get_object_vars($this);
248236
foreach ($data as $key => $value) {
@@ -511,7 +499,6 @@ public function addAttributeByScope(AbstractAttribute $attribute, $entity = null
511499
/**
512500
* Get attributes by scope
513501
*
514-
* @param string $suffix
515502
* @return array
516503
*/
517504
private function getAttributesByScope($suffix)
@@ -982,8 +969,12 @@ public function checkAttributeUniqueValue(AbstractAttribute $attribute, $object)
982969

983970
$data = $connection->fetchCol($select, $bind);
984971

985-
if ($object->getData($entityIdField)) {
986-
return $this->uniqueValidator->validate($attribute, $object, $this, $entityIdField, $data);
972+
$objectId = $object->getData($entityIdField);
973+
if ($objectId) {
974+
if (isset($data[0])) {
975+
return $data[0] == $objectId;
976+
}
977+
return true;
987978
}
988979

989980
return !count($data);
@@ -1995,7 +1986,6 @@ public function afterDelete(DataObject $object)
19951986

19961987
/**
19971988
* Load attributes for object
1998-
*
19991989
* If the object will not pass all attributes for this entity type will be loaded
20001990
*
20011991
* @param array $attributes

app/code/Magento/Eav/Model/Entity/Attribute/UniqueValidationInterface.php

Lines changed: 0 additions & 35 deletions
This file was deleted.

app/code/Magento/Eav/Model/Entity/Attribute/UniqueValidator.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

app/code/Magento/Eav/etc/di.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
99
<preference for="Magento\Eav\Model\Entity\Setup\PropertyMapperInterface" type="Magento\Eav\Model\Entity\Setup\PropertyMapper\Composite" />
1010
<preference for="Magento\Eav\Model\Entity\AttributeLoaderInterface" type="Magento\Eav\Model\Entity\AttributeLoader" />
11-
<preference for="Magento\Eav\Model\Entity\Attribute\UniqueValidationInterface" type="Magento\Eav\Model\Entity\Attribute\UniqueValidator" />
1211
<preference for="Magento\Eav\Api\Data\AttributeInterface" type="Magento\Eav\Model\Entity\Attribute" />
1312
<preference for="Magento\Eav\Api\AttributeRepositoryInterface" type="Magento\Eav\Model\AttributeRepository" />
1413
<preference for="Magento\Eav\Api\Data\AttributeGroupInterface" type="Magento\Eav\Model\Entity\Attribute\Group" />

0 commit comments

Comments
 (0)