Concepto de EAV

Estas son las entidades en Magento 2. Cada una está asociada a un ResourceModel class, que interacciona con la bbdd, básicamente para hacer acciones CRUD.

    
    +------------------+----------------------------------------------------+
    | entity_type_code | entity_model                                       |
    +------------------+----------------------------------------------------+
    | customer         | Magento\Customer\Model\ResourceModel\Customer      |
    | customer_address | Magento\Customer\Model\ResourceModel\Address       |
    | catalog_category | Magento\Catalog\Model\ResourceModel\Category       |
    | catalog_product  | Magento\Catalog\Model\ResourceModel\Product        |
    | order            | Magento\Sales\Model\ResourceModel\Order            |
    | invoice          | Magento\Sales\Model\ResourceModel\Order\Invoice    |
    | creditmemo       | Magento\Sales\Model\ResourceModel\Order\Creditmemo |
    | shipment         | Magento\Sales\Model\ResourceModel\Order\Shipment   |
    +------------------+----------------------------------------------------+
        

Comparación de una entidad con un objeto del mundo real

Por ejemplo, un pantalón puede tener muchos atributos, tales como color, talla, marca etc. El color puede tener más de un valor: verde, rojo, negro, azul, etc. El pantalón es una entidad. Los atributos del pantalón son el color, talla y marca. Los valores del atributo color puede ser verde, rojo, negro y azul. Si miramos el esquema, podemos ver que hay una tabla intermedia entre la entidad y el atributo. Eso es porque el atributo color puede pertenecer a más de una entidad. Es decir, aparte del pantalón, el vestido, la chaqueta, la blusa etc puede tener el atributo color.

eav_attribute_magento2
EAV Attribute de Magento 2

cada atributo tiene sus propias características


+-------------------------------+-------------------------------------------------+
| Type                          | Value                                           |
+-------------------------------+-------------------------------------------------+
| ID                            | 93                                              |
| Code                          | color                                           |
| Attribute-Set-ID              |                                                 |
| Visible-On-Front              | no                                              |
| Attribute-Model               |                                                 |
| Backend-Model                 |                                                 |
| Backend-Table                 | catalog_product_entity_int                      |
| Backend-Type                  | int                                             |
| Source-Model                  | Magento\Eav\Model\Entity\Attribute\Source\Table |
| Cache-ID-Tags                 |                                                 |
| Cache-Tags                    | EAV_ATTRIBUTE                                   |
| Default-Value                 |                                                 |
| Flat-Columns                  | color,color_value                               |
| Flat-Indexes                  |                                                 |
| Frontend-Label                | Color                                           |
| Frontend-Class                |                                                 |
| Frontend-Input-Type           | select                                          |
| Frontend-Input-Renderer-Class |                                                 |
+-------------------------------+-------------------------------------------------+

EAV: form

Estas son las entidades del formulario y éstas dependen de algún entity_type_code

    +-----------------------------------+
    | code                              |
    +-----------------------------------+
    | checkout_onepage_billing_address  |
    | checkout_onepage_register         |
    | checkout_onepage_register_guest   |
    | checkout_onepage_shipping_address |
    +-----------------------------------+

Lista de los atributos de la entidad customer_address


+---------------------+----+-----------------------+---------------------------------------+
| code                | id | entity_type           | label                                 |
+---------------------+----+-----------------------+---------------------------------------+
| city                | 29 | customer_address (#2) | City                                  |
| company             | 27 | customer_address (#2) | Company                               |
| country_id          | 30 | customer_address (#2) | Country                               |
| fax                 | 35 | customer_address (#2) | Fax                                   |
| firstname           | 23 | customer_address (#2) | First Name                            |
| lastname            | 25 | customer_address (#2) | Last Name                             |
| middlename          | 24 | customer_address (#2) | Middle Name/Initial                   |
| postcode            | 33 | customer_address (#2) | Zip/Postal Code                       |
| prefix              | 22 | customer_address (#2) | Name Prefix                           |
| region              | 31 | customer_address (#2) | State/Province                        |
| region_id           | 32 | customer_address (#2) | State/Province                        |
| street              | 28 | customer_address (#2) | Street Address                        |
| suffix              | 26 | customer_address (#2) | Name Suffix                           |
| telephone           | 34 | customer_address (#2) | Phone Number                          |
| vat_id              | 36 | customer_address (#2) | VAT Number                            |
| vat_is_valid        | 37 | customer_address (#2) | VAT number validity                   |
| vat_request_date    | 39 | customer_address (#2) | VAT number validation request date    |
| vat_request_id      | 38 | customer_address (#2) | VAT number validation request ID      |
| vat_request_success | 40 | customer_address (#2) | VAT number validation request success |
+---------------------+----+-----------------------+---------------------------------------+

Lista de los atributos de la entidad catalog_product

+--------------------------------+-----+----------------------+-----------------------------------+
| code                           | id  | entity_type          | label                             |
+--------------------------------+-----+----------------------+-----------------------------------+
| category_ids                   | 105 | catalog_product (#4) | Categories                        |
| color                          | 93  | catalog_product (#4) | Color                             |
| cost                           | 81  | catalog_product (#4) | Cost                              |
| country_of_manufacture         | 114 | catalog_product (#4) | Country of Manufacture            |
| created_at                     | 112 | catalog_product (#4) |                                   |
| custom_design                  | 100 | catalog_product (#4) | New Theme                         |
| custom_design_from             | 101 | catalog_product (#4) | Active From                       |
| custom_design_to               | 102 | catalog_product (#4) | Active To                         |
| custom_layout                  | 116 | catalog_product (#4) | New Layout                        |
| custom_layout_update           | 103 | catalog_product (#4) | Layout Update XML                 |
| custom_layout_update_file      | 117 | catalog_product (#4) | Custom Layout Update              |
| description                    | 75  | catalog_product (#4) | Description                       |
| gallery                        | 96  | catalog_product (#4) | Image Gallery                     |
| gift_message_available         | 134 | catalog_product (#4) | Allow Gift Message                |
| has_options                    | 108 | catalog_product (#4) |                                   |
| image                          | 87  | catalog_product (#4) | Base                              |
| image_label                    | 109 | catalog_product (#4) | Image Label                       |
| links_exist                    | 133 | catalog_product (#4) |                                   |
| links_purchased_separately     | 130 | catalog_product (#4) | Links can be purchased separately |
| links_title                    | 132 | catalog_product (#4) | Links title                       |
| manufacturer                   | 83  | catalog_product (#4) | Manufacturer                      |
| media_gallery                  | 90  | catalog_product (#4) | Media Gallery                     |
| meta_description               | 86  | catalog_product (#4) | Meta Description                  |
| meta_keyword                   | 85  | catalog_product (#4) | Meta Keywords                     |
| meta_title                     | 84  | catalog_product (#4) | Meta Title                        |
| minimal_price                  | 98  | catalog_product (#4) | Minimal Price                     |
| msrp                           | 123 | catalog_product (#4) | Minimum Advertised Price          |
| msrp_display_actual_price_type | 124 | catalog_product (#4) | Display Actual Price              |
| name                           | 73  | catalog_product (#4) | Product Name                      |
| news_from_date                 | 94  | catalog_product (#4) | Set Product as New from Date      |
| news_to_date                   | 95  | catalog_product (#4) | Set Product as New to Date        |
| old_id                         | 91  | catalog_product (#4) |                                   |
| options_container              | 106 | catalog_product (#4) | Display Product Options In        |
| page_layout                    | 104 | catalog_product (#4) | Layout                            |
| price                          | 77  | catalog_product (#4) | Price                             |
| price_type                     | 125 | catalog_product (#4) | Dynamic Price                     |
| price_view                     | 128 | catalog_product (#4) | Price View                        |
| quantity_and_stock_status      | 115 | catalog_product (#4) | Quantity                          |
| required_options               | 107 | catalog_product (#4) |                                   |
| samples_title                  | 131 | catalog_product (#4) | Samples title                     |
| shipment_type                  | 129 | catalog_product (#4) | Ship Bundle Items                 |
| short_description              | 76  | catalog_product (#4) | Short Description                 |
| sku                            | 74  | catalog_product (#4) | SKU                               |
| sku_type                       | 126 | catalog_product (#4) | Dynamic SKU                       |
| small_image                    | 88  | catalog_product (#4) | Small                             |
| small_image_label              | 110 | catalog_product (#4) | Small Image Label                 |
| special_from_date              | 79  | catalog_product (#4) | Special Price From Date           |
| special_price                  | 78  | catalog_product (#4) | Special Price                     |
| special_to_date                | 80  | catalog_product (#4) | Special Price To Date             |
| status                         | 97  | catalog_product (#4) | Enable Product                    |
| swatch_image                   | 135 | catalog_product (#4) | Swatch                            |
| tax_class_id                   | 136 | catalog_product (#4) | Tax Class                         |
| thumbnail                      | 89  | catalog_product (#4) | Thumbnail                         |
| thumbnail_label                | 111 | catalog_product (#4) | Thumbnail Label                   |
| tier_price                     | 92  | catalog_product (#4) | Tier Price                        |
| updated_at                     | 113 | catalog_product (#4) |                                   |
| url_key                        | 121 | catalog_product (#4) | URL Key                           |
| url_path                       | 122 | catalog_product (#4) |                                   |
| visibility                     | 99  | catalog_product (#4) | Visibility                        |
| weight                         | 82  | catalog_product (#4) | Weight                            |
| weight_type                    | 127 | catalog_product (#4) | Dynamic Weight                    |
+--------------------------------+-----+----------------------+-----------------------------------+

Lista de los atributos de la entidad catalog_category

+----------------------------+-----+-----------------------+-----------------------------------+
| code                       | id  | entity_type           | label                             |
+----------------------------+-----+-----------------------+-----------------------------------+
| all_children               | 57  | catalog_category (#3) |                                   |
| available_sort_by          | 67  | catalog_category (#3) | Available Product Listing Sort By |
| children                   | 59  | catalog_category (#3) |                                   |
| children_count             | 66  | catalog_category (#3) | Children Count                    |
| custom_apply_to_products   | 71  | catalog_category (#3) | Apply To Products                 |
| custom_design              | 60  | catalog_category (#3) | Custom Design                     |
| custom_design_from         | 61  | catalog_category (#3) | Active From                       |
| custom_design_to           | 62  | catalog_category (#3) | Active To                         |
| custom_layout_update       | 64  | catalog_category (#3) | Custom Layout Update              |
| custom_layout_update_file  | 118 | catalog_category (#3) | Custom Layout Update              |
| custom_use_parent_settings | 70  | catalog_category (#3) | Use Parent Category Settings      |
| default_sort_by            | 68  | catalog_category (#3) | Default Product Listing Sort By   |
| description                | 47  | catalog_category (#3) | Description                       |
| display_mode               | 52  | catalog_category (#3) | Display Mode                      |
| filter_price_range         | 72  | catalog_category (#3) | Layered Navigation Price Step     |
| image                      | 48  | catalog_category (#3) | Image                             |
| include_in_menu            | 69  | catalog_category (#3) | Include in Navigation Menu        |
| is_active                  | 46  | catalog_category (#3) | Is Active                         |
| is_anchor                  | 54  | catalog_category (#3) | Is Anchor                         |
| landing_page               | 53  | catalog_category (#3) | CMS Block                         |
| level                      | 65  | catalog_category (#3) | Level                             |
| meta_description           | 51  | catalog_category (#3) | Meta Description                  |
| meta_keywords              | 50  | catalog_category (#3) | Meta Keywords                     |
| meta_title                 | 49  | catalog_category (#3) | Page Title                        |
| name                       | 45  | catalog_category (#3) | Name                              |
| page_layout                | 63  | catalog_category (#3) | Page Layout                       |
| path                       | 55  | catalog_category (#3) | Path                              |
| path_in_store              | 58  | catalog_category (#3) |                                   |
| position                   | 56  | catalog_category (#3) | Position                          |
| url_key                    | 119 | catalog_category (#3) | URL Key                           |
| url_path                   | 120 | catalog_category (#3) |                                   |
+----------------------------+-----+-----------------------+-----------------------------------+

Lista de los atributos de la entidad customer

+---------------------------+----+---------------+------------------------------------------------+
| code                      | id | entity_type   | label                                          |
+---------------------------+----+---------------+------------------------------------------------+
| confirmation              | 18 | customer (#1) | Is Confirmed                                   |
| created_at                | 19 | customer (#1) | Created At                                     |
| created_in                | 3  | customer (#1) | Created From                                   |
| default_billing           | 15 | customer (#1) | Default Billing Address                        |
| default_shipping          | 16 | customer (#1) | Default Shipping Address                       |
| disable_auto_group_change | 21 | customer (#1) | Disable Automatic Group Change Based on VAT ID |
| dob                       | 11 | customer (#1) | Date of Birth                                  |
| email                     | 9  | customer (#1) | Email                                          |
| failures_num              | 42 | customer (#1) | Failures Number                                |
| firstname                 | 5  | customer (#1) | First Name                                     |
| first_failure             | 43 | customer (#1) | First Failure Date                             |
| gender                    | 20 | customer (#1) | Gender                                         |
| group_id                  | 10 | customer (#1) | Group                                          |
| lastname                  | 7  | customer (#1) | Last Name                                      |
| lock_expires              | 44 | customer (#1) | Failures Number                                |
| middlename                | 6  | customer (#1) | Middle Name/Initial                            |
| password_hash             | 12 | customer (#1) |                                                |
| prefix                    | 4  | customer (#1) | Name Prefix                                    |
| rp_token                  | 13 | customer (#1) |                                                |
| rp_token_created_at       | 14 | customer (#1) |                                                |
| store_id                  | 2  | customer (#1) | Create In                                      |
| suffix                    | 8  | customer (#1) | Name Suffix                                    |
| taxvat                    | 17 | customer (#1) | Tax/VAT Number                                 |
| updated_at                | 41 | customer (#1) | Updated At                                     |
| website_id                | 1  | customer (#1) | Associate to Website                           |
+---------------------------+----+---------------+------------------------------------------------+