Fork me on GitHub

The Blog > Introducing ExtraPropertiesBehavior

The Propel Team – 01 February 2012

Hi all,

when I released ExtraPropertiesBehavior on github, William asked me to introduce it on the propel blog to make sure everybody is aware it exists. I'm definitely not used to blog, so I'll try to do my best.

Sometimes in a dev's life you have to store fields you did not or can not plan about, that's usualy what happens when a model can be extended through plugins, but also for user preferences or configuration. To handle this kind of extension, the best way is a key/value table related to your model.

Most of use cases do not require this kind of behavior as joining with a key/value table can slow down queries, so always make sure that delegate or concrete inheritance cannot solve your problem but sometimes there is no other way. If you already had to manage such things, you probably know it can be really painful.

Not anymore, thanks to ExtraPropertiesBehavior, all you need is this line in your model declaration : <behavior name="extra_properties" />, rebuild the model, and you're done !

From now on, declare, get or set properties with dedicated methods, you even can handle simple collections. Behavior is fully documented in the README file, so no more hesitation, fork me on github ;)


Found a typo ? Something is wrong in this documentation ? Just fork and edit it !