127 if (!isset($this->cache[$value]))
129 $connection = \Bitrix\Main\Application::getConnection();
131 $sqlHelper = $connection->getSqlHelper();
132 $valueId = $connection->queryScalar(
"SELECT ID FROM ".$this->
getTableName().
" WHERE VALUE = '".$sqlHelper->forSql($value).
"'");
133 if ($valueId ===
null)
135 if ($addWhenNotFound)
137 $valueId = $connection->add($this->
getTableName(), array(
147 $this->cache[$value] = intval($valueId);
150 return $this->cache[$value];
181 if (empty($valueIDs) || !is_array($valueIDs))
183 \Bitrix\Main\Type\Collection::normalizeArrayValuesByInt($valueIDs,
true);
184 if (empty($valueIDs))
187 $connection = \Bitrix\Main\Application::getConnection();
189 $result = array_fill_keys($valueIDs,
'');
191 $rs = $connection->query(
"SELECT ID, VALUE FROM ".$this->
getTableName().
" WHERE ID IN(".implode(
',',$valueIDs).
")");
192 while ($row = $rs->fetch())
194 $result[$row[
'ID']] = $row[
'VALUE'];