1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
GroupModel.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
6
13use ReflectionClass;
14
16{
17 protected ?Workgroup $group = null;
18
19 protected int $id = 0;
20 protected ?int $ownerId = null;
21 protected ?array $siteIds = null;
22
23 public static function createFromArray(array|Arrayable $data): static
24 {
25 if ($data instanceof Arrayable)
26 {
27 $data = $data->toArray();
28 }
29
30 $model = new static();
31
32 $reflection = new ReflectionClass($model);
33
34 foreach ($data as $key => $value)
35 {
36 if ($reflection->hasProperty($key))
37 {
38 $model->{$key} = $value;
39 }
40 }
41
42 return $model;
43 }
44
45 public static function createFromId(int $itemId): static
46 {
47 $model = new static();
48 $model->id = $itemId;
49
50 return $model;
51 }
52
53 public function getId(): int
54 {
55 return $this->id;
56 }
57
58 public function getOwnerId(): int
59 {
60 $this->ownerId ??= (int)$this->getDomainObject()?->getOwnerId();
61
62 return $this->ownerId;
63 }
64
65 public function getSiteIds(): array
66 {
67 if ($this->siteIds !== null)
68 {
69 return $this->siteIds;
70 }
71
72 if ($this->id <= 0)
73 {
74 $this->siteIds = $this->getDefaultSiteIds();
75 }
76 else
77 {
78 $this->siteIds = $this->getDomainObject()?->getSiteIds();
79 }
80
81 return $this->siteIds;
82 }
83
84 public function getDomainObject(): ?Workgroup
85 {
86 if ($this->group === null)
87 {
88 $this->group = $this->getRegistry()->get($this->id);
89 }
90
91 return $this->group;
92 }
93
94 protected function getRegistry(): GroupRegistry
95 {
96 return GroupRegistry::getInstance();
97 }
98
99 protected function getDefaultSiteIds(): array
100 {
101 return [Site::getInstance()->getMainSiteId()];
102 }
103}
static createFromArray(array|Arrayable $data)
Определения GroupModel.php:23
static createFromId(int $itemId)
Определения GroupModel.php:45
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
if(empty($signedUserToken)) $key
Определения quickway.php:257