1 | <?php |
||
27 | class StructureGenerator extends BaseGenerator |
||
28 | { |
||
29 | /** |
||
30 | * generate |
||
31 | * |
||
32 | * Generate structure file. |
||
33 | * |
||
34 | * @see BaseGenerator |
||
35 | */ |
||
36 | public function generate(ParameterHolder $input, array $output = []) |
||
76 | |||
77 | /** |
||
78 | * formatAddFields |
||
79 | * |
||
80 | * Format 'addField' method calls. |
||
81 | * |
||
82 | * @access protected |
||
83 | * @param ConvertedResultIterator $field_information |
||
84 | * @return string |
||
85 | */ |
||
86 | protected function formatAddFields(ConvertedResultIterator $field_information) |
||
108 | |||
109 | /** |
||
110 | * formatFieldsComment |
||
111 | * |
||
112 | * Format fields comment to be in the class comment. This is because there |
||
113 | * can be very long comments or comments with carriage returns. It is |
||
114 | * furthermore more convenient to get all the descriptions in the head of |
||
115 | * the generated class. |
||
116 | * |
||
117 | * @access protected |
||
118 | * @param ConvertedResultIterator $field_information |
||
119 | * @return string |
||
120 | */ |
||
121 | protected function formatFieldsComment(ConvertedResultIterator $field_information) |
||
135 | |||
136 | /** |
||
137 | * createPhpDocBlockFromText |
||
138 | * |
||
139 | * Format a text into a PHPDoc comment block. |
||
140 | * |
||
141 | * @access protected |
||
142 | * @param string $text |
||
143 | * @return string |
||
144 | */ |
||
145 | protected function createPhpDocBlockFromText($text) |
||
155 | |||
156 | /** |
||
157 | * checkRelationInformation |
||
158 | * |
||
159 | * Check if the given schema and relation exist. If so, the table oid is |
||
160 | * returned, otherwise a GeneratorException is thrown. |
||
161 | * |
||
162 | * @access private |
||
163 | * @throws GeneratorException |
||
164 | * @return int $oid |
||
165 | */ |
||
166 | private function checkRelationInformation() |
||
186 | |||
187 | /** |
||
188 | * getFieldInformation |
||
189 | * |
||
190 | * Fetch a table field information. |
||
191 | * |
||
192 | * @access protected |
||
193 | * @param int $table_oid |
||
194 | * @throws GeneratorException |
||
195 | * @return ConvertedResultIterator $fields_info |
||
196 | */ |
||
197 | protected function getFieldInformation($table_oid) |
||
215 | |||
216 | /** |
||
217 | * getPrimaryKey |
||
218 | * |
||
219 | * Return the primary key of a relation if any. |
||
220 | * |
||
221 | * @access protected |
||
222 | * @param string $table_oid |
||
223 | * @return array $primary_key |
||
224 | */ |
||
225 | protected function getPrimaryKey($table_oid) |
||
234 | |||
235 | /** |
||
236 | * getTableComment |
||
237 | * |
||
238 | * Grab table comment from database. |
||
239 | * |
||
240 | * @access protected |
||
241 | * @param int $table_oid |
||
242 | * @return string|null |
||
243 | */ |
||
244 | protected function getTableComment($table_oid) |
||
253 | |||
254 | /** |
||
255 | * getCodeTemplate |
||
256 | * |
||
257 | * @see BaseGenerator |
||
258 | */ |
||
259 | protected function getCodeTemplate() |
||
304 | } |
||
305 |