_init('weltpixel_ln_attribute_options', 'id'); } /** * Load Attribute display option by attribute_id & store_id * * @param \WeltPixel\LayeredNavigation\Model\AttributeOptions $attributeOptions * @param $attributeId * @throws \Magento\Framework\Exception\LocalizedException */ public function loadDisplayOptionsByAttribute( \WeltPixel\LayeredNavigation\Model\AttributeOptions $attributeOptions, $attributeId ) { if (isset($this->loadedAttributes[$attributeId])) { $attributeOptions->setData($this->loadedAttributes[$attributeId]->getData()); return $this; } $connection = $this->getConnection(); $bind = [ 'attribute_id' => $attributeId ]; $select = $connection->select()->from( $this->getMainTable(), [$this->getIdFieldName()] )->where( 'attribute_id = :attribute_id' ); $lineId = $connection->fetchOne($select, $bind); if ($lineId) { $this->load($attributeOptions, $lineId); } else { $attributeOptions->setData([]); } $this->loadedAttributes[$attributeId] = clone $attributeOptions; } }