1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
ElementToUpdate.php
См. документацию.
1<?php
2
3namespace Bitrix\Lists\Api\Data\ServiceFactory;
4
5use Bitrix\Lists\Api\Data\Data;
6use Bitrix\Lists\Api\Request\ServiceFactory\UpdateElementRequest;
7use Bitrix\Main\ArgumentOutOfRangeException;
8
9final class ElementToUpdate extends Data
10{
11 private int $elementId;
12 private int $iBlockId;
13 private int $sectionId;
14 private array $values;
15 private int $modifiedBy;
16
17 private function __construct(
18 int $elementId,
19 int $iBlockId,
20 int $sectionId,
21 array $values,
22 int $modifiedBy,
23 )
24 {
25 $this->elementId = $elementId;
26 $this->iBlockId = $iBlockId;
27 $this->sectionId = $sectionId;
28 $this->values = $values;
29 $this->modifiedBy = $modifiedBy;
30 }
31
37 public static function createFromRequest($request): self
38 {
39 $elementId = self::validateId($request->elementId);
40 if ($elementId === null || $elementId === 0)
41 {
42 throw new ArgumentOutOfRangeException('elementId', 1, null);
43 }
44
45 $iBlockId = self::validateId($request->iBlockId);
46 if ($iBlockId === null || $iBlockId === 0)
47 {
48 throw new ArgumentOutOfRangeException('iBlockId', 1, null);
49 }
50
51 $sectionId = self::validateId($request->sectionId);
52 if ($sectionId === null)
53 {
54 throw new ArgumentOutOfRangeException('sectionId', 0, null);
55 }
56
57 $modifiedBy = self::validateId($request->modifiedByUserId);
58 if ($modifiedBy === null || $modifiedBy === 0)
59 {
60 throw new ArgumentOutOfRangeException('modifiedBy', 1, null);
61 }
62
63 $values = $request->values;
64 $values['ID'] = $elementId;
65 $values['IBLOCK_ID'] = $iBlockId;
66 $values['IBLOCK_SECTION_ID'] = $sectionId;
67
68 return new self($elementId, $iBlockId, $sectionId, $values, $modifiedBy);
69 }
70
74 public function getElementId(): int
75 {
76 return $this->elementId;
77 }
78
82 public function getIBlockId(): int
83 {
84 return $this->iBlockId;
85 }
86
90 public function getModifiedBy(): int
91 {
92 return $this->modifiedBy;
93 }
94
98 public function getSectionId(): int
99 {
100 return $this->sectionId;
101 }
102
106 public function getValues(): array
107 {
108 return $this->values;
109 }
110}
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
static validateId(int $id)
Определения Data.php:9
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$iBlockId
Определения iblock_subelement_generator.php:45