1 | <?php |
||
21 | class TableSchema extends Object |
||
22 | { |
||
23 | /** |
||
24 | * @var string the name of the schema that this table belongs to. |
||
25 | */ |
||
26 | public $schemaName; |
||
27 | /** |
||
28 | * @var string the name of this table. The schema name is not included. Use [[fullName]] to get the name with schema name prefix. |
||
29 | */ |
||
30 | public $name; |
||
31 | /** |
||
32 | * @var string the full name of this table, which includes the schema name prefix, if any. |
||
33 | * Note that if the schema name is the same as the [[Schema::defaultSchema|default schema name]], |
||
34 | * the schema name will not be included. |
||
35 | */ |
||
36 | public $fullName; |
||
37 | /** |
||
38 | * @var string[] primary keys of this table. |
||
39 | */ |
||
40 | public $primaryKey = []; |
||
41 | /** |
||
42 | * @var string sequence name for the primary key. Null if no sequence. |
||
43 | */ |
||
44 | public $sequenceName; |
||
45 | /** |
||
46 | * @var array foreign keys of this table. Each array element is of the following structure: |
||
47 | * |
||
48 | * ```php |
||
49 | * [ |
||
50 | * 'ForeignTableName', |
||
51 | * 'fk1' => 'pk1', // pk1 is in foreign table |
||
52 | * 'fk2' => 'pk2', // if composite foreign key |
||
53 | * ] |
||
54 | * ``` |
||
55 | */ |
||
56 | public $foreignKeys = []; |
||
57 | /** |
||
58 | * @var ColumnSchema[] column metadata of this table. Each array element is a [[ColumnSchema]] object, indexed by column names. |
||
59 | */ |
||
60 | public $columns = []; |
||
61 | |||
62 | |||
63 | /** |
||
64 | * Gets the named column metadata. |
||
65 | * This is a convenient method for retrieving a named column even if it does not exist. |
||
66 | * @param string $name column name |
||
67 | * @return ColumnSchema metadata of the named column. Null if the named column does not exist. |
||
68 | */ |
||
69 | 5 | public function getColumn($name) |
|
73 | |||
74 | /** |
||
75 | * Returns the names of all columns in this table. |
||
76 | * @return array list of column names |
||
77 | */ |
||
78 | 3 | public function getColumnNames() |
|
82 | |||
83 | /** |
||
84 | * Manually specifies the primary key for this table. |
||
85 | * @param string|array $keys the primary key (can be composite) |
||
86 | * @throws InvalidParamException if the specified key cannot be found in the table. |
||
87 | */ |
||
88 | public function fixPrimaryKey($keys) |
||
103 | } |
||
104 |