1
|
|
|
<?php |
2
|
|
|
/******************************************************************************** |
3
|
|
|
* Apache License, Version 2.0 * |
4
|
|
|
* * |
5
|
|
|
* Copyright [2020] [Nurlan Mukhanov <[email protected]>] * |
6
|
|
|
* * |
7
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); * |
8
|
|
|
* you may not use this file except in compliance with the License. * |
9
|
|
|
* You may obtain a copy of the License at * |
10
|
|
|
* * |
11
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 * |
12
|
|
|
* * |
13
|
|
|
* Unless required by applicable law or agreed to in writing, software * |
14
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, * |
15
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * |
16
|
|
|
* See the License for the specific language governing permissions and * |
17
|
|
|
* limitations under the License. * |
18
|
|
|
* * |
19
|
|
|
********************************************************************************/ |
20
|
|
|
|
21
|
|
|
declare(strict_types=1); |
22
|
|
|
|
23
|
|
|
namespace DBD\Entity; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Class Constraint |
27
|
|
|
* |
28
|
|
|
* @package DBD\Entity |
29
|
|
|
*/ |
30
|
|
|
class Constraint |
31
|
|
|
{ |
32
|
|
|
const BASE_CLASS = "class"; |
33
|
|
|
const FOREIGN_COLUMN = "foreignColumn"; |
34
|
|
|
const FOREIGN_SCHEME = "foreignScheme"; |
35
|
|
|
const FOREIGN_TABLE = "foreignTable"; |
36
|
|
|
const JOIN_TYPE = "join"; |
37
|
|
|
const LOCAL_COLUMN = "localColumn"; |
38
|
|
|
const LOCAL_TABLE = "localTable"; |
39
|
|
|
/** @var Column|string $localColumn */ |
40
|
|
|
public $localColumn; |
41
|
|
|
/** @var Table $localTable */ |
42
|
|
|
public $localTable; |
43
|
|
|
/** @var Table $foreignTable */ |
44
|
|
|
public $foreignTable; |
45
|
|
|
/** @var Column $foreignColumn */ |
46
|
|
|
public $foreignColumn; |
47
|
|
|
/** @var Join $joinType */ |
48
|
|
|
public $join; |
49
|
|
|
/** @var string $class */ |
50
|
|
|
public $class; |
51
|
|
|
/** @var string $foreignScheme */ |
52
|
|
|
public $foreignScheme; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Constraint constructor. |
56
|
|
|
* |
57
|
|
|
* @param array|null $constraintParams |
58
|
|
|
*/ |
59
|
|
|
public function __construct(?array $constraintParams = null) |
60
|
|
|
{ |
61
|
|
|
if (is_array($constraintParams)) { |
62
|
|
|
foreach ($constraintParams as $key => $value) { |
63
|
|
|
$this->$key = $value; |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|