1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Lagdo\DbAdmin\Driver\Db; |
4
|
|
|
|
5
|
|
|
use Lagdo\DbAdmin\Driver\DriverInterface; |
6
|
|
|
use Lagdo\DbAdmin\Driver\UtilInterface; |
7
|
|
|
use Lagdo\DbAdmin\Driver\TranslatorInterface; |
8
|
|
|
|
9
|
|
|
use Lagdo\DbAdmin\Driver\Entity\TableEntity; |
10
|
|
|
|
11
|
|
|
abstract class Table implements TableInterface |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @var DriverInterface |
15
|
|
|
*/ |
16
|
|
|
protected $driver; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var UtilInterface |
20
|
|
|
*/ |
21
|
|
|
protected $util; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var TranslatorInterface |
25
|
|
|
*/ |
26
|
|
|
protected $trans; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var ConnectionInterface |
30
|
|
|
*/ |
31
|
|
|
protected $connection; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* The constructor |
35
|
|
|
* |
36
|
|
|
* @param DriverInterface $driver |
37
|
|
|
* @param UtilInterface $util |
38
|
|
|
* @param TranslatorInterface $trans |
39
|
|
|
* @param ConnectionInterface $connection |
40
|
|
|
*/ |
41
|
|
|
public function __construct(DriverInterface $driver, UtilInterface $util, TranslatorInterface $trans, ConnectionInterface $connection) |
42
|
|
|
{ |
43
|
|
|
$this->driver = $driver; |
44
|
|
|
$this->util = $util; |
45
|
|
|
$this->trans = $trans; |
46
|
|
|
$this->connection = $connection; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @inheritDoc |
51
|
|
|
*/ |
52
|
|
|
public function tableStatusOrName(string $table, bool $fast = false) |
53
|
|
|
{ |
54
|
|
|
if (($status = $this->tableStatus($table, $fast))) { |
55
|
|
|
return $status; |
56
|
|
|
} |
57
|
|
|
return new TableEntity($table); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @inheritDoc |
62
|
|
|
*/ |
63
|
|
|
public function foreignKeys(string $table) |
64
|
|
|
{ |
65
|
|
|
return []; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @inheritDoc |
70
|
|
|
*/ |
71
|
|
|
public function supportForeignKeys(TableEntity $tableStatus) |
72
|
|
|
{ |
73
|
|
|
return false; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @inheritDoc |
78
|
|
|
*/ |
79
|
|
|
public function alterIndexes(string $table, array $alte) |
|
|
|
|
80
|
|
|
{ |
81
|
|
|
return false; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @inheritDoc |
86
|
|
|
*/ |
87
|
|
|
public function isView(TableEntity $tableStatus) |
88
|
|
|
{ |
89
|
|
|
return false; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @inheritDoc |
94
|
|
|
*/ |
95
|
|
|
public function trigger(string $name, string $table = '') |
96
|
|
|
{ |
97
|
|
|
return null; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @inheritDoc |
102
|
|
|
*/ |
103
|
|
|
public function triggers(string $table) |
104
|
|
|
{ |
105
|
|
|
return []; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @inheritDoc |
110
|
|
|
*/ |
111
|
|
|
public function triggerOptions() |
112
|
|
|
{ |
113
|
|
|
return []; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @inheritDoc |
118
|
|
|
*/ |
119
|
|
|
public function referencableTables(string $table) |
120
|
|
|
{ |
121
|
|
|
return []; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @inheritDoc |
126
|
|
|
*/ |
127
|
|
|
public function tableHelp(string $name) |
128
|
|
|
{ |
129
|
|
|
return ''; |
130
|
|
|
} |
131
|
|
|
} |
132
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.