1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
elementv1.php
См. документацию.
1
<?php
8
9
namespace
Bitrix\Iblock\ORM;
10
11
use Bitrix\Iblock\ORM\Fields\PropertyReference;
12
use Bitrix\Main\ORM\Data\Result;
13
use Bitrix\Main\ORM\Objectify\EntityObject;
14
use Bitrix\Main\ORM\Objectify\State;
15
20
abstract
class
ElementV1
extends
CommonElement
21
{
32
public
function
sysSetValue
($fieldName, $value)
33
{
34
$field = $this->entity->getField($fieldName);
35
36
if
($field instanceof
PropertyReference
)
37
{
38
// for v1 preferable to change existing object (sel+upd) instead of new (del+ins)
39
if
($this->state !== State::RAW && !$this->sysIsFilled($fieldName))
40
{
41
$this->fill($fieldName);
42
}
43
}
44
45
return
parent::sysSetValue($fieldName, $value);
46
}
47
48
public
function
sysSaveRelations(
Result
$result
)
49
{
50
parent::sysSaveRelations(
$result
);
51
52
// save single value references
53
foreach
($this->entity->getFields() as $field)
54
{
55
if
($field instanceof
PropertyReference
)
56
{
57
if
($this->sysHasValue($field->getName()) && !empty($this->
get
($field->getName())))
58
{
60
$valueObject = $this->
get
($field->getName());
61
62
if
($valueObject->state == State::RAW)
63
{
64
// previously we made fill, so now we don't need to remove old value
65
// it would be insert only, and that's all
66
$valueObject->save();
67
}
68
elseif
($valueObject->state == State::CHANGED)
69
{
70
// regular update
71
$valueObject->save();
72
}
73
}
74
}
75
}
76
}
77
}
Bitrix\Iblock\ORM\CommonElement
Определения
commonelement.php:25
Bitrix\Iblock\ORM\ElementV1
Определения
elementv1.php:21
Bitrix\Iblock\ORM\ElementV1\sysSetValue
sysSetValue($fieldName, $value)
Определения
elementv1.php:32
Bitrix\Iblock\ORM\Fields\PropertyReference
Определения
propertyreference.php:18
Bitrix\Main\ORM\Data\Result
Определения
result.php:16
$result
$result
Определения
get_property_values.php:14
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
bitrix
modules
iblock
lib
orm
elementv1.php
Создано системой
1.14.0