21 private $idToCodeMap = [];
26 private $attributeCollection;
31 private $attributes = [];
47 if (!array_key_exists($attributeId, $this->idToCodeMap)) {
48 $code = $attributeId ===
'options' 50 : $this->attributeCollection->getItemById($attributeId)->getAttributeCode();
51 $this->idToCodeMap[$attributeId] =
$code;
53 return $this->idToCodeMap[$attributeId];
62 if (!array_key_exists(
$attributeCode, array_flip($this->idToCodeMap))) {
65 : $this->attributeCollection->getItemByColumnValue(
'attribute_code',
$attributeCode)->getId();
68 $codeToIdMap = array_flip($this->idToCodeMap);
78 $searchableAttributes = $this->getAttributes();
87 public function getAttributes()
89 if (0 === count($this->attributes)) {
91 $attributesCollection = $this->attributeCollection;
92 foreach ($attributesCollection as
$attribute) {
97 return $this->attributes;
getAttributeCodeById($attributeId)
__construct(Collection $attributeCollection)
getAttribute($attributeCode)
getAttributeIdByCode($attributeCode)