From 92ff7bd594ac6eaa849ffd381afeb2e22e01e834 Mon Sep 17 00:00:00 2001 From: Dmytro Voskoboinikov Date: Fri, 16 Oct 2015 17:44:06 +0300 Subject: [PATCH 01/14] MAGETWO-44134: [Github] Sales API should use searchCriteria not criteria --- .../Sales/Api/CreditmemoCommentRepositoryInterface.php | 4 ++-- .../Sales/Api/CreditmemoItemRepositoryInterface.php | 4 ++-- .../Sales/Api/CreditmemoRepositoryInterface.php | 4 ++-- .../Sales/Api/InvoiceCommentRepositoryInterface.php | 4 ++-- .../Sales/Api/InvoiceItemRepositoryInterface.php | 4 ++-- .../Magento/Sales/Api/InvoiceRepositoryInterface.php | 4 ++-- .../Sales/Api/OrderAddressRepositoryInterface.php | 4 ++-- .../Magento/Sales/Api/OrderItemRepositoryInterface.php | 4 ++-- .../Sales/Api/OrderPaymentRepositoryInterface.php | 4 ++-- .../Magento/Sales/Api/OrderRepositoryInterface.php | 4 ++-- .../Api/OrderStatusHistoryRepositoryInterface.php | 4 ++-- .../Sales/Api/ShipmentCommentRepositoryInterface.php | 4 ++-- .../Sales/Api/ShipmentItemRepositoryInterface.php | 4 ++-- .../Magento/Sales/Api/ShipmentRepositoryInterface.php | 4 ++-- .../Sales/Api/ShipmentTrackRepositoryInterface.php | 4 ++-- .../Sales/Api/TransactionRepositoryInterface.php | 4 ++-- .../Block/Adminhtml/Order/Create/Form/Address.php | 4 ++-- .../Magento/Sales/Model/Order/AddressRepository.php | 10 +++++----- .../Magento/Sales/Model/Order/CreditmemoRepository.php | 10 +++++----- .../Magento/Sales/Model/Order/InvoiceRepository.php | 10 +++++----- app/code/Magento/Sales/Model/Order/ItemRepository.php | 8 ++++---- .../Magento/Sales/Model/Order/Payment/Repository.php | 10 +++++----- .../Model/Order/Payment/Transaction/Repository.php | 8 ++++---- .../Magento/Sales/Model/Order/ShipmentRepository.php | 10 +++++----- app/code/Magento/Sales/Model/OrderRepository.php | 10 +++++----- .../Magento/Sales/Model/Service/CreditmemoService.php | 4 ++-- .../Magento/Sales/Model/Service/InvoiceService.php | 4 ++-- app/code/Magento/Sales/Model/Service/OrderService.php | 4 ++-- .../Magento/Sales/Model/Service/ShipmentService.php | 4 ++-- .../Sales/Test/Unit/Model/InvoiceRepositoryTest.php | 6 +++--- .../Test/Unit/Model/Order/AddressRepositoryTest.php | 6 +++--- .../Test/Unit/Model/Order/CreditmemoRepositoryTest.php | 6 +++--- .../Sales/Test/Unit/Model/Order/ItemRepositoryTest.php | 6 +++--- .../Test/Unit/Model/Order/ShipmentRepositoryTest.php | 6 +++--- 34 files changed, 95 insertions(+), 95 deletions(-) diff --git a/app/code/Magento/Sales/Api/CreditmemoCommentRepositoryInterface.php b/app/code/Magento/Sales/Api/CreditmemoCommentRepositoryInterface.php index d7c1f067cc046..bc8cda48f2b21 100644 --- a/app/code/Magento/Sales/Api/CreditmemoCommentRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/CreditmemoCommentRepositoryInterface.php @@ -32,10 +32,10 @@ public function get($id); * * Returns a credit memo comment search results interface. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\CreditmemoCommentSearchResultInterface Credit memo comment search results interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Deletes a specified credit memo comment. diff --git a/app/code/Magento/Sales/Api/CreditmemoItemRepositoryInterface.php b/app/code/Magento/Sales/Api/CreditmemoItemRepositoryInterface.php index b322cc7b68f48..9921c53a84385 100644 --- a/app/code/Magento/Sales/Api/CreditmemoItemRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/CreditmemoItemRepositoryInterface.php @@ -27,10 +27,10 @@ public function get($id); /** * Lists credit memo items that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\CreditmemoItemSearchResultInterface Credit memo item search results interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Deletes a specified credit memo item. diff --git a/app/code/Magento/Sales/Api/CreditmemoRepositoryInterface.php b/app/code/Magento/Sales/Api/CreditmemoRepositoryInterface.php index 8bb487d732299..e1577630215c4 100644 --- a/app/code/Magento/Sales/Api/CreditmemoRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/CreditmemoRepositoryInterface.php @@ -18,10 +18,10 @@ interface CreditmemoRepositoryInterface /** * Lists credit memos that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\CreditmemoSearchResultInterface Credit memo search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified credit memo. diff --git a/app/code/Magento/Sales/Api/InvoiceCommentRepositoryInterface.php b/app/code/Magento/Sales/Api/InvoiceCommentRepositoryInterface.php index f256bb88af2ab..d9d698b987b61 100644 --- a/app/code/Magento/Sales/Api/InvoiceCommentRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/InvoiceCommentRepositoryInterface.php @@ -17,10 +17,10 @@ interface InvoiceCommentRepositoryInterface /** * Lists invoice comments that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\InvoiceCommentSearchResultInterface Invoice search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified invoice comment. diff --git a/app/code/Magento/Sales/Api/InvoiceItemRepositoryInterface.php b/app/code/Magento/Sales/Api/InvoiceItemRepositoryInterface.php index 90ae5cea092df..510623d1932ba 100644 --- a/app/code/Magento/Sales/Api/InvoiceItemRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/InvoiceItemRepositoryInterface.php @@ -16,10 +16,10 @@ interface InvoiceItemRepositoryInterface /** * Lists the invoice items that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria * @return \Magento\Sales\Api\Data\InvoiceItemSearchResultInterface */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified invoice item. diff --git a/app/code/Magento/Sales/Api/InvoiceRepositoryInterface.php b/app/code/Magento/Sales/Api/InvoiceRepositoryInterface.php index 0fa5f268be642..9b864ba2ea380 100644 --- a/app/code/Magento/Sales/Api/InvoiceRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/InvoiceRepositoryInterface.php @@ -16,10 +16,10 @@ interface InvoiceRepositoryInterface /** * Lists invoices that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\InvoiceSearchResultInterface Invoice search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Return Invoice object diff --git a/app/code/Magento/Sales/Api/OrderAddressRepositoryInterface.php b/app/code/Magento/Sales/Api/OrderAddressRepositoryInterface.php index 5c3db02774762..8071ec0c4894c 100644 --- a/app/code/Magento/Sales/Api/OrderAddressRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/OrderAddressRepositoryInterface.php @@ -18,10 +18,10 @@ interface OrderAddressRepositoryInterface /** * Lists order addresses that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\OrderAddressSearchResultInterface Order address search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified order address. diff --git a/app/code/Magento/Sales/Api/OrderItemRepositoryInterface.php b/app/code/Magento/Sales/Api/OrderItemRepositoryInterface.php index e1832a09e5568..6355db859bbcf 100644 --- a/app/code/Magento/Sales/Api/OrderItemRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/OrderItemRepositoryInterface.php @@ -18,10 +18,10 @@ interface OrderItemRepositoryInterface /** * Lists order items that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\OrderItemSearchResultInterface Order item search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified order item. diff --git a/app/code/Magento/Sales/Api/OrderPaymentRepositoryInterface.php b/app/code/Magento/Sales/Api/OrderPaymentRepositoryInterface.php index e4ff2acf54ba6..005de16342db3 100644 --- a/app/code/Magento/Sales/Api/OrderPaymentRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/OrderPaymentRepositoryInterface.php @@ -18,10 +18,10 @@ interface OrderPaymentRepositoryInterface /** * Lists order payments that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\OrderPaymentSearchResultInterface Order payment search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified order payment. diff --git a/app/code/Magento/Sales/Api/OrderRepositoryInterface.php b/app/code/Magento/Sales/Api/OrderRepositoryInterface.php index d8420ce0da729..50a683b437153 100644 --- a/app/code/Magento/Sales/Api/OrderRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/OrderRepositoryInterface.php @@ -18,10 +18,10 @@ interface OrderRepositoryInterface /** * Lists orders that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\OrderSearchResultInterface Order search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified order. diff --git a/app/code/Magento/Sales/Api/OrderStatusHistoryRepositoryInterface.php b/app/code/Magento/Sales/Api/OrderStatusHistoryRepositoryInterface.php index b99bf0dc2c729..743f9aaa734e9 100644 --- a/app/code/Magento/Sales/Api/OrderStatusHistoryRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/OrderStatusHistoryRepositoryInterface.php @@ -21,10 +21,10 @@ interface OrderStatusHistoryRepositoryInterface /** * Lists order status history comments that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\OrderStatusHistorySearchResultInterface Order status history search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified order status comment. diff --git a/app/code/Magento/Sales/Api/ShipmentCommentRepositoryInterface.php b/app/code/Magento/Sales/Api/ShipmentCommentRepositoryInterface.php index e6605c9c5dd24..9ca3bb336f268 100644 --- a/app/code/Magento/Sales/Api/ShipmentCommentRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/ShipmentCommentRepositoryInterface.php @@ -17,10 +17,10 @@ interface ShipmentCommentRepositoryInterface /** * Lists shipment comments that match specific search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\ShipmentCommentSearchResultInterface Shipment comment search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified shipment comment. diff --git a/app/code/Magento/Sales/Api/ShipmentItemRepositoryInterface.php b/app/code/Magento/Sales/Api/ShipmentItemRepositoryInterface.php index 0db3adabf885c..5d2d3946a9197 100644 --- a/app/code/Magento/Sales/Api/ShipmentItemRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/ShipmentItemRepositoryInterface.php @@ -17,10 +17,10 @@ interface ShipmentItemRepositoryInterface /** * Lists shipment items that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\ShipmentItemSearchResultInterface Shipment item search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified shipment item. diff --git a/app/code/Magento/Sales/Api/ShipmentRepositoryInterface.php b/app/code/Magento/Sales/Api/ShipmentRepositoryInterface.php index 1cfa85d87e66f..858347a6f166d 100644 --- a/app/code/Magento/Sales/Api/ShipmentRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/ShipmentRepositoryInterface.php @@ -17,10 +17,10 @@ interface ShipmentRepositoryInterface /** * Lists shipments that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\ShipmentSearchResultInterface Shipment search results interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified shipment. diff --git a/app/code/Magento/Sales/Api/ShipmentTrackRepositoryInterface.php b/app/code/Magento/Sales/Api/ShipmentTrackRepositoryInterface.php index 5d7817b0c828d..ada64b54d862f 100644 --- a/app/code/Magento/Sales/Api/ShipmentTrackRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/ShipmentTrackRepositoryInterface.php @@ -17,10 +17,10 @@ interface ShipmentTrackRepositoryInterface /** * Lists shipment tracks that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\ShipmentTrackSearchResultInterface Shipment track search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified shipment track. diff --git a/app/code/Magento/Sales/Api/TransactionRepositoryInterface.php b/app/code/Magento/Sales/Api/TransactionRepositoryInterface.php index 7a256e7deaf7c..be5315f1329cc 100644 --- a/app/code/Magento/Sales/Api/TransactionRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/TransactionRepositoryInterface.php @@ -16,10 +16,10 @@ interface TransactionRepositoryInterface /** * Lists transactions that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\TransactionSearchResultInterface Transaction search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified transaction. diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php index 1ee0386f87110..4af19b69b1361 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php @@ -160,8 +160,8 @@ public function getAddressCollection() ->setConditionType('eq') ->create(); $this->searchCriteriaBuilder->addFilters([$filter]); - $criteria = $this->searchCriteriaBuilder->create(); - $result = $this->addressService->getList($criteria); + $searchCriteria = $this->searchCriteriaBuilder->create(); + $result = $this->addressService->getList($searchCriteria); return $result->getItems(); } return []; diff --git a/app/code/Magento/Sales/Model/Order/AddressRepository.php b/app/code/Magento/Sales/Model/Order/AddressRepository.php index 2e4c9df86fa22..fb77f8d17c351 100644 --- a/app/code/Magento/Sales/Model/Order/AddressRepository.php +++ b/app/code/Magento/Sales/Model/Order/AddressRepository.php @@ -77,24 +77,24 @@ public function get($id) /** * Find order addresses by criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria * @return \Magento\Sales\Api\Data\OrderAddressInterface[] */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria) + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) { //@TODO: fix search logic /** @var \Magento\Sales\Api\Data\OrderAddressSearchResultInterface $searchResult */ $searchResult = $this->searchResultFactory->create(); - foreach ($criteria->getFilterGroups() as $filterGroup) { + foreach ($searchCriteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $searchResult->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } - $searchResult->setCurPage($criteria->getCurrentPage()); - $searchResult->setPageSize($criteria->getPageSize()); + $searchResult->setCurPage($searchCriteria->getCurrentPage()); + $searchResult->setPageSize($searchCriteria->getPageSize()); return $searchResult; } diff --git a/app/code/Magento/Sales/Model/Order/CreditmemoRepository.php b/app/code/Magento/Sales/Model/Order/CreditmemoRepository.php index 200a57a73fff5..c9621a7e668d3 100644 --- a/app/code/Magento/Sales/Model/Order/CreditmemoRepository.php +++ b/app/code/Magento/Sales/Model/Order/CreditmemoRepository.php @@ -87,21 +87,21 @@ public function create() /** * Lists credit memos that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\CreditmemoSearchResultInterface Credit memo search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria) + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) { /** @var \Magento\Sales\Api\Data\CreditmemoSearchResultInterface $searchResult */ $searchResult = $this->searchResultFactory->create(); - foreach ($criteria->getFilterGroups() as $filterGroup) { + foreach ($searchCriteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $searchResult->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } - $searchResult->setCurPage($criteria->getCurrentPage()); - $searchResult->setPageSize($criteria->getPageSize()); + $searchResult->setCurPage($searchCriteria->getCurrentPage()); + $searchResult->setPageSize($searchCriteria->getPageSize()); return $searchResult; } diff --git a/app/code/Magento/Sales/Model/Order/InvoiceRepository.php b/app/code/Magento/Sales/Model/Order/InvoiceRepository.php index 04275723bda95..6ac147108bb73 100644 --- a/app/code/Magento/Sales/Model/Order/InvoiceRepository.php +++ b/app/code/Magento/Sales/Model/Order/InvoiceRepository.php @@ -83,21 +83,21 @@ public function create() /** * Find entities by criteria * - * @param \Magento\Framework\Api\SearchCriteria $criteria + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria * @return \Magento\Sales\Api\Data\InvoiceInterface[] */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria) + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) { /** @var \Magento\Sales\Model\ResourceModel\Order\Invoice\Collection $collection */ $collection = $this->searchResultFactory->create(); - foreach ($criteria->getFilterGroups() as $filterGroup) { + foreach ($searchCriteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $collection->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } - $collection->setCurPage($criteria->getCurrentPage()); - $collection->setPageSize($criteria->getPageSize()); + $collection->setCurPage($searchCriteria->getCurrentPage()); + $collection->setPageSize($searchCriteria->getPageSize()); return $collection; } diff --git a/app/code/Magento/Sales/Model/Order/ItemRepository.php b/app/code/Magento/Sales/Model/Order/ItemRepository.php index 776b862828658..983a87834fabf 100644 --- a/app/code/Magento/Sales/Model/Order/ItemRepository.php +++ b/app/code/Magento/Sales/Model/Order/ItemRepository.php @@ -114,16 +114,16 @@ public function get($id) /** * Find entities by criteria * - * @param SearchCriteria $criteria + * @param SearchCriteria $searchCriteria * @return OrderItemInterface[] */ - public function getList(SearchCriteria $criteria) + public function getList(SearchCriteria $searchCriteria) { /** @var OrderItemSearchResultInterface $searchResult */ $searchResult = $this->searchResultFactory->create(); - $searchResult->setSearchCriteria($criteria); + $searchResult->setSearchCriteria($searchCriteria); - foreach ($criteria->getFilterGroups() as $filterGroup) { + foreach ($searchCriteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $searchResult->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); diff --git a/app/code/Magento/Sales/Model/Order/Payment/Repository.php b/app/code/Magento/Sales/Model/Order/Payment/Repository.php index 2517c4b9adbcc..ef3fb08b5daa1 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/Repository.php +++ b/app/code/Magento/Sales/Model/Order/Payment/Repository.php @@ -47,21 +47,21 @@ public function __construct(Metadata $metaData, SearchResultFactory $searchResul /** * Lists order payments that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\OrderPaymentSearchResultInterface Order payment search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria) + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) { /** @var \Magento\Sales\Model\ResourceModel\Order\Payment\Collection $collection */ $collection = $this->searchResultFactory->create(); - foreach ($criteria->getFilterGroups() as $filterGroup) { + foreach ($searchCriteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $collection->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } - $collection->setCurPage($criteria->getCurrentPage()); - $collection->setPageSize($criteria->getPageSize()); + $collection->setCurPage($searchCriteria->getCurrentPage()); + $collection->setPageSize($searchCriteria->getPageSize()); return $collection; } diff --git a/app/code/Magento/Sales/Model/Order/Payment/Transaction/Repository.php b/app/code/Magento/Sales/Model/Order/Payment/Transaction/Repository.php index 051ab5401d59f..a3550d6073ecd 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/Transaction/Repository.php +++ b/app/code/Magento/Sales/Model/Order/Payment/Transaction/Repository.php @@ -185,18 +185,18 @@ public function getByTransactionId($transactionId, $paymentId, $orderId) /** * {@inheritdoc} */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria) + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) { /** @var TransactionResource\Collection $collection */ $collection = $this->searchResultFactory->create(); - foreach ($criteria->getFilterGroups() as $filterGroup) { + foreach ($searchCriteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $collection->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } - $collection->setCurPage($criteria->getCurrentPage()); - $collection->setPageSize($criteria->getPageSize()); + $collection->setCurPage($searchCriteria->getCurrentPage()); + $collection->setPageSize($searchCriteria->getPageSize()); $collection->addPaymentInformation(['method']); $collection->addOrderInformation(['increment_id']); return $collection; diff --git a/app/code/Magento/Sales/Model/Order/ShipmentRepository.php b/app/code/Magento/Sales/Model/Order/ShipmentRepository.php index c44fa79ae56c7..0476e481452b5 100644 --- a/app/code/Magento/Sales/Model/Order/ShipmentRepository.php +++ b/app/code/Magento/Sales/Model/Order/ShipmentRepository.php @@ -77,24 +77,24 @@ public function get($id) /** * Find shipments by criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria * @return \Magento\Sales\Api\Data\ShipmentInterface[] */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria) + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) { //@TODO: fix search logic /** @var \Magento\Sales\Api\Data\ShipmentSearchResultInterface $searchResult */ $searchResult = $this->searchResultFactory->create(); - foreach ($criteria->getFilterGroups() as $filterGroup) { + foreach ($searchCriteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $searchResult->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } - $searchResult->setCurPage($criteria->getCurrentPage()); - $searchResult->setPageSize($criteria->getPageSize()); + $searchResult->setCurPage($searchCriteria->getCurrentPage()); + $searchResult->setPageSize($searchCriteria->getPageSize()); return $searchResult; } diff --git a/app/code/Magento/Sales/Model/OrderRepository.php b/app/code/Magento/Sales/Model/OrderRepository.php index 976a03486a4f1..1d4a7b8e66a9a 100644 --- a/app/code/Magento/Sales/Model/OrderRepository.php +++ b/app/code/Magento/Sales/Model/OrderRepository.php @@ -73,22 +73,22 @@ public function get($id) /** * Find entities by criteria * - * @param \Magento\Framework\Api\SearchCriteria $criteria + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria * @return \Magento\Sales\Api\Data\OrderInterface[] */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria) + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) { //@TODO: fix search logic /** @var \Magento\Sales\Api\Data\OrderSearchResultInterface $searchResult */ $searchResult = $this->searchResultFactory->create(); - foreach ($criteria->getFilterGroups() as $filterGroup) { + foreach ($searchCriteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $searchResult->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } - $searchResult->setCurPage($criteria->getCurrentPage()); - $searchResult->setPageSize($criteria->getPageSize()); + $searchResult->setCurPage($searchCriteria->getCurrentPage()); + $searchResult->setPageSize($searchCriteria->getPageSize()); return $searchResult; } diff --git a/app/code/Magento/Sales/Model/Service/CreditmemoService.php b/app/code/Magento/Sales/Model/Service/CreditmemoService.php index ea0e1ed82d1b3..6b949718c11e0 100644 --- a/app/code/Magento/Sales/Model/Service/CreditmemoService.php +++ b/app/code/Magento/Sales/Model/Service/CreditmemoService.php @@ -108,8 +108,8 @@ public function getCommentsList($id) $this->searchCriteriaBuilder->addFilters( [$this->filterBuilder->setField('parent_id')->setValue($id)->setConditionType('eq')->create()] ); - $criteria = $this->searchCriteriaBuilder->create(); - return $this->commentRepository->getList($criteria); + $searchCriteria = $this->searchCriteriaBuilder->create(); + return $this->commentRepository->getList($searchCriteria); } /** diff --git a/app/code/Magento/Sales/Model/Service/InvoiceService.php b/app/code/Magento/Sales/Model/Service/InvoiceService.php index 5c07bf365e9fb..7352d0f221e33 100644 --- a/app/code/Magento/Sales/Model/Service/InvoiceService.php +++ b/app/code/Magento/Sales/Model/Service/InvoiceService.php @@ -103,8 +103,8 @@ public function getCommentsList($id) $this->criteriaBuilder->addFilters( [$this->filterBuilder->setField('parent_id')->setValue($id)->setConditionType('eq')->create()] ); - $criteria = $this->criteriaBuilder->create(); - return $this->commentRepository->getList($criteria); + $searchCriteria = $this->criteriaBuilder->create(); + return $this->commentRepository->getList($searchCriteria); } /** diff --git a/app/code/Magento/Sales/Model/Service/OrderService.php b/app/code/Magento/Sales/Model/Service/OrderService.php index 5df21bf9df691..d3c45bd2bd2e6 100644 --- a/app/code/Magento/Sales/Model/Service/OrderService.php +++ b/app/code/Magento/Sales/Model/Service/OrderService.php @@ -98,8 +98,8 @@ public function getCommentsList($id) $this->criteriaBuilder->addFilters( [$this->filterBuilder->setField('parent_id')->setValue($id)->setConditionType('eq')->create()] ); - $criteria = $this->criteriaBuilder->create(); - return $this->historyRepository->getList($criteria); + $searchCriteria = $this->criteriaBuilder->create(); + return $this->historyRepository->getList($searchCriteria); } /** diff --git a/app/code/Magento/Sales/Model/Service/ShipmentService.php b/app/code/Magento/Sales/Model/Service/ShipmentService.php index 6523e8e83825e..62593c1b1d0dc 100644 --- a/app/code/Magento/Sales/Model/Service/ShipmentService.php +++ b/app/code/Magento/Sales/Model/Service/ShipmentService.php @@ -91,8 +91,8 @@ public function getCommentsList($id) $this->criteriaBuilder->addFilters( [$this->filterBuilder->setField('parent_id')->setValue($id)->setConditionType('eq')->create()] ); - $criteria = $this->criteriaBuilder->create(); - return $this->commentRepository->getList($criteria); + $searchCriteria = $this->criteriaBuilder->create(); + return $this->commentRepository->getList($searchCriteria); } /** diff --git a/app/code/Magento/Sales/Test/Unit/Model/InvoiceRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/InvoiceRepositoryTest.php index 4a2ef97a19764..0cb9a4dc71576 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/InvoiceRepositoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/InvoiceRepositoryTest.php @@ -148,10 +148,10 @@ public function testGetList() ->method('getFilters') ->willReturn([$filter]); - $criteria = $this->getMockBuilder('Magento\Framework\Api\SearchCriteria') + $searchCriteria = $this->getMockBuilder('Magento\Framework\Api\SearchCriteria') ->disableOriginalConstructor() ->getMock(); - $criteria->expects($this->once()) + $searchCriteria->expects($this->once()) ->method('getFilterGroups') ->willReturn($filterGroups); @@ -166,7 +166,7 @@ public function testGetList() ->method('create') ->willReturn($collection); - $this->assertEquals($collection, $this->invoice->getList($criteria)); + $this->assertEquals($collection, $this->invoice->getList($searchCriteria)); } public function testDelete() diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/AddressRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/AddressRepositoryTest.php index f943f6632225b..3dd1590bf72ad 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/AddressRepositoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/AddressRepositoryTest.php @@ -170,14 +170,14 @@ public function testGetList() ->method('getFilters') ->willReturn([$filter]); - $criteria = $this->getMock( + $searchCriteria = $this->getMock( 'Magento\Framework\Api\SearchCriteria', ['getFilterGroups'], [], '', false ); - $criteria->expects($this->once()) + $searchCriteria->expects($this->once()) ->method('getFilterGroups') ->willReturn([$filterGroup]); @@ -196,7 +196,7 @@ public function testGetList() ->method('create') ->willReturn($collection); - $this->assertEquals($collection, $this->subject->getList($criteria)); + $this->assertEquals($collection, $this->subject->getList($searchCriteria)); } public function testDelete() diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoRepositoryTest.php index cba7908dacd42..25357bd65177f 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoRepositoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoRepositoryTest.php @@ -153,10 +153,10 @@ public function testGetList() ->method('getFilters') ->willReturn([$filter]); - $criteria = $this->getMockBuilder('Magento\Framework\Api\SearchCriteria') + $searchCriteria = $this->getMockBuilder('Magento\Framework\Api\SearchCriteria') ->disableOriginalConstructor() ->getMock(); - $criteria->expects($this->once()) + $searchCriteria->expects($this->once()) ->method('getFilterGroups') ->willReturn($filterGroups); @@ -171,7 +171,7 @@ public function testGetList() ->method('create') ->willReturn($collection); - $this->assertEquals($collection, $this->creditmemo->getList($criteria)); + $this->assertEquals($collection, $this->creditmemo->getList($searchCriteria)); } public function testDelete() diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ItemRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ItemRepositoryTest.php index e2deb200dbcfc..314271c315696 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/ItemRepositoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ItemRepositoryTest.php @@ -200,10 +200,10 @@ public function testGetList() ->method('getFilters') ->willReturn([$filterMock]); - $criteriaMock = $this->getMockBuilder('Magento\Framework\Api\SearchCriteria') + $searchCriteriaMock = $this->getMockBuilder('Magento\Framework\Api\SearchCriteria') ->disableOriginalConstructor() ->getMock(); - $criteriaMock->expects($this->once()) + $searchCriteriaMock->expects($this->once()) ->method('getFilterGroups') ->willReturn([$filterGroupMock]); @@ -230,7 +230,7 @@ public function testGetList() ->willReturn($searchResultMock); $model = $this->getModel($orderItemMock, $productType); - $this->assertSame($searchResultMock, $model->getList($criteriaMock)); + $this->assertSame($searchResultMock, $model->getList($searchCriteriaMock)); } public function testDeleteById() diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentRepositoryTest.php index 36a8360ee094f..f76732578da21 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentRepositoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentRepositoryTest.php @@ -170,14 +170,14 @@ public function testGetList() ->method('getFilters') ->willReturn([$filter]); - $criteria = $this->getMock( + $searchCriteria = $this->getMock( 'Magento\Framework\Api\SearchCriteria', ['getFilterGroups'], [], '', false ); - $criteria->expects($this->once()) + $searchCriteria->expects($this->once()) ->method('getFilterGroups') ->willReturn([$filterGroup]); @@ -196,7 +196,7 @@ public function testGetList() ->method('create') ->willReturn($collection); - $this->assertEquals($collection, $this->subject->getList($criteria)); + $this->assertEquals($collection, $this->subject->getList($searchCriteria)); } public function testDelete() From 4327f8b314279eca12dd79db49052001ded57243 Mon Sep 17 00:00:00 2001 From: Sergey Ivashchenko Date: Fri, 16 Oct 2015 19:25:07 +0300 Subject: [PATCH 02/14] MAGETWO-43993: Coupon Code is deleted from Cart Price rule if we use it for checkout with ExpressCheckout button --- .../Magento/SalesRule/Observer/SalesOrderAfterPlaceObserver.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/SalesRule/Observer/SalesOrderAfterPlaceObserver.php b/app/code/Magento/SalesRule/Observer/SalesOrderAfterPlaceObserver.php index 1d1a6be10918d..9ceb8221d17a2 100644 --- a/app/code/Magento/SalesRule/Observer/SalesOrderAfterPlaceObserver.php +++ b/app/code/Magento/SalesRule/Observer/SalesOrderAfterPlaceObserver.php @@ -77,6 +77,7 @@ public function execute(EventObserver $observer) $rule = $this->_ruleFactory->create(); $rule->load($ruleId); if ($rule->getId()) { + $rule->loadCouponCode(); $rule->setTimesUsed($rule->getTimesUsed() + 1); $rule->save(); From ed33e2b3a6fba24cf1f9c48fce98b701f90a4fca Mon Sep 17 00:00:00 2001 From: Sergey Ivashchenko Date: Fri, 16 Oct 2015 19:40:13 +0300 Subject: [PATCH 03/14] MAGETWO-43993: Coupon Code is deleted from Cart Price rule if we use it for checkout with ExpressCheckout button --- app/code/Magento/SalesRule/Model/Plugin/Rule.php | 2 +- app/code/Magento/SalesRule/Model/Rule.php | 14 +++++++++++++- .../SalesRule/Test/Unit/Model/Plugin/RuleTest.php | 6 +++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/SalesRule/Model/Plugin/Rule.php b/app/code/Magento/SalesRule/Model/Plugin/Rule.php index 7bf8cb3c43d8a..8aa29ffe419e7 100644 --- a/app/code/Magento/SalesRule/Model/Plugin/Rule.php +++ b/app/code/Magento/SalesRule/Model/Plugin/Rule.php @@ -13,7 +13,7 @@ class Rule * @return \Magento\SalesRule\Model\Rule * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundLoadCouponCode( + public function aroundLoadRelations( \Magento\SalesRule\Model\Rule $subject, \Closure $proceed ) { diff --git a/app/code/Magento/SalesRule/Model/Rule.php b/app/code/Magento/SalesRule/Model/Rule.php index 200a836592c1c..b9ad49da250ae 100644 --- a/app/code/Magento/SalesRule/Model/Rule.php +++ b/app/code/Magento/SalesRule/Model/Rule.php @@ -231,11 +231,23 @@ protected function _construct() */ protected function _afterLoad() { - $this->loadCouponCode(); + $this->loadRelations(); return parent::_afterLoad(); } /** + * Load all relative data + * + * return void + */ + public function loadRelations() + { + $this->loadCouponCode(); + } + + /** + * Load coupon code + * * @return void */ public function loadCouponCode() diff --git a/app/code/Magento/SalesRule/Test/Unit/Model/Plugin/RuleTest.php b/app/code/Magento/SalesRule/Test/Unit/Model/Plugin/RuleTest.php index fb788c5cf5b6f..a30a4acb36a0f 100644 --- a/app/code/Magento/SalesRule/Test/Unit/Model/Plugin/RuleTest.php +++ b/app/code/Magento/SalesRule/Test/Unit/Model/Plugin/RuleTest.php @@ -14,7 +14,7 @@ class RuleTest extends \PHPUnit_Framework_TestCase protected $plugin; /**} - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\SalesRule\Model\Rule|\PHPUnit_Framework_MockObject_MockObject */ protected $subject; @@ -36,11 +36,11 @@ public function setUp() $this->plugin = $objectManager->getObject('Magento\SalesRule\Model\Plugin\Rule'); } - public function testLoadCouponCode() + public function testLoadRelations() { $this->assertEquals( $this->subject, - $this->plugin->aroundLoadCouponCode($this->subject, $this->genericClosure) + $this->plugin->aroundLoadRelations($this->subject, $this->genericClosure) ); } } From c30fcab93b67362f232c04a5146967f99c94b7e4 Mon Sep 17 00:00:00 2001 From: Sergey Ivashchenko Date: Sat, 17 Oct 2015 13:37:34 +0300 Subject: [PATCH 04/14] MAGETWO-44157: Limiter (Show 20 per page) does not work in My Account -> My Orders --- app/code/Magento/Theme/view/frontend/templates/html/pager.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml b/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml index e7835bee90cc6..331903c8ced11 100644 --- a/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml @@ -116,7 +116,7 @@ isShowPerPage()): ?>
- getAvailableLimit() as $_key => $_limit): ?>