2323abstract class AbstractType
2424{
2525 /**
26- * Common attributes cache
27- *
2826 * @var array
2927 */
3028 public static $ commonAttributesCache = [];
@@ -149,8 +147,6 @@ abstract class AbstractType
149147 protected $ metadataPool ;
150148
151149 /**
152- * Product entity link field
153- *
154150 * @var string
155151 */
156152 private $ productEntityLinkField ;
@@ -332,6 +328,7 @@ protected function attachAttributesById($attributeSetName, $attributeIds)
332328
333329 if ($ attribute ->getIsVisible () || in_array ($ attributeCode , $ this ->_forcedAttributesCodes )) {
334330 if (!isset (self ::$ commonAttributesCache [$ attributeId ])) {
331+ $ defaultValue = $ attribute ->getDefaultValue ();
335332 self ::$ commonAttributesCache [$ attributeId ] = [
336333 'id ' => $ attributeId ,
337334 'code ' => $ attributeCode ,
@@ -342,9 +339,8 @@ protected function attachAttributesById($attributeSetName, $attributeIds)
342339 'is_static ' => $ attribute ->isStatic (),
343340 'apply_to ' => $ attribute ->getApplyTo (),
344341 'type ' => \Magento \ImportExport \Model \Import::getAttributeType ($ attribute ),
345- 'default_value ' => strlen (
346- $ attribute ->getDefaultValue ()
347- ) ? $ attribute ->getDefaultValue () : null ,
342+ 'default_value ' => (is_string ($ defaultValue ) && strlen ($ defaultValue )) ?
343+ $ attribute ->getDefaultValue () : null ,
348344 'options ' => $ this ->_entityModel ->getAttributeOptions (
349345 $ attribute ,
350346 $ this ->_indexValueAttributes
@@ -597,6 +593,7 @@ public function saveData()
597593 protected function getMetadataPool ()
598594 {
599595 if (!$ this ->metadataPool ) {
596+ // phpcs:ignore Magento2.PHP.AutogeneratedClassNotInConstructor
600597 $ this ->metadataPool = \Magento \Framework \App \ObjectManager::getInstance ()
601598 ->get (\Magento \Framework \EntityManager \MetadataPool::class);
602599 }
0 commit comments