|
1
|
|
|
<?php |
|
2
|
|
|
//---------------------------------------------------------------------------------------------------------------------- |
|
3
|
|
|
namespace SetBased\Audit\MySql\Metadata; |
|
4
|
|
|
|
|
5
|
|
|
//-------------------------------------------------------------------------------------------------------------------- |
|
6
|
|
|
/** |
|
7
|
|
|
* Class for the metadata of a database table. |
|
8
|
|
|
*/ |
|
9
|
|
|
class TableMetadata |
|
10
|
|
|
{ |
|
11
|
|
|
//-------------------------------------------------------------------------------------------------------------------- |
|
12
|
|
|
/** |
|
13
|
|
|
* The metadata of the columns of this table. |
|
14
|
|
|
* |
|
15
|
|
|
* @var TableColumnsMetadata. |
|
16
|
|
|
*/ |
|
17
|
|
|
private $columns; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* The name of the schema were the table is located. |
|
21
|
|
|
* |
|
22
|
|
|
* @var string |
|
23
|
|
|
*/ |
|
24
|
|
|
private $schemaName; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* The name of this table. |
|
28
|
|
|
* |
|
29
|
|
|
* @var string |
|
30
|
|
|
*/ |
|
31
|
|
|
private $tableName; |
|
32
|
|
|
|
|
33
|
|
|
//-------------------------------------------------------------------------------------------------------------------- |
|
34
|
|
|
/** |
|
35
|
|
|
* Object constructor. |
|
36
|
|
|
* |
|
37
|
|
|
* @param string $tableName The table name. |
|
38
|
|
|
* @param string $schemaName The name of the schema were the table is located. |
|
39
|
|
|
* @param array[] $columns The metadata of the columns of this table. |
|
40
|
|
|
*/ |
|
41
|
8 |
|
public function __construct($tableName, $schemaName, $columns) |
|
42
|
|
|
{ |
|
43
|
8 |
|
$this->tableName = $tableName; |
|
44
|
8 |
|
$this->columns = new TableColumnsMetadata($columns); |
|
|
|
|
|
|
45
|
8 |
|
$this->schemaName = $schemaName; |
|
46
|
8 |
|
} |
|
47
|
|
|
|
|
48
|
|
|
//-------------------------------------------------------------------------------------------------------------------- |
|
49
|
|
|
/** |
|
50
|
|
|
* Returns table columns. |
|
51
|
|
|
* |
|
52
|
|
|
* @return TableColumnsMetadata |
|
53
|
|
|
*/ |
|
54
|
8 |
|
public function getColumns() |
|
55
|
|
|
{ |
|
56
|
8 |
|
return $this->columns; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
//-------------------------------------------------------------------------------------------------------------------- |
|
60
|
|
|
/** |
|
61
|
|
|
* Returns the name of schema. |
|
62
|
|
|
* |
|
63
|
|
|
* @return string |
|
64
|
|
|
*/ |
|
65
|
8 |
|
public function getSchemaName() |
|
66
|
|
|
{ |
|
67
|
8 |
|
return $this->schemaName; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
//-------------------------------------------------------------------------------------------------------------------- |
|
71
|
|
|
/** |
|
72
|
|
|
* Returns the name of this table. |
|
73
|
|
|
* |
|
74
|
|
|
* @return string |
|
75
|
|
|
*/ |
|
76
|
8 |
|
public function getTableName() |
|
77
|
|
|
{ |
|
78
|
8 |
|
return $this->tableName; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
//-------------------------------------------------------------------------------------------------------------------- |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
//---------------------------------------------------------------------------------------------------------------------- |
|
85
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: