Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
Barcode.php
1<?php
2
4
7use Bitrix\Catalog\v2\HasSettingsTrait;
8
18class Barcode extends BaseEntity
19{
21
22 public function __construct(BarcodeRepositoryContract $repository)
23 {
24 parent::__construct($repository);
25 }
26
27 public function setStoreId(int $storeId): self
28 {
29 $this->setField('STORE_ID', $storeId);
30
31 return $this;
32 }
33
34 public function getStoreId(): string
35 {
36 return $this->getField('STORE_ID');
37 }
38
39 public function setProductId(int $productId): self
40 {
41 $this->setField('PRODUCT_ID', $productId);
42
43 return $this;
44 }
45
46 public function getProductId(): int
47 {
48 return (int)$this->getField('PRODUCT_ID');
49 }
50
51 public function setBarcode(?string $barcode): self
52 {
53 $this->setField('BARCODE', $barcode);
54
55 return $this;
56 }
57
58 public function unsetBarcode(): self
59 {
60 return $this->setBarcode(null);
61 }
62
63 public function hasBarcode(): bool
64 {
65 return $this->hasField('BARCODE');
66 }
67
68 public function getBarcode(): ?string
69 {
70 return $this->hasBarcode() ? (string)$this->getField('BARCODE') : null;
71 }
72
73 protected function getFieldsMap(): array
74 {
75 return [
77 'PRODUCT_ID' => MapTypeCaster::INT,
78 'STORE_ID' => MapTypeCaster::INT,
80 ];
81 }
82}
setBarcode(?string $barcode)
Definition Barcode.php:51
__construct(BarcodeRepositoryContract $repository)
Definition Barcode.php:22
setField(string $name, $value)