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.

ModuleStudio…

Model-driven development is not limited to Zikula extensions created with ModuleStudio. ModuleStudio, itself, is… >read more

 

MenuSuggestion

The „MenuSuggestion“ application allows one to manage menus and recipe suggestions that are connected to products… >read more

 

Materials

If one wants to distribute things irregularly over the Internet, a complex shopping cart is not always required.… >read more

 

Presentation…

On Camp Zikula 2010 in Georgsmarienhütte (near Osnabrück) Axel Guckelsberger has shown the evolvement of the… >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

 

Knowledge Base

A common problem for larger support forums is that posts about frequently asked support topics are lost among the… >read more

 

What is ModuleStudio

ModuleStudio rapidly simplifies the creation, maintenance and customisation of applications for Zikula. It speeds up… >read more

 

ModuleStudio…

We are happy to announce that ModuleStudio 0.5.2 has been released offering a huge amount of new features. Many… >read more

 

Version 0.5.1…

We are happy about the release of the first bugfix version for the 0.5 series of ModuleStudio. After 0.5 has built… >read more

 

ModuleStudio…

We are happy to announce that a new version of MOST is available. This updates resolves many minor issues in the… >read more

 
 
 
 

ModuleStudio Honey

Close

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