Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
elementbatchitem.php
1<?php
3
4use Bitrix\Catalog\EO_StoreBatch_Collection;
5use Bitrix\Catalog\EO_StoreBatchDocumentElement;
17use phpDocumentor\Reflection\Types\Boolean;
18
25{
26 private EO_StoreBatchDocumentElement $bindingElement;
27 private int $storeId;
28 private string $storeItemHash;
29
30 public function __construct(EO_StoreBatchDocumentElement $bindingElement, int $storeId)
31 {
32 $this->bindingElement = $bindingElement;
33
34 $this->storeId = $storeId;
35 }
36
37 public function getElement(): EO_StoreBatchDocumentElement
38 {
39 return $this->bindingElement;
40 }
41
42 public function isArrivalElement(): bool
43 {
44 return $this->bindingElement->getAmount() > 0;
45 }
46
47 public function getStoreId(): int
48 {
49 return $this->storeId;
50 }
51
52 public function setStoreItemHash(string $storeItemHash): void
53 {
54 $this->storeItemHash = $storeItemHash;
55 }
56
57 public function getStoreItemHash(): string
58 {
59 return $this->storeItemHash;
60 }
61
62 public function getAmount(): float
63 {
64 return abs($this->bindingElement->getAmount());
65 }
66
67 public function save(): Result
68 {
69 if (empty($this->bindingElement->getProductBatchId()))
70 {
71 $result = new Result();
72 $result->addError(new Error('Empty store batch'));
73
74 return $result;
75 }
76
77 return $this->bindingElement->save();
78 }
79}
__construct(EO_StoreBatchDocumentElement $bindingElement, int $storeId)