183 public static function getByDiscount(array $discountList, $filter = [], $groupModule =
true)
185 $groupModule = ($groupModule ===
true);
187 if (!empty($discountList))
189 Type\Collection::normalizeArrayValuesByInt($discountList);
190 if (!empty($discountList))
192 if (!is_array($filter))
195 $discountRows = array_chunk($discountList, 500);
196 foreach ($discountRows as &$row)
198 $filter[
'@DISCOUNT_ID'] = $row;
201 'DISCOUNT_ID',
'MODULE_ID',
202 'ENTITY',
'ENTITY_ID',
'ENTITY_VALUE',
'FIELD_ENTITY',
'FIELD_TABLE'
208 while (
$entity = $entityIterator->fetch())
211 $module =
$entity[
'MODULE_ID'];
212 $entityCode =
$entity[
'ENTITY'];
213 if (!isset($result[$module]))
214 $result[$module] = [];
215 if (!isset($result[$module][$entityCode]))
216 $result[$module][$entityCode] = [];
219 unset($entityCode, $module);
223 while (
$entity = $entityIterator->fetch())
226 if (!isset($result[
$entity[
'DISCOUNT_ID']]))
227 $result[
$entity[
'DISCOUNT_ID']] = [];
231 unset(
$entity, $entityIterator);
233 unset($row, $discountRows);