Template Manager in PHP Code
Relates Pages
Implementation
How is the Template Manager actually implemented?
We have seen how the Template Manager is used in the mDIS for Data Entry and Data Management and mDIS for Administrators pages. We know how the GUI of the templates manger looks like and how it can be used. But how does the Template Manager actually look like, in code?
Directories
For the codebase of the Template manager GUI, see directory backend/components/templates/
for both
- the tableset designer (4 .php-files)
- the forms designer (2 .php-files)
- base Classes (3 .php files)
Files in Detail
BaseTemplate.php
Component.php
FormTemplateField.php
FormTemplate.php
ModelTemplateBehavior.php
ModelTemplateColumn.php
ModelTemplateForeignKey.php
ModelTemplateIndex.php
ModelTemplate.php
Code Generators
For implementation details of the code generators, see directories backend/modules/api/
, backend/modules/cg/
and file backend/config/web.php
.
- Forms code-generator: file
backend/modules/cg/generators/DISForm/Generator.php
- Models code-generator: file
backend/modules/cg/generators/DISModel/Generator.php
.
Extra Documents
For a detailed explanation of the structure of the PHP code generated and the 9-level class hierarchy involved, read this background document.
More about Gii, the Yii extension for code generation.
insolita/yii2-migration-generator (opens new window): A third-party Gii extension that creates Migration Scripts for tables and models. Maintained until at least 2018. (? really important for mDIS?)
TBC