/** * Generate dynamic fields requests * * @return array */ public function generate() { $requests = []; foreach ($this->indexPool->getAvailableIndexes() as $index) { $requests[$index->getCode()] = $this->generateQuickSearchRequest($index); } return $requests; }
/** * To option array * * @param bool $onlyUnused * @return array */ public function toOptionArray($onlyUnused = false) { $options = []; foreach ($this->pool->getAvailableIndexes() as $index) { $code = $index->getCode(); if (!$onlyUnused || !$this->indexCollection->getItemByColumnValue('code', $code)) { $options[$code] = $index->toString(); } } return $options; }
/** * @return \Mirasvit\Search\Model\Index\AbstractIndex * @throws \Exception */ public function getIndexInstance() { if (!$this->indexInstance) { $code = $this->getData('code'); $this->indexInstance = $this->indexPool->get($code); if (!$this->indexInstance) { throw new \Exception(__("Instance for '%1' not found", $code)); } $this->indexInstance->setData($this->getData())->setModel($this); } return $this->indexInstance; }