// check read for visibilities
$criteria =
new Criteria();
$criteria->
addFilter(new EqualsFilter('product_visibility.productId',
$id));
$visibilities =
$this->visibilityRepository->
search($criteria,
$context);
static::
assertCount(2,
$visibilities);
// test filter visibilities over product
$criteria =
new Criteria([$id]);
$criteria->
addFilter( new MultiFilter( MultiFilter::CONNECTION_AND,
[ new RangeFilter('product.visibilities.visibility',
[ RangeFilter::GTE => ProductVisibilityDefinition::VISIBILITY_LINK,
]),
new EqualsFilter('product.visibilities.salesChannelId',
$this->salesChannelId1
),
] ) );
$product =
$this->productRepository->
search($criteria,
$context)->
first();