File tree Expand file tree Collapse file tree 3 files changed +13
-7
lines changed
DownloadableGraphQl/Model
GroupedProductGraphQl/Model Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 8
8
namespace Magento \BundleGraphQl \Model ;
9
9
10
10
use Magento \Framework \GraphQl \Query \Resolver \TypeResolverInterface ;
11
+ use Magento \Bundle \Model \Product \Type as Type ;
11
12
12
13
/**
13
14
* {@inheritdoc}
14
15
*/
15
16
class BundleProductTypeResolver implements TypeResolverInterface
16
17
{
18
+ const BUNDLE_PRODUCT = 'BundleProduct ' ;
19
+
17
20
/**
18
21
* {@inheritdoc}
19
22
*/
20
23
public function resolveType (array $ data ) : string
21
24
{
22
- if (isset ($ data ['type_id ' ]) && $ data ['type_id ' ] == ' bundle ' ) {
23
- return ' BundleProduct ' ;
25
+ if (isset ($ data ['type_id ' ]) && $ data ['type_id ' ] == Type:: TYPE_CODE ) {
26
+ return self :: BUNDLE_PRODUCT ;
24
27
}
25
28
return '' ;
26
29
}
Original file line number Diff line number Diff line change 8
8
namespace Magento \DownloadableGraphQl \Model ;
9
9
10
10
use Magento \Framework \GraphQl \Query \Resolver \TypeResolverInterface ;
11
+ use Magento \Downloadable \Model \Product \Type as Type ;
11
12
12
13
/**
13
14
* {@inheritdoc}
14
15
*/
15
16
class DownloadableProductTypeResolver implements TypeResolverInterface
16
17
{
18
+ const DOWNLOADABLE_PRODUCT = 'DownloadableProduct ' ;
17
19
/**
18
20
* {@inheritdoc}
19
21
*/
20
22
public function resolveType (array $ data ) : string
21
23
{
22
- if (isset ($ data ['type_id ' ]) && $ data ['type_id ' ] == ' downloadable ' ) {
23
- return ' DownloadableProduct ' ;
24
+ if (isset ($ data ['type_id ' ]) && $ data ['type_id ' ] == Type:: TYPE_DOWNLOADABLE ) {
25
+ return self :: DOWNLOADABLE_PRODUCT ;
24
26
}
25
27
return '' ;
26
28
}
Original file line number Diff line number Diff line change 8
8
namespace Magento \GroupedProductGraphQl \Model ;
9
9
10
10
use Magento \Framework \GraphQl \Query \Resolver \TypeResolverInterface ;
11
-
11
+ use Magento \ GroupedProduct \ Model \ Product \ Type \ Grouped as Type ;
12
12
/**
13
13
* {@inheritdoc}
14
14
*/
15
15
class GroupedProductTypeResolver implements TypeResolverInterface
16
16
{
17
+ const GROUPED_PRODUCT = 'GroupedProduct ' ;
17
18
/**
18
19
* {@inheritdoc}
19
20
*/
20
21
public function resolveType (array $ data ) : string
21
22
{
22
- if (isset ($ data ['type_id ' ]) && $ data ['type_id ' ] == ' grouped ' ) {
23
- return ' GroupedProduct ' ;
23
+ if (isset ($ data ['type_id ' ]) && $ data ['type_id ' ] == Type:: TYPE_CODE ) {
24
+ return self :: GROUPED_PRODUCT ;
24
25
}
25
26
return '' ;
26
27
}
You can’t perform that action at this time.
0 commit comments