nestedProperties()
Description
Allows for nested objects, structs, and arrays to be set from params and other generated data.
Function Syntax
nestedProperties([ association, autoSave, allowDelete, sortProperty, rejectIfBlank ])
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
association |
string |
No | |
The association (or list of associations) you want to allow to be set through the params. This argument is also aliased as associations. |
autoSave |
boolean |
No | true |
Whether to save the association(s) when the parent object is saved. |
allowDelete |
boolean |
No | false |
Set allowDelete to true to tell Wheels to look for the property _delete in your model. If present and set to a value that evaluates to true, the model will be deleted when saving the parent. |
sortProperty |
string |
No | |
Set sortProperty to a property on the object that you would like to sort by. The property should be numeric, should start with 1, and should be consecutive. Only valid with hasMany associations. |
rejectIfBlank |
string |
No | |
A list of properties that should not be blank. If any of the properties are blank, any CRUD operations will be rejected. |
Examples
<!--- In `models/User.cfc`, allow for `groupEntitlements` to be saved and deleted through the `user` object --->
<cffunction name="init">
<cfset hasMany("groupEntitlements")>
<cfset nestedProperties(association="groupEntitlements", allowDelete=true)>
</cffunction>
