1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Product\Media\Subjects\MediaSubject |
5
|
|
|
* |
6
|
|
|
* NOTICE OF LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
9
|
|
|
* that is available through the world-wide-web at this URL: |
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
11
|
|
|
* |
12
|
|
|
* PHP version 5 |
13
|
|
|
* |
14
|
|
|
* @author Tim Wagner <[email protected]> |
15
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/techdivision/import-product-media |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Product\Media\Subjects; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* A trait implementation that provides functionality to handle the media import on subject level. |
25
|
|
|
* |
26
|
|
|
* @author Tim Wagner <[email protected]> |
27
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
28
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
29
|
|
|
* @link https://github.com/techdivision/import-product-media |
30
|
|
|
* @link http://www.techdivision.com |
31
|
|
|
*/ |
32
|
|
|
trait MediaSubjectTrait |
33
|
|
|
{ |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* The ID of the parent product to relate the variant with. |
37
|
|
|
* |
38
|
|
|
* @var integer |
39
|
|
|
*/ |
40
|
|
|
protected $parentId; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* The value ID of the created media gallery entry. |
44
|
|
|
* |
45
|
|
|
* @var integer |
46
|
|
|
*/ |
47
|
|
|
protected $parentValueId; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* The Magento installation directory. |
51
|
|
|
* |
52
|
|
|
* @var string |
53
|
|
|
*/ |
54
|
|
|
protected $installationDir; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* The position counter, if no position for the product media gallery value has been specified. |
58
|
|
|
* |
59
|
|
|
* @var integer |
60
|
|
|
* @deprecated Since 23.0.0 |
61
|
|
|
*/ |
62
|
|
|
protected $positionCounter = 1; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Set's the ID of the parent product to relate the variant with. |
66
|
|
|
* |
67
|
|
|
* @param integer $parentId The ID of the parent product |
68
|
|
|
* |
69
|
|
|
* @return void |
70
|
|
|
*/ |
71
|
|
|
public function setParentId($parentId) |
72
|
|
|
{ |
73
|
|
|
$this->parentId = $parentId; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Return's the ID of the parent product to relate the variant with. |
78
|
|
|
* |
79
|
|
|
* @return integer The ID of the parent product |
80
|
|
|
*/ |
81
|
|
|
public function getParentId() |
82
|
|
|
{ |
83
|
|
|
return $this->parentId; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Set's the value ID of the created media gallery entry. |
88
|
|
|
* |
89
|
|
|
* @param integer $parentValueId The ID of the created media gallery entry |
90
|
|
|
* |
91
|
|
|
* @return void |
92
|
|
|
*/ |
93
|
|
|
public function setParentValueId($parentValueId) |
94
|
|
|
{ |
95
|
|
|
$this->parentValueId = $parentValueId; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Return's the value ID of the created media gallery entry. |
100
|
|
|
* |
101
|
|
|
* @return integer The ID of the created media gallery entry |
102
|
|
|
*/ |
103
|
|
|
public function getParentValueId() |
104
|
|
|
{ |
105
|
|
|
return $this->parentValueId; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Reset the position counter to 1. |
110
|
|
|
* |
111
|
|
|
* @return void |
112
|
|
|
* @deprecated Since 23.0.0 |
113
|
|
|
*/ |
114
|
|
|
public function resetPositionCounter() |
115
|
|
|
{ |
116
|
|
|
$this->positionCounter = 0; |
|
|
|
|
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* Returns the acutal value of the position counter and raise's it by one. |
121
|
|
|
* |
122
|
|
|
* @return integer The actual value of the position counter |
123
|
|
|
* @deprecated Since 23.0.0 |
124
|
|
|
*/ |
125
|
|
|
public function raisePositionCounter() |
126
|
|
|
{ |
127
|
|
|
return $this->positionCounter++; |
|
|
|
|
128
|
|
|
} |
129
|
|
|
} |
130
|
|
|
|
This property has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.