1 | <?php |
||
15 | abstract class BaseTable |
||
16 | { |
||
17 | /** @var \Doctrine\DBAL\Platforms\AbstractPlatform $platform */ |
||
18 | protected $platform; |
||
19 | /** @var \Doctrine\DBAL\Schema\Table */ |
||
20 | protected $table; |
||
21 | /** @var string */ |
||
22 | protected $tablePrefix; |
||
23 | /** @var string */ |
||
24 | protected $tableName; |
||
25 | /** @var string */ |
||
26 | protected $aliasName; |
||
27 | |||
28 | /** |
||
29 | * Constructor. |
||
30 | * |
||
31 | * @param AbstractPlatform $platform |
||
32 | * @param string $tablePrefix |
||
33 | */ |
||
34 | public function __construct(AbstractPlatform $platform, $tablePrefix) |
||
39 | |||
40 | /** |
||
41 | * Get the table object. |
||
42 | * |
||
43 | * @throws StorageException |
||
44 | * |
||
45 | * @return \Doctrine\DBAL\Schema\Table |
||
46 | */ |
||
47 | public function getTable() |
||
55 | |||
56 | /** |
||
57 | * Get the table's schema object. |
||
58 | * |
||
59 | * @param Schema $schema |
||
60 | * @param string $aliasName |
||
61 | * @param string $charset |
||
62 | * @param string $collate |
||
63 | * |
||
64 | * @return \Doctrine\DBAL\Schema\Table |
||
65 | */ |
||
66 | public function buildTable(Schema $schema, $aliasName, $charset, $collate) |
||
82 | |||
83 | /** |
||
84 | * Get the table's name. |
||
85 | * |
||
86 | * @throws \RuntimeException |
||
87 | * |
||
88 | * @return string |
||
89 | */ |
||
90 | public function getTableName() |
||
98 | |||
99 | /** |
||
100 | * Get the table's alias (short) name. |
||
101 | * |
||
102 | * @throws \RuntimeException |
||
103 | * |
||
104 | * @return string |
||
105 | */ |
||
106 | public function getTableAlias() |
||
114 | |||
115 | /** |
||
116 | * Default value for TEXT fields, differs per platform. |
||
117 | * |
||
118 | * @return string|null |
||
119 | */ |
||
120 | protected function getTextDefault() |
||
128 | |||
129 | /** |
||
130 | * Add columns to the table. |
||
131 | */ |
||
132 | abstract protected function addColumns(); |
||
133 | |||
134 | /** |
||
135 | * Define the columns that require indexing. |
||
136 | */ |
||
137 | abstract protected function addIndexes(); |
||
138 | |||
139 | /** |
||
140 | * Set the table's primary key. |
||
141 | */ |
||
142 | abstract protected function setPrimaryKey(); |
||
143 | |||
144 | /** |
||
145 | * Set the table's foreign key constraints. |
||
146 | */ |
||
147 | protected function addForeignKeyConstraints() |
||
150 | } |
||
151 |