New visual symbols for NULL/NOT NULL column types
Today I want to show you a new small feature in ORM Designer 1.4.2 which helps you with navigation in the model. Until now, ORM Designer has shown only three different icons in a column for primary keys, foreign keys and other columns. Today we have added another three types for differentiation of NULL and NOT NULL columns. Empty diamonds beside the column names symbolize columns where NULL is allowed, filled diamonds where value is requried.
Here is screenshot of this feature:
Currently is this feature in beta-version of ORM Designer. Download here: http://www.orm-designer.com/article/orm-designer-beta-versions
How to share modules among several ORM Designer projects
In this short tip I want to show you how to share modules (plugins) bewteen serveral ORM Designer projects.
Save module to shared location
As first step you can create or select any module you want to share among several projects and double click on it. As the next step select "Files and export" tab and enter a path to the shared directory to the "Data storage" edit window. In our example we store shared module in the location c:\sharedlocation\plugin.data.xml. The situation looks as in our first screenshot:
Import existing module
As the third step, open any project where you want to use this shared module. After that, select "Attach existing ORMD file to model" from "Import" menu.
Shared module in another model
In "open file" window select shared module data file. In our case we select file c:\sharedlocation\plugin.data.xml and click OK. After that shared module is attached to the model.
Conclusion
By using this technique you can share your models among several projects with minimal effort. Instead of repeatable creating of entities over and over again you can simply attach your shared modules to any project. And every change you create in the shared module will be automatically shared in all your models. This behavior can be used in any ORM framework (PHP Doctrine, Doctrine2, Propel or CakePHP).
Tip: How to setup associations in Doctrine2 project for correct export
In this tip I want to show you how to correctly setup associations in ORM Designer Doctrine2 project. Because Doctrine2 supports one-way or bidirectional associations, there is a need to tell ORM Designer how to export it. This is proceeded by Association alias. When you create association between two entities, you have to enter how you would like to access from one entity to another. Currently there are three ways how to do it:
Setup alias in association wizard
When you are creating a new association by using association wizard, you have to enter alias for direction you want to use. Below the alias edit boxes is a "Direction" item which shows you a type of created association.
Setup alias in association editor
Another option is to setup association alias in association editor (executed by "Edit object" menu item or simply double click on the association). In this window there are simmilar edit boxes as in the association wizard. Depending on values you entered into edit boxes the association is exported to your Doctrine2 schema files.
Enter alias using Property Editor
The third option how to setup association alias is in Property editor. Simply select the association you want to setup and in Property editor enter Owning alias or Property alias value.
Conclusion
I hope that this tip will help you to understand a way how ORM Designer proceeds associations export. Because Doctrine2 supports multi-direction associations, it is required this "Alias-enter" step. Please, leave us your comment about this feature if you have any opinion.
New version notifier for ORM Designer
Another small improvement for upcoming new 1.4.x version of ORM Designer is a new version notifier. Here is a screenshot of this new feature:
New feature for CakePHP users – DB Schema export
Today I would like to introduce you a new upcoming feature for CakePHP users. Nowadays ORM Designer can export php classes for your model objects. But when you want to use CakePHP migrations, you have to make the DB changes manually. This would change in the next ORM Designer release. Besides model classes ORM Designer knows how to generate CakeSchema (http://book.cakephp.org/view/1523/Schema-management-and-migrations) object class which defines a whole DB structure.
Usage of this new function is very simple. In your current ORM Designer model choose "Project object"
In Project property window there is a new item Schema with child export-file. Select "export-file" property and click on the button with three dots and choose export file for schema file.
Now, if you export your model by using "Export to ORM" button, beside the model object files DB schema file will be also generated.
For our example DB schema file will look like this:
<?php
/* SVN FILE: $Id$ */
/* App schema generated by: ORM Designer (http://www.orm-designer.com) */
class AppSchema extends CakeSchema
{
public $name = 'App';
public $Contact =
array (
'ID' =>
array (
'type' => 'integer',
'null' => 'true',
'default' => 'NULL',
'key' => 'primary',
'length' => '4'
),
'Name' =>
array (
'type' => 'string',
'null' => 'true',
'default' => 'NULL'
),
'Age' =>
array (
'type' => 'integer',
'null' => 'true',
'default' => 'NULL'
),
'indexes' =>
array (
'PRIMARY' =>
array (
'column' => 'ID'
)
)
);
}
Note:
This feature will be available in 1.4.0.420 and later.
Support of CakePHP validators in ORM Designer
Today we finished beta support of CakePHP validators in ORM Designer. Thanks to Stefano Manfredini for giving us the idea and testing this new feature. You will find this new feature in upcoming ORM Designer 1.4.0 version build 417 and later.
Screenshot of testing model with entered validators:

Detailed screenshot to all supported validators in ORM Designer:
How to use it
If you want to add a validator to any field in your model, follow next instructions:
1) Select the field where you want to define new data validation.
2) In ORM Property window click on Validator item -> "Add Item".
3) After clicking on "Add Item", the window with all supported validators appear. Choose the required validator and press OK.
4) After selecting validator from the list, you can add some additional parameters. You can do this by selecting added validator and entering value to the correspond property.
After you enter all required validators, you can "Export" them to base class.
And it's done. No more complicated and confused array definitions, simple design it in ORM Designer
List of currently supported validators include their parameters:
- alphaNumeric (link)
- between (link)
- minimum
- maximum
- blank (link)
- boolean (link)
- cc (link)
- type
- deep
- regex
- comparison (link)
- operator
- value
- date (link)
- format
- decimal (link)
- decimal
- email (link)
- validate-host
- equalTo (link)
- value
- extension (link)
- value
- ip (link)
- isUnique (link)
- minLength (link)
- value
- maxLength (link)
- value
- money (link)
- position
- multiple (link)
- in
- min
- max
- inList (link)
- values
- numeric (link)
- notEmpty (link)
- phone (link)
- reg-ex
- country
- postal(link)
- reg-ex
- country
- range (link)
- minimum
- maximum
- ssn (link)
- reg-ex
- country
- url (link)
- strict
- reg-ex (link)
- regex
- own-function (link)
- name
- params
All validators have folllowing commont properties:
- name: Rule name used in definition array when field has multiple validators
- required: Require flag, for more information follow CakePHP documentation.
- allowEmpty: AllowEmpty flagfor more information follow CakePHP documentation.
- on: Validator type. Can be NULL/create/update. For more information follow CakePHP documentation.
- message: Error message for the rule.For more information follow CakePHP documentation.
- last: Flag used when one field have multiple validators. More information about last flag in CakePHP documentation .
Inheritance support in ORM Designer
One of other major features introduced in ORM Designer 1.4.0 is inheritance support. Currently supported frameworks are PHP Doctrine and Doctrine2.
There are several ways how to create inheritance between entities.
1) Inheritance tool
If you want to use inheritance tool, first select this tool on the ribbon window:
With this tool selected click on base entity from which you want to inherit.
Next click on entity that should be derived from base entity.
Once the inheritance is created, you can configure more parameters in the Property editor.
2) Inheritance wizard
If you want to use inheritance wizard, select entity in model and use "Create Inheritance" command from ribbon tab "Editing".
In the Create New Inheritance wizard select base and derived entity from the list of entities in the combo boxes.
You can also select type of inheritance, discriminator field and discriminator value for created inheritance. More information about additional parameters is at the end of this article.
3) Create inheritance in project tree
You can also create inheritance through project tree. Simply select entity (which will be used as the base entity for inheritance) in the project tree and select "Add Inheritance" in the context menu (right-click on the entity). New inheritance wizard will be executed after this step (same wizard as in previous step)
4) Create inheritance in entity edit window
Another way how to start "New Inheritance Wizard" is through the edit entity window. Select "Inheritance" tab in the "Edit entity" window. In this tab select "Add Inheritance" from top tool bar to start "New Inheritance Wizard". This tab also contains list of all extending and base entities.
Inheritance Additional parameters
Type of inheritance is ORM framework dependent. For PHP Doctrine framework is available Simple inheritance, Concrete inheritance or Column aggregation inheritance. For Doctrine2 is currently available Single table inheritance and Class table inheritance.
Note: Mapped superclass isn't currently supported, because there is no way how to define it in YAML or XML file format.
Inheritance in ORM Designer – First screenshot
One week after first ORM Designer 1.4.0 public beta release we're finishing full support of Model Inheritance. Inheritance will be available for Doctrine and Doctrine2 ORM frameworks. Within a few weeks we want to implement inheritance support also for the new version of Propel 1.5.
Bellow is a screenshot of simple model with inheritance and association. On the right side of the screen is a detail of inheritance editor.
How to start with Doctrine2 in ORM Designer
The simpliest way how to start using ORM Designer with your current Doctrine2 model is to use an import doctrine2 model function. Currently is available only import from Doctrine2 XML schema files. If you have your model defined in anotation or using YAML files, please convert it to XML files. After that, follow next step-by-step instructions.
Import a new project from ORM
In a ribbon menu select Import New... and then Import Project from ORM.
In Import Project Wizard choose your project name and a root directory of your project where are your Doctrine2 XML files stored. As MVC framework choose Without Framework and as ORM choose Doctrine2 as shown on this screenshot.
After an import confirmation ORM Designer starts searching for your files and import them to new ORM Designer model.
In our example we import unit-testing model from Doctrine2 repository called CMS. When import procedure is over, you will see model like this.
After that you can start enjoying ORM Designer in your work with Doctrine2 model.
More details about using ORM Designer with Doctrine2
Using of Doctrine2 in ORM Designer is very similar to using ORM Designer with PHP ORM Doctrine framework. For more information please look at ORM Designer and Doctrine framework page.
Supported Doctrine2 properties
Currently ORM Designer supports all properties from Doctrine2 except inheritance, which will be implemented during next months. All supported properties are based on official Doctrine2 XML schema. You can edit all properties simply by selecting the object and enter value to correspond field.
There are lot of properties which can be edited for every type. Here are screenshots of property editors for entity, field, association, many to many association.
Download ORM Designer with Doctrine2 support
If you want to download ORMD with Doctrine2 support, please download latest beta version from our site http://www.orm-designer.com/article/orm-designer-beta-versions. If you find any inconsistency or bug, please let us know.
Appendix: Supported Doctrine2 properties and behaviors
Supported Doctrine2 core properties
| Object | Property |
|---|---|
| Project | Name, CodeName, Description |
| Module | Name, Description |
| Entity | Name, Description |
| Field | Name, Type, Size, Required, Unique, Primary key, Auto increment, Default value, Enum values, Description |
| Association (1:m ) | Name, Reference columns, Owning alias, Inverse Alias, Association type, Parent required |
| Index | Name, Unique, Indexed columns |
| Many to Many associtaion | M:N Entity, First and second entity, Alias to first and second entity |
Supported Doctrine2 ORM properties
| Object | Property |
|---|---|
| Module | namespace |
| Entity | db table,schema,repository-class,inheritance-type,export-file-name,change-tracking-policy,lifecycle-callbacks |
| Field | db column,version,scale,precision,column-definition,generator, generator strategy,sequence-generator,sequence-name,allocation-size,initial-value |
| Associtaion (1:m) | on-delete,on-update,owning side/inverse side, fetch,orphan-repoval,cascade,order-by |
| Many to Many Association | join-table-schema,fetch,on-delete,on-update,cascade,order-by |
| cascade-types | cascade-all,cascade-persist,cascade-merge,cascade-remove,cascade-refresh |
Appendix: Currently unsupported features for Doctrine2
ORM Designer currently doesn't support inheritance in any level of designing (visual, editing, import, export).
Iheritance for Doctrine2 and other ORM frameworks will be implemented in next few months.
Currently not supported XML tags from Doctrine2 schema :
- discriminator-column
- discriminator-mapping
- discriminator-map
- mapped-superclass
Updated Doctrine association property editor
ORM Designer 1.4.0 is almost here and we want to give you yet another peek of what is coming. ORM property editor is the core feature since the first release of ORM Designer but it can be sometimes hard to use and understand which values to fill. Especially association configuration ("alias" / "foreignAlias", "type" / "foreignType", "cascade" / foreignCascade") was one of these cases. Some of these association properties were side-dependent and others were same for both sides (in Doctirne ORM for example database attribute "onDelete"). From now on you'll find side-dependent properties grouped by owning-side and inverse-side with destination table hint for better orientation.
ORM Designer screenshots
On the left side is old version, on the right side new one.
New property editor in ORM Designer 1.4.x
On the left side is old version, on the right side new one.
Detailed screenshots of side-dependent groups with selected direction assistant:






























