/** * {@inheritdoc} */ public function searchForInLanguages($strPattern, $arrLanguages = array()) { $arrParams = array($strPattern, $strPattern); $strTableName = $this->getTagSource(); $strColNameId = $this->getIdColumn(); $strColNameLangCode = $this->getTagLangColumn(); $strColumn = $this->getValueColumn(); $strColAlias = $this->getAliasColumn(); $languages = ''; if ($arrLanguages) { $languages = sprintf(' AND %s IN (\'%s\')', $strColNameLangCode, implode('\',\'', $arrLanguages)); } $objFilterRule = new SimpleQuery(sprintf('SELECT item_id FROM tl_metamodel_tag_relation WHERE value_id IN ( SELECT DISTINCT %1$s FROM %2$s WHERE %3$s LIKE ? OR %6$s LIKE ?%4$s ) AND att_id = %5$s', $strColNameId, $strTableName, $strColumn, $languages, $this->get('id'), $strColAlias), $arrParams, 'item_id', $this->getDatabase()); return $objFilterRule->getMatchingIds(); }
/** * {@inheritDoc} */ public function searchForInLanguages($strPattern, $arrLanguages = array()) { $optionizer = $this->getOptionizer(); $procedure = $optionizer['value'] . ' LIKE ?'; $parameters = array(str_replace(array('*', '?'), array('%', '_'), $strPattern)); $arrWhere = $this->getWhere(null, $arrLanguages); if ($arrWhere) { $procedure .= ' AND ' . $arrWhere['procedure']; $parameters = array_merge($parameters, $arrWhere['params']); } $filterRule = new SimpleQuery(sprintf('SELECT DISTINCT %1$s FROM %2$s WHERE %3$s', 'item_id', $this->getValueTable(), $procedure), $parameters, 'item_id', $this->getMetaModel()->getServiceContainer()->getDatabase()); return $filterRule->getMatchingIds(); }