Write your own Templates

You can access every variable created during the visual creation of your project. The provided Template-IDE supports you in the access of this variables with Autocomplete and the Object-Explorer (which lets you view and copy the existing informations as raw data).

So, what's accessible in Generato?

We'll go through all of our sections and explain what's accessible and usable.

Scope (Accessible Everywhere)

Access the following informations everywhere:

// the current user
user = {
    "name": "text",              // the name
    "email": "text",             // the email
}

organisation = {
    "name": "text",              // the name
    "website": "text",           // the website
    "phone": "text",             // the phone
}

// the current template
template = {
    "name": "text",               // name of the template  
    "fileName": "text",           // generated name from the template
    "filePath": "text",           // generated path from the template
}

project = Project
models = [ Entity / Enum ]         // all Project's Backend-Models
entities = [ Entity ]              // Project's Entities
roots = [ Entity ]                 // Project's Root-Entities                                               (standing for their own,                                               not embedded in other entities)
enums = [ Enum ]                   // Project's Enums
views = [ Page / Component ]       // all Project's Frontend-Views
pages = [ Page ]                   // Project's Pages
components = [ Component ]         // Project's Components

? = [ Entity / Enum / Page / Component ]
                       ... <- Bundle-Units are named by their key    

Project

The project contains the following informations:

project = {
    "name": "text",               // name of the project
    "description": "text",        // description from the
     "models": [ Entity / Enum ]  // all Project's Backend-Models
     "entities": [ Entity ]       // Project's Entities
     "roots": [ Entity ]          // Project's Root-Entities                                                (standing for their own,                                               not embedded in other entities)
     "enums": [ Enum ]            // Project's Enums
     "views": [ Page / Component ]// all Project's Frontend-Views
     "pages": [ Page ]            // Project's Pages
     "components: [ Component ]   // Project's Components
     "templates": [ Template ]    // all selected templates
     "bundles": [ Bundle]         // all selected bundles

    ... <- Project-Parameters     // every parameter declared by                                            templates is injected right here
}

Entity (Model)

The created Models with the Type "Entity" are containing the following informations.

entity = {
    "name": "text",                 // name of the model
    "description": "text",          // description from the model
    "modelType": "Entity" | "Enum", // type of the model
    "propertys": [ Property ],      // all included propertys
    "templates": [ Template ]       // names of the selected templates
    "parents": [ Entity ]           // Entities where this Entity is
                                       the Child
    "models": [ Entity / Enum ]     // Models where this Entity is the
                                       Parent (included by its own
                                       Propertys)
    "enums": [ Enum ]               // Enums where this Entity is the
                                       Parent (included by its own
                                       Propertys
    "views": [ Page / Component ]   // Views which are referencing
                                       to this Entity
    "pages": [ Page ]               // Pages which are referencing
                                       to this Entity
    "components": [ Component ]     // Component which are referencing
                                       to this Entity

    ... <- Model-Parameter          // every parameter declared by                                         templates is injected right here
}

Property in Entity

Every Property in the Entity looks like this:

property = {
    "name": "text",              // name of the property
    "description": "text",       // description from the property
    "propertyType": "Attribute"|"Foreign"|"Embed"
                                 // the type of the property
    "type": {
        "name": "text",          // name of the property-type
        "description": "text",   // description from the property-type
        "value": "text",         // code-declaration (e.g. string,
                                    number) in the selected
                                    programming-language
        "qualifier": "text",     // same as "value"  
        "example": "bool"        // example-code-initialization (e.g.
                                    '', -1) for the selected
                                    programming-language
        "init": "bool",          // same as "example"  

        "model": ?Model            // full model, if the property has                                       a relation to another model
        "propertys": ?[ Property ] // model-propertys, if the property                                       has a relation to another model

        "isSingle": "bool",      // selected data-type has more than                                       one included type (e.g. number is                                     single, array is multiple)
        "isList": "bool",        // opposite of "isSingle"
        "isArray": "bool",       // opposite of "isSingle",                                               same as "isArray"

        "isStandard": "bool",    // property is declared as data-type
        "isDataType": "bool",    // same as "isStandard"
        "isRelation": "bool",    // property is relation to another                                       model
        "isForeign": "bool",     // is a foreign-key-type-relation
        "isEmbedded": "bool",    // is a embedded-object-type-relation
        "isRequired": "bool",    // required by the relation-type
        "isOptional": "bool",    // opposite of "isRequired"

¬† ¬† ¬† ¬† "isForeignSingle": "bool", // conjunction (and, ‚ąß) of ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† "isForeign" and "isSingle"
¬† ¬† ¬† ¬† "isForeignArray": "bool", ¬†// conjunction (and, ‚ąß) of
                                      "isForeign" and "isArray"
¬† ¬† ¬† ¬† "isEmbeddedSingle": "bool", // conjunction (and, ‚ąß) of
                                      "isEmbedded" and "isSingle"
¬† ¬† ¬† ¬† "isEmbeddedArray": "bool", ¬†// conjunction (and, ‚ąß) of ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† "isEmbedded" and "isArray"
    },
    "model": ?Model              // full model, if the property has a
                                    relation to another model
    "propertys": ?[ Property ]   // model-propertys, if the property
                                    has a relation to another model

    ... <- Property-Parameter,   // every parameter declared by                                           templates is injected right here
}

Enum (Model)

When the Model is created as an Enum, it looks like this:

enum = {
    "name": "text",                 // name of the model
    "description": "text",          // description from the model
    "modelType": "Entity" | "Enum", // type of the model
    "values": [ Value ],            // all included values
    "templates": [ Template         // the selected templates
    "parents": [ Entity ]           // Entities where this Entity is
                                       the Child
    "models": [ Entity / Enum ]     // Models where this Entity is the
                                       Parent (included by its own
                                       Propertys)
    "enums": [ Enum ]               // Enums where this Entity is the
                                       Parent (included by its own
                                       Propertys
    "views": [ Page / Component ]   // Views which are referencing
                                       to this Entity
    "pages": [ Page ]               // Pages which are referencing
                                       to this Entity
    "components": [ Component ]     // Component which are referencing
                                       to this Entity
    ... <- Model-Parameter          // every parameter declared by                                         templates is injected right here
}

Value in Enum

the Values of the Enum are having this structure:

value = {
    "name": "text",              // name of the enum-value
    "description": "text",       // description from the enum-value
}

Page (Views)

page = {
    "name": "text",               // the name of the view
    "description": "text",        // the description from the view
    "viewType": "Page" | "Component", // the type of the view
    "models": [ Entity / Enum ],  // Referenced Models
    "entities": [ Entity ],       // Referenced Entity
    "enums": [ Enum ],            // Referenced Enums
    "views": [ Component / Page ], // Referenced Views
    "components": [ Component ],  // Referenced Components
    "navigations": [ Page ],      // Pages to which the view navigates
    "templates": [ Template ]     // the selected templates

    ... <- View-Parameter         // every parameter declared by
                                     templates is injected right here
};

Component (Views)

component = {
    "name": "text",               // the name of the view
    "description": "text",        // the description from the view
    "viewType": "Page" | "Component", // the type of the view
    "models": [ Entity / Enum ],  // Referenced Models
    "entities": [ Entity ],       // Referenced Entity
    "enums": [ Enum ],            // Referenced Enums
    "views": [ Component / Page ], // Referenced Views
    "components": [ Component ],  // Referenced Components
    "navigations": [ Page ],      // Pages to which the view navigates
    "templates": [ Template ]     // the selected templates

    ... <- View-Parameter         // every parameter declared by
                                     templates is injected right here
};

Did this answer your question?