EntityLoadByPK
Load an array of entities by the primary key.
var myAuto = entityLoadByPK( "Automobile", "1HGCM82633A123456" );
In Lucee, by default, an array of entities is returned and you must pass a third `unique=true` argument to return only a single entity. In BoxLang, only a single entity is returned - matching the Adobe ColdFusion behavior - and no `unique` attribute is supported. To return an array of entities, use the `entityLoad` BIF.
Composite keys are also supported:
entityLoadByPK( "VehicleType", { make : "Ford", model: "Fusion" } );
Method Signature
EntityLoadByPK(entity=[String], id=[String], unique=[String])
Arguments
Argument
Type
Required
Description
Default
entity
String
true
The name of the entity to load.
id
String
true
The primary key value, or a struct of key/value pairs for composite keys.
unique
String
false
Not implemented. In BoxLang, a single entity is always returned.
Examples
Related
Last updated
Was this helpful?