- Модуль: iblock
- Путь к файлу: ~/bitrix/modules/iblock/lib/inheritedproperty/sectionvalues.php
- Класс: BitrixIblockInheritedPropertySectionValues
- Вызов: SectionValues::queryValues
public function queryValues()
{
$connection = BitrixMainApplication::getConnection();
$result = array();
if ($this->hasTemplates())
{
if ($this->queue->getElement($this->iblockId, $this->sectionId) === false)
{
$ids = $this->queue->get($this->iblockId);
$query = $connection->query("
SELECT
P.ID
,P.CODE
,P.TEMPLATE
,P.ENTITY_TYPE
,P.ENTITY_ID
,IP.VALUE
,IP.SECTION_ID
FROM
b_iblock_section_iprop IP
INNER JOIN b_iblock_iproperty P ON P.ID = IP.IPROP_ID
WHERE
IP.IBLOCK_ID = ".$this->iblockId."
AND IP.SECTION_ID in (".implode(", ", $ids).")
");
$result = array();
while ($row = $query->fetch())
{
$result[$row["SECTION_ID"]][$row["CODE"]] = $row;
}
$this->queue->set($this->iblockId, $result);
}
$result = $this->queue->getElement($this->iblockId, $this->sectionId);
if (empty($result))
{
$sqlHelper = $connection->getSqlHelper();
$fields = array(
"IBLOCK_ID",
"SECTION_ID",
"IPROP_ID",
"VALUE",
);
$rows = array();
$result = parent::queryValues();
foreach ($result as $row)
{
$rows[] = array(
$this->iblockId,
$this->sectionId,
$row["ID"],
$sqlHelper->forSql($row["VALUE"]),
);
}
$this->insertValues("b_iblock_section_iprop", $fields, $rows);
}
}
return $result;
}