Menu

Why product attributes live in 6 tables: Magento 2 EAV vs a Laravel JSON column
📰

Why product attributes live in 6 tables: Magento 2 EAV vs a Laravel JSON column

DEV Community: laravel·Nikita Sirenko·about 23 hours ago
#zd0VCPOm
#devtolaravel#devto#dev#product#value
Long article (971 words) — no AI summary yet.
Reading 0:00
15s threshold

Magento 2 keeps a product's attributes in 6 tables. In Laravel, the same product can be 1 row with a JSON column. Each design makes one thing free and charges for another. Magento gives you new attributes without a migration and charges for them in joins. Laravel gives you one indexed read and charges for it in migrations.

Magento: entity, attribute, value

catalog_product_entity holds the product itself: SKU, type, attribute set, little else. The attribute values sit in 5 more tables, one per data type: _int , _varchar , _decimal , _text and _datetime . Every value row has the same 5 columns: value_id , attribute_id , store_id , entity_id , value . That store_id is why a product name can differ per store view (usually one per language) without any extra schema. The layout is called EAV: entity, attribute, value.

Images, tier prices and category links have tables of their own.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.