Ejemplo n.º 1
0
 /**
  * @see IblockFinder::getItems()
  *
  * @return array
  *
  * @throws ValueNotFoundException
  * @throws ArgumentException
  */
 protected function getItemsIblockShard()
 {
     $items = [];
     $rsIblocks = IblockTable::query()->setFilter(['ID' => $this->id])->setSelect(['IBLOCK_TYPE_ID', 'CODE'])->exec();
     if ($iblock = $rsIblocks->fetch()) {
         if ($iblock['CODE']) {
             $items['CODE'] = $iblock['CODE'];
         }
         $items['TYPE'] = $iblock['IBLOCK_TYPE_ID'];
     }
     if (empty($items)) {
         throw new ValueNotFoundException('Iblock', 'ID #' . $this->id);
     }
     $propIds = [];
     $rsProps = PropertyTable::query()->setFilter(['IBLOCK_ID' => $this->id])->setSelect(['ID', 'CODE', 'IBLOCK_ID'])->exec();
     while ($prop = $rsProps->fetch()) {
         $propIds[] = $prop['ID'];
         $items['PROPS_ID'][$prop['CODE']] = $prop['ID'];
     }
     if (!empty($propIds)) {
         $rsPropsEnum = PropertyEnumerationTable::query()->setFilter(['PROPERTY_ID' => $propIds])->setSelect(['ID', 'XML_ID', 'PROPERTY_ID', 'PROPERTY_CODE' => 'PROPERTY.CODE'])->exec();
         while ($propEnum = $rsPropsEnum->fetch()) {
             if ($propEnum['PROPERTY_CODE']) {
                 $items['PROPS_ENUM_ID'][$propEnum['PROPERTY_CODE']][$propEnum['XML_ID']] = $propEnum['ID'];
             }
         }
     }
     $this->registerCacheTag('bex_iblock_' . $this->id);
     return $items;
 }