/** * @param $term * @return Keyword[] */ public function getKeywordsOfTerm($term) { $id = md5('Shopware_Modules_Search_' . $term); if (($keywords = $this->cache->fetch($id)) !== false) { return $keywords; } $keywords = $this->keywordFinder->getKeywordsOfTerm($term); $this->cache->save($id, $keywords, $this->config->get('cachesearch')); return $keywords; }
/** * Helper function which generates an array with table column selections * for the passed table. * * @param string $table * @param string $alias * @return array */ public function getTableFields($table, $alias) { $key = $table; if (isset($this->attributeFields[$key])) { return $this->attributeFields[$key]; } if ($columns = $this->cache->fetch($key)) { return $columns; } $schemaManager = $this->connection->getSchemaManager(); $tableColumns = $schemaManager->listTableColumns($table); $columns = []; foreach ($tableColumns as $column) { $columns[] = $alias . '.' . $column->getName() . ' as __' . $alias . '_' . $column->getName(); } $this->cache->save($key, $columns); $this->attributeFields[$key] = $columns; return $columns; }