6
6
7
7
namespace Magento \Catalog \Model ;
8
8
9
- use Magento \Framework \Exception \InputException ;
9
+ use Magento \Catalog \Api \CategoryLinkRepositoryInterface ;
10
+ use Magento \Catalog \Api \CategoryListDeleteBySkuInterface ;
11
+ use Magento \Catalog \Api \CategoryRepositoryInterface ;
12
+ use Magento \Catalog \Api \ProductRepositoryInterface ;
13
+ use Magento \Catalog \Model \ResourceModel \Product ;
14
+ use Magento \Framework \App \ObjectManager ;
10
15
use Magento \Framework \Exception \CouldNotSaveException ;
16
+ use Magento \Framework \Exception \InputException ;
11
17
12
- class CategoryLinkRepository implements \Magento \Catalog \Api \CategoryLinkRepositoryInterface,
13
- \Magento \Catalog \Api \CategoryListDeleteBySkuInterface
18
+ /**
19
+ * @inheritdoc
20
+ */
21
+ class CategoryLinkRepository implements CategoryLinkRepositoryInterface, CategoryListDeleteBySkuInterface
14
22
{
15
23
/**
16
24
* @var CategoryRepository
17
25
*/
18
26
protected $ categoryRepository ;
19
27
20
28
/**
21
- * @var \Magento\Catalog\Api\ ProductRepositoryInterface
29
+ * @var ProductRepositoryInterface
22
30
*/
23
31
protected $ productRepository ;
24
32
25
33
/**
26
- * @var \Magento\Catalog\Model\ResourceModel\ Product
34
+ * @var Product
27
35
*/
28
36
private $ productResource ;
29
37
30
38
/**
31
- * @param \Magento\Catalog\Api\ CategoryRepositoryInterface $categoryRepository
32
- * @param \Magento\Catalog\Api\ ProductRepositoryInterface $productRepository
33
- * @param \Magento\Catalog\Model\ResourceModel\ Product $productResource
39
+ * @param CategoryRepositoryInterface $categoryRepository
40
+ * @param ProductRepositoryInterface $productRepository
41
+ * @param Product $productResource
34
42
*/
35
43
public function __construct (
36
- \ Magento \ Catalog \ Api \ CategoryRepositoryInterface $ categoryRepository ,
37
- \ Magento \ Catalog \ Api \ ProductRepositoryInterface $ productRepository ,
38
- \ Magento \ Catalog \ Model \ ResourceModel \ Product $ productResource = null
44
+ CategoryRepositoryInterface $ categoryRepository ,
45
+ ProductRepositoryInterface $ productRepository ,
46
+ Product $ productResource = null
39
47
) {
40
48
$ this ->categoryRepository = $ categoryRepository ;
41
49
$ this ->productRepository = $ productRepository ;
42
- $ this ->productResource = $ productResource ?? \ Magento \ Framework \ App \ ObjectManager::getInstance ()->get (\ Magento \ Catalog \ Model \ ResourceModel \ Product::class);
50
+ $ this ->productResource = $ productResource ?? ObjectManager::getInstance ()->get (Product::class);
43
51
}
44
52
45
53
/**
46
- * { @inheritdoc}
54
+ * @inheritdoc
47
55
*/
48
56
public function save (\Magento \Catalog \Api \Data \CategoryProductLinkInterface $ productLink )
49
57
{
@@ -69,15 +77,15 @@ public function save(\Magento\Catalog\Api\Data\CategoryProductLinkInterface $pro
69
77
}
70
78
71
79
/**
72
- * { @inheritdoc}
80
+ * @inheritdoc
73
81
*/
74
82
public function delete (\Magento \Catalog \Api \Data \CategoryProductLinkInterface $ productLink )
75
83
{
76
84
return $ this ->deleteByIds ($ productLink ->getCategoryId (), $ productLink ->getSku ());
77
85
}
78
86
79
87
/**
80
- * { @inheritdoc}
88
+ * @inheritdoc
81
89
*/
82
90
public function deleteByIds ($ categoryId , $ sku )
83
91
{
@@ -112,7 +120,7 @@ public function deleteByIds($categoryId, $sku)
112
120
}
113
121
114
122
/**
115
- * {@inheritDoc}
123
+ * @inheritdoc
116
124
*/
117
125
public function deleteBySkus (int $ categoryId , array $ productSkuList ): bool
118
126
{
0 commit comments