Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
BaseMeasureRatio.php
1
<?php
2
3
namespace
Bitrix\Catalog\v2\MeasureRatio
;
4
5
use
Bitrix\Catalog\v2\BaseEntity
;
6
use
Bitrix\Catalog\v2\Fields\TypeCasters\MapTypeCaster
;
7
16
abstract
class
BaseMeasureRatio
extends
BaseEntity
17
{
18
public
function
__construct
(
MeasureRatioRepositoryContract
$measureRatioRepository)
19
{
20
parent::__construct($measureRatioRepository);
21
}
22
23
public
function
setRatio
(
float
$ratio): self
24
{
25
$this->
setField
(
'RATIO'
, $ratio);
26
27
return
$this;
28
}
29
30
public
function
getRatio
(): string
31
{
32
return
$this->
getField
(
'RATIO'
);
33
}
34
35
public
function
isDefault
(): bool
36
{
37
return
$this->
getField
(
'IS_DEFAULT'
) ===
'Y'
;
38
}
39
40
public
function
setDefault
(
bool
$state =
true
): self
41
{
42
$this->
setField
(
'IS_DEFAULT'
, $state ?
'Y'
:
'N'
);
43
44
return
$this;
45
}
46
47
public
function
setProductId
(
int
$productId): self
48
{
49
$this->
setField
(
'PRODUCT_ID'
, $productId);
50
51
return
$this;
52
}
53
54
public
function
getProductId
(): int
55
{
56
return
(
int
)$this->
getField
(
'PRODUCT_ID'
);
57
}
58
59
protected
function
getFieldsMap
(): array
60
{
61
return
[
62
'ID'
=> MapTypeCaster::NULLABLE_INT,
63
'PRODUCT_ID'
=> MapTypeCaster::INT,
64
'RATIO'
=> MapTypeCaster::FLOAT,
65
'IS_DEFAULT'
=> MapTypeCaster::Y_OR_N,
66
];
67
}
68
}
Bitrix\Catalog\v2\BaseEntity
Definition
BaseEntity.php:22
Bitrix\Catalog\v2\BaseEntity\setField
setField(string $name, $value)
Definition
BaseEntity.php:102
Bitrix\Catalog\v2\BaseEntity\getField
getField(string $name)
Definition
BaseEntity.php:119
Bitrix\Catalog\v2\Fields\TypeCasters\MapTypeCaster
Definition
MapTypeCaster.php:20
Bitrix\Catalog\v2\MeasureRatio\BaseMeasureRatio
Definition
BaseMeasureRatio.php:17
Bitrix\Catalog\v2\MeasureRatio\BaseMeasureRatio\isDefault
isDefault()
Definition
BaseMeasureRatio.php:35
Bitrix\Catalog\v2\MeasureRatio\BaseMeasureRatio\setDefault
setDefault(bool $state=true)
Definition
BaseMeasureRatio.php:40
Bitrix\Catalog\v2\MeasureRatio\BaseMeasureRatio\getProductId
getProductId()
Definition
BaseMeasureRatio.php:54
Bitrix\Catalog\v2\MeasureRatio\BaseMeasureRatio\setRatio
setRatio(float $ratio)
Definition
BaseMeasureRatio.php:23
Bitrix\Catalog\v2\MeasureRatio\BaseMeasureRatio\getRatio
getRatio()
Definition
BaseMeasureRatio.php:30
Bitrix\Catalog\v2\MeasureRatio\BaseMeasureRatio\getFieldsMap
getFieldsMap()
Definition
BaseMeasureRatio.php:59
Bitrix\Catalog\v2\MeasureRatio\BaseMeasureRatio\__construct
__construct(MeasureRatioRepositoryContract $measureRatioRepository)
Definition
BaseMeasureRatio.php:18
Bitrix\Catalog\v2\MeasureRatio\BaseMeasureRatio\setProductId
setProductId(int $productId)
Definition
BaseMeasureRatio.php:47
Bitrix\Catalog\v2\MeasureRatio\MeasureRatioRepositoryContract
Definition
MeasureRatioRepositoryContract.php:17
Bitrix\Catalog\v2\MeasureRatio
Definition
BaseMeasureRatio.php:3
modules
catalog
lib
v2
MeasureRatio
BaseMeasureRatio.php
Создано системой
1.10.0