Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Api\SearchCriteriaBuilder::addFilter() to addFilters() #1421

Merged
merged 1 commit into from
Jul 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Model/Search/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function load()
->setValue($this->getQuery() . '%')
->create();
}
$this->searchCriteriaBuilder->addFilter($filters);
$this->searchCriteriaBuilder->addFilters($filters);
$searchCriteria = $this->searchCriteriaBuilder->create();
$searchResults = $this->customerRepository->getList($searchCriteria);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function getCustomAttributesMetadata($dataObjectClassName = null)
$defaultAttributeSetId = $this->eavConfig
->getEntityType(\Magento\Catalog\Api\Data\CategoryAttributeInterface::ENTITY_TYPE_CODE)
->getDefaultAttributeSetId();
$searchCriteria = $this->searchCriteriaBuilder->addFilter(
$searchCriteria = $this->searchCriteriaBuilder->addFilters(
[
$this->filterBuilder
->setField('attribute_set_id')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public function getCustomAttributesMetadata($dataObjectClassName = null)
$defaultAttributeSetId = $this->eavConfig
->getEntityType(\Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE)
->getDefaultAttributeSetId();
$searchCriteria = $this->searchCriteriaBuilder->addFilter(
$searchCriteria = $this->searchCriteriaBuilder->addFilters(
[
$this->filterBuilder
->setField('attribute_set_id')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function save(\Magento\Eav\Api\Data\AttributeSetInterface $attributeSet)
*/
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
{
$this->searchCriteriaBuilder->addFilter(
$this->searchCriteriaBuilder->addFilters(
[
$this->filterBuilder
->setField('entity_type_code')
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Model/ProductRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
$defaultAttributeSetId = $this->eavConfig
->getEntityType(\Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE)
->getDefaultAttributeSetId();
$extendedSearchCriteria = $this->searchCriteriaBuilder->addFilter(
$extendedSearchCriteria = $this->searchCriteriaBuilder->addFilters(
[
$this->filterBuilder
->setField('attribute_set_id')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function testGetCustomAttributesMetadata()
3
)->willReturnSelf();
$this->filterBuilderMock->expects($this->once())->method('create')->willReturn($filterMock);
$this->searchBuilderMock->expects($this->once())->method('addFilter')->with([$filterMock])->willReturnSelf();
$this->searchBuilderMock->expects($this->once())->method('addFilters')->with([$filterMock])->willReturnSelf();
$searchCriteriaMock = $this->getMock('Magento\Framework\Api\SearchCriteria', [], [], '', false);
$this->searchBuilderMock->expects($this->once())->method('create')->willReturn($searchCriteriaMock);
$itemMock = $this->getMock('Magento\Framework\Object', [], [], '', false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function testGetCustomAttributesMetadata()
->willReturnSelf();
$this->filterBuilderMock->expects($this->once())->method('create')->willReturn($filterMock);
$this->searchCriteriaBuilderMock->expects($this->once())
->method('addFilter')
->method('addFilters')
->with([$filterMock])
->willReturnSelf();
$searchCriteriaMock = $this->getMock('Magento\Framework\Api\SearchCriteria', [], [], '', false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function testGetList()
$this->filterBuilderMock->expects($this->once())->method('create')->willReturn($filterMock);

$this->searchCriteriaBuilderMock->expects($this->once())
->method('addFilter')
->method('addFilters')
->with([$filterMock])
->willReturnSelf();
$this->searchCriteriaBuilderMock->expects($this->once())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ public function testGetList()
$this->filterBuilderMock->expects($this->once())->method('setValue')
->with(4)
->willReturn($this->filterBuilderMock);
$this->searchCriteriaBuilderMock->expects($this->once())->method('addFilter')->with([$filterMock])
$this->searchCriteriaBuilderMock->expects($this->once())->method('addFilters')->with([$filterMock])
->willReturn($searchCriteriaBuilderMock);
$searchCriteriaBuilderMock->expects($this->once())->method('create')->willReturn($extendedSearchCriteriaMock);
$this->metadataServiceMock->expects($this->once())->method('getList')->with($extendedSearchCriteriaMock)
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Customer/Model/GroupManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ public function getLoggedInGroups()
->setValue(self::CUST_GROUP_ALL)
->create();
$searchCriteria = $this->searchCriteriaBuilder
->addFilter($notLoggedInFilter)
->addFilter($groupAll)
->addFilters($notLoggedInFilter)
->addFilters($groupAll)
->create();
return $this->groupRepository->getList($searchCriteria)->getItems();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function testGetSearchCriteriaImplicitEq()
->setCurrentPage(1)
->setPageSize(false)
->addSortOrder($sortOrder)
->addFilter(
->addFilters(
[$this->filterBuilder->setField('name')->setConditionType('eq')->setValue('Magento')->create()]
)->create();

Expand Down Expand Up @@ -119,7 +119,7 @@ public function testGetSearchCriteriaOneField()
->setCurrentPage(1)
->setPageSize(0)
->addSortOrder($sortOrder)
->addFilter([$filter])
->addFilters([$filter])
->create();

// Verifies that the search criteria Data Object created by the serviceCollection matches expected
Expand Down Expand Up @@ -150,7 +150,7 @@ public function testGetSearchCriteriaOr()
->setCurrentPage(1)
->setPageSize(0)
->addSortOrder($sortOrder)
->addFilter(
->addFilters(
[
$this->filterBuilder->setField($fieldA)->setConditionType('eq')->setValue($value)->create(),
$this->filterBuilder->setField($fieldB)->setConditionType('eq')->setValue($value)->create(),
Expand Down Expand Up @@ -186,13 +186,13 @@ public function testGetSearchCriteriaAnd()
->setCurrentPage(1)
->setPageSize(0)
->addSortOrder($sortOrder)
->addFilter(
->addFilters(
[
$this->filterBuilder->setField($fieldA)->setConditionType('gt')
->setValue($value)->create(),
]
)
->addFilter(
->addFilters(
[
$this->filterBuilder->setField($fieldB)->setConditionType('gt')
->setValue($value)->create(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function getAddress()
->setConditionType('eq')
->create();
$addresses = (array)($this->addressRepository->getList(
$this->searchCriteriaBuilder->addFilter([$filter])->create()
$this->searchCriteriaBuilder->addFilters([$filter])->create()
)->getItems());
} catch (NoSuchEntityException $e) {
return [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function execute()
$filter = $this->filterBuilder->setField('parent_id')->setValue($this->_getCheckout()->getCustomer()->getId())
->setConditionType('eq')->create();
$addresses = (array)($this->addressRepository->getList(
$this->searchCriteriaBuilder->addFilter([$filter])->create()
$this->searchCriteriaBuilder->addFilters([$filter])->create()
)->getItems());

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ private function getDefaultAddressByDataKey($key, $defaultAddressIdFromCustomer)
->setConditionType('eq')
->create();
$addresses = (array)($this->addressRepository->getList(
$this->searchCriteriaBuilder->addFilter([$filter])->create()
$this->searchCriteriaBuilder->addFilters([$filter])->create()
)->getItems());
if ($addresses) {
$address = reset($addresses);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function testGetAddress()
$this->filterBuilderMock->expects($this->once())->method('create')->willReturn($this->filterMock);
$this->searchCriteriaBuilderMock
->expects($this->once())
->method('addFilter')
->method('addFilters')
->with([$this->filterMock])
->willReturnSelf();
$this->searchCriteriaBuilderMock
Expand Down Expand Up @@ -176,7 +176,7 @@ public function testGetAddressWhenItNotExistInCustomer()
$this->filterBuilderMock->expects($this->once())->method('create')->willReturn($this->filterMock);
$this->searchCriteriaBuilderMock
->expects($this->once())
->method('addFilter')
->method('addFilters')
->with([$this->filterMock])
->willReturnSelf();
$this->searchCriteriaBuilderMock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private function mockCustomerAddressRepository($customerId, array $addresses)
$this->filterBuilderMock->expects($this->once())->method('create')->willReturn($filterMock);

$searchCriteriaMock = $this->getMock('Magento\Framework\Api\SearchCriteria', [], [], '', false);
$this->criteriaBuilderMock->expects($this->once())->method('addFilter')->with([$filterMock])->willReturnSelf();
$this->criteriaBuilderMock->expects($this->once())->method('addFilters')->with([$filterMock])->willReturnSelf();
$this->criteriaBuilderMock->expects($this->once())->method('create')->willReturn($searchCriteriaMock);

$searchResultMock = $this->getMock('Magento\Customer\Api\Data\AddressSearchResultsInterface');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function testSetShippingItemsInformation()
$this->filterBuilderMock->expects($this->atLeastOnce())->method('create')->willReturnSelf();

$searchCriteriaMock = $this->getMock('\Magento\Framework\Api\SearchCriteria', [], [], '', false);
$this->searchCriteriaBuilderMock->expects($this->atLeastOnce())->method('addFilter')->willReturnSelf();
$this->searchCriteriaBuilderMock->expects($this->atLeastOnce())->method('addFilters')->willReturnSelf();
$this->searchCriteriaBuilderMock->expects($this->atLeastOnce())->method('create')
->willReturn($searchCriteriaMock);

Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Quote/Model/Quote.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C
*
* @var \Magento\Framework\Api\SearchCriteriaBuilder
*/
protected $criteriaBuilder;
protected $searchCriteriaBuilder;

/**
* Filter builder
Expand Down Expand Up @@ -421,7 +421,7 @@ public function __construct(
$this->_quotePaymentCollectionFactory = $quotePaymentCollectionFactory;
$this->_objectCopyService = $objectCopyService;
$this->addressRepository = $addressRepository;
$this->criteriaBuilder = $criteriaBuilder;
$this->searchCriteriaBuilder = $criteriaBuilder;
$this->filterBuilder = $filterBuilder;
$this->stockRegistry = $stockRegistry;
$this->itemProcessor = $itemProcessor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Address extends \Magento\Sales\Block\Adminhtml\Order\Create\Form\AbstractF
*
* @var \Magento\Framework\Api\SearchCriteriaBuilder
*/
protected $criteriaBuilder;
protected $searchCriteriaBuilder;

/**
* Filter builder
Expand Down Expand Up @@ -121,7 +121,7 @@ public function __construct(
$this->_customerFormFactory = $customerFormFactory;
$this->_addressHelper = $addressHelper;
$this->addressService = $addressService;
$this->criteriaBuilder = $criteriaBuilder;
$this->searchCriteriaBuilder = $criteriaBuilder;
$this->filterBuilder = $filterBuilder;
$this->addressMapper = $addressMapper;
parent::__construct(
Expand Down Expand Up @@ -159,8 +159,8 @@ public function getAddressCollection()
->setValue($this->getCustomerId())
->setConditionType('eq')
->create();
$this->criteriaBuilder->addFilter([$filter]);
$criteria = $this->criteriaBuilder->create();
$this->searchCriteriaBuilder->addFilters([$filter]);
$criteria = $this->searchCriteriaBuilder->create();
$result = $this->addressService->getList($criteria);
return $result->getItems();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function get($id)
}
if (!isset($this->registry[$id])) {
$filter = $this->filterBuilder->setField('transaction_id')->setValue($id)->setConditionType('eq')->create();
$this->searchCriteriaBuilder->addFilter([$filter]);
$this->searchCriteriaBuilder->addFilters([$filter]);
$this->find($this->searchCriteriaBuilder->create());

if (!isset($this->registry[$id])) {
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Sales/Model/Service/CreditmemoService.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public function cancel($id)
*/
public function getCommentsList($id)
{
$this->searchCriteriaBuilder->addFilter(
['eq' => $this->filterBuilder->setField('parent_id')->setValue($id)->create()]
$this->searchCriteriaBuilder->addFilters(
[$this->filterBuilder->setField('parent_id')->setValue($id)->setConditionType('eq')->create()]
);
$criteria = $this->searchCriteriaBuilder->create();
return $this->creditmemoCommentRepository->getList($criteria);
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Sales/Model/Service/InvoiceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public function setCapture($id)
*/
public function getCommentsList($id)
{
$this->criteriaBuilder->addFilter(
['eq' => $this->filterBuilder->setField('parent_id')->setValue($id)->create()]
$this->criteriaBuilder->addFilters(
[$this->filterBuilder->setField('parent_id')->setValue($id)->setConditionType('eq')->create()]
);
$criteria = $this->criteriaBuilder->create();
return $this->commentRepository->getList($criteria);
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Sales/Model/Service/OrderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ public function cancel($id)
*/
public function getCommentsList($id)
{
$this->criteriaBuilder->addFilter(
['eq' => $this->filterBuilder->setField('parent_id')->setValue($id)->create()]
$this->criteriaBuilder->addFilters(
[$this->filterBuilder->setField('parent_id')->setValue($id)->setConditionType('eq')->create()]
);
$criteria = $this->criteriaBuilder->create();
return $this->historyRepository->getList($criteria);
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Sales/Model/Service/ShipmentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public function getLabel($id)
*/
public function getCommentsList($id)
{
$this->criteriaBuilder->addFilter(
['eq' => $this->filterBuilder->setField('parent_id')->setValue($id)->create()]
$this->criteriaBuilder->addFilters(
[$this->filterBuilder->setField('parent_id')->setValue($id)->setConditionType('eq')->create()]
);
$criteria = $this->criteriaBuilder->create();
return $this->commentRepository->getList($criteria);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function testGet($id, array $collectionIds, $conditionType)
->method('getFilterGroups')
->willReturn([$filterGroup]);
$this->searchCriteriaBuilder->expects($this->once())
->method('addFilter')
->method('addFilters')
->with([$filter]);
$this->searchCriteriaBuilder->expects($this->once())
->method('create')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ protected function setUp()
);
$this->searchCriteriaBuilderMock = $this->getMock(
'Magento\Framework\Api\SearchCriteriaBuilder',
['create', 'addFilter'],
['create', 'addFilters'],
[],
'',
false
);
$this->filterBuilderMock = $this->getMock(
'Magento\Framework\Api\FilterBuilder',
['setField', 'setValue', 'create'],
['setField', 'setValue', 'setConditionType', 'create'],
[],
'',
false
Expand Down Expand Up @@ -150,12 +150,16 @@ public function testGetCommentsList()
->method('setValue')
->with($id)
->will($this->returnSelf());
$this->filterBuilderMock->expects($this->once())
->method('setConditionType')
->with('eq')
->will($this->returnSelf());
$this->filterBuilderMock->expects($this->once())
->method('create')
->will($this->returnValue($filterMock));
$this->searchCriteriaBuilderMock->expects($this->once())
->method('addFilter')
->with(['eq' => $filterMock]);
->method('addFilters')
->with([$filterMock]);
$this->searchCriteriaBuilderMock->expects($this->once())
->method('create')
->will($this->returnValue($searchCriteriaMock));
Expand Down
Loading