Skip to content

Commit 13cd3ca

Browse files
committed
MAGETWO-62691: [Performance] EAV attributes caching optimization
1 parent dafcb2d commit 13cd3ca

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

app/code/Magento/Eav/Model/Config.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,14 +544,13 @@ private function createAttribute($model)
544544
*
545545
* @param mixed $entityType
546546
* @param \Magento\Framework\DataObject $object
547-
* @return array
547+
* @return string[]
548548
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
549549
* @SuppressWarnings(PHPMD.NPathComplexity)
550550
*/
551551
public function getEntityAttributeCodes($entityType, $object = null)
552552
{
553-
$attributes = array_keys($this->getEntityAttributes($entityType, $object));
554-
return $attributes;
553+
return array_keys($this->getEntityAttributes($entityType, $object));
555554
}
556555

557556
/**

app/code/Magento/Eav/Model/Entity/AbstractEntity.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ protected function _getOrigObject($object)
11861186
*
11871187
* @param array &$delete
11881188
* @param AbstractAttribute $attribute
1189-
* @param \Magento\Eav\Model\Entity\AbstractEntity $object
1189+
* @param AbstractEntity $object
11901190
* @return void
11911191
*/
11921192
private function _aggregateDeleteData(&$delete, $attribute, $object)
@@ -1920,8 +1920,12 @@ public function afterDelete(\Magento\Framework\DataObject $object)
19201920
}
19211921

19221922
/**
1923+
* Load attributes for object
1924+
* if the object will not pass all attributes for this entity type will be loaded
1925+
*
19231926
* @param array $attributes
1924-
* @param |null $object
1927+
* @param AbstractEntity|null $object
1928+
* @return void
19251929
*/
19261930
protected function loadAttributesForObject($attributes, $object = null)
19271931
{

app/code/Magento/Eav/Model/Entity/AttributeLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function __construct(
5757
*/
5858
public function loadAllAttributes(AbstractEntity $resource, DataObject $object = null)
5959
{
60-
$attributes = (array)$this->config->getEntityAttributes($resource->getEntityType(), $object);
60+
$attributes = $this->config->getEntityAttributes($resource->getEntityType(), $object);
6161
$attributeCodes = array_keys($attributes);
6262
/**
6363
* Check and init default attributes

0 commit comments

Comments
 (0)