1

Recently I saw Setup/Patch/Data with 'type' => 'static'

$eavSetup->addAttribute(
        \Magento\Catalog\Model\Product::ENTITY,
        'attribute_code',
        [
            'group' => 'General',
            'label' => 'Product Type ID',
            'type'  => 'static',
            'input' => 'select',
            'source' => \Vendor\Module\Model\Source\Source::class,
            'required' => false,
            'sort_order' => 1,
            'global' => Attribute::SCOPE_GLOBAL,
            'used_in_product_listing' => false,
            'visible_on_front' => false,
        ]
    );

How does this static type work and when should I use it? Thank's for any information))

1 Answer 1

0

In short details :

'type' => 'static' means that attributes is stored in main eav table. For ex : position is stored in catalog_category_entity table.

You can see here that attribute created from vendor/magento/module-catalog/Setup/CategorySetup.php

1
  • Thank's, for your answer
    – LolKek
    Oct 14, 2022 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.