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) |
|
162 | |||
163 | /** |
||
164 | * Return's mapping for the supported backend types (for the product entity) => persist methods. |
||
165 | * |
||
166 | * @return array The mapping for the supported backend types |
||
167 | */ |
||
168 | 1 | public function getBackendTypes() |
|
172 | |||
173 | /** |
||
174 | * Set's the attribute set of the product that has to be created. |
||
175 | * |
||
176 | * @param array $attributeSet The attribute set |
||
177 | * |
||
178 | * @return void |
||
179 | */ |
||
180 | 5 | public function setAttributeSet(array $attributeSet) |
|
184 | |||
185 | /** |
||
186 | * Return's the attribute set of the product that has to be created. |
||
187 | * |
||
188 | * @return array The attribute set |
||
189 | */ |
||
190 | 1 | public function getAttributeSet() |
|
194 | |||
195 | /** |
||
196 | * Cast's the passed value based on the backend type information. |
||
197 | * |
||
198 | * @param string $backendType The backend type to cast to |
||
199 | * @param mixed $value The value to be casted |
||
200 | * |
||
201 | * @return mixed The casted value |
||
202 | */ |
||
203 | 9 | public function castValueByBackendType($backendType, $value) |
|
224 | |||
225 | /** |
||
226 | * Return's the entity type code to be used. |
||
227 | * |
||
228 | * @return string The entity type code to be used |
||
229 | */ |
||
230 | 22 | public function getEntityTypeCode() |
|
244 | |||
245 | /** |
||
246 | * Return's the attribute set with the passed attribute set name. |
||
247 | * |
||
248 | * @param string $attributeSetName The name of the requested attribute set |
||
249 | * |
||
250 | * @return array The attribute set data |
||
251 | * @throws \Exception Is thrown, if the attribute set or the given entity type with the passed name is not available |
||
252 | */ |
||
253 | 3 | public function getAttributeSetByAttributeSetName($attributeSetName) |
|
281 | |||
282 | /** |
||
283 | * Return's the attributes for the attribute set of the product that has to be created. |
||
284 | * |
||
285 | * @return array The attributes |
||
286 | * @throws \Exception Is thrown, if the attribute set or the given entity type with the passed name is not available |
||
287 | */ |
||
288 | 5 | public function getAttributes() |
|
324 | |||
325 | /** |
||
326 | * Return's an array with the available user defined EAV attributes for the actual entity type. |
||
327 | * |
||
328 | * @return array The array with the user defined EAV attributes |
||
329 | */ |
||
330 | 22 | public function getEavUserDefinedAttributes() |
|
344 | |||
345 | /** |
||
346 | * Return's the EAV attribute with the passed attribute code. |
||
347 | * |
||
348 | * @param string $attributeCode The attribute code |
||
349 | * |
||
350 | * @return array The array with the EAV attribute |
||
351 | * @throws \Exception Is thrown if the attribute with the passed code is not available |
||
352 | */ |
||
353 | 2 | public function getEavAttributeByAttributeCode($attributeCode) |
|
371 | } |
||
372 |