Skip to content
This repository has been archived by the owner on May 20, 2019. It is now read-only.

Commit

Permalink
#12: Operations Status Search API Endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
vrann committed Jun 27, 2018
1 parent 7a6c902 commit a17c1fa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@
namespace Magento\AsynchronousOperations\Api\Data;

/**
* Interface defines Operation Search Results data object
*
* @api
*/
interface OperationSearchResultsInterface extends \Magento\Framework\Api\SearchResultsInterface
{
/**
* Get attributes list.
* Get operations list.
*
* @return \Magento\AsynchronousOperations\Api\Data\OperationInterface[]
*/
public function getItems();

/**
* Set attributes list.
* Set operations list.
*
* @param \Magento\AsynchronousOperations\Api\Data\OperationInterface[] $items
* @return $this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Magento\Framework\Exception\NoSuchEntityException;

/**
* Class OperationManagement
* Operation Management Service
*/
class OperationRepository implements \Magento\AsynchronousOperations\Api\OperationRepositoryInterface
{
Expand Down Expand Up @@ -60,14 +60,13 @@ class OperationRepository implements \Magento\AsynchronousOperations\Api\Operati
private $logger;

/**
* Initialize dependencies.
*
* @param \Magento\Framework\EntityManager\EntityManager $entityManager
* @param \Magento\AsynchronousOperations\Model\ResourceModel\Operation\CollectionFactory $collectionFactory
* @param \Magento\AsynchronousOperations\Api\Data\OperationSearchResultsInterfaceFactory $searchResultFactory
* @param \Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface $joinProcessor
* @param \Magento\AsynchronousOperations\Api\Data\OperationExtensionInterfaceFactory $operationExtensionFactory
* @param \Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface|null $collectionProcessor
* OperationRepository constructor.
* @param EntityManager $entityManager
* @param CollectionFactory $collectionFactory
* @param SearchResultFactory $searchResultFactory
* @param JoinProcessorInterface $joinProcessor
* @param OperationExtensionInterfaceFactory $operationExtension
* @param CollectionProcessorInterface $collectionProcessor
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(
Expand All @@ -76,16 +75,14 @@ public function __construct(
SearchResultFactory $searchResultFactory,
JoinProcessorInterface $joinProcessor,
OperationExtensionInterfaceFactory $operationExtension,
CollectionProcessorInterface $collectionProcessor = null,
CollectionProcessorInterface $collectionProcessor,
\Psr\Log\LoggerInterface $logger
) {
$this->entityManager = $entityManager;
$this->collectionFactory = $collectionFactory;
$this->searchResultFactory = $searchResultFactory;
$this->joinProcessor = $joinProcessor;
$this->operationExtensionFactory = $operationExtension;
$this->collectionProcessor = $collectionProcessor ? : ObjectManager::getInstance()
->get(\Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface::class);
$this->logger = $logger;
}

Expand All @@ -110,7 +107,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
if ($extensionAttributes == null) {
$extensionAttributes = $this->operationExtensionFactory->create();
}
$extensionAttributes->setStartTime('dsadsa');
$extensionAttributes->setStartTime($item->getExtensionAttributeStartTimeStartTime());
$item->setExtensionAttributes($extensionAttributes);
$items[] = $item;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use Magento\TestFramework\TestCase\WebapiAbstract;
use Magento\Framework\Bulk\OperationInterface;

/**
* @magentoDbIsolation enabled
*/
class OperationRepositoryInterfaceTest extends WebapiAbstract
{
const RESOURCE_PATH = '/V1/bulk';
Expand Down

0 comments on commit a17c1fa

Please sign in to comment.