Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
workgrouprequestsin.php
1<?php
2
11
14
15class WorkgroupRequestsIn implements Base
16{
17 private $workgroupId;
18
19 public function __construct(array $params = [])
20 {
21 $this->workgroupId = (int)($params['workgroupId'] ?? 0);
22
23 if ($this->workgroupId <= 0)
24 {
25 throw new ArgumentException('Wrong workgroupId value');
26 }
27 }
28
29 public function getCounterValue(): array
30 {
31 $result = (new \Bitrix\Main\Entity\Query(UserToGroupTable::getEntity()))
32 ->addFilter('=GROUP_ID', $this->workgroupId)
33 ->addFilter('=ROLE', UserToGroupTable::ROLE_REQUEST)
34 ->addFilter('=INITIATED_BY_TYPE', UserToGroupTable::INITIATED_BY_USER)
35 ->addSelect('ID')
36 ->countTotal(true)
37 ->exec()
38 ->getCount();
39
40 return [
41 'all' => $result,
42 ];
43 }
44}