Skip to content

Commit bf38673

Browse files
author
Mohan Ahuja
committed
ACP2E-726: Unable to query bulk operations by search criteria using REST Api
- Reverting framework file changes. - Created changes in specific module interface instead of doing in base api interface
1 parent 1a8feb2 commit bf38673

File tree

6 files changed

+42
-44
lines changed

6 files changed

+42
-44
lines changed

app/code/Magento/AsynchronousOperations/Api/Data/OperationInterface.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
*/
1414
interface OperationInterface extends \Magento\Framework\Bulk\OperationInterface
1515
{
16+
public const OPERATION_ID = 'id';
17+
1618
/**
1719
* Retrieve existing extension attributes object.
1820
*
@@ -31,4 +33,20 @@ public function getExtensionAttributes();
3133
public function setExtensionAttributes(
3234
\Magento\AsynchronousOperations\Api\Data\OperationExtensionInterface $extensionAttributes
3335
);
36+
37+
/**
38+
* Get operation key
39+
*
40+
* @return int|null
41+
* @since 103.0.1
42+
*/
43+
public function getOperationKey();
44+
45+
/**
46+
* Set operation key
47+
*
48+
* @param int|null $operationKey
49+
* @since 103.0.1
50+
*/
51+
public function setOperationKey(?int $operationKey);
3452
}

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

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

88
use Magento\AsynchronousOperations\Api\Data\OperationInterface;
99
use Magento\AsynchronousOperations\Model\OperationStatusValidator;
10-
use Magento\Framework\Bulk\OperationInterface as BulkOperationInterface;
1110
use Magento\Framework\DataObject;
1211

1312
/**
@@ -39,15 +38,15 @@ public function __construct(
3938
*/
4039
public function getId()
4140
{
42-
return $this->getData(self::ID);
41+
return $this->getData(self::OPERATION_ID);
4342
}
4443

4544
/**
4645
* @inheritDoc
4746
*/
4847
public function setId($id)
4948
{
50-
return $this->setData(self::ID, $id);
49+
return $this->setData(self::OPERATION_ID, $id);
5150
}
5251

5352
/**
@@ -168,16 +167,15 @@ public function setErrorCode($errorCode)
168167
*/
169168
public function getOperationKey(): ?int
170169
{
171-
return $this->getData(self::OPERATION_KEY) ? (int) $this->getData(self::OPERATION_KEY) : null;
170+
return $this->getData(self::ID) ? (int) $this->getData(self::ID) : null;
172171
}
173172

174173
/**
175174
* @inheritDoc
176175
*/
177-
public function setOperationKey(?int $operationKey): BulkOperationInterface
176+
public function setOperationKey(?int $operationKey)
178177
{
179-
$this->setData(self::OPERATION_KEY, $operationKey);
180-
return $this;
178+
return $this->setData(self::ID, $operationKey);
181179
}
182180

183181
/**

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::OPERATION_KEY => $operationId,
94+
OperationInterface::ID => $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::OPERATION_KEY => $operationId,
92+
OperationInterface::ID => $operationId,
9393
OperationInterface::BULK_ID => $groupId,
9494
OperationInterface::TOPIC_NAME => $topicName,
9595
OperationInterface::SERIALIZED_DATA => $this->jsonSerializer->serialize($serializedData),

dev/tests/integration/testsuite/Magento/AsynchronousOperations/Cron/MarkIncompleteOperationsAsFailedTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,22 @@ public function testExecute(): void
5353
$startedAt = $resource->getConnection()->formatDate(new \DateTime('-14 hours', new \DateTimeZone('UTC')));
5454
$operationsData = [
5555
[
56-
OperationInterface::OPERATION_KEY => 0,
56+
OperationInterface::ID => 0,
5757
OperationInterface::STATUS => OperationInterface::STATUS_TYPE_COMPLETE,
5858
'started_at' => $startedAt,
5959
],
6060
[
61-
OperationInterface::OPERATION_KEY => 1,
61+
OperationInterface::ID => 1,
6262
OperationInterface::STATUS => OperationInterface::STATUS_TYPE_OPEN,
6363
'started_at' => $startedAt,
6464
],
6565
[
66-
OperationInterface::OPERATION_KEY => 2,
66+
OperationInterface::ID => 2,
6767
OperationInterface::STATUS => OperationInterface::STATUS_TYPE_NOT_RETRIABLY_FAILED,
6868
'started_at' => $startedAt,
6969
],
7070
[
71-
OperationInterface::OPERATION_KEY => 3,
71+
OperationInterface::ID => 3,
7272
OperationInterface::STATUS => OperationInterface::STATUS_TYPE_OPEN,
7373
'started_at' => null,
7474
]

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

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,24 @@ 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-
public const ID = 'id';
19-
public const BULK_ID = 'bulk_uuid';
20-
public const TOPIC_NAME = 'topic_name';
21-
public const SERIALIZED_DATA = 'serialized_data';
22-
public const RESULT_SERIALIZED_DATA = 'result_serialized_data';
23-
public const OPERATION_KEY = 'operation_key';
24-
public const STATUS = 'status';
25-
public const RESULT_MESSAGE = 'result_message';
26-
public const ERROR_CODE = 'error_code';
18+
const ID = 'operation_key';
19+
const BULK_ID = 'bulk_uuid';
20+
const TOPIC_NAME = 'topic_name';
21+
const SERIALIZED_DATA = 'serialized_data';
22+
const RESULT_SERIALIZED_DATA = 'result_serialized_data';
23+
const STATUS = 'status';
24+
const RESULT_MESSAGE = 'result_message';
25+
const ERROR_CODE = 'error_code';
2726
/**#@-*/
2827

2928
/**#@+
3029
* Status types
3130
*/
32-
public const STATUS_TYPE_COMPLETE = 1;
33-
public const STATUS_TYPE_RETRIABLY_FAILED = 2;
34-
public const STATUS_TYPE_NOT_RETRIABLY_FAILED = 3;
35-
public const STATUS_TYPE_OPEN = 4;
36-
public const STATUS_TYPE_REJECTED = 5;
31+
const STATUS_TYPE_COMPLETE = 1;
32+
const STATUS_TYPE_RETRIABLY_FAILED = 2;
33+
const STATUS_TYPE_NOT_RETRIABLY_FAILED = 3;
34+
const STATUS_TYPE_OPEN = 4;
35+
const STATUS_TYPE_REJECTED = 5;
3736
/**#@-*/
3837

3938
/**
@@ -173,21 +172,4 @@ public function getErrorCode();
173172
* @since 103.0.0
174173
*/
175174
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;
193175
}

0 commit comments

Comments
 (0)