- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/services/base/restrictionmanager.php
- Класс: BitrixSaleServicesBaseRestrictionManager
- Вызов: RestrictionManager::prepareData
static function prepareData(array $servicesIds, array $fields = array())
{
if(empty($servicesIds))
return;
$serviceType = static::getServiceType();
$cachedServices =
isset(static::$cachedFields[$serviceType]) && is_array(static::$cachedFields[$serviceType])
? array_keys(static::$cachedFields[$serviceType])
: []
;
$ids = array_diff($servicesIds, $cachedServices);
$idsForDb = array_diff($ids, array_keys($fields));
if(!empty($idsForDb))
{
$dbRes = ServiceRestrictionTable::getList(array(
'filter' => array(
'=SERVICE_ID' => $idsForDb,
'=SERVICE_TYPE' => $serviceType,
),
'order' => array('SORT' =>'ASC'),
));
while($restriction = $dbRes->fetch())
self::setCache($restriction["SERVICE_ID"], $serviceType, $restriction);
}
foreach($fields as $serviceId => $serviceRestrictions)
{
if(is_array($serviceRestrictions))
{
foreach($serviceRestrictions as $restrId => $restrFields)
self::setCache($serviceId, $serviceType, $restrFields);
}
}
foreach($ids as $serviceId)
self::setCache($serviceId, $serviceType);
/** @var BitrixSaleServicesBaseRestriction $className */
foreach(static::getClassesList() as $className)
$className::prepareData($ids);
}