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

FilterBuilder Doc Block Update #11854

Merged

Conversation

ByteCreation
Copy link
Contributor

@ByteCreation ByteCreation commented Oct 29, 2017

Description

Edited doc block of setValue in FilterBuilder to reflect that this method will accept an array

The following filter is created by passing an array of product skus. While this results in a successful request, the doc block of the setValue method of the filter builder incorrectly reports that it will only accept a string, while the following example uses an array.

<?php
/* @var $this->filterBuilder = \Magento\Framework\Api\FilterBuilder */
/* @var $this->searchCriteriaBuilder = \Magento\Framework\Api\SearchCriteriaBuilder */
/* @var $this->productRepository = \Magento\Catalog\Model\ProductRepository */

$skus = ['sku1', 'sku2', 'sku3']

$filters[] = $this->filterBuilder
                  ->setField('sku')
                  ->setValue($skus)
                  ->setConditionType('in')
                  ->create();

$searchCriteria = $this->searchCriteriaBuilder
                       ->addFilters($filters)
                       ->setPageSize(5)
                       ->create();

$products = $this->productRepository->getList($searchCriteria);
        
$collection = $products->getItems();

Manual testing scenarios

Code is provided above to show a scenario where the doc block does not reflect what it will actually accept.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

Related Pull Requests

#11855

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Oct 29, 2017

CLA assistant check
All committers have signed the CLA.

@okorshenko okorshenko self-assigned this Oct 30, 2017
@okorshenko okorshenko added this to the October 2017 milestone Oct 30, 2017
@okorshenko okorshenko merged commit 9ffe626 into magento:2.2-develop Oct 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants