本文整理匯總了PHP中Magento\Eav\Model\Entity\Attribute::getFlatColumns方法的典型用法代碼示例。如果您正苦於以下問題:PHP Attribute::getFlatColumns方法的具體用法?PHP Attribute::getFlatColumns怎麽用?PHP Attribute::getFlatColumns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Eav\Model\Entity\Attribute
的用法示例。
在下文中一共展示了Attribute::getFlatColumns方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getStaticAttributeFilterType
/**
* 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;
}