1 | <?php declare(strict_types=1); |
||
9 | class TableMetadata |
||
10 | { |
||
11 | /** @var string Database table name */ |
||
12 | public $tableName; |
||
13 | |||
14 | /** @var string Entity class name */ |
||
15 | public $className; |
||
16 | |||
17 | /** @var array Collection of database table columns */ |
||
18 | public $columns = []; |
||
19 | |||
20 | /** @var array Collection of database table columns types */ |
||
21 | public $columnTypes = []; |
||
22 | |||
23 | /** @var array Collection of database table columns aliases to real column names */ |
||
24 | public $columnAliases = []; |
||
25 | |||
26 | /** @var array Collection of lower case table column aliases to real column names */ |
||
27 | public $lowerColumnAliases = []; |
||
28 | |||
29 | /** @var string Database table primary field */ |
||
30 | public $primaryField; |
||
31 | |||
32 | /** @var array Collection of database UNIQUE table columns */ |
||
33 | public $uniqueColumns = []; |
||
34 | |||
35 | /** @var array Collection of database INDEXED table columns */ |
||
36 | public $indexColumns = []; |
||
37 | |||
38 | /** @var array Collection of database table columns default values */ |
||
39 | public $columnDefaults = []; |
||
40 | |||
41 | /** @var array Collection of database table columns is nullable status */ |
||
42 | public $columnNullable = []; |
||
43 | |||
44 | /** |
||
45 | * Create metadata instance from entity class name |
||
46 | * @param string $className Entity class name |
||
47 | * @deprecated This is temporary old approach |
||
48 | * @return TableMetadata Metadata instance |
||
49 | * |
||
50 | * @throws \InvalidArgumentException If entity class not found |
||
51 | */ |
||
52 | public static function fromClassName(string $className) : TableMetadata |
||
80 | |||
81 | /** |
||
82 | * Get table column type by column name or alias. |
||
83 | * |
||
84 | * @param string $columnNameOrAlias Table column name or alias |
||
85 | * |
||
86 | * @return string Table column type |
||
87 | * @throws \InvalidArgumentException |
||
88 | */ |
||
89 | public function getTableColumnType(string $columnNameOrAlias) : string |
||
101 | |||
102 | /** |
||
103 | * Get table column name by column name or alias. |
||
104 | * |
||
105 | * @param string $columnNameOrAlias Table column name or alias |
||
106 | * |
||
107 | * @return string Table column name |
||
108 | * @throws \InvalidArgumentException |
||
109 | */ |
||
110 | public function getTableColumnName(string $columnNameOrAlias) : string |
||
132 | |||
133 | /** |
||
134 | * Get table column index by column name or alias. |
||
135 | * |
||
136 | * @param string $columnNameOrAlias Table column name or alias |
||
137 | * |
||
138 | * @return int Table column index |
||
139 | * @throws \InvalidArgumentException |
||
140 | */ |
||
141 | public function getTableColumnIndex(string $columnNameOrAlias) : int |
||
145 | } |
||
146 |