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:
- Mark the requested table
- In ORM Properties list click “Add item” next to “Behaviors” property
- Select “customBehavior” from the list
- Enter behaviour name to relevant “name” property
- If your behavior has some parameters, add them by using “Add item” next to “CustomParameters” property
- After that you have to enter the parameter name and the parameter value. You can add unlimited number of additional parameters.
- 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.
- 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”.
- 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.
- 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.
- 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!