Describing the model

Describing the Model pdf

This screencast shows how one creates a Model, which is the data layer for an application. With the model we define the database tables that are managed by the application, as well as how the objects behave within the working application.

Variables can also be defined here, which are generated as basic settings in the application. For this, we simply create one or more container elements for variables on the canvas. (As a rule, one container is typically sufficient.) This container can hold the definition of several variables, and the corresponding elements are placed in the third group in the palette. Variables can be created for boolean values, integers, text fields, file paths and lists. We will now create two variables in this model. First we create a checkbox that can be used to set the application to "maintenance mode." Second, we create a text field for a message that is shown to the user when the maintenance mode is active.

Let's now start with the actual data layer. When a new entity is created, the editor needs to know three things: the name for the entity in singular, and in plural, and a field specifying whether the entity is leading. In every model container there must be one entity marked as leading. This entity is used as the default object type.

An entity has two visual areas. The upper one is used to add fields, and the lower one specifies indexes. We create a string field named „name“ and define it as leading. At the field level this property means, for example, that the field will be used as the default for sorting, or for displaying the entity in dropdown lists. Additional fields are easily created with the popup bar that appears when the mouse hovers over an entity. This is significantly faster than moving the mouse to the palette and back all the time. There are several different field types available. One can experiment with them to get to know them better.

preview

As an example, we can create an index. This gets a name and has a certain type. The index can contain different entries which must be named exactly like an existing field from the upper entity area.

The modeling of entities is the most important step in defining the data layer, but this process is incomplete without defining the relationships between them. There are different ways of describing these relationships in the editor, each of which we will show briefly.

The easiest method works the same way as the creation of new elements. We choose the connection type in the palette and activate the tool with a mouse click. We click on the source entity and (without releasing the mouse button) drag the mouse to the target entity, where the button is released. Now the editor asks for the names of both sides of the relationship. Once provided, the relationship is created. If one wants to create a self-relationship, a simple click on the corresponding entity is enough.

preview

Another method — which is more intuitive — is provided by the small arrows, called handles, that appear when the mouse hovers above an entity. We can drag one of these arrows from entity A to entity B directly, and will be asked for the desired connection type. The third method is less commonly used, but from time to time one is happy that it is available. Rather than dragging an arrow to an entity, we drag it to an empty area on the canvas. A menu appears and we can choose one of two options: the creation of a new entity, or the inclusion of an existing element from the model. In the first case, a new relationship with a new entity element is created, and the editor is then focused on the new entity. One must remember to add the relationship name after editing this new entity. The second option allows the selection of an existing element from a dialog. This usually only makes sense for large models when entities are not near each other on the diagram. In the future, when the ability to add external references is integrated into the application, this second option will be used to link to entities in other applications.

preview

Once the model is specified as desired, the definition of controllers follows. This article has only demonstrated the basics of the model editor. For further information, the tutorials about drag n drop and, especially, Doctrine are recommended.

Tags

Comments

No comments posted yet.

Only logged in users are allowed to comment. Register or log in.

Working with…

ModuleStudio has inherited a flexible environment from Eclipse, including the ability to position multiple windows… >read more

 

Documentation…

This automn, Gabriel Freinbichler (gf) will begin working on several projects for ModuleStudio as part of his… >read more

 

ModuleStudio…

We are happy to release the new MOST version 0.5.1 which fixes numerous bugs. Beside these corrections also several… >read more

 

Controlling…

The automatic live validation of models can make even expensive computers break a sweat when the number of elements… >read more

 

Basic settings…

The canvas of the main editor corresponds to the modeled application. Some basic settings should be defined here. We… >read more

 

Customise palette

The palette in ModuleStudio can be customised in several ways. This video points out the different possibilities. If… >read more

 

Modeling the…

This video will demonstrate how controllers can be defined for an application. Controllers define the interaction… >read more

 

Feedback and support

We developed ModuleStudio according to the needs of IT professionals, so if you have any ideas or suggestions, we… >read more

 

RSS feeds in…

The welcome pages in ModuleStudio contain valuable information for a successful start with the product. Since… >read more

 

CampManager

The „CampManager“ module has been built mainly for simplifying the organisation of the annual Camp Zikula… >read more

 
 
 
 

ModuleStudio Honey

Close

You don't have permission to e-mail this story - please login