ILIAS
trunk Revision v11.0_alpha-1702-gfd3ecb7f852
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
c
e
g
h
j
l
m
p
s
t
u
v
+
Enumerations
a
c
e
f
i
j
l
m
n
o
p
r
s
t
u
v
z
+
Enumerator
a
c
d
e
f
g
i
l
m
n
o
p
q
s
t
u
v
y
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Ö
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Ö
Enumerations
Enumerator
+
Files
File List
+
Globals
+
All
$
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
z
+
Functions
a
b
c
d
e
f
g
h
i
m
n
p
r
s
t
u
v
+
Variables
$
a
c
e
g
h
i
m
n
o
p
r
s
t
u
v
z
Enumerations
Enumerator
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Enumerations
Enumerator
Modules
Pages
Definition.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\components\Database\Integrity
;
22
23
use
InvalidArgumentException
;
24
25
class
Definition
26
{
30
public
function
__construct
(
private
array $associations,
private
Ignore
$ignore =
new
Ignore
())
31
{
32
$this->
validate
();
33
}
34
35
private
function
validate
(): void
36
{
37
if
($this->
associations
=== []) {
38
throw
new
InvalidArgumentException
(
'Associations must not be empty.'
);
39
}
40
41
array_walk($this->
associations
,
static
function
($association):
void
{
42
if
(!$association instanceof
Association
) {
43
throw
new
InvalidArgumentException
(
44
'Associations must be of type '
. Association::class .
'.'
45
);
46
}
47
});
48
49
$first = $this->
associations
[0];
50
51
foreach
($this->
associations
as $association) {
52
if
($association->field()->tableName() !== $first->field()->tableName() ||
53
$association->referenceField()->tableName() !== $first->referenceField()->tableName()
54
) {
55
throw
new
InvalidArgumentException
(
'All fields must have the same table'
);
56
}
57
}
58
}
59
60
public
function
tableName
(): string
61
{
62
return
$this->
associations
[0]->field()->tableName();
63
}
64
68
public
function
associations
(): array
69
{
70
return
$this->associations;
71
}
72
76
public
function
ignoreValues
(): array
77
{
78
return
$this->ignore->values();
79
}
80
81
public
function
referenceTableName
(): string
82
{
83
return
$this->
associations
[0]->referenceField()->tableName();
84
}
85
}
ILIAS\components\Database\Integrity
Definition:
Association.php:21
ILIAS\components\Database\Integrity\Ignore
Definition:
Ignore.php:23
ILIAS\components\Database\Integrity\Association
Definition:
Association.php:23
ILIAS\components\Database\Integrity\Definition\__construct
__construct(private array $associations, private Ignore $ignore=new Ignore())
Definition:
Definition.php:30
ILIAS\components\Database\Integrity\Definition\referenceTableName
referenceTableName()
Definition:
Definition.php:81
ILIAS\components\Database\Integrity\Definition\associations
associations()
Definition:
Definition.php:68
ILIAS\components\Database\Integrity\Definition\ignoreValues
ignoreValues()
Definition:
Definition.php:76
ILIAS\components\Database\Integrity\Definition\validate
validate()
Definition:
Definition.php:35
ILIAS\components\Database\Integrity\Definition
Definition:
Definition.php:25
InvalidArgumentException
ILIAS\components\Database\Integrity\Definition\tableName
tableName()
Definition:
Definition.php:60
components
ILIAS
Database
classes
Integrity
Definition.php
Generated on Thu Apr 3 2025 23:02:44 for ILIAS by
1.8.13 (using
Doxyfile
)