2

I created custom product attributes in custom module. when Add new product is clicked it shows this error message.

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento2_dev.catalog_product_entity_integer' doesn't exist

3

It seems that you have set integer as the backend_type or type property of your attribute. This is not possible. Normally you would use varchar, if you want to store numbers, use int or decimal if you want to store prices or weight.

You can find the types mentioned in the table eav_attribute.

UPDATE

While you are totally correct that you prefer class constants over strings, imho this does not apply here.

\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER should be used when you create or modify columns of a database table. This is not the case, though, when you create a product attribute. This does not change any table structure, but only adds a new row to eav_attribute and catalog_eav_attribute.

If you look, for example, into \Magento\Catalog\Setup\CategorySetup, you will find that even here the type attribute is written as the string "int". So, I guess it's totally fine if you do it like this in your own module.

  • i am defining my type as : 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, for dropdown. whats wrong with this ? – iqbal malik Feb 7 '18 at 6:31
  • I updated the answer – simonthesorcerer Feb 7 '18 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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