ORM Designer Blog

27May/110

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:

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!

5May/110

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 )