protected function buildQuery() { if ($this->useIblockSearch()) { $this->appendIblockRelatedData(); } else { $entityClass = $this->getEntity()->getDataClass(); $this->filter['IBLOCK_ID'] = $entityClass::getIblockId(); } return parent::buildQuery(); }