Skip to content

Configuration

collection()

collection() — returns struct

Available in: mapper Category: Routing

Defines a collection route in your Wheels application. Collection routes operate on a set of resources and do not require an id, unlike member routes which act on a single resource. This is useful when building actions that retrieve, filter, or display multiple objects, such as search pages, listings, or batch operations.


<cfscript>

mapper()
    // Create a route like `photos/search`
    .resources(name="photos", nested=true)
        .collection()
            .get("search")
        .end()
    .end()
.end();

</cfscript>