mementoin this case is a simple representation of your entity using arrays, structs, and simple values.
this.mementostruct on the entity and passing in arguments to the
includes. You can change this or add other Mementifier options by defining your own
this.mementostruct on your entity. Your custom
this.mementostruct will be merged with Quick's default, so you can only define what changes you need.
instanceReady()lifecycle method in this example because
retrieveAttributeNames()relies on the entity being wired (though not loaded); it is not otherwise necessary to put
getMementofunction on your entity. In this case, a
$getMementofunction will be available which is the Mementifier function.
getMementoyourself or mapping over the array of results returned by calling
asMementobefore executing the query.
asMementotakes the same arguments that
getMementodoes. It will pass those arguments on and convert your entities to mementos after executing the query. This works for all the query execution methods -
$renderDatamethod is a special method for ColdBox. When returning a model from a handler, this method will be called and the value returned will be used as the serialized response. This let's you simply return an entity from a handler for your API. By default this will call
QuickCollectionalso defines a
$renderDatamethod, which will delegate the call to each entity in the collection and return the array of serialized entities.