Propel ORM Behaviors support!
Note: This feature is currently available only in beta-version 1.4.5. If you want to try it, please download latest version from http://www.orm-designer.com/beta.
Another news for Propel ORM users! Today I want to introduce you new Behaviours support feature.
ORM Designer supports two ways how to handle behaviours. The first way uses predefined behaviour list of already known behaviours, the second way uses customBehaviour type to define any behaviour by it's name and params.
Use of custom behaviors
For setup custom behaviour to any of your tables, follow next steps:
1) Mark the requested table
2) In ORM Properties list click "Add item" next to "Behaviors" property
3) Select "customBehavior" from the list
4) Enter behaviour name to relevant "name" property
5) If your behavior has some parameters, add them by using "Add item" next to "CustomParameters" property
6) After that you have to enter the parameter name and the parameter value. You can add unlimited number of additional parameters.
7) And this is it
. Now when you export your model, you can see definitions like this:
Use of predefined behaviours
Using of predefined behaviours is better than custom one in several ways. As first, you don't have to write behavior name again and again but you can simply select it from a list. The same thing is for the behavior parameters. The second advantage is that for specific parameter values there is an automatic completion and offering of preferred values (booleans, column names, ... ). Now I show you how to define "Timestampable" behavior for a specific entity.
1) The first steps are the same as in the previous example. Select the requested entity, click "Add item" next to "Behaviors" property and select desired behavior. In our example "Timestampable".
2) Now you can configure timestampable behavior by using two predefined properties "create_column" and "update_column". When you click on the arrow next to property value, you can simply choose the one of available columns.
3) Each predefined behaviour has also an option to define another additional behaviour parameter. This can be simply achieve by using "customParameter" as well as in the case of the custom behaviors.
4) When you add one or more custom parameters you can simply configure them.
List of currently supported Propel ORM behaviors:
- NestedSet
- SoftDelete
- Sluggable
- Timestampable
- Sortable
- Aggregate
- Versionable
- I18n
- Query Cache
- AutoAddPk
- Alternative Coding Standards
Note: Remembr that you can anytime use customBehavior if you need to use behavior not listed in list above. If you find any behavior which is common for more users and isn't listed here, let us know and we will add it to ORM Designer configuration.
I hope you like this new function and as always if you find any bug or have any idea feel free to let us know!
Propel ORM validators support!
Note: This feature is currently available only in beta-version 1.4.5. If you want to try it, please download latest version from http://www.orm-designer.com/beta.
While working on a new ORM Designer version we prepared one significant improvement of the current ORM Designer version for all Propel ORM users.
From now, ORM Designer natively supports all Propel PHP validators mentioned on this page: http://www.propelorm.org/wiki/Documentation/1.6/Validators
The usage is simple, as usually
. Create an object, add few fields and commit changes. Then select desired field of the model and look to the ORM Properties editor:
Now, when you click on the add icon you can choose from the list of available validators or choose one of two special items "otherValidator" or "customValidator":
- OtherValidator use in special cases when you want to use validator which isn't listed in this list. This validator choose if you would like to enter all validator identificators like name,value and message and these values will be added to the specific column.
- CustomValidator is there for cases when you have implemented your own validator and want to use it in a specific column. In this case simply add a class name to this validator and ORM Designer will export it for you.
You can have zero,one or more validators of one type for one column because of multiple instances of custom or other validator. Here are few examples of already configured validators:
Now, when you press "Export" button, your XML file will look like this:
Note: Validators aren't supported for YAML export, because there isn't support in Propel ORM! (there is link: http://trac.symfony-project.org/ticket/1769 )
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
Prefixes for Doctrine ORM entities (useful for Doctrine and Zend Framework)
Today I want to show you a new feature of ORM Desigener for Doctrine ORM. It is an ability to define prefix for a whole module by which ORM Designer exports every entity with a name composed of this prefix and stand-alone name. In the past we received several requests from Zend Framework users for this feature, so here it is
.
This feature is the most useful for Zend Framework users, but might be used by every Doctrine ORM user. When using Doctrine ORM with Zend Framework you have to create the names of your entities with prefixes as Default_Model_Entity_Name or Forum_Model_Entity_Name (more about this topic is described in the article Doctrine1 Integration with Zend Framework).
And how does it work? Here is a screenshot of an example model:
In this model we're using simple and nice entity names like "parent" or "child". To "entity_prefix" attribute of each module we enter common prefix for all entities. After that when we export the model to the YAML file, we get a following result:
APPLICATION_child:
columns:
id:
primary: true
parent_id:
relations:
APPLICATION_parent:
foreign: id
local: parent_id
APPLICATION_parent:
columns:
id:
primary: true
MODULE_derived:
columns:
id:
primary: true
inheritance:
extends: MODULE_external
type: simple
MODULE_external:
columns:
child_id:
id:
primary: true
relations:
APPLICATION_child:
foreign: id
local: child_id
I hope this function will help you a bit more with you everyday work
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.
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:







































