Skip to content

Commit a17c1fa

Browse files
committed
magento/bulk-api-ce#12: Operations Status Search API Endpoint
1 parent 7a6c902 commit a17c1fa

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,21 @@
1010
namespace Magento\AsynchronousOperations\Api\Data;
1111

1212
/**
13+
* Interface defines Operation Search Results data object
14+
*
1315
* @api
1416
*/
1517
interface OperationSearchResultsInterface extends \Magento\Framework\Api\SearchResultsInterface
1618
{
1719
/**
18-
* Get attributes list.
20+
* Get operations list.
1921
*
2022
* @return \Magento\AsynchronousOperations\Api\Data\OperationInterface[]
2123
*/
2224
public function getItems();
2325

2426
/**
25-
* Set attributes list.
27+
* Set operations list.
2628
*
2729
* @param \Magento\AsynchronousOperations\Api\Data\OperationInterface[] $items
2830
* @return $this

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

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use Magento\Framework\Exception\NoSuchEntityException;
2121

2222
/**
23-
* Class OperationManagement
23+
* Operation Management Service
2424
*/
2525
class OperationRepository implements \Magento\AsynchronousOperations\Api\OperationRepositoryInterface
2626
{
@@ -60,14 +60,13 @@ class OperationRepository implements \Magento\AsynchronousOperations\Api\Operati
6060
private $logger;
6161

6262
/**
63-
* Initialize dependencies.
64-
*
65-
* @param \Magento\Framework\EntityManager\EntityManager $entityManager
66-
* @param \Magento\AsynchronousOperations\Model\ResourceModel\Operation\CollectionFactory $collectionFactory
67-
* @param \Magento\AsynchronousOperations\Api\Data\OperationSearchResultsInterfaceFactory $searchResultFactory
68-
* @param \Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface $joinProcessor
69-
* @param \Magento\AsynchronousOperations\Api\Data\OperationExtensionInterfaceFactory $operationExtensionFactory
70-
* @param \Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface|null $collectionProcessor
63+
* OperationRepository constructor.
64+
* @param EntityManager $entityManager
65+
* @param CollectionFactory $collectionFactory
66+
* @param SearchResultFactory $searchResultFactory
67+
* @param JoinProcessorInterface $joinProcessor
68+
* @param OperationExtensionInterfaceFactory $operationExtension
69+
* @param CollectionProcessorInterface $collectionProcessor
7170
* @param \Psr\Log\LoggerInterface $logger
7271
*/
7372
public function __construct(
@@ -76,16 +75,14 @@ public function __construct(
7675
SearchResultFactory $searchResultFactory,
7776
JoinProcessorInterface $joinProcessor,
7877
OperationExtensionInterfaceFactory $operationExtension,
79-
CollectionProcessorInterface $collectionProcessor = null,
78+
CollectionProcessorInterface $collectionProcessor,
8079
\Psr\Log\LoggerInterface $logger
8180
) {
8281
$this->entityManager = $entityManager;
8382
$this->collectionFactory = $collectionFactory;
8483
$this->searchResultFactory = $searchResultFactory;
8584
$this->joinProcessor = $joinProcessor;
8685
$this->operationExtensionFactory = $operationExtension;
87-
$this->collectionProcessor = $collectionProcessor ? : ObjectManager::getInstance()
88-
->get(\Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface::class);
8986
$this->logger = $logger;
9087
}
9188

@@ -110,7 +107,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
110107
if ($extensionAttributes == null) {
111108
$extensionAttributes = $this->operationExtensionFactory->create();
112109
}
113-
$extensionAttributes->setStartTime('dsadsa');
110+
$extensionAttributes->setStartTime($item->getExtensionAttributeStartTimeStartTime());
114111
$item->setExtensionAttributes($extensionAttributes);
115112
$items[] = $item;
116113
}

dev/tests/api-functional/testsuite/Magento/AsynchronousOperations/Api/OperationRepositoryInterfaceTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
use Magento\TestFramework\TestCase\WebapiAbstract;
1313
use Magento\Framework\Bulk\OperationInterface;
1414

15+
/**
16+
* @magentoDbIsolation enabled
17+
*/
1518
class OperationRepositoryInterfaceTest extends WebapiAbstract
1619
{
1720
const RESOURCE_PATH = '/V1/bulk';

0 commit comments

Comments
 (0)