{"id":16490,"date":"2018-08-21T16:38:50","date_gmt":"2018-08-21T14:38:50","guid":{"rendered":"https:\/\/belvg.com\/blog\/?p=16490"},"modified":"2025-02-11T10:21:25","modified_gmt":"2025-02-11T08:21:25","slug":"eav-load-and-save-processes-in-magento-2","status":"publish","type":"post","link":"https:\/\/belvg.com\/blog\/eav-load-and-save-processes-in-magento-2.html","title":{"rendered":"EAV Load and Save Processes in Magento 2"},"content":{"rendered":"\n<p>The <em>Magento\\Framework\\EntityManager\\EntityManager<\/em> class was introduced in Magento 2.1 for loading, saving, checking for presence and deleting EAV and Flat objects. To work via EntityManager, you must provide the information about the entity interface in the <strong>di.xml<\/strong> file for MetadataPool and for HydratorPool.<\/p>\n<p><!--more--><\/p>\n<pre class=\"lang:xhtml decode:true\">&lt;type name=\"Magento\\Framework\\EntityManager\\MetadataPool\"&gt;\r\n&nbsp;&nbsp;&nbsp;&lt;arguments&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;argument name=\"metadata\" xsi:type=\"array\"&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"MyVendor\\MyModule\\Api\\Data\\MyEntityInterface\" xsi:type=\"array\"&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"entityTableName\" xsi:type=\"string\"&gt;myvendor_mymodule_myentity_entity&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"eavEntityType\" xsi:type=\"string\"&gt;myvendor_mymodule_myentity&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"identifierField\" xsi:type=\"string\"&gt;entity_id&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"entityContext\" xsi:type=\"array\"&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"store\" xsi:type=\"string\"&gt;Magento\\Store\\Model\\StoreScopeProvider&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/argument&gt;\r\n&nbsp;&nbsp;&nbsp;&lt;\/arguments&gt;\r\n&lt;\/type&gt;\r\n\r\n&lt;type name=\"Magento\\Framework\\EntityManager\\HydratorPool\"&gt;\r\n&nbsp;&nbsp;&nbsp;&lt;arguments&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;argument name=\"hydrators\" xsi:type=\"array\"&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"MyVendor\\MyModule\\Api\\Data\\MyEntityInterface\" xsi:type=\"string\"&gt;Magento\\Framework\\EntityManager\\AbstractModelHydrator&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/argument&gt;\r\n&nbsp;&nbsp;&nbsp;&lt;\/arguments&gt;\r\n&lt;\/type&gt;<\/pre>\n<p>The <em>Magento\\Framework\\EntityManager\\OperationPool<\/em> class contains an array of operations that invoke the EntityManager to perform loading, saving, checking for presence, and deleting an object. The operation is executed by the <em>execute<\/em> method.<\/p>\n<p>Default operations:<\/p>\n<p>checkIfExists&nbsp;&mdash; Magento\\Framework\\EntityManager\\Operation\\CheckIfExists;<\/p>\n<p>read&nbsp;&mdash; Magento\\Framework\\EntityManager\\Operation\\Read;<\/p>\n<p>create&nbsp;&mdash; Magento\\Framework\\EntityManager\\Operation\\Create;<\/p>\n<p>update&nbsp;&mdash; Magento\\Framework\\EntityManager\\Operation\\Update;<\/p>\n<p>delete&nbsp;&mdash; Magento\\Framework\\EntityManager\\Operation\\Delete.<\/p>\n<p>The <em>CheckIfExists<\/em> operation checks by default the presence of a record in the main table using a direct SQL query.<\/p>\n<div class=\"module_in_content_container\"><a href=\"https:\/\/belvg.com\/magento-custom-development\" class=\"link_to_module\" target=\"_blank\" rel=\"noopener\"><\/a><div class=\"module_content\"><img src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/01\/magento-custom-development.png\" width=\"120\" height=\"120\" alt=\"magento custom development\" class=\"module_image\" title=\"EAV Load and Save Processes in Magento 2\"><div class=\"module_content_part\"><h3 class=\"title\">Magento Custom Development<\/h3><p class=\"module_content_text\">Take your online store to the next level with BelVG Magento Custom Development<\/p><a href=\"https:\/\/belvg.com\/magento-custom-development\" class=\"link_2_to_module\" target=\"_blank\" style=\"display:inline-block\" rel=\"noopener\"><span class=\"read-more\">Visit the page<\/span><\/a><\/div><\/div><\/div>\n<p>The <em>Read<\/em> operation performs 3 sub-operations by default:<\/p>\n<ul>\n<li>ReadMain<\/li>\n<li>ReadAttributes<\/li>\n<li>ReadExtensions<\/li>\n<\/ul>\n<p>The <em>Create<\/em> operation performs 3 sub-operations by default:<\/p>\n<ul>\n<li>CreateMain<\/li>\n<li>CreateAttributes<\/li>\n<li>CreateExtensions<\/li>\n<\/ul>\n<p>The <em>Update<\/em> operation performs 3 sub-operations by default:<\/p>\n<ul>\n<li>UpdateMain<\/li>\n<li>UpdateAttributes<\/li>\n<li>UpdateExtensions<\/li>\n<\/ul>\n<p>The <em>Delete<\/em> operation performs 3 sub-operations by default (in the reverse order):<\/p>\n<ul>\n<li>DeleteExtensions<\/li>\n<li>DeleteAttributes<\/li>\n<li>DeleteMain<\/li>\n<\/ul>\n<p>The operations for working with attributes are located in the <em>Magento\\Framework\\EntityManager\\Operation\\AttributePool<\/em> class.<\/p>\n<p>With the help of overrides on attribute operations, EAV uses the following classes for operations:<\/p>\n<ul>\n<li>Magento\\Eav\\Model\\ResourceModel\\CreateHandler<\/li>\n<li>Magento\\Eav\\Model\\ResourceModel\\UpdateHandler<\/li>\n<li>Magento\\Eav\\Model\\ResourceModel\\ReadHandler<\/li>\n<\/ul>\n<p>CreateHandler writes the attribute values to the new entity.<\/p>\n<p><em>UpdateHandler<\/em> takes a snapshot using ReadSnapshot (which is based on ReadHandler). Next:<\/p>\n<ul>\n<li>it changes the value if the attribute is changed relative to Snapshot and the new value is not empty or the attribute allows null values;<\/li>\n<li>deletes if the attribute has been changed relative to Snapshot and the new value is null and the attribute does not allow null values;<\/li>\n<li>creates if the attribute is absent in Snapshot and the new value is not null or the attribute allows null values.<\/li>\n<\/ul>\n<p><em>ReadHandler<\/em> executes the reading according to the following algorithm:<\/p>\n<ol>\n<li>Gets all the attribute tables for a particular entity_type.<\/li>\n<li>Performs the following for each table:\n<ol>\n<li>a&nbsp;<em>select<\/em> subquery is created from the current table, which requests value and attribute_id;<\/li>\n<li>a condition is added that entity_id = ID of the requested entity;<\/li>\n<li>a condition is added for each scope from the context that store_id IN ($scope-&gt;getValue());<\/li>\n<li>sorts by store_id in descending order.<\/li>\n<\/ol>\n<\/li>\n<li>Does UNION ALL of all the subqueries.<\/li>\n<li>Executes the SQL query.<\/li>\n<li>Writes the received values to the $entityData array.<\/li>\n<\/ol>\n<div class=\"content_sales_info\" style=\"background-image: url(https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/Sales_background.png\"><img width=\"65\" height=\"65\" src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/Igor-Dragun1.png\" alt=\"Igor Dragun\" title=\"EAV Load and Save Processes in Magento 2\"><div class=\"content_part\"><h3 class=\"title\">Partner With Us <\/h3><span class=\"sales_content_text\">Let's discuss how to grow your business. Get a Free Quote.<\/span><\/div> <a class=\"call-to-action\" href=\"https:\/\/belvg.com\/contact?utm_source=blog&amp;utm_campaign=sales_block&amp;utm_content=middle\" target=\"_blank\" rel=\"noopener\">Talk to Igor<\/a><\/div>\n<h2><strong><span style=\"color: #000000;\">What happens when an EAV entity has too many attributes<\/span><\/strong><\/h2>\n<p>The advantage of EAV over Flat is that a Flat table in InnoDb can contain no more than 1017 columns. In EAV, the number of attributes is limited only by the maximum size of innodb tables.<\/p>\n<h2><strong><span style=\"color: #000000;\">How the number of websites\/stores affects the EAV load\/save process<\/span><\/strong><\/h2>\n<p>The number of websites\/stores affects the loading\/saving of an entity.<\/p>\n<p>Let&rsquo;s see how a number of websites\/stores affect the loading and saving of attributes.<\/p>\n<p>The Magento scope in EAV is implemented using the store_id column in the EAV attribute value tables.<\/p>\n<ul>\n<li>store_id = 0, if the scope is global;<\/li>\n<li>store_id = ID of the chosen Store View, if not global.<\/li>\n<\/ul>\n<p>Loading of attribute values happens as follows:<\/p>\n<ul>\n<li>store_id IN (STORE_IDS), where STORE_IDS &mdash; Store View identifiers of the current context.<\/li>\n<\/ul>\n<p>The context is evaluated recursively:<\/p>\n<p>The identifier of the current scope is added to the STORE_IDS array.<\/p>\n<p>If there is a Fallback scope in the current scope, then the operation is repeated for Fallback.<\/p>\n<p>Example: store_id = 5 specifies fallback as 3, and 3 specifies fallback as 0. Then STORE_IDS will be: [5, 3, 0].<\/p>\n<p>In most cases, the standard scope provider Magento\\Store\\Model\\StoreScopeProvider is used.<\/p>\n<p>It works as follows:<\/p>\n<ul>\n<li>The store_id is specified as an identifier of the current Store View;<\/li>\n<li>If the current store_id!= 0, then it adds a fallback as 0.<\/li>\n<\/ul>\n<p>It turns out that the number of websites\/stores does not directly* affect the loading speed, because when loaded using the StoreScopeProvider, the context contains no more than two store_id, i.e. does not depend on the number of websites\/stores.<\/p>\n<p>* the number of websites\/stores always affects indirectly the loading of attribute values, since the more rows there are in the attribute value tables, the slower is the download.<\/p>\n<p>Let&rsquo;s consider the value of store_id when saving the attribute value.<\/p>\n<table>\n<tbody>\n<tr>\n<td>Attribute scope<\/td>\n<td>All Store Views<\/td>\n<td>Particular Store View<\/td>\n<\/tr>\n<tr>\n<td>global<\/td>\n<td>store_id = 0<\/td>\n<td>store_id = 0<\/td>\n<\/tr>\n<tr>\n<td>website<\/td>\n<td>store_id = 0<\/td>\n<td>records for each Store View of this Website are created \/ changed<\/td>\n<\/tr>\n<tr>\n<td>store view<\/td>\n<td>store_id = 0<\/td>\n<td>store_id = ID Store View<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Thus, the speed of storing an attribute, depending on the number of websites\/stores, is affected by the presence of the changed attributes from the scope website. The more Store Views there are in the Website, the more necessary it is to create or change records in the database, the slower is the saving.<\/p>\n<h2>How&nbsp;to customize the load and save process for an EAV entity in the situations described here<\/h2>\n<p>To override operations, add the following to <strong>di.xml<\/strong>:<\/p>\n<pre class=\"lang:xhtml decode:true\">&lt;type name=\"Magento\\Framework\\EntityManager\\OperationPool\"&gt;\r\n&nbsp;&nbsp;&nbsp;&lt;arguments&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;argument name=\"operations\" xsi:type=\"array\"&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"MyVendor\\MyModule\\Api\\Data\\MyEntityInterface\" xsi:type=\"array\"&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"checkIsExists\" xsi:type=\"string\"&gt;MY_NAMESPACE\\CheckIsExists&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"read\" xsi:type=\"string\"&gt;MY_NAMESPACE\\Read&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"create\" xsi:type=\"string\"&gt;MY_NAMESPACE\\Create&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"update\" xsi:type=\"string\"&gt;MY_NAMESPACE\\Update&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"delete\" xsi:type=\"string\"&gt;MY_NAMESPACE\\Delete&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/argument&gt;\r\n&nbsp;&nbsp;&nbsp;&lt;\/arguments&gt;\r\n&lt;\/type&gt;<\/pre>\n<p>You can perform a partial override, for example, of only one read operation, then the default operations will be used instead of the rest operations.<\/p>\n<p>You can also override the operations of working with attributes for EAV:<\/p>\n<pre class=\"lang:xhtml decode:true\">&lt;type name=\"Magento\\Framework\\EntityManager\\Operation\\AttributePool\"&gt;\r\n&nbsp;&nbsp;&nbsp;&lt;arguments&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;argument name=\"extensionActions\" xsi:type=\"array\"&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"eav\" xsi:type=\"array\"&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"MyVendor\\MyModule\\Api\\Data\\MyEntityInterface\" xsi:type=\"array\"&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"read\" xsi:type=\"string\"&gt;MY_NAMESPACE\\ReadHandler&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"create\" xsi:type=\"string\"&gt;MY_NAMESPACE\\CreateHandler&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"update\" xsi:type=\"string\"&gt;MY_NAMESPACE\\UpdateHandler&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/argument&gt;\r\n&nbsp;&nbsp;&nbsp;&lt;\/arguments&gt;\r\n&lt;\/type&gt;<\/pre>\n<p>Overriding the Extensions:<\/p>\n<pre class=\"lang:xhtml decode:true\">&lt;type name=\"Magento\\Framework\\EntityManager\\Operation\\ExtensionPool\"&gt;\r\n&nbsp;&nbsp;&nbsp;&lt;arguments&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;argument name=\"extensionActions\" xsi:type=\"array\"&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"MyVendor\\MyModule\\Api\\Data\\MyEntityInterface\" xsi:type=\"array\"&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"read\" xsi:type=\"array\"&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"myReader\" xsi:type=\"string\"&gt;MY_NAMESPACE\\ReadHandler&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"create\" xsi:type=\"array\"&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"myCreator\" xsi:type=\"string\"&gt;MY_NAMESPACE\\CreateHandler&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"update\" xsi:type=\"array\"&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item name=\"myUpdater\" xsi:type=\"string\"&gt;MY_NAMESPACE\\UpdateHandler&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/item&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/argument&gt;\r\n&nbsp;&nbsp;&nbsp;&lt;\/arguments&gt;\r\n&lt;\/type&gt;\r\n<\/pre>\n<div class=\"module_in_content_container\"><a href=\"https:\/\/belvg.com\/magento-audit\" class=\"link_to_module\" target=\"_blank\" rel=\"noopener\"><\/a><div class=\"module_content\"><div class=\"module_content_part\"><h3 class=\"title\">Magento Audit<\/h3><p class=\"module_content_text\">Take your online store to the next level with BelVG Magento Audit<\/p><a href=\"https:\/\/belvg.com\/magento-audit\" class=\"link_2_to_module\" target=\"_blank\" style=\"display:inline-block\" rel=\"noopener\"><span class=\"read-more\">Visit the page<\/span><\/a><\/div><\/div><\/div>\n\n","protected":false},"excerpt":{"rendered":"The Magento\\Framework\\EntityManager\\EntityManager class was introduced in Magento 2.1 for loading, saving, checking for presence and &#8230;","protected":false},"author":47,"featured_media":16496,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":{"_acf_changed":false,"footnotes":""},"categories":[491,389,524],"tags":[],"class_list":["post-16490","post","type-post","status-publish","format-image","has-post-thumbnail","hentry","category-magento-2","category-magento2-development","category-magento-speed-optimization","post_format-image"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"Demonstrating the ability to use EAV load and save processes and the differences from the flat table load and save operations.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Artsem Miklashevich\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/belvg.com\/blog\/eav-load-and-save-processes-in-magento-2.html\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/eav-load-and-save-processes-in-magento-2.html#article\",\"name\":\"How EAV load and save processes work in Magento 2 | BelVG Blog\",\"headline\":\"EAV Load and Save Processes in Magento 2\",\"author\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/artsem-miklashevich#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/08\\\/EAV-Load-and-Save-Processes-in-Magento-2.jpg\",\"width\":770,\"height\":433,\"caption\":\"EAV load and save processes in Magento 2\"},\"datePublished\":\"2018-08-21T16:38:50+02:00\",\"dateModified\":\"2025-02-11T10:21:25+02:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/eav-load-and-save-processes-in-magento-2.html#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/eav-load-and-save-processes-in-magento-2.html#webpage\"},\"articleSection\":\"Magento 2, Magento 2 Development, Magento Speed Optimization, Image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/eav-load-and-save-processes-in-magento-2.html#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento2-development#listItem\",\"name\":\"Magento 2 Development\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento2-development#listItem\",\"position\":2,\"name\":\"Magento 2 Development\",\"item\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento2-development\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/eav-load-and-save-processes-in-magento-2.html#listItem\",\"name\":\"EAV Load and Save Processes in Magento 2\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/eav-load-and-save-processes-in-magento-2.html#listItem\",\"position\":3,\"name\":\"EAV Load and Save Processes in Magento 2\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento2-development#listItem\",\"name\":\"Magento 2 Development\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\",\"name\":\"BelVG Blog\",\"description\":\"Magento and Prestashop articles\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/artsem-miklashevich#author\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/artsem-miklashevich\",\"name\":\"Artsem Miklashevich\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/eav-load-and-save-processes-in-magento-2.html#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/145dc6a225439ebb3a257da8fd0f46383a3649cdca2e58190b33a28af5f216a5?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Artsem Miklashevich\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/eav-load-and-save-processes-in-magento-2.html#webpage\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/eav-load-and-save-processes-in-magento-2.html\",\"name\":\"How EAV load and save processes work in Magento 2 | BelVG Blog\",\"description\":\"Demonstrating the ability to use EAV load and save processes and the differences from the flat table load and save operations.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/eav-load-and-save-processes-in-magento-2.html#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/artsem-miklashevich#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/artsem-miklashevich#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/08\\\/EAV-Load-and-Save-Processes-in-Magento-2.jpg\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/eav-load-and-save-processes-in-magento-2.html\\\/#mainImage\",\"width\":770,\"height\":433,\"caption\":\"EAV load and save processes in Magento 2\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/eav-load-and-save-processes-in-magento-2.html#mainImage\"},\"datePublished\":\"2018-08-21T16:38:50+02:00\",\"dateModified\":\"2025-02-11T10:21:25+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\",\"name\":\"BelVG Blog\",\"description\":\"Magento and Prestashop articles\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"How EAV load and save processes work in Magento 2 | BelVG Blog","description":"Demonstrating the ability to use EAV load and save processes and the differences from the flat table load and save operations.","canonical_url":"https:\/\/belvg.com\/blog\/eav-load-and-save-processes-in-magento-2.html","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/belvg.com\/blog\/eav-load-and-save-processes-in-magento-2.html#article","name":"How EAV load and save processes work in Magento 2 | BelVG Blog","headline":"EAV Load and Save Processes in Magento 2","author":{"@id":"https:\/\/belvg.com\/blog\/author\/artsem-miklashevich#author"},"publisher":{"@id":"https:\/\/belvg.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2018\/08\/EAV-Load-and-Save-Processes-in-Magento-2.jpg","width":770,"height":433,"caption":"EAV load and save processes in Magento 2"},"datePublished":"2018-08-21T16:38:50+02:00","dateModified":"2025-02-11T10:21:25+02:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/belvg.com\/blog\/eav-load-and-save-processes-in-magento-2.html#webpage"},"isPartOf":{"@id":"https:\/\/belvg.com\/blog\/eav-load-and-save-processes-in-magento-2.html#webpage"},"articleSection":"Magento 2, Magento 2 Development, Magento Speed Optimization, Image"},{"@type":"BreadcrumbList","@id":"https:\/\/belvg.com\/blog\/eav-load-and-save-processes-in-magento-2.html#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/#listItem","position":1,"name":"Home","item":"https:\/\/belvg.com\/blog\/","nextItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento2-development#listItem","name":"Magento 2 Development"}},{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento2-development#listItem","position":2,"name":"Magento 2 Development","item":"https:\/\/belvg.com\/blog\/category\/magento2-development","nextItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/eav-load-and-save-processes-in-magento-2.html#listItem","name":"EAV Load and Save Processes in Magento 2"},"previousItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/eav-load-and-save-processes-in-magento-2.html#listItem","position":3,"name":"EAV Load and Save Processes in Magento 2","previousItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento2-development#listItem","name":"Magento 2 Development"}}]},{"@type":"Organization","@id":"https:\/\/belvg.com\/blog\/#organization","name":"BelVG Blog","description":"Magento and Prestashop articles","url":"https:\/\/belvg.com\/blog\/"},{"@type":"Person","@id":"https:\/\/belvg.com\/blog\/author\/artsem-miklashevich#author","url":"https:\/\/belvg.com\/blog\/author\/artsem-miklashevich","name":"Artsem Miklashevich","image":{"@type":"ImageObject","@id":"https:\/\/belvg.com\/blog\/eav-load-and-save-processes-in-magento-2.html#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/145dc6a225439ebb3a257da8fd0f46383a3649cdca2e58190b33a28af5f216a5?s=96&d=mm&r=g","width":96,"height":96,"caption":"Artsem Miklashevich"}},{"@type":"WebPage","@id":"https:\/\/belvg.com\/blog\/eav-load-and-save-processes-in-magento-2.html#webpage","url":"https:\/\/belvg.com\/blog\/eav-load-and-save-processes-in-magento-2.html","name":"How EAV load and save processes work in Magento 2 | BelVG Blog","description":"Demonstrating the ability to use EAV load and save processes and the differences from the flat table load and save operations.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/belvg.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/belvg.com\/blog\/eav-load-and-save-processes-in-magento-2.html#breadcrumblist"},"author":{"@id":"https:\/\/belvg.com\/blog\/author\/artsem-miklashevich#author"},"creator":{"@id":"https:\/\/belvg.com\/blog\/author\/artsem-miklashevich#author"},"image":{"@type":"ImageObject","url":"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2018\/08\/EAV-Load-and-Save-Processes-in-Magento-2.jpg","@id":"https:\/\/belvg.com\/blog\/eav-load-and-save-processes-in-magento-2.html\/#mainImage","width":770,"height":433,"caption":"EAV load and save processes in Magento 2"},"primaryImageOfPage":{"@id":"https:\/\/belvg.com\/blog\/eav-load-and-save-processes-in-magento-2.html#mainImage"},"datePublished":"2018-08-21T16:38:50+02:00","dateModified":"2025-02-11T10:21:25+02:00"},{"@type":"WebSite","@id":"https:\/\/belvg.com\/blog\/#website","url":"https:\/\/belvg.com\/blog\/","name":"BelVG Blog","description":"Magento and Prestashop articles","inLanguage":"en-US","publisher":{"@id":"https:\/\/belvg.com\/blog\/#organization"}}]}},"aioseo_meta_data":{"post_id":"16490","title":"How EAV load and save processes work in Magento 2 | #site_title","description":"Demonstrating the ability to use EAV load and save processes and the differences from the flat table load and save operations.","keywords":[{"label":"EAV","value":"EAV"},{"label":"load","value":"load"},{"label":"save","value":"save"},{"label":"process","value":"process"},{"label":"magento 2","value":"magento 2"},{"label":"ecommerce","value":"ecommerce"}],"keyphrases":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_image_url":null,"twitter_title":null,"twitter_description":null,"schema_type":"default","schema_type_options":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null,"created":"2026-11-03 18:37:05","updated":"2026-11-03 18:37:05"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/belvg.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/belvg.com\/blog\/category\/magento2-development\" title=\"Magento 2 Development\">Magento 2 Development<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tEAV Load and Save Processes in Magento 2\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/belvg.com\/blog\/"},{"label":"Magento 2 Development","link":"https:\/\/belvg.com\/blog\/category\/magento2-development"},{"label":"EAV Load and Save Processes in Magento 2","link":"https:\/\/belvg.com\/blog\/eav-load-and-save-processes-in-magento-2.html"}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/16490","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/users\/47"}],"replies":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/comments?post=16490"}],"version-history":[{"count":-1,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/16490\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/media\/16496"}],"wp:attachment":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/media?parent=16490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/categories?post=16490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/tags?post=16490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}