1
1
<?php
2
2
/**
3
- * Copyright © Magento, Inc. All rights reserved.
4
- * See COPYING.txt for license details .
3
+ * Copyright 2015 Adobe
4
+ * All Rights Reserved .
5
5
*/
6
6
namespace Magento \Downloadable \Model \Product \TypeHandler ;
7
7
10
10
use Magento \Downloadable \Model \ComponentInterface ;
11
11
12
12
/**
13
- * Class Link
14
13
* @api
15
14
* @since 100.0.2
16
15
*/
@@ -22,7 +21,7 @@ class Link extends AbstractTypeHandler
22
21
private $ sampleItem = [];
23
22
24
23
/**
25
- * @var \Magento\Downloadable\Model\ComponentInterfaceFactory
24
+ * @var \Magento\Downloadable\Model\LinkFactory
26
25
*/
27
26
private $ linkFactory ;
28
27
@@ -49,54 +48,55 @@ public function __construct(
49
48
}
50
49
51
50
/**
52
- * { @inheritdoc}
51
+ * @inheritdoc
53
52
*/
54
53
public function getDataKey ()
55
54
{
56
55
return 'link ' ;
57
56
}
58
57
59
58
/**
60
- * { @inheritdoc}
59
+ * @inheritdoc
61
60
*/
62
61
public function getIdentifierKey ()
63
62
{
64
63
return 'link_id ' ;
65
64
}
66
65
67
66
/**
68
- * { @inheritdoc}
67
+ * @inheritdoc
69
68
*/
70
69
public function save (Product $ product , array $ data )
71
70
{
72
71
parent ::save ($ product , $ data );
72
+
73
73
if ($ product ->getLinksPurchasedSeparately ()) {
74
74
$ product ->setIsCustomOptionChanged ();
75
75
}
76
+
77
+ return $ this ;
76
78
}
77
79
78
80
/**
79
- * { @inheritdoc}
81
+ * @inheritdoc
80
82
*/
81
83
protected function clear ()
82
84
{
83
85
$ this ->sampleItem = [];
84
- return parent ::clear ();
86
+
87
+ parent ::clear ();
85
88
}
86
89
87
90
/**
88
- * @return ComponentInterface
91
+ * @inheritdoc
89
92
*/
90
93
protected function createItem ()
91
94
{
92
95
return $ this ->linkFactory ->create ();
93
96
}
94
97
95
98
/**
96
- * @param ComponentInterface $model
97
- * @param array $data
98
- * @param Product $product
99
- * @return void
99
+ * @inheritdoc
100
100
*/
101
101
protected function setDataToModel (ComponentInterface $ model , array $ data , Product $ product )
102
102
{
@@ -124,17 +124,15 @@ protected function setDataToModel(ComponentInterface $model, array $data, Produc
124
124
}
125
125
126
126
/**
127
- * @param ComponentInterface $model
128
- * @param Product $product
129
- * @return void
127
+ * @inheritdoc
130
128
*/
131
129
protected function linkToProduct (ComponentInterface $ model , Product $ product )
132
130
{
133
131
$ product ->setLastAddedLinkId ($ model ->getId ());
134
132
}
135
133
136
134
/**
137
- * @return void
135
+ * @inheritdoc
138
136
*/
139
137
protected function processDelete ()
140
138
{
@@ -144,7 +142,7 @@ protected function processDelete()
144
142
}
145
143
146
144
/**
147
- * { @inheritdoc}
145
+ * @inheritdoc
148
146
*/
149
147
protected function saveItem (Product $ product , array $ item )
150
148
{
@@ -156,9 +154,7 @@ protected function saveItem(Product $product, array $item)
156
154
}
157
155
158
156
/**
159
- * @param ComponentInterface $model
160
- * @param array $files
161
- * @return void
157
+ * @inheritdoc
162
158
*/
163
159
protected function setFiles (ComponentInterface $ model , array $ files )
164
160
{
0 commit comments