Skip to content

Commit f4cb20d

Browse files
committed
Fixed static tests for abstract attribute entity model
1 parent 0934250 commit f4cb20d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ abstract class AbstractEntity extends AbstractResource implements EntityInterfac
4343
protected $attributeLoader;
4444

4545
/**
46-
* Connection name
46+
* The connection name.
4747
*
4848
* @var string
4949
*/
@@ -226,11 +226,13 @@ abstract class AbstractEntity extends AbstractResource implements EntityInterfac
226226
* @param Context $context
227227
* @param array $data
228228
* @param UniqueValidationInterface|null $uniqueValidator
229+
* @param AttributeLoaderInterface|null $attributeLoader
229230
*/
230231
public function __construct(
231232
Context $context,
232233
$data = [],
233-
UniqueValidationInterface $uniqueValidator = null
234+
?UniqueValidationInterface $uniqueValidator = null,
235+
?AttributeLoaderInterface $attributeLoader = null
234236
) {
235237
$this->_eavConfig = $context->getEavConfig();
236238
$this->_resource = $context->getResource();
@@ -240,8 +242,10 @@ public function __construct(
240242
$this->_universalFactory = $context->getUniversalFactory();
241243
$this->transactionManager = $context->getTransactionManager();
242244
$this->objectRelationProcessor = $context->getObjectRelationProcessor();
243-
$this->uniqueValidator = $uniqueValidator ?:
244-
ObjectManager::getInstance()->get(UniqueValidationInterface::class);
245+
$this->uniqueValidator = $uniqueValidator
246+
?: ObjectManager::getInstance()->get(UniqueValidationInterface::class);
247+
$this->attributeLoader = $attributeLoader
248+
?: ObjectManager::getInstance()->get(AttributeLoaderInterface::class);
245249
parent::__construct();
246250
$properties = get_object_vars($this);
247251
foreach ($data as $key => $value) {
@@ -547,7 +551,7 @@ public function isPartialSave($flag = null)
547551
*/
548552
public function loadAllAttributes($object = null)
549553
{
550-
return $this->getAttributeLoader()->loadAllAttributes($this, $object);
554+
return $this->attributeLoader->loadAllAttributes($this, $object);
551555
}
552556

553557
/**
@@ -1928,9 +1932,6 @@ protected function _isAttributeValueEmpty(AbstractAttribute $attribute, $value)
19281932
*/
19291933
protected function getAttributeLoader()
19301934
{
1931-
if ($this->attributeLoader === null) {
1932-
$this->attributeLoader= ObjectManager::getInstance()->get(AttributeLoaderInterface::class);
1933-
}
19341935
return $this->attributeLoader;
19351936
}
19361937

0 commit comments

Comments
 (0)