Skip to content

Commit 592346a

Browse files
committed
Use last entity when multiple candidates for requiredEntity are found.
This enables to overwrite a requiredEntity in an extended entity.
1 parent 57fb32e commit 592346a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Magento/FunctionalTestingFramework/DataGenerator/Persist/OperationDataArrayResolver.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,11 @@ private function getDependentEntitiesOfType($type)
245245
private function resolveOperationObjectAndEntityData($entityObject, $operationElementValue)
246246
{
247247
if ($operationElementValue != $entityObject->getType()) {
248-
// if we have a mismatch attempt to retrieve linked data and return just the first linkage
248+
// if we have a mismatch attempt to retrieve linked data and return just the last linkage
249+
// this enables overwriting of required entity fields
249250
$linkName = $entityObject->getLinkedEntitiesOfType($operationElementValue);
250251
if (!empty($linkName)) {
251-
$linkName = $linkName[0];
252+
$linkName = array_pop($linkName);
252253
return DataObjectHandler::getInstance()->getObject($linkName);
253254
}
254255
return null;

0 commit comments

Comments
 (0)