Skip to content

Commit 8ce8f27

Browse files
author
Mohan Ahuja
committed
ACP2E-726: Unable to query bulk operations by search criteria using REST Api
- Changed key from operation key to id - Updated interfaces accordingly
1 parent 96faea7 commit 8ce8f27

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

app/code/Magento/AsynchronousOperations/Model/Operation.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\AsynchronousOperations\Api\Data\OperationInterface;
99
use Magento\AsynchronousOperations\Model\OperationStatusValidator;
10+
use Magento\Framework\Bulk\OperationInterface as BulkOperationInterface;
1011
use Magento\Framework\DataObject;
1112

1213
/**
@@ -162,6 +163,23 @@ public function setErrorCode($errorCode)
162163
return $this->setData(self::ERROR_CODE, $errorCode);
163164
}
164165

166+
/**
167+
* @inheritDoc
168+
*/
169+
public function getOperationKey(): ?int
170+
{
171+
return $this->getData(self::OPERATION_KEY) ? (int) $this->getData(self::OPERATION_KEY) : null;
172+
}
173+
174+
/**
175+
* @inheritDoc
176+
*/
177+
public function setOperationKey(?int $operationKey): BulkOperationInterface
178+
{
179+
$this->setData(self::OPERATION_KEY, $operationKey);
180+
return $this;
181+
}
182+
165183
/**
166184
* Retrieve existing extension attributes object.
167185
*

app/code/Magento/AsynchronousOperations/Model/ResourceModel/Operation/OperationRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function createByTopic($topicName, $entityParams, $groupId, $operationId)
9191
];
9292
$data = [
9393
'data' => [
94-
OperationInterface::ID => $operationId,
94+
OperationInterface::OPERATION_KEY => $operationId,
9595
OperationInterface::BULK_ID => $groupId,
9696
OperationInterface::TOPIC_NAME => $topicName,
9797
OperationInterface::SERIALIZED_DATA => $this->jsonSerializer->serialize($serializedData),

app/code/Magento/WebapiAsync/Model/OperationRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function create($topicName, $entityParams, $groupId, $operationId): Opera
8989
];
9090
$data = [
9191
'data' => [
92-
OperationInterface::ID => $operationId,
92+
OperationInterface::OPERATION_KEY => $operationId,
9393
OperationInterface::BULK_ID => $groupId,
9494
OperationInterface::TOPIC_NAME => $topicName,
9595
OperationInterface::SERIALIZED_DATA => $this->jsonSerializer->serialize($serializedData),

lib/internal/Magento/Framework/Bulk/OperationInterface.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ interface OperationInterface extends \Magento\Framework\Api\ExtensibleDataInterf
1515
/**#@+
1616
* Constants for keys of data array. Identical to the name of the getter in snake case
1717
*/
18-
const ID = 'operation_key';
18+
const ID = 'id';
1919
const BULK_ID = 'bulk_uuid';
2020
const TOPIC_NAME = 'topic_name';
2121
const SERIALIZED_DATA = 'serialized_data';
2222
const RESULT_SERIALIZED_DATA = 'result_serialized_data';
23+
const OPERATION_KEY = 'operation_key';
2324
const STATUS = 'status';
2425
const RESULT_MESSAGE = 'result_message';
2526
const ERROR_CODE = 'error_code';
@@ -172,4 +173,21 @@ public function getErrorCode();
172173
* @since 103.0.0
173174
*/
174175
public function setErrorCode($errorCode);
176+
177+
/**
178+
* Get operation key
179+
*
180+
* @return int|null
181+
* @since 103.0.1
182+
*/
183+
public function getOperationKey(): ?int;
184+
185+
/**
186+
* Set operation key
187+
*
188+
* @param int|null $operationKey
189+
* @return $this
190+
* @since 103.0.1
191+
*/
192+
public function setOperationKey(?int $operationKey): self;
175193
}

0 commit comments

Comments
 (0)