Doctrine in ModuleStudio
The core version 1.3 of Zikula now ships the ORM layer called Doctrine. Because of this we completely overhauled the data layer in ModuleStudio to precisely express the different concepts and functions available in Doctrine. This article deals with the essential aspects for modeling Doctrine artifacts and demonstrates relevant specialities. Prerequisites for the full understanding of this articles are knowledge of Doctrine terms, as well as the tutorials for describing the model and about the structure and customisation of generated applications.
From each entity in the data layer there are classes for records, table and event listeners created. Therewith the single fields as well as their properties are accordingly interpretated. For many data types and basic properties, like unique, readonly or notnull this happens with a one to one adaption. Several things are shortened for convenience in ModuleStudio though. Furthermore there are some additional data types, like for example for users, email addresses, urls and uploads. An email field is treated by the generator as a string field in Doctrine which has the email validator activated.
Validators are generally not explicitely modeled in MOST, but simply defined with properties. So there are for example attributes like notspace, country, ipaddress or htmlcolor for string fields. Timestamp fields have according properties for past and future, for Integer fields there is a creditcard property beside others. Individual check constraints were not considered at all in ModuleStudio yet, because they are not portable anyway. Indexes are naturally supported though.
The different types of relations in Doctrine are all offered, too. For inheritance relationships the strategy can be selected (Simple, Custom, Column Aggregation). All other connection types store a name for the two entities on both sides (Source Alias and Target Alias) as well as the referenced fields (Source Field and Target Field). Because the primary id fields of entities are not modeled, but automatically added before the generation, the string „id“ is allowed and also set per default. By changing these fields it is possible to describe also relations referencing other fields. Beside this it is possible to have multiple relationships between the same entities and also self relations, only the alias settings must be unique. Finally one can also define how the cascading behaviour should look like. Also here all options offered in Doctrine are supported.
The properties of an entity itself contain the table type, collation and encoding. Those properties involve also settings regarding behaviors. Therefore it is important to mention that one has to specify for several behaviours which fields are affected. For example this is the case for Versionable, I10n, Searchable and Sluggable. For each of them there exists a corresponding property for storing names of the desired fields, separated by a comma with space. For some behaviors special fields were not added, for others a selection of all options has been provided. If missing fields should be relevant often in practice they can be added without problems. Beside the core behaviors of Doctrine the entities do also have some Zikula-specific additions by the way, like the behaviors Attributable, Categorisable, Loggable, MetaData and StandardFields.
The modeling of own event listeners is planned and the language elements are already existing, but they are not yet integrated in the editor. Base implementations for all record listeners supported by Doctrine are already generated though.
Tags
Comments
Materials
If one wants to distribute things irregularly over the Internet, a complex shopping cart is not always required.… >read more
Installation…
ModuleStudio is based on Eclipse and, therefore, works with many different systems and environments. To avoid having… >read more
ModuleStudio…
Model-driven development is not limited to Zikula extensions created with ModuleStudio. ModuleStudio, itself, is… >read more
RSS feeds in…
The welcome pages in ModuleStudio contain valuable information for a successful start with the product. Since… >read more
Advantages of…
Model-driven development with ModuleStudio and Zikula has a multitude of advantages. The biggest advantage is that… >read more
ModuleStudio 0.5
It is finally here, the ModuleStudio 0.5 release! This version brings many visible and invisible innovations and has… >read more
What is ModuleStudio
ModuleStudio rapidly simplifies the creation, maintenance and customisation of applications for Zikula. It speeds up… >read more
World History
The World History module is a long-term project in the area of medieval history. In the design phase, ModuleStudio… >read more
CampManager
The „CampManager“ module has been built mainly for simplifying the organisation of the annual Camp Zikula… >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

Axel / Sep 14, 2011 / 02:26
Update
Dieser Artikel bezog sich auf Doctrine 1.3. Mittlerweile wird statt dessen Doctrine 2.1 verwendet.
Only logged in users are allowed to comment. Register or log in.