1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
stringfield.php
См. документацию.
1
<?php
8
9
namespace
Bitrix\Main\ORM\Fields;
10
11
use Bitrix\Main\DB\SqlExpression;
12
19
class
StringField
extends
ScalarField
20
{
25
protected
$format
=
null
;
26
28
protected
$size
=
null
;
29
38
function
__construct
(
$name
, $parameters =
array
())
39
{
40
parent::__construct(
$name
, $parameters);
41
42
if
(!empty($parameters[
'format'
]))
43
{
44
$this->format = $parameters[
'format'
];
45
}
46
if
(isset($parameters[
'size'
]) && intval($parameters[
'size'
]) > 0)
47
{
48
$this->
size
= intval($parameters[
'size'
]);
49
}
50
}
51
57
public
function
configureFormat
(
$format
)
58
{
59
$this->format =
$format
;
60
return
$this;
61
}
62
67
public
function
getFormat
()
68
{
69
return
$this->format
;
70
}
71
77
public
function
getValidators
()
78
{
79
$validators
= parent::getValidators();
80
81
if
($this->format !==
null
)
82
{
83
$validators
[] =
new
Validators\RegExpValidator
($this->format);
84
}
85
86
return
$validators
;
87
}
88
94
public
function
configureSize
(
$size
)
95
{
96
$this->
size
=
$size
;
97
return
$this;
98
}
99
104
public
function
getSize
()
105
{
106
return
$this->size
;
107
}
108
114
public
function
cast
($value)
115
{
116
if
($this->is_nullable && $value ===
null
)
117
{
118
return
$value;
119
}
120
121
if
($value instanceof
SqlExpression
)
122
{
123
return
$value;
124
}
125
126
$value = (string) $value;
127
128
if
($this->
size
!==
null
)
129
{
130
$value = mb_substr($value, 0, $this->
size
);
131
}
132
133
return
$value;
134
}
135
142
public
function
convertValueFromDb
($value)
143
{
144
return
$this->
getConnection
()->getSqlHelper()->convertFromDbString($value);
145
}
146
153
public
function
convertValueToDb
($value)
154
{
155
if
($value instanceof
SqlExpression
)
156
{
157
return
$value;
158
}
159
elseif
($value ===
null
&& $this->is_nullable)
160
{
161
return
$value;
162
}
163
elseif
($this->is_binary)
164
{
165
return
$this->
getConnection
()->getSqlHelper()->convertToDbBinary($value);
166
}
167
elseif
($this->is_fulltext)
168
{
169
return
$this->
getConnection
()->getSqlHelper()->convertToFullText($value);
170
}
171
else
172
{
173
return
$this->
getConnection
()->getSqlHelper()->convertToDbString($value, $this->
size
);
174
}
175
}
176
}
Bitrix\Main\DB\SqlExpression
Определения
sqlexpression.php:21
Bitrix\Main\ORM\Fields\Field\$validators
$validators
Определения
field.php:42
Bitrix\Main\ORM\Fields\Field\$name
$name
Определения
field.php:27
Bitrix\Main\ORM\Fields\Field\getConnection
getConnection()
Определения
field.php:638
Bitrix\Main\ORM\Fields\ScalarField
Определения
scalarfield.php:19
Bitrix\Main\ORM\Fields\StringField
Определения
stringfield.php:20
Bitrix\Main\ORM\Fields\StringField\configureSize
configureSize($size)
Определения
stringfield.php:94
Bitrix\Main\ORM\Fields\StringField\$format
$format
Определения
stringfield.php:25
Bitrix\Main\ORM\Fields\StringField\configureFormat
configureFormat($format)
Определения
stringfield.php:57
Bitrix\Main\ORM\Fields\StringField\getValidators
getValidators()
Определения
stringfield.php:77
Bitrix\Main\ORM\Fields\StringField\cast
cast($value)
Определения
stringfield.php:114
Bitrix\Main\ORM\Fields\StringField\getSize
getSize()
Определения
stringfield.php:104
Bitrix\Main\ORM\Fields\StringField\__construct
__construct($name, $parameters=array())
Определения
stringfield.php:38
Bitrix\Main\ORM\Fields\StringField\convertValueFromDb
convertValueFromDb($value)
Определения
stringfield.php:142
Bitrix\Main\ORM\Fields\StringField\getFormat
getFormat()
Определения
stringfield.php:67
Bitrix\Main\ORM\Fields\StringField\$size
$size
Определения
stringfield.php:28
Bitrix\Main\ORM\Fields\StringField\convertValueToDb
convertValueToDb($value)
Определения
stringfield.php:153
Bitrix\Main\ORM\Fields\Validators\RegExpValidator
Определения
regexpvalidator.php:18
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
size
font size
Определения
invoice.php:442
bitrix
modules
main
lib
orm
fields
stringfield.php
Создано системой
1.14.0