Skip to content

Commit 4385c43

Browse files
author
Mohan Ahuja
committed
ACP2E-726: Unable to query bulk operations by search criteria using REST Api
- Tried another solution to set primary key as id field in collection class - Reverted old solution
1 parent 62463d1 commit 4385c43

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\AsynchronousOperations\Model;
77

88
use Magento\AsynchronousOperations\Api\Data\OperationInterface;
9+
use Magento\AsynchronousOperations\Model\OperationStatusValidator;
910
use Magento\Framework\DataObject;
1011

1112
/**

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,6 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
9494

9595
/** @var \Magento\AsynchronousOperations\Model\ResourceModel\Operation\Collection $collection */
9696
$collection = $this->collectionFactory->create();
97-
$collection->addFieldToSelect('id', 'operation_key');
98-
$collection->addFieldToSelect('operation_key', 'id');
99-
$collection->addFieldToSelect([
100-
'bulk_uuid', 'topic_name', 'serialized_data',
101-
'result_serialized_data', 'status', 'error_code',
102-
'result_message', 'started_at'
103-
]);
10497
$this->joinProcessor->process($collection, \Magento\AsynchronousOperations\Api\Data\OperationInterface::class);
10598
$this->collectionProcessor->process($searchCriteria, $collection);
10699
$searchResult->setSearchCriteria($searchCriteria);

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
*/
77
namespace Magento\AsynchronousOperations\Model\ResourceModel\Operation;
88

9+
use Magento\AsynchronousOperations\Model\Operation;
10+
use Magento\AsynchronousOperations\Model\ResourceModel\Operation as OperationResourceModel;
11+
912
/**
1013
* Class Collection
1114
* @codeCoverageIgnore
@@ -20,9 +23,10 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab
2023
protected function _construct()
2124
{
2225
$this->_init(
23-
\Magento\AsynchronousOperations\Model\Operation::class,
24-
\Magento\AsynchronousOperations\Model\ResourceModel\Operation::class
26+
Operation::class,
27+
OperationResourceModel::class
2528
);
2629
$this->setMainTable('magento_operation');
30+
$this->_setIdFieldName(OperationResourceModel::TABLE_PRIMARY_KEY);
2731
}
2832
}

0 commit comments

Comments
 (0)