Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
integerfield.php
1
<?php
9
namespace
Bitrix\Main\ORM\Fields
;
10
11
use
Bitrix\Main\DB\SqlExpression
;
12
19
class
IntegerField
extends
ScalarField
20
{
22
protected
$size
= 4;
23
32
function
__construct
(
$name
, $parameters = array())
33
{
34
parent::__construct(
$name
, $parameters);
35
36
if
(isset($parameters[
'size'
]) && intval($parameters[
'size'
]) > 0)
37
{
38
$this->size = intval($parameters[
'size'
]);
39
}
40
}
41
47
public
function
configureSize
(
$size
)
48
{
49
$this->size = (int)
$size
;
50
return
$this;
51
}
52
57
public
function
getSize
()
58
{
59
return
$this->size
;
60
}
61
67
public
function
cast
($value)
68
{
69
if
($this->is_nullable && $value ===
null
)
70
{
71
return
$value;
72
}
73
74
if
($value instanceof
SqlExpression
)
75
{
76
return
$value;
77
}
78
79
return
(
int
) $value;
80
}
81
88
public
function
convertValueFromDb
($value)
89
{
90
return
$this->
getConnection
()->getSqlHelper()->convertFromDbInteger($value);
91
}
92
99
public
function
convertValueToDb
($value)
100
{
101
if
($value instanceof
SqlExpression
)
102
{
103
return
$value;
104
}
105
106
return
$value ===
null
&& $this->is_nullable
107
? $value
108
: $this->
getConnection
()->getSqlHelper()->convertToDbInteger($value);
109
}
110
114
public
function
getGetterTypeHint
()
115
{
116
return
$this->
getNullableTypeHint
(
'\\int'
);
117
}
118
122
public
function
getSetterTypeHint
()
123
{
124
return
$this->
getNullableTypeHint
(
'\\int'
);
125
}
126
}
Bitrix\Main\DB\SqlExpression
Definition
sqlexpression.php:19
Bitrix\Main\ORM\Fields\Field\$name
$name
Definition
field.php:27
Bitrix\Main\ORM\Fields\Field\getConnection
getConnection()
Definition
field.php:626
Bitrix\Main\ORM\Fields\IntegerField
Definition
integerfield.php:20
Bitrix\Main\ORM\Fields\IntegerField\configureSize
configureSize($size)
Definition
integerfield.php:47
Bitrix\Main\ORM\Fields\IntegerField\getSetterTypeHint
getSetterTypeHint()
Definition
integerfield.php:122
Bitrix\Main\ORM\Fields\IntegerField\cast
cast($value)
Definition
integerfield.php:67
Bitrix\Main\ORM\Fields\IntegerField\getSize
getSize()
Definition
integerfield.php:57
Bitrix\Main\ORM\Fields\IntegerField\__construct
__construct($name, $parameters=array())
Definition
integerfield.php:32
Bitrix\Main\ORM\Fields\IntegerField\getGetterTypeHint
getGetterTypeHint()
Definition
integerfield.php:114
Bitrix\Main\ORM\Fields\IntegerField\convertValueFromDb
convertValueFromDb($value)
Definition
integerfield.php:88
Bitrix\Main\ORM\Fields\IntegerField\$size
$size
Definition
integerfield.php:22
Bitrix\Main\ORM\Fields\IntegerField\convertValueToDb
convertValueToDb($value)
Definition
integerfield.php:99
Bitrix\Main\ORM\Fields\ScalarField
Definition
scalarfield.php:19
Bitrix\Main\ORM\Fields\ScalarField\getNullableTypeHint
getNullableTypeHint(string $type)
Definition
scalarfield.php:255
Bitrix\Main\ORM\Fields
Definition
arrayfield.php:9
modules
main
lib
orm
fields
integerfield.php
Создано системой
1.10.0