Documentation

ConvertToDB

array
CIBlockProperty*::ConvertToDB(
array arProperty,
array value
);

The method converts property value to the format suitable for database storage. And return the array type("VALUE" => "...", "DESCRIPTION" => "..."). When the property value is an array, its recommended to use the serialize function. And Date/time is converted to ODBC format "YYYY-MM-DD HH:MI:SS". It defines sorting and filtering options for these property values. This method is static when using standard properties. Must be static for properties, created by client when using php7.

Note: the method is called before saving property in the database.

Parameters

Parameter Description
arProperty
Property metadata. See. iblock element properties
valueProperty value. Array type:
array(
"VALUE" => value,
"DESCRIPTION" => description,
);

Returned value

String for the database.

See Also

Examples

<?
class CIBlockPropertyMyDateTime
{
function ConvertToDB($arProperty, $value)
{
if(strlen($value["VALUE"])>0)
{
$value["VALUE"] = CDatabase::FormatDate(
$value["VALUE"],
CLang::GetDateFormat("FULL"), "YYYY-MM-DD HH:MI:SS"
);
}
return $value;
}
}
?>


© «Bitrix24», 2001-2024