CFWheels

Plugins
What you've got loaded..

JSON Properties

The JSON properties plugin allows you to easily add structured data to a single database table field. You can easily store arrays and structures without the need for extra tables in your model.

The JSON properties plugin has a single initialization method that you must call in your models init().

Init Method

  • jsonProperty
    • property - the model property the serialize and deserialize when interacting with the database.
    • type - possible values include array or struct.
Once you have initialized your model, there is no extra work required to start using the functionality of this plugin.

How to Use

Simply add structure data to your JSON property. That's it!

Interal workings

The JSON proerties plugin works by adding callbacks to the initialized model to transparently serialize/deserialize complex data types into strings that can be stored in a database.

Callbacks Added

  • $deserializeJSONProperties is called on AferFind and AfterSave
  • $serializeJSONProperties is called on BeforeValidation and BeforeDelete

Uninstallation

To uninstall this plugin simply delete the /plugins/AssetBundler-0.9.zip file.

Credits

This plugin was created by James Gibson.

<<< Go Back