|
@@ 253-280 (lines=28) @@
|
| 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 |
|
public function getAttributeSetByAttributeSetName($attributeSetName) |
| 254 |
|
{ |
| 255 |
|
|
| 256 |
|
// query whether or not attribute sets for the actualy entity type code are available |
| 257 |
|
if (isset($this->attributeSets[$entityTypeCode = $this->getEntityTypeCode()])) { |
| 258 |
|
// load the attribute sets for the actualy entity type code |
| 259 |
|
$attributSets = $this->attributeSets[$entityTypeCode]; |
| 260 |
|
|
| 261 |
|
// query whether or not, the requested attribute set is available |
| 262 |
|
if (isset($attributSets[$attributeSetName])) { |
| 263 |
|
return $attributSets[$attributeSetName]; |
| 264 |
|
} |
| 265 |
|
|
| 266 |
|
// throw an exception, if not |
| 267 |
|
throw new \Exception( |
| 268 |
|
$this->appendExceptionSuffix( |
| 269 |
|
sprintf('Found invalid attribute set name "%s"', $attributeSetName) |
| 270 |
|
) |
| 271 |
|
); |
| 272 |
|
} |
| 273 |
|
|
| 274 |
|
// throw an exception, if not |
| 275 |
|
throw new \Exception( |
| 276 |
|
$this->appendExceptionSuffix( |
| 277 |
|
sprintf('Found invalid entity type code "%s"', $entityTypeCode) |
| 278 |
|
) |
| 279 |
|
); |
| 280 |
|
} |
| 281 |
|
|
| 282 |
|
/** |
| 283 |
|
* Return's the attributes for the attribute set of the product that has to be created. |
|
@@ 288-315 (lines=28) @@
|
| 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 |
|
public function getAttributes() |
| 289 |
|
{ |
| 290 |
|
|
| 291 |
|
// query whether or not, the requested EAV attributes are available |
| 292 |
|
if (isset($this->attributes[$entityTypeCode = $this->getEntityTypeCode()])) { |
| 293 |
|
// load the attributes for the entity type code |
| 294 |
|
$attributes = $this->attributes[$entityTypeCode]; |
| 295 |
|
|
| 296 |
|
// query whether or not attributes for the actual attribute set name |
| 297 |
|
if (isset($attributes[$attributeSetName = $this->attributeSet[MemberNames::ATTRIBUTE_SET_NAME]])) { |
| 298 |
|
return $attributes[$attributeSetName]; |
| 299 |
|
} |
| 300 |
|
|
| 301 |
|
// throw an exception, if not |
| 302 |
|
throw new \Exception( |
| 303 |
|
$this->appendExceptionSuffix( |
| 304 |
|
sprintf('Found invalid attribute set name "%s"', $attributeSetName) |
| 305 |
|
) |
| 306 |
|
); |
| 307 |
|
} |
| 308 |
|
|
| 309 |
|
// throw an exception, if not |
| 310 |
|
throw new \Exception( |
| 311 |
|
$this->appendExceptionSuffix( |
| 312 |
|
sprintf('Found invalid entity type code "%s"', $entityTypeCode) |
| 313 |
|
) |
| 314 |
|
); |
| 315 |
|
} |
| 316 |
|
|
| 317 |
|
/** |
| 318 |
|
* Return's an array with the available user defined EAV attributes for the actual entity type. |