/**
  * Check if an attribute can be indexed.
  *
  * @param AttributeInterface $attribute Entity attribute.
  *
  * @return boolean
  */
 private function canIndexAttribute(AttributeInterface $attribute)
 {
     $canIndex = $attribute->getBackendType() != 'static';
     if ($canIndex && $attribute->getBackendModel()) {
         $canIndex = in_array($attribute->getBackendModel(), $this->indexedBackendModels);
     }
     return $canIndex;
 }
Beispiel #2
0
 /**
  * Ensure types of numerical values is correct before indexing.
  *
  * @param AttributeInterface $attribute Product attribute.
  * @param mixed              $value     Raw value.
  *
  * @return mixed
  */
 private function prepareSimpleIndexAttributeValue(AttributeInterface $attribute, $value)
 {
     if ($attribute->getBackendType() == 'decimal') {
         $value = floatval($value);
     } elseif ($attribute->getBackendType() == 'int') {
         $value = intval($value);
     }
     return $value;
 }