Skip to content
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
2c3a2c9
#40216-Replacing nested foreach with array_replace to reduce time com…
Oct 4, 2025
f3f5bc9
#40216 - array union seems to be better optimised from memory perspec…
Oct 4, 2025
85c13c6
#40216 - Moving the setting to outside of if to fix data setting issue
Oct 4, 2025
f8d70b6
#40216 - Moving the attribute value to right side to keep the left ar…
Oct 5, 2025
1ce65b5
Merge branch '2.4-develop' into Fixing-BigOComplexity-in-Eav
senthilengg Oct 7, 2025
072db63
#40216 - Reproduced WebApiFunctional Test errors & fixed
Oct 9, 2025
ab42d68
#40216 - Removing a confusing comment
Oct 9, 2025
48b92ff
Merge branch '2.4-develop' into Fixing-BigOComplexity-in-Eav
engcom-Hotel Oct 13, 2025
189dd72
Merge branch '2.4-develop' into Fixing-BigOComplexity-in-Eav
senthilengg Oct 14, 2025
48c2f62
#40217 - Introduced _setItemAttributeValues function and deprecate _s…
Oct 16, 2025
5062fef
Merge branch '2.4-develop' into Fixing-BigOComplexity-in-Eav
senthilengg Oct 17, 2025
409afc2
Merge branch '2.4-develop' into Fixing-BigOComplexity-in-Eav
senthilengg Oct 21, 2025
5399f76
Remove blank line in AbstractCollection.php
senthilengg Oct 21, 2025
cd2251d
Merge branch '2.4-develop' into Fixing-BigOComplexity-in-Eav
engcom-Dash Oct 23, 2025
dc33533
Merge branch '2.4-develop' into Fixing-BigOComplexity-in-Eav
senthilengg Oct 27, 2025
2c2bacf
Merge branch '2.4-develop' into Fixing-BigOComplexity-in-Eav
senthilengg Oct 27, 2025
9036c74
Merge branch '2.4-develop' into Fixing-BigOComplexity-in-Eav
senthilengg Oct 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright 2013 Adobe
* Copyright 2025 Adobe
* All Rights Reserved.
*/

Expand Down Expand Up @@ -1233,8 +1233,27 @@ public function _loadAttributes($printQuery = false, $logQuery = false)
throw $e;
}

$attributeCode = $data = [];
$entityIdField = $entity->getEntityIdField();

foreach ($values as $value) {
$this->_setItemAttributeValue($value);
$entityId = $value[$entityIdField];
$attributeId = $value['attribute_id'];
if (!isset($attributeCode[$attributeId])) {
$attributeCode[$attributeId] = array_search($attributeId, $this->_selectAttributes);
if (!$attributeCode[$attributeId]) {
$attribute = $this->_eavConfig->getAttribute(
$this->getEntity()->getType(),
$attributeId
);
$attributeCode[$attributeId] = $attribute->getAttributeCode();
}
}
$data[$entityId][$attributeCode[$attributeId]] = $value['value'];
}

if ($data) {
$this->_setItemAttributeValues($data);
}
}
}
Expand Down Expand Up @@ -1305,6 +1324,9 @@ protected function _addLoadAttributesSelectValues($select, $table, $type)
*
* Parameter $valueInfo is _getLoadAttributesSelect fetch result row
*
* @deprecated Batch process of attribute values is introduced to reduce time complexity.
* @see _setItemAttributeValues($entityAttributeMap) uses array union (+) to acheive O(n) complexity.
*
* @param array $valueInfo
* @return $this
* @throws LocalizedException
Expand Down Expand Up @@ -1334,6 +1356,33 @@ protected function _setItemAttributeValue($valueInfo)
return $this;
}

/**
* Initialize entity object property value
*
* Parameter $entityAttributeMap is [entity_id => [attribute_code => value, ...]]
*
* @param array $entityAttributeMap
* @return $this
* @throws LocalizedException
*/
protected function _setItemAttributeValues(array $entityAttributeMap)
{
foreach ($entityAttributeMap as $entityId => $attributeValues) {
if (!isset($this->_itemsById[$entityId])) {
throw new LocalizedException(
__('A header row is missing for an attribute. Verify the header row and try again.')
);
}
// _itemsById[$entityId] is always an array (typically with one element)
// foreach handles edge cases where multiple objects share the same entity ID
foreach ($this->_itemsById[$entityId] as $object) {
$object->setData($object->getData()+$attributeValues);
}

}
return $this;
}

/**
* Get alias for attribute value table
*
Expand Down