Model Data Binding
Easily bind incoming data into your models.
populate()
/**
* Populate an object from the incoming request collection
*
* @model The name of the model to get and populate or the acutal model object. If you already have an instance of a model, then use the populateBean() method
* @scope Use scope injection instead of setters population. Ex: scope=variables.instance.
* @trustedSetter If set to true, the setter method will be called even if it does not exist in the object
* @include A list of keys to include in the population
* @exclude A list of keys to exclude in the population
* @ignoreEmpty Ignore empty values on populations, great for ORM population
* @nullEmptyInclude A list of keys to NULL when empty
* @nullEmptyExclude A list of keys to NOT NULL when empty
* @composeRelationships Automatically attempt to compose relationships from memento
* @memento A structure to populate the model, if not passed it defaults to the request collection
* @jsonstring If you pass a json string, we will populate your model with it
* @xml If you pass an xml string, we will populate your model with it
* @qry If you pass a query, we will populate your model with it
* @rowNumber The row of the qry parameter to populate your model with
* @ignoreTargetLists If this is true, then the populator will ignore the target's population include/exclude metadata lists. By default this is false.
*
* @return The instance populated
*/
function populate(
required model,
scope = "",
boolean trustedSetter = false,
include = "",
exclude = "",
boolean ignoreEmpty = false,
nullEmptyInclude = "",
nullEmptyExclude = "",
boolean composeRelationships = false,
struct memento = getRequestCollection(),
string jsonstring,
string xml,
query qry,
boolean ignoreTargetLists = false
)Examples
ORM Integration
Mass Population Control: this.population
this.populationIgnoring Mass Population
Last updated
Was this helpful?