Skip to content

Commit 73fc7ed

Browse files
author
Vadim Zubovich
committed
MAGNSWTC-168: Remove unnecessary changes previously added.
1 parent b964a76 commit 73fc7ed

File tree

1 file changed

+11
-56
lines changed

1 file changed

+11
-56
lines changed

app/code/Magento/ConfigurableProduct/Model/SuggestedAttributeList.php

Lines changed: 11 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -6,55 +6,31 @@
66
* See COPYING.txt for license details.
77
*/
88
namespace Magento\ConfigurableProduct\Model;
9-
109
class SuggestedAttributeList
1110
{
1211
/**
1312
* Attribute collection factory
1413
*
1514
* @var \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory
1615
*/
17-
protected $attributeCollectionFactory;
18-
16+
protected $_attributeColFactory;
1917
/**
2018
* Catalog resource helper
2119
*
2220
* @var \Magento\Catalog\Model\Resource\Helper
2321
*/
24-
protected $resourceHelper;
25-
22+
protected $_resourceHelper;
2623
/**
27-
* Application Event Dispatcher
28-
*
29-
* @var \Magento\Framework\Event\ManagerInterface
30-
*/
31-
protected $eventManager;
32-
33-
/**
34-
* Object Factory
35-
*
36-
* @var \Magento\Framework\ObjectFactory
37-
*/
38-
protected $objectFactory;
39-
40-
/**
41-
* @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory
24+
* @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeColFactory
4225
* @param \Magento\Catalog\Model\Resource\Helper $resourceHelper
43-
* @param \Magento\Framework\Event\ManagerInterface $eventManager
44-
* @param \Magento\Framework\ObjectFactory $objectFactory
4526
*/
4627
public function __construct(
47-
\Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory,
48-
\Magento\Catalog\Model\Resource\Helper $resourceHelper,
49-
\Magento\Framework\Event\ManagerInterface $eventManager,
50-
\Magento\Framework\ObjectFactory $objectFactory
28+
\Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeColFactory,
29+
\Magento\Catalog\Model\Resource\Helper $resourceHelper
5130
) {
52-
$this->attributeCollectionFactory = $attributeCollectionFactory;
53-
$this->resourceHelper = $resourceHelper;
54-
$this->objectFactory = $objectFactory;
55-
$this->eventManager = $eventManager;
31+
$this->_attributeColFactory = $attributeColFactory;
32+
$this->_resourceHelper = $resourceHelper;
5633
}
57-
5834
/**
5935
* Retrieve list of attributes with admin store label containing $labelPart
6036
*
@@ -63,14 +39,12 @@ public function __construct(
6339
*/
6440
public function getSuggestedAttributes($labelPart)
6541
{
66-
$escapedLabelPart = $this->resourceHelper->addLikeEscape($labelPart, ['position' => 'any']);
67-
$availableFrontendTypes = $this->getAvailableFrontendTypes();
68-
42+
$escapedLabelPart = $this->_resourceHelper->addLikeEscape($labelPart, ['position' => 'any']);
6943
/** @var $collection \Magento\Catalog\Model\Resource\Product\Attribute\Collection */
70-
$collection = $this->attributeCollectionFactory->create();
44+
$collection = $this->_attributeColFactory->create();
7145
$collection->addFieldToFilter(
72-
'main_table.frontend_input',
73-
['in' => $availableFrontendTypes->getData('values')]
46+
'frontend_input',
47+
'select'
7448
)->addFieldToFilter(
7549
'frontend_label',
7650
['like' => $escapedLabelPart]
@@ -81,7 +55,6 @@ public function getSuggestedAttributes($labelPart)
8155
'is_global',
8256
\Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL
8357
);
84-
8558
$result = [];
8659
$types = [
8760
\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE,
@@ -101,22 +74,4 @@ public function getSuggestedAttributes($labelPart)
10174
}
10275
return $result;
10376
}
104-
105-
/**
106-
* @return \Magento\Framework\Object
107-
*/
108-
private function getAvailableFrontendTypes()
109-
{
110-
$availableFrontendTypes = $this->objectFactory->create();
111-
$availableFrontendTypes->setData(
112-
[
113-
'values' => ['select']
114-
]
115-
);
116-
$this->eventManager->dispatch(
117-
'product_suggested_attribute_frontend_type_init_after',
118-
['types_dto' => $availableFrontendTypes]
119-
);
120-
return $availableFrontendTypes;
121-
}
12277
}

0 commit comments

Comments
 (0)