Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
onetomany.php
1
<?php
9
namespace
Bitrix\Main\ORM\Fields\Relations
;
10
11
use
Bitrix\Main\ArgumentException
;
12
use
Bitrix\Main\ORM\Entity
;
13
use
Bitrix\Main\ORM\Fields\FieldTypeMask
;
14
use
Bitrix\Main\SystemException
;
15
22
class
OneToMany
extends
Relation
23
{
25
protected
$referenceName
;
26
28
protected
$cascadeSavePolicy
=
CascadePolicy::FOLLOW
;
29
30
protected
$cascadeDeletePolicy
=
CascadePolicy::SET_NULL
;
// follow | no_action | set_null
31
32
public
function
__construct
(
$name
, $referenceEntity,
$referenceName
)
33
{
34
$this->referenceName =
$referenceName
;
35
36
if
($referenceEntity instanceof
Entity
)
37
{
38
$this->refEntity = $referenceEntity;
39
$this->refEntityName = $referenceEntity->getFullName();
40
}
41
else
42
{
43
// this one could be without leading backslash and/or with Table-postfix
44
$this->refEntityName =
Entity::normalizeName
($referenceEntity);
45
}
46
47
parent::__construct(
$name
);
48
}
49
50
public
function
getTypeMask
()
51
{
52
return
FieldTypeMask::ONE_TO_MANY
;
53
}
54
55
public
function
getRefField
()
56
{
57
return
$this->getRefEntity()->getField($this->referenceName);
58
}
59
63
public
function
getReferenceName
()
64
{
65
return
$this->referenceName
;
66
}
67
}
Bitrix\Main\ArgumentException
Definition
exception.php:34
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Main\ORM\Entity\normalizeName
static normalizeName($entityName)
Definition
entity.php:876
Bitrix\Main\ORM\Fields\Field\$name
$name
Definition
field.php:27
Bitrix\Main\ORM\Fields\FieldTypeMask
Definition
fieldtypemask.php:16
Bitrix\Main\ORM\Fields\FieldTypeMask\ONE_TO_MANY
const ONE_TO_MANY
Definition
fieldtypemask.php:21
Bitrix\Main\ORM\Fields\Relations\CascadePolicy\FOLLOW
const FOLLOW
Definition
cascadepolicy.php:21
Bitrix\Main\ORM\Fields\Relations\CascadePolicy\SET_NULL
const SET_NULL
Definition
cascadepolicy.php:19
Bitrix\Main\ORM\Fields\Relations\OneToMany
Definition
onetomany.php:23
Bitrix\Main\ORM\Fields\Relations\OneToMany\$cascadeDeletePolicy
$cascadeDeletePolicy
Definition
onetomany.php:30
Bitrix\Main\ORM\Fields\Relations\OneToMany\$cascadeSavePolicy
$cascadeSavePolicy
Definition
onetomany.php:28
Bitrix\Main\ORM\Fields\Relations\OneToMany\getRefField
getRefField()
Definition
onetomany.php:55
Bitrix\Main\ORM\Fields\Relations\OneToMany\getReferenceName
getReferenceName()
Definition
onetomany.php:63
Bitrix\Main\ORM\Fields\Relations\OneToMany\getTypeMask
getTypeMask()
Definition
onetomany.php:50
Bitrix\Main\ORM\Fields\Relations\OneToMany\__construct
__construct($name, $referenceEntity, $referenceName)
Definition
onetomany.php:32
Bitrix\Main\ORM\Fields\Relations\OneToMany\$referenceName
$referenceName
Definition
onetomany.php:25
Bitrix\Main\ORM\Fields\Relations\Relation
Definition
relation.php:26
Bitrix\Main\SystemException
Definition
exception.php:8
Bitrix\Main\ORM\Fields\Relations
Definition
cascadepolicy.php:9
modules
main
lib
orm
fields
relations
onetomany.php
Создано системой
1.10.0