|
ColdFusion 9.0 Resources |
EntityLoadDescriptionLoads and returns an array of entities for the specified entity name. You can also specify a filter criteria and sort order. All EntityLoad methods take the entity name as input. ReturnsArray (if unique=false) Single entity (if unique=true) CategoryFunction syntaxEntityLoad (entityname) EntityLoad (entityname, id [, unique]) EntityLoad (entityname, filtercriteria [,unique] EntityLoad(entityname, filtercriteria, sortorder [, options]) See AlsoParameters
HistoryColdFusion 9: Added this function. UsageFor pagination, you can use the options offset and maxResults as shown in the example: EntityLoad('employee', {department='qa'} , {offset=21, maxResults=10})
This example retrieves the (next) 10 objects of employees whose department is qa from offset 21. ExampleExample with only entity name specified: <cfset employees = EntityLoad('employee')>
Example with EntityName, ID, and unique set to true. Instead of true, if you set unique as false, then array is returned with one entity. <cfset employee = EntityLoad('employee', 100, true)>
Entity name, composite key.
<cfset orderDetail = EntityLoad('orderdetails', {OrderID=100, ProductID=1}, true)>
Example which describes how to retrieve objects whose country is UK, and sorted by Department ascending and Age descending: <cfset employeesInUKSorted = EntityLoad('employee',
{country="UK"}, "Department Asc, Age Desc")>
Example that describes how to retrieve details of all the employees who live in 'UK': <cfset employeesFromUK = EntityLoad('employee', {country="UK"}>
Example that describes how to retrieve a unique object. If you specify unique= "true" and more than one object satisfies the condition, then an exception occurs. <cfset employee = EntityLoad('employee', {firstname="Marcia", lastname="Em"}, "true")>
|