Skip to content

Commit ba19876

Browse files
author
Yu Tang
committed
MAGETWO-33662: Refactor Downloadable module to use mutable data object interfaces
1 parent 31e4834 commit ba19876

File tree

12 files changed

+724
-76
lines changed

12 files changed

+724
-76
lines changed

app/code/Magento/Downloadable/Api/Data/File/ContentInterface.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,26 @@ interface ContentInterface extends \Magento\Framework\Api\ExtensibleDataInterfac
1717
*/
1818
public function getFileData();
1919

20+
/**
21+
* Set data (base64 encoded content)
22+
*
23+
* @param string $fileData
24+
* @return $this
25+
*/
26+
public function setFileData($fileData);
27+
2028
/**
2129
* Retrieve file name
2230
*
2331
* @return string
2432
*/
2533
public function getName();
34+
35+
/**
36+
* Set file name
37+
*
38+
* @param string $name
39+
* @return $this
40+
*/
41+
public function setName($name);
2642
}

app/code/Magento/Downloadable/Api/Data/LinkContentInterface.php

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,73 +17,161 @@ interface LinkContentInterface extends \Magento\Framework\Api\ExtensibleDataInte
1717
*/
1818
public function getTitle();
1919

20+
/**
21+
* Set sample title
22+
*
23+
* @param string $title
24+
* @return $this
25+
*/
26+
public function setTitle($title);
27+
2028
/**
2129
* Retrieve sample sort order
2230
*
2331
* @return int
2432
*/
2533
public function getSortOrder();
2634

35+
/**
36+
* Set sample sort order
37+
*
38+
* @param int $sortOrder
39+
* @return $this
40+
*/
41+
public function setSortOrder($sortOrder);
42+
2743
/**
2844
* Retrieve link price
2945
*
3046
* @return string
3147
*/
3248
public function getPrice();
3349

50+
/**
51+
* Set link price
52+
*
53+
* @param string $price
54+
* @return $this
55+
*/
56+
public function setPrice($price);
57+
3458
/**
3559
* Retrieve number of allowed downloads of the link
3660
*
3761
* @return int
3862
*/
3963
public function getNumberOfDownloads();
4064

65+
/**
66+
* Set number of allowed downloads of the link
67+
*
68+
* @param int $numberOfDownloads
69+
* @return $this
70+
*/
71+
public function setNumberOfDownloads($numberOfDownloads);
72+
4173
/**
4274
* Check if link is shareable
4375
*
4476
* @return bool
4577
*/
4678
public function isShareable();
4779

80+
/**
81+
* Set whether link is shareable
82+
*
83+
* @param bool $shareable
84+
* @return $this
85+
*/
86+
public function setShareable($shareable);
87+
4888
/**
4989
* Retrieve link file content
5090
*
5191
* @return \Magento\Downloadable\Api\Data\File\ContentInterface|null
5292
*/
5393
public function getLinkFile();
5494

95+
/**
96+
* Set link file content
97+
*
98+
* @param \Magento\Downloadable\Api\Data\File\ContentInterface $linkFile
99+
* @return $this
100+
*/
101+
public function setLinkFile(\Magento\Downloadable\Api\Data\File\ContentInterface $linkFile = null);
102+
55103
/**
56104
* Retrieve link URL
57105
*
58106
* @return string|null
59107
*/
60108
public function getLinkUrl();
61109

110+
/**
111+
* Set link URL
112+
*
113+
* @param string $linkUrl
114+
* @return $this
115+
*/
116+
public function setLinkUrl($linkUrl);
117+
62118
/**
63119
* Retrieve link type ('url' or 'file')
64120
*
65121
* @return string|null
66122
*/
67123
public function getLinkType();
68124

125+
/**
126+
* Set link type ('url' or 'file')
127+
*
128+
* @param string $linkType
129+
* @return $this
130+
*/
131+
public function setLinkType($linkType);
132+
69133
/**
70134
* Retrieve sample file content
71135
*
72136
* @return \Magento\Downloadable\Api\Data\File\ContentInterface|null
73137
*/
74138
public function getSampleFile();
75139

140+
/**
141+
* Retrieve sample file content
142+
*
143+
* @param \Magento\Downloadable\Api\Data\File\ContentInterface $sampleFile
144+
* @return $this
145+
*/
146+
public function setSampleFile(\Magento\Downloadable\Api\Data\File\ContentInterface $sampleFile = null);
147+
76148
/**
77149
* Retrieve sample URL
78150
*
79151
* @return string|null
80152
*/
81153
public function getSampleUrl();
82154

155+
/**
156+
* Set sample URL
157+
*
158+
* @param string $sampleUrl
159+
* @return $this
160+
*/
161+
public function setSampleUrl($sampleUrl);
162+
83163
/**
84164
* Retrieve sample type ('url' or 'file')
85165
*
86166
* @return string|null
87167
*/
88168
public function getSampleType();
169+
170+
/**
171+
* Set sample type ('url' or 'file')
172+
*
173+
* @param string $sampleType
174+
* @return $this
175+
*/
176+
public function setSampleType($sampleType);
89177
}

app/code/Magento/Downloadable/Api/Data/LinkInterface.php

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,34 @@ interface LinkInterface extends \Magento\Framework\Api\ExtensibleDataInterface
1616
*/
1717
public function getId();
1818

19+
/**
20+
* @param int $id
21+
* @return $this
22+
*/
23+
public function setId($id);
24+
1925
/**
2026
* @return string|null
2127
*/
2228
public function getTitle();
2329

30+
/**
31+
* @param string $title
32+
* @return $this
33+
*/
34+
public function setTitle($title);
35+
2436
/**
2537
* @return int
2638
*/
2739
public function getSortOrder();
2840

41+
/**
42+
* @param int $sortOrder
43+
* @return $this
44+
*/
45+
public function setSortOrder($sortOrder);
46+
2947
/**
3048
* Link shareable status
3149
* 0 -- No
@@ -36,13 +54,27 @@ public function getSortOrder();
3654
*/
3755
public function getIsShareable();
3856

57+
/**
58+
* @param int $isShareable
59+
* @return $this
60+
*/
61+
public function setIsShareable($isShareable);
62+
3963
/**
4064
* Link price
4165
*
4266
* @return float
4367
*/
4468
public function getPrice();
4569

70+
/**
71+
* Set link price
72+
*
73+
* @param float $price
74+
* @return $this
75+
*/
76+
public function setPrice($price);
77+
4678
/**
4779
* Number of downloads per user
4880
* Null for unlimited downloads
@@ -51,41 +83,94 @@ public function getPrice();
5183
*/
5284
public function getNumberOfDownloads();
5385

86+
/**
87+
* Set number of downloads per user
88+
* Null for unlimited downloads
89+
*
90+
* @param int $numberOfDownloads
91+
* @return $this
92+
*/
93+
public function setNumberOfDownloads($numberOfDownloads);
94+
5495
/**
5596
* @return string
5697
*/
5798
public function getLinkType();
5899

100+
/**
101+
* @param string $linkType
102+
* @return $this
103+
*/
104+
public function setLinkType($linkType);
105+
59106
/**
60107
* Return file path or null when type is 'url'
61108
*
62109
* @return string|null relative file path
63110
*/
64111
public function getLinkFile();
65112

113+
/**
114+
* Set file path or null when type is 'url'
115+
*
116+
* @param string $linkFile
117+
* @return $this
118+
*/
119+
public function setLinkFile($linkFile);
120+
66121
/**
67122
* Return URL or NULL when type is 'file'
68123
*
69124
* @return string|null file URL
70125
*/
71126
public function getLinkUrl();
72127

128+
/**
129+
* Set URL
130+
*
131+
* @param string $linkUrl
132+
* @return $this
133+
*/
134+
public function setLinkUrl($linkUrl);
135+
73136
/**
74137
* @return string
75138
*/
76139
public function getSampleType();
77140

141+
/**
142+
* @param string $sampleType
143+
* @return $this
144+
*/
145+
public function setSampleType($sampleType);
146+
78147
/**
79148
* Return file path or null when type is 'url'
80149
*
81150
* @return string|null relative file path
82151
*/
83152
public function getSampleFile();
84153

154+
/**
155+
* Set file path
156+
*
157+
* @param string $sampleFile
158+
* @return $this
159+
*/
160+
public function setSampleFile($sampleFile);
161+
85162
/**
86163
* Return URL or NULL when type is 'file'
87164
*
88165
* @return string|null file URL
89166
*/
90167
public function getSampleUrl();
168+
169+
/**
170+
* Set URL
171+
*
172+
* @param string $sampleUrl
173+
* @return $this
174+
*/
175+
public function setSampleUrl($sampleUrl);
91176
}

0 commit comments

Comments
 (0)