Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Attributes
EngineResolver Class Reference
Inheritance diagram for EngineResolver:
EngineResolverInterface

Public Member Functions

 __construct (ScopeConfigInterface $scopeConfig, array $engines, LoggerInterface $logger, $path, $scopeType, $scopeCode=null)
 
 getCurrentSearchEngine ()
 

Data Fields

const CATALOG_SEARCH_MYSQL_ENGINE = 'mysql'
 

Protected Attributes

 $scopeConfig
 
 $path
 
 $scopeType
 
 $scopeCode
 

Detailed Description

@api

Since
100.1.0

Definition at line 16 of file EngineResolver.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( ScopeConfigInterface  $scopeConfig,
array  $engines,
LoggerInterface  $logger,
  $path,
  $scopeType,
  $scopeCode = null 
)
Parameters
ScopeConfigInterface$scopeConfig
array$engines
string$path
string$scopeType
string$scopeCode

Definition at line 68 of file EngineResolver.php.

75  {
76  $this->scopeConfig = $scopeConfig;
77  $this->path = $path;
78  $this->scopeType = $scopeType;
79  $this->scopeCode = $scopeCode;
80  $this->engines = $engines;
81  $this->logger = $logger;
82  }
$logger

Member Function Documentation

◆ getCurrentSearchEngine()

getCurrentSearchEngine ( )

Returns Current Search Engine

It returns string identifier of Search Engine that is currently chosen in configuration

Returns
string
Since
100.1.0

Implements EngineResolverInterface.

Definition at line 92 of file EngineResolver.php.

93  {
94  $engine = $this->scopeConfig->getValue(
95  $this->path,
96  $this->scopeType,
97  $this->scopeCode
98  );
99 
100  if (in_array($engine, $this->engines)) {
101  return $engine;
102  } else {
103  $this->logger->error(
104  $engine . ' search engine doesn\'t exists. Falling back to ' . self::CATALOG_SEARCH_MYSQL_ENGINE
105  );
107  }
108  }

Field Documentation

◆ $path

$path
protected

Definition at line 34 of file EngineResolver.php.

◆ $scopeCode

$scopeCode
protected

Definition at line 48 of file EngineResolver.php.

◆ $scopeConfig

$scopeConfig
protected

Definition at line 27 of file EngineResolver.php.

◆ $scopeType

$scopeType
protected

Definition at line 41 of file EngineResolver.php.

◆ CATALOG_SEARCH_MYSQL_ENGINE

const CATALOG_SEARCH_MYSQL_ENGINE = 'mysql'

MySQL search engine

Definition at line 21 of file EngineResolver.php.


The documentation for this class was generated from the following file: