Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
StoreDocument.php
1<?php
2
4
7
9{
15
16 private int $id;
17 private ?string $type;
18
22 public function __construct(int $id)
23 {
24 $this->id = $id;
25 }
26
32 public static function createFromId(int $itemId): StoreDocument
33 {
34 return new static($itemId);
35 }
36
44 public static function createFromArray(array $fields): StoreDocument
45 {
46 $self = new static(
47 (int)($fields['ID'] ?? 0)
48 );
49 $self->type = $fields['DOC_TYPE'] ?? null;
50
51 return $self;
52 }
53
63 public static function createForSaleRealization(int $id): StoreDocument
64 {
65 $self = new static($id);
66 $self->type = self::TYPE_SALES_ORDERS;
67
68 return $self;
69 }
70
74 public function getId(): int
75 {
76 return $this->id;
77 }
78
84 public function getType(): ?string
85 {
86 if (!isset($this->type))
87 {
89 'select' => [
90 'DOC_TYPE',
91 ],
92 'filter' => [
93 '=ID' => $this->getId(),
94 ],
95 ]);
96
97 if ($row['DOC_TYPE'])
98 {
99 $this->type = (string)$row['DOC_TYPE'];
100 }
101 else
102 {
103 $this->type = null;
104 }
105 }
106
107 return $this->type;
108 }
109}
static getRow(array $parameters)