Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
client.php
1<?php
3
4
8
9abstract class Client extends Proxy
10{
11 static public function resolveFieldsValuesFromOrderList(array $params)
12 {
13 $indexes = static::getIndexesFromParams($params);
14 $list = static::getUsersFieldsValues($indexes);
15
16 return count($list)>0 ? static::collapseUserList($list):[];
17 }
18 static public function getUserCollectionFromOrderList(array $params)
19 {
20 $indexes = static::getIndexesFromParams($params);
21 return static::loadUserCollection($indexes);
22 }
23
24 static protected function collapseUserList(array $list)
25 {
26 $result = [];
27 foreach($list as $item)
28 {
29 $result[$item['ID']] = $item;
30 }
31 return $result;
32 }
33
34 abstract static protected function getUsersFieldsValues(array $indexes);
35
36 //resolveClients
37
38 static protected function loadUserCollection($indexes)
39 {
41 foreach ($indexes as $index)
42 {
43 $order = Order::load($index);
44
45 $typeName = Integration\Service\User\Entity\Base::resolveNamePersonDomain($order->getPersonTypeId());
46 $clients->addItem(
47 Integration\Service\User\Container\Item::create(
48 Integration\Service\User\Factory::create(
49 Integration\Service\User\EntityType::resolveId($typeName))
50 ->load($order))->setInternalIndex($index));
51 }
52 return $clients;
53 }
54 static protected function getUserCollectionByTypeId(Integration\Service\User\Container\Collection $collection, $typeId)
55 {
58 foreach ($collection as $item)
59 {
60 if($item->getEntity()->getType() == $typeId)
61 {
62 $clients->addItem($item);
63 }
64 }
65 return $clients;
66 }
67}