1.4.6 Build 488

visual editor for ORM frameworks

Pricing information Free download

Structure of ORM Designer configuration file

The main part of ORM framework configuration is stored in ORM Designer XML configuration files. User can extend or change these files in order to adapt the ORM Designer to his needs.

What is stored in configuration files

1) MVC framework definition

  • Which ORM frameworks are supported
  • Paths to files with model schemas

2) ORM framework definition

  • Paths to XSLT templates for import/export
  • ORM property definition and behaviors
  • Supported schema file format definitions and their XSLT conversion templates
  • ORM framework data types

XML configuration file structure

Every XML configuration file has root element orm-designer-configuration. This element can contain two types of child elements in any number. The first type serves for defining MVC framework, the second one for ORM framework. Basic structure of XML configuration file can be descibes as follows:

<orm-designer-configuration>
    <framework-configuration/>
    <orm-configuration/>
</orm-designer-configuration>

MVC framework definition

MVC framework definition in ORM Designer is very simple. Here is the example of definition for MVC framework Symfony.

<framework-configuration name="Symfony" import-path-mask="%path-reg-ex%">
    <supported-orm name="Doctrine" import-full-filename-mask="%fn-reg-ex%"/>
    <supported-orm name="Propel"/>
</framework-configuration>
  • Element framework-configuration define a new MVC framework. If ORM Designer find more definition with the same name during the configuration files loading, these MVC configurations will be merged.
  • Elements supported-orm specify which ORM frameworks can be used with concrete MVC framework.

  • Attribute import-path-mask specifies by regular expression in which directories the definition files should be found during their automatic import.

  • Atributte import-full-filename-mask is also the regular expression defining the data format of founded file.

ORM framework definition

Every ORM framework is defined by the element orm-configuration and explicitely identified by its name. As well as in the case of MVC framework, if more definitions with the same name are found, these ORM definitions will be merged. Every ORM framework configuration includes a definition of import and export, properties types definition, data files and data types definitions.

<orm-configuration name="Propel"  import-template="...\PropelXml2Xml.xsl" export-template="...\Xml2PropelXml.xsl" configuration-mode="strict"> 
    <attribute>...</attribute>
    <orm-data-format/>
    <orm-data-type/>
</orm-configuration>
  • Attribute import-template defines the XSLT template performed during the import in step.
  • Attribute export-template defines the XSLT template performed during the export in step.
  • Attribute configuration-mode is optional attribute. ORM Designer doesn't add new data types automatically when strict mode is turn on.

More about the principles and settings of import and export for ORM frameworks in ORM Designer you can find in the article How ORM Designer performs import and export model schema files.

ORM attributes definitons

For each ORM framework ORM Designer allows to set up available ORM properties which can be assigned to any object in the model. Available attributes are in configuration file set by element attribute.

<attribute name="TABLE">
    <attribute ..../>
</attribute>

For more information about ORM attributes settings and functioning in ORM Designer read the article How to configure new ORM properties and data types.

ORM framework data files defitions

For each ORM framewor it is necessary to define format of its data files. Most of ORM frameworks has usually only the one data file format, but e.g. ORM Propel allows to save the definitions both to XML and YML format.

    <orm-data-format 
        name="PropelYml" 
        file-type="YML" 
        pre-import-template = "...\PropelYml2PropelXml.xsl"
        post-export-template = "...\PropelXml2PropelYml.xsl"
        import-filename-mask=".*(schema\.yml)" 
    />
  • Attribute name serves to unique naming of data format.
  • Attribute file-type defines a file format. Currently the XML and YML file is supported.
  • Attribute import-filename-mask defines by regular expression which files will be considered as definition during automatic import.
  • Attribute pre-import-template defines a path to XSLT file with a template performed during import in step
  • Attribute post-export-template defines a path to XSLT file with a template performed during export in step

ORM framework data types definitons

Each ORM framework has its own data types used in table columns definitions. In order to meet the requirements of all the frameworks in ORM Designer are these types defined by configuration files.

<orm-data-type name="integer"/>
<orm-data-type name="enum" has-enum-values="true"/>

Data type is defined by the element orm-data-type which has only one a required param "name".

  • Attribute has-enum-values specifies that it is enum type for which the posible values are entered in table editor.

Configuration files location and validation

Application configuration files

During the ORM Designer installation, the files defining the individual frameworks support are by default copied into the configuration file. These files describes the frameworks and their properties.

This file is placed in directory

%ORM_Designer_Path%\Config

Warning: User should not change these files because during the next ORM Designer installation they are automatically overwritten by a current version.

User configuration files

User configuration folder serves for user modification and framework extension. All this files will remain also after the reinstalling. Using user configuration files user can extend current framework with new data types, new properties of any object or it serves to add e.g. new behavior. Eventually user can define there also his own ORM framework.

The file with user data is placed at

 %User_Application_Data%\OrmDesignerCore\config

Configuration path

Both paths described above you can find in application configuration in file System Info.


Configuration files validation

During a configuration files loading, an XML validation is performing by XML schema. This schema is also recommended to use during editing XML configurations in your favorite XML editor. The schema is stored at

  %ORM_Designer_Path%\Schema\configuration.xsd

Conclusion

As exemples I recommend to study existing ORM Designer configuration. If you have any further questions, you are welcome to contact us.

Author: Ludek Vodicka

ORM Designer on Twitter

Feed from our blog

Missing field-type icons in ORM Designer

Propel ORM Behaviors support!

Propel ORM validators support!

How to change export format (schema.yml / schema.xml)

How to import model from MySql Workbench

New visual symbols for NULL/NOT NULL column types

Execute another application from ORM Designer import/export script

Forum topics

ORM Designer forum: http://forum.orm-designer.com/

About ORM Designer

ORM Designer is a tool for modelling entity relationship diagrams (ERD). The biggest advantage is full support of any ORM framework which has its definitions stored in a markup language or other structured file.

Currently supported ORMs are PHP Doctrine, PHP Propel and CakePHP frameworks, but more will be added in close future.

Inventic s.r.o. - PayPal verified

Real Time Web Analytics

Clicky

Legal notice: The name CakePHP and the cake icon are trademarks of the Cake Software Foundation Inc., and used with permission. "symfony" is a trademark of Fabien Potencier.

© 2009-2012 Inventic s.r.o. all rights reserved