11
11
use Magento \Catalog \Api \Data \ProductCustomOptionValuesInterfaceFactory ;
12
12
use Magento \Catalog \Api \Data \ProductInterface ;
13
13
use Magento \Catalog \Model \Product ;
14
- use Magento \Catalog \Model \Product \Option \Type \DefaultType ;
15
14
use Magento \Catalog \Model \ResourceModel \Product \Option \Value \Collection ;
16
15
use Magento \Catalog \Pricing \Price \BasePrice ;
16
+ use Magento \Framework \DataObject ;
17
17
use Magento \Framework \EntityManager \MetadataPool ;
18
18
use Magento \Framework \Exception \LocalizedException ;
19
19
use Magento \Framework \Model \AbstractExtensibleModel ;
@@ -100,14 +100,14 @@ class Option extends AbstractExtensibleModel implements ProductCustomOptionInter
100
100
protected $ validatorPool ;
101
101
102
102
/**
103
- * @var DefaultType []
103
+ * @var string []
104
104
*/
105
- private $ groupsPool ;
105
+ private $ optionGroups ;
106
106
107
107
/**
108
108
* @var string[]
109
109
*/
110
- private $ typesPool ;
110
+ private $ optionGroupsToTypes ;
111
111
112
112
/**
113
113
* @var MetadataPool
@@ -131,8 +131,8 @@ class Option extends AbstractExtensibleModel implements ProductCustomOptionInter
131
131
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
132
132
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
133
133
* @param array $data
134
- * @param array $groupsPool
135
- * @param array $typesPool
134
+ * @param array $optionGroups
135
+ * @param array $optionGroupsToTypes
136
136
* @param ProductCustomOptionValuesInterfaceFactory|null $customOptionValuesFactory
137
137
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
138
138
*/
@@ -148,18 +148,18 @@ public function __construct(
148
148
\Magento \Framework \Model \ResourceModel \AbstractResource $ resource = null ,
149
149
\Magento \Framework \Data \Collection \AbstractDb $ resourceCollection = null ,
150
150
array $ data = [],
151
- array $ groupsPool = [] ,
152
- array $ typesPool = [],
153
- ProductCustomOptionValuesInterfaceFactory $ customOptionValuesFactory = null
151
+ ProductCustomOptionValuesInterfaceFactory $ customOptionValuesFactory = null ,
152
+ array $ optionGroups = [],
153
+ array $ optionGroupsToTypes = []
154
154
) {
155
155
$ this ->productOptionValue = $ productOptionValue ;
156
156
$ this ->optionTypeFactory = $ optionFactory ;
157
157
$ this ->string = $ string ;
158
158
$ this ->validatorPool = $ validatorPool ;
159
- $ this ->groupsPool = $ groupsPool ;
160
- $ this ->typesPool = $ typesPool ;
161
159
$ this ->customOptionValuesFactory = $ customOptionValuesFactory ?:
162
160
\Magento \Framework \App \ObjectManager::getInstance ()->get (ProductCustomOptionValuesInterfaceFactory::class);
161
+ $ this ->optionGroups = $ optionGroups ;
162
+ $ this ->optionGroupsToTypes = $ optionGroupsToTypes ;
163
163
164
164
parent ::__construct (
165
165
$ context ,
@@ -332,21 +332,21 @@ public function getGroupByType($type = null): string
332
332
$ type = $ this ->getType ();
333
333
}
334
334
335
- return $ this ->typesPool [$ type ] ?? '' ;
335
+ return $ this ->optionGroupsToTypes [$ type ] ?? '' ;
336
336
}
337
337
338
338
/**
339
339
* Group model factory
340
340
*
341
341
* @param string $type Option type
342
- * @return DefaultType
342
+ * @return DataObject
343
343
* @throws LocalizedException
344
344
*/
345
- public function groupFactory ($ type ): DefaultType
345
+ public function groupFactory ($ type )
346
346
{
347
347
$ group = $ this ->getGroupByType ($ type );
348
- if (!empty ($ group ) && isset ($ this ->groupsPool [$ group ])) {
349
- return $ this ->optionTypeFactory ->create ($ this ->groupsPool [$ group ]);
348
+ if (!empty ($ group ) && isset ($ this ->optionGroups [$ group ])) {
349
+ return $ this ->optionTypeFactory ->create ($ this ->optionGroups [$ group ]);
350
350
}
351
351
throw new LocalizedException (__ ('The option type to get group instance is incorrect. ' ));
352
352
}
0 commit comments