Skip to content

Commit ca13237

Browse files
author
nsyvokonenko
committed
MAGETWO-38138: Stabilize story
1 parent ff74f26 commit ca13237

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

app/code/Magento/ImportExport/Model/Export.php

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,41 @@ public static function getAttributeFilterType(\Magento\Eav\Model\Entity\Attribut
213213
return self::FILTER_TYPE_DATE;
214214
} elseif ('decimal' == $attribute->getBackendType() || 'int' == $attribute->getBackendType()) {
215215
return self::FILTER_TYPE_NUMBER;
216-
} elseif ($attribute->isStatic() ||
217-
'varchar' == $attribute->getBackendType() ||
218-
'text' == $attribute->getBackendType()
219-
) {
216+
} elseif ('varchar' == $attribute->getBackendType() || 'text' == $attribute->getBackendType()) {
220217
return self::FILTER_TYPE_INPUT;
218+
} elseif ($attribute->isStatic()) {
219+
return self::getStaticAttributeFilterType($attribute);
221220
} else {
222221
throw new \Magento\Framework\Exception\LocalizedException(__('Cannot determine attribute filter type'));
223222
}
224223
}
225224

225+
/**
226+
* Determine filter type for static attribute.
227+
*
228+
* @static
229+
* @param \Magento\Eav\Model\Entity\Attribute $attribute
230+
* @return string
231+
*/
232+
public static function getStaticAttributeFilterType(\Magento\Eav\Model\Entity\Attribute $attribute)
233+
{
234+
$columns = $attribute->getFlatColumns();
235+
switch ($columns[$attribute->getAttributeCode()]['type']) {
236+
case \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER:
237+
case \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT:
238+
$type = self::FILTER_TYPE_NUMBER;
239+
break;
240+
case \Magento\Framework\DB\Ddl\Table::TYPE_DATE:
241+
case \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME:
242+
case \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP:
243+
$type = self::FILTER_TYPE_DATE;
244+
break;
245+
default:
246+
$type = self::FILTER_TYPE_INPUT;
247+
}
248+
return $type;
249+
}
250+
226251
/**
227252
* MIME-type for 'Content-Type' header.
228253
*

0 commit comments

Comments
 (0)