Ejemplo n.º 1
0
 /**
  * Determine filter type for static attribute.
  *
  * @static
  * @param \Magento\Eav\Model\Entity\Attribute $attribute
  * @return string
  */
 public static function getStaticAttributeFilterType(\Magento\Eav\Model\Entity\Attribute $attribute)
 {
     if (in_array($attribute->getAttributeCode(), ['category_ids', 'media_gallery'])) {
         return self::FILTER_TYPE_INPUT;
     }
     $columns = $attribute->getFlatColumns();
     switch ($columns[$attribute->getAttributeCode()]['type']) {
         case \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER:
         case \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT:
             $type = self::FILTER_TYPE_NUMBER;
             break;
         case \Magento\Framework\DB\Ddl\Table::TYPE_DATE:
         case \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME:
         case \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP:
             $type = self::FILTER_TYPE_DATE;
             break;
         default:
             $type = self::FILTER_TYPE_INPUT;
     }
     return $type;
 }