123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\CatalogSearch\Model\Search\SelectContainer;
- use Magento\Framework\DB\Select;
- use Magento\Framework\Search\Request\FilterInterface;
- /**
- * This class is a container for all data that is required for creating select query by search request
- *
- * @deprecated 101.0.0
- * @see \Magento\ElasticSearch
- */
- class SelectContainer
- {
- /**
- * @var array FilterInterface[]
- */
- private $nonCustomAttributesFilters;
- /**
- * @var array FilterInterface[]
- */
- private $customAttributesFilters;
- /**
- * @var FilterInterface
- */
- private $visibilityFilter;
- /**
- * @var bool
- */
- private $isFullTextSearchRequired;
- /**
- * @var bool
- */
- private $isShowOutOfStockEnabled;
- /**
- * @var Select
- */
- private $select;
- /**
- * @var string
- */
- private $usedIndex;
- /**
- * @var array
- */
- private $dimensions;
- /**
- * @param Select $select
- * @param array $nonCustomAttributesFilters
- * @param array $customAttributesFilters
- * @param array $dimensions
- * @param bool $isFullTextSearchRequired
- * @param bool $isShowOutOfStockEnabled
- * @param string $usedIndex
- * @param FilterInterface|null $visibilityFilter
- */
- public function __construct(
- Select $select,
- array $nonCustomAttributesFilters,
- array $customAttributesFilters,
- array $dimensions,
- bool $isFullTextSearchRequired,
- bool $isShowOutOfStockEnabled,
- $usedIndex,
- FilterInterface $visibilityFilter = null
- ) {
- $this->nonCustomAttributesFilters = $nonCustomAttributesFilters;
- $this->customAttributesFilters = $customAttributesFilters;
- $this->visibilityFilter = $visibilityFilter;
- $this->isFullTextSearchRequired = $isFullTextSearchRequired;
- $this->isShowOutOfStockEnabled = $isShowOutOfStockEnabled;
- $this->select = $select;
- $this->usedIndex = $usedIndex;
- $this->dimensions = $dimensions;
- }
- /**
- * @return array
- */
- public function getNonCustomAttributesFilters()
- {
- return $this->nonCustomAttributesFilters;
- }
- /**
- * @return array
- */
- public function getCustomAttributesFilters()
- {
- return $this->customAttributesFilters;
- }
- /**
- * @return bool
- */
- public function hasCustomAttributesFilters()
- {
- return count($this->customAttributesFilters) > 0;
- }
- /**
- * @return bool
- */
- public function hasVisibilityFilter()
- {
- return $this->visibilityFilter !== null;
- }
- /**
- * Returns a null or copy of FilterInterface
- * This is done to ensure that SelectContainer is immutable
- *
- * @return FilterInterface
- */
- public function getVisibilityFilter()
- {
- return $this->visibilityFilter === null ? null : clone $this->visibilityFilter;
- }
- /**
- * @return bool
- */
- public function isFullTextSearchRequired()
- {
- return $this->isFullTextSearchRequired;
- }
- /**
- * @return bool
- */
- public function isShowOutOfStockEnabled()
- {
- return $this->isShowOutOfStockEnabled;
- }
- /**
- * @return string
- */
- public function getUsedIndex()
- {
- return $this->usedIndex;
- }
- /**
- * @return array
- */
- public function getDimensions()
- {
- return $this->dimensions;
- }
- /**
- * Returns a copy of Select
- * This is done to ensure that SelectContainer is immutable
- *
- * @return Select
- */
- public function getSelect()
- {
- return clone $this->select;
- }
- /**
- * Returns new instance of SelectContainer on update
- * This is done to ensure that SelectContainer is immutable
- *
- * @param Select $select
- * @return SelectContainer
- */
- public function updateSelect(Select $select)
- {
- $data = [
- clone $select,
- $this->nonCustomAttributesFilters,
- $this->customAttributesFilters,
- $this->dimensions,
- $this->isFullTextSearchRequired,
- $this->isShowOutOfStockEnabled,
- $this->usedIndex
- ];
- if ($this->visibilityFilter !== null) {
- $data[] = clone $this->visibilityFilter;
- }
- return new self(...$data);
- }
- }
|