1 | <?php |
||
37 | abstract class AbstractEavSubject extends AbstractSubject implements EavSubjectInterface |
||
38 | { |
||
39 | |||
40 | /** |
||
41 | * The available EAV attributes, grouped by their attribute set and the attribute set name as keys. |
||
42 | * |
||
43 | * @var array |
||
44 | */ |
||
45 | protected $attributes = array(); |
||
46 | |||
47 | /** |
||
48 | * The available user defined EAV attributes, grouped by their entity type. |
||
49 | * |
||
50 | * @var array |
||
51 | */ |
||
52 | protected $userDefinedAttributes = array(); |
||
53 | |||
54 | /** |
||
55 | * The attribute set of the entity that has to be created. |
||
56 | * |
||
57 | * @var array |
||
58 | */ |
||
59 | protected $attributeSet = array(); |
||
60 | |||
61 | /** |
||
62 | * The available EAV attribute sets. |
||
63 | * |
||
64 | * @var array |
||
65 | */ |
||
66 | protected $attributeSets = array(); |
||
67 | |||
68 | /** |
||
69 | * The mapping for the supported backend types (for the EAV entity) => persist methods. |
||
70 | * |
||
71 | * @var array |
||
72 | */ |
||
73 | protected $backendTypes = array( |
||
74 | BackendTypeKeys::BACKEND_TYPE_DATETIME => array('persistDatetimeAttribute', 'loadDatetimeAttribute', 'deleteDatetimeAttribute'), |
||
75 | BackendTypeKeys::BACKEND_TYPE_DECIMAL => array('persistDecimalAttribute', 'loadDecimalAttribute', 'deleteDecimalAttribute'), |
||
76 | BackendTypeKeys::BACKEND_TYPE_INT => array('persistIntAttribute', 'loadIntAttribute', 'deleteIntAttribute'), |
||
77 | BackendTypeKeys::BACKEND_TYPE_TEXT => array('persistTextAttribute', 'loadTextAttribute', 'deleteTextAttribute'), |
||
78 | BackendTypeKeys::BACKEND_TYPE_VARCHAR => array('persistVarcharAttribute', 'loadVarcharAttribute', 'deleteVarcharAttribute') |
||
79 | ); |
||
80 | |||
81 | /** |
||
82 | * The mappings for the entity type code to attribute set. |
||
83 | * |
||
84 | * @var array |
||
85 | */ |
||
86 | protected $entityTypeCodeToAttributeSetMappings = array( |
||
87 | EntityTypeCodes::CATALOG_PRODUCT => EntityTypeCodes::CATALOG_PRODUCT, |
||
88 | EntityTypeCodes::CATALOG_PRODUCT_PRICE => EntityTypeCodes::CATALOG_PRODUCT, |
||
89 | EntityTypeCodes::CATALOG_PRODUCT_INVENTORY => EntityTypeCodes::CATALOG_PRODUCT, |
||
90 | EntityTypeCodes::CATALOG_CATEGORY => EntityTypeCodes::CATALOG_CATEGORY, |
||
91 | EntityTypeCodes::EAV_ATTRIBUTE => EntityTypeCodes::EAV_ATTRIBUTE, |
||
92 | EntityTypeCodes::NONE => EntityTypeCodes::NONE |
||
93 | ); |
||
94 | |||
95 | /** |
||
96 | * The default mappings for the user defined attributes, based on the attributes frontend input type. |
||
97 | * |
||
98 | * @var array |
||
99 | */ |
||
100 | protected $defaultFrontendInputCallbackMappings = array(); |
||
101 | |||
102 | /** |
||
103 | * Return's the default callback frontend input mappings for the user defined attributes. |
||
104 | * |
||
105 | * @return array The default frontend input callback mappings |
||
106 | */ |
||
107 | 22 | public function getDefaultFrontendInputCallbackMappings() |
|
111 | |||
112 | /** |
||
113 | * Intializes the previously loaded global data for exactly one bunch. |
||
114 | * |
||
115 | * @param string $serial The serial of the actual import |
||
116 | * |
||
117 | * @return void |
||
118 | */ |
||
119 | 22 | public function setUp($serial) |
|
168 | |||
169 | /** |
||
170 | * Return's mapping for the supported backend types (for the product entity) => persist methods. |
||
171 | * |
||
172 | * @return array The mapping for the supported backend types |
||
173 | */ |
||
174 | 1 | public function getBackendTypes() |
|
178 | |||
179 | /** |
||
180 | * Set's the attribute set of the product that has to be created. |
||
181 | * |
||
182 | * @param array $attributeSet The attribute set |
||
183 | * |
||
184 | * @return void |
||
185 | */ |
||
186 | 5 | public function setAttributeSet(array $attributeSet) |
|
190 | |||
191 | /** |
||
192 | * Return's the attribute set of the product that has to be created. |
||
193 | * |
||
194 | * @return array The attribute set |
||
195 | */ |
||
196 | 1 | public function getAttributeSet() |
|
200 | |||
201 | /** |
||
202 | * Cast's the passed value based on the backend type information. |
||
203 | * |
||
204 | * @param string $backendType The backend type to cast to |
||
205 | * @param mixed $value The value to be casted |
||
206 | * |
||
207 | * @return mixed The casted value |
||
208 | */ |
||
209 | 9 | public function castValueByBackendType($backendType, $value) |
|
230 | |||
231 | /** |
||
232 | * Return's the entity type code to be used. |
||
233 | * |
||
234 | * @return string The entity type code to be used |
||
235 | */ |
||
236 | 22 | public function getEntityTypeCode() |
|
250 | |||
251 | /** |
||
252 | * Return's the attribute set with the passed attribute set name. |
||
253 | * |
||
254 | * @param string $attributeSetName The name of the requested attribute set |
||
255 | * |
||
256 | * @return array The attribute set data |
||
257 | * @throws \Exception Is thrown, if the attribute set or the given entity type with the passed name is not available |
||
258 | */ |
||
259 | 3 | public function getAttributeSetByAttributeSetName($attributeSetName) |
|
287 | |||
288 | /** |
||
289 | * Return's the attributes for the attribute set of the product that has to be created. |
||
290 | * |
||
291 | * @return array The attributes |
||
292 | * @throws \Exception Is thrown, if the attribute set or the given entity type with the passed name is not available |
||
293 | */ |
||
294 | 5 | public function getAttributes() |
|
330 | |||
331 | /** |
||
332 | * Return's an array with the available user defined EAV attributes for the actual entity type. |
||
333 | * |
||
334 | * @return array The array with the user defined EAV attributes |
||
335 | */ |
||
336 | 22 | public function getEavUserDefinedAttributes() |
|
350 | |||
351 | /** |
||
352 | * Return's the EAV attribute with the passed attribute code. |
||
353 | * |
||
354 | * @param string $attributeCode The attribute code |
||
355 | * |
||
356 | * @return array The array with the EAV attribute |
||
357 | * @throws \Exception Is thrown if the attribute with the passed code is not available |
||
358 | */ |
||
359 | 2 | public function getEavAttributeByAttributeCode($attributeCode) |
|
377 | } |
||
378 |